From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3385 invoked by alias); 24 Nov 2009 03:31:47 -0000 Received: (qmail 3378 invoked by uid 22791); 24 Nov 2009 03:31:46 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from ey-out-1920.google.com (HELO ey-out-1920.google.com) (74.125.78.148) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 24 Nov 2009 03:31:41 +0000 Received: by ey-out-1920.google.com with SMTP id 26so1631473eyw.24 for ; Mon, 23 Nov 2009 19:31:39 -0800 (PST) Received: by 10.216.85.68 with SMTP id t46mr575631wee.114.1259033499136; Mon, 23 Nov 2009 19:31:39 -0800 (PST) Received: from nowhere (ADijon-552-1-123-3.w92-148.abo.wanadoo.fr [92.148.186.3]) by mx.google.com with ESMTPS id 28sm1580825eye.1.2009.11.23.19.31.37 (version=SSLv3 cipher=RC4-MD5); Mon, 23 Nov 2009 19:31:38 -0800 (PST) Received: by nowhere (nbSMTP-1.00) for uid 1000 (using TLSv1/SSLv3 with cipher RC4-MD5 (128/128 bits)) fweisbec@gmail.com; Tue, 24 Nov 2009 04:31:39 +0100 (CET) Date: Tue, 24 Nov 2009 03:31:00 -0000 From: Frederic Weisbecker To: Masami Hiramatsu Cc: Ingo Molnar , Ananth N Mavinakayanahalli , lkml , systemtap , DLE , Jim Keniston , Srikar Dronamraju , Christoph Hellwig , Steven Rostedt , "H. Peter Anvin" , Anders Kaseorg , Tim Abbott , Andi Kleen , Jason Baron , Mathieu Desnoyers Subject: Re: [PATCH -tip v5 03/10] kprobes: Introduce kprobes jump optimization Message-ID: <20091124033135.GE6752@nowhere> References: <20091123232115.22071.71558.stgit@dhcp-100-2-132.bos.redhat.com> <20091123232141.22071.53317.stgit@dhcp-100-2-132.bos.redhat.com> <20091124024417.GA6752@nowhere> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20091124024417.GA6752@nowhere> User-Agent: Mutt/1.5.18 (2008-05-17) Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2009-q4/txt/msg00656.txt.bz2 On Tue, Nov 24, 2009 at 03:44:19AM +0100, Frederic Weisbecker wrote: > On Mon, Nov 23, 2009 at 06:21:41PM -0500, Masami Hiramatsu wrote: > > +static void kprobe_optimizer(struct work_struct *work); > > +static DECLARE_DELAYED_WORK(optimizing_work, kprobe_optimizer); > > +#define OPTIMIZE_DELAY 5 > > + > > +/* Kprobe jump optimizer */ > > +static __kprobes void kprobe_optimizer(struct work_struct *work) > > +{ > > + struct optimized_kprobe *op, *tmp; > > + > > + /* Lock modules while optimizing kprobes */ > > + mutex_lock(&module_mutex); > > + mutex_lock(&kprobe_mutex); > > + if (kprobes_all_disarmed) > > + goto end; > > + > > + /* Wait quiesence period for ensuring all interrupts are done */ > > + synchronize_sched(); > > > > It's not clear to me why you are doing that. > Is this waiting for pending int 3 kprobes handlers > to complete? If so, why, and what does that prevent? I _might_ have understood. You have set up the optimized flags, then you wait for any old-style int 3 kprobes to complete and route to detour buffer so that you can patch the jump safely in the dead code? (and finish with first byte by patching the int 3 itself)