From: Andrew Morton <akpm@linux-foundation.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Arjan van de Ven <arjan@infradead.org>,
Steven Rostedt <srostedt@redhat.com>
Subject: Re: [PATCH 2/3] trace: fix default boot up tracer
Date: Mon, 2 Feb 2009 20:20:41 -0800 [thread overview]
Message-ID: <20090202202041.6256a566.akpm@linux-foundation.org> (raw)
In-Reply-To: <alpine.DEB.1.10.0902022302060.2192@gandalf.stny.rr.com>
On Mon, 2 Feb 2009 23:12:37 -0500 (EST) Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Mon, 2 Feb 2009, Andrew Morton wrote:
>
> > On Mon, 02 Feb 2009 21:38:32 -0500 Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> > > @@ -510,8 +520,25 @@ int register_tracer(struct tracer *type)
> > > out:
> > > tracing_selftest_running = false;
> > > mutex_unlock(&trace_types_lock);
> > > - lock_kernel();
> > >
> > > + if (!ret && default_bootup_tracer) {
> > > + if (!strncmp(default_bootup_tracer, type->name,
> > > + BOOTUP_TRACER_SIZE)) {
> > > + printk(KERN_INFO "Starting tracer '%s'\n",
> > > + type->name);
> > > + /* Do we want this tracer to start on bootup? */
> > > + tracing_set_tracer(type->name);
> > > + default_bootup_tracer = NULL;
> > > + /* disable other selftests, since this will break it. */
> > > + tracing_selftest_disabled = 1;
> > > +#ifdef CONFIG_FTRACE_STARTUP_TEST
> > > + printk(KERN_INFO "Disabling FTRACE selftests due"
> > > + " to running tracer '%s'\n", type->name);
> > > +#endif
> > > + }
> > > + }
> > > +
> > > + lock_kernel();
> > > return ret;
> > > }
> >
> > The fun and games which register_tracer() plays with lock_kernel() tell
> > us that this function is only called at bootup time and hence could be
> > __init. A quick whizz through callers confirms that.
> >
> > And if register_tracer() is also only callable at bootup, one suspects
> > that unregister_tracer() isn't useful. And lo, it has no callers.
> >
> > This leads one to further surmise that trace_types_lock a) could be
> > __initdata and b) could be removed (the list is only altered when we're
> > running single-threaded). This appears to be the case.
>
> The lock_kernel addition was added when the BKL became a spinlock again.
> The selftests needed to be able to sleep, and this caused issues.
Sleeping inside lock_kernel() is quite OK. Confused.
What is the call path to this function? Does it all happen under
ftrace_init()? If not, do we risk breaking start_kernel()'s
thou-shalt-not-enable-interrupts-early rule which powerpc (at least)
imposes?
> The register_tracer was initial written to be pluggable at any time.
> Perhaps in the future to allow modules. But this does not seem to have
> panned out.
>
> Since we have the lock_kernel there anyway, if we ever need to handle
> modules, that will need a different interface anyway. I guess I can nuke
> the unregister tracer.
And add some __init/__initdatas?
> As for the trace_types_lock mutex, that is still needed. Not only did it
> guard against the tracer registry, it also guards the switching of tracers.
>
> # echo function > /debug/tracing/current_tracer
>
OK, it's a dual-use lock, as the comment indicates.
next prev parent reply other threads:[~2009-02-03 4:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-03 2:38 [PATCH 0/3] ftrace: updates for tip Steven Rostedt
2009-02-03 2:38 ` [PATCH 1/3] trace: disable branch tracer on alpha Steven Rostedt
2009-02-03 5:19 ` Ingo Molnar
2009-02-03 2:38 ` [PATCH 2/3] trace: fix default boot up tracer Steven Rostedt
2009-02-03 3:50 ` Andrew Morton
2009-02-03 4:12 ` Steven Rostedt
2009-02-03 4:20 ` Andrew Morton [this message]
2009-02-03 4:33 ` Steven Rostedt
2009-02-03 5:00 ` Andrew Morton
2009-02-03 5:29 ` Ingo Molnar
2009-02-03 9:26 ` Frederic Weisbecker
2009-02-03 2:38 ` [PATCH 3/3] trace: let boot trace be chosen by command line Steven Rostedt
2009-02-03 5:31 ` Ingo Molnar
2009-02-03 9:31 ` Frederic Weisbecker
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=20090202202041.6256a566.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=arjan@infradead.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=srostedt@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox