Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756046AbZDTN6J (ORCPT ); Mon, 20 Apr 2009 09:58:09 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756052AbZDTN5j (ORCPT ); Mon, 20 Apr 2009 09:57:39 -0400 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.125]:34829 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756027AbZDTN5i (ORCPT ); Mon, 20 Apr 2009 09:57:38 -0400 Date: Mon, 20 Apr 2009 09:57:35 -0400 (EDT) From: Steven Rostedt X-X-Sender: rostedt@gandalf.stny.rr.com To: Rusty Russell cc: linux-kernel@vger.kernel.org, Ingo Molnar , Andrew Morton , Thomas Gleixner , Peter Zijlstra , Frederic Weisbecker , Tim Abbott Subject: Re: [PATCH 1/5] ftrace: use module notifier for function tracer In-Reply-To: <200904192055.04213.rusty@rustcorp.com.au> Message-ID: References: <20090416021830.556671772@goodmis.org> <20090416021928.040177084@goodmis.org> <200904192055.04213.rusty@rustcorp.com.au> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2017 Lines: 55 On Sun, 19 Apr 2009, Rusty Russell wrote: > On Thu, 16 Apr 2009 11:48:31 am Steven Rostedt wrote: > > From: Steven Rostedt > > > > Impact: fix and clean up > > > > The hooks in the module code for the function tracer must be called > > before any of that module code runs. The function tracer hooks > > modify the module (replacing calls to mcount to nops). If the code > > is executed while the change occurs, then the CPU can take a GPF. > > > > To handle the above with a bit of paranoia, I originally implemented > > the hooks as calls directly from the module code. > > > > After examining the notifier calls, it looks as though the start up > > notify is called before any of the module's code is executed. This makes > > the use of the notify safe with ftrace. > > Hi Steven, > > Unfortunately not: we do parse_args, which can call into the module code. > (Though it shouldn't do anything "significant", as it won't get a chance to > clean up if module load fails later). > > I think you need to do something else in general. Share the module_mutex for > the ftrace code? The ksplice guys have a similar issue, so maybe we should > generalize this into a "kernel_text" mutex? Hi Rusty, Thanks, for the update. I think we may still be OK. The thing that dynamic ftrace must watch out for is not running of code per say, but the executing of code on one cpu that is being modified on another. Can those parse_args kick off threads? Hmm, probably. Sounds nasty to me. The other thing is, if the parse_args code is only in "__init" then they also will not be touched. I guess we can keep the code as notify if we never expect to run kthreads from parse_args. Or is it possible to move parse_args after notify? -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/