All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Tim Abbott <tabbott@mit.edu>
Subject: Re: [PATCH 1/5] ftrace: use module notifier for function tracer
Date: Tue, 21 Apr 2009 14:45:41 +0930	[thread overview]
Message-ID: <200904211445.42812.rusty@rustcorp.com.au> (raw)
In-Reply-To: <alpine.DEB.2.00.0904200942350.15439@gandalf.stny.rr.com>

On Mon, 20 Apr 2009 11:27:35 pm Steven Rostedt wrote:
> 
> On Sun, 19 Apr 2009, Rusty Russell wrote:
> 
> > On Thu, 16 Apr 2009 11:48:31 am Steven Rostedt wrote:
> > > From: Steven Rostedt <srostedt@redhat.com>
> > > 
> > > 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.

Agreed, just wanted to make sure you were aware.
 
> Can those parse_args kick off threads? Hmm, probably. Sounds nasty to 
> me.

Not without a bug.  Imagine you have a "create_threads" module_param, someone
loads the module with two args "create_threads crap".  We call the
create_threads parse function via parse_args, then hit the crap parameter
and free the module.  Oops.

> The other thing is, if the parse_args code is only in "__init" then they 
> also will not be touched.

It can be non-init for sysfs access.

FWIW:
Acked-by: Rusty Russell <rusty@rustcorp.com.au>

Thanks,
Rusty.

  reply	other threads:[~2009-04-21  5:16 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-16  2:18 [PATCH 0/5] [GIT PULL] updates for tip Steven Rostedt
2009-04-16  2:18 ` [PATCH 1/5] ftrace: use module notifier for function tracer Steven Rostedt
2009-04-16 15:36   ` Frederic Weisbecker
2009-04-16 15:53     ` Steven Rostedt
2009-04-17 11:44   ` Steven Rostedt
2009-04-19 11:25   ` Rusty Russell
2009-04-20 13:57     ` Steven Rostedt
2009-04-21  5:15       ` Rusty Russell [this message]
2009-04-21 13:13         ` Steven Rostedt
2009-04-21 13:58           ` Ingo Molnar
2009-04-21 17:51     ` Tim Abbott
2009-04-21 18:17       ` Steven Rostedt
2009-04-21 18:47         ` Tim Abbott
2009-04-22  9:16       ` Ingo Molnar
2009-04-22 22:20         ` Tim Abbott
2009-04-22 22:57           ` Masami Hiramatsu
2009-04-23 19:40             ` Anders Kaseorg
2009-04-23 19:57               ` Mathieu Desnoyers
2009-04-23 22:31                 ` Tim Abbott
2009-04-24  3:11                   ` Masami Hiramatsu
2009-04-23 20:06               ` Masami Hiramatsu
2009-04-16  2:18 ` [PATCH 2/5] tracing/events: add startup tests for events Steven Rostedt
2009-04-16  8:39   ` [PATCH] tracing: add #include <linux/delay.h> to fix build failure in test_work() Ingo Molnar
2009-04-16 14:08     ` Steven Rostedt
2009-04-17  0:30       ` Ingo Molnar
2009-04-16 15:41   ` [PATCH 2/5] tracing/events: add startup tests for events Frederic Weisbecker
2009-04-16 15:51     ` Steven Rostedt
2009-04-16 16:02   ` Frederic Weisbecker
2009-04-16  2:18 ` [PATCH 3/5] tracing/events: add rcu locking around trace event prints Steven Rostedt
2009-04-17 14:08   ` Steven Rostedt
2009-04-17 15:20     ` Jeremy Fitzhardinge
2009-04-17 15:42       ` Steven Rostedt
2009-04-17 23:53         ` Jeremy Fitzhardinge
2009-04-17 16:18     ` Theodore Tso
2009-04-17 16:32       ` Jeremy Fitzhardinge
2009-04-17 16:41         ` Steven Rostedt
2009-05-07  2:10   ` Steven Rostedt
2009-05-07 11:32     ` Ingo Molnar
2009-05-07 13:10       ` Steven Rostedt
2009-04-16  2:18 ` [PATCH 4/5] tracing/events/ring-buffer: expose format of ring buffer headers to users Steven Rostedt
2009-04-16  2:18 ` [PATCH 5/5] tracing: add saved_cmdlines file to show cached task comms Steven Rostedt
2009-04-16 15:54   ` Frederic Weisbecker
2009-04-16 15:58     ` Steven Rostedt
2009-04-16 16:05       ` Frederic Weisbecker
2009-04-16  9:51 ` [PATCH 0/5] [GIT PULL] updates for tip Ingo Molnar
2009-04-16  9:53   ` Ingo Molnar
2009-04-16 13:52   ` Steven Rostedt
2009-04-16 16:12     ` Ingo Molnar
2009-04-16 16:22       ` Steven Rostedt
2009-04-17  0:29         ` Ingo Molnar
2009-04-16 16:30       ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200904211445.42812.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tabbott@mit.edu \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.