mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Anton Vorontsov <anton.vorontsov@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Kees Cook <keescook@chromium.org>,
	Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@redhat.com>, Arnd Bergmann <arnd@arndb.de>,
	John Stultz <john.stultz@linaro.org>,
	Shuah Khan <shuahkhan@gmail.com>,
	arve@android.com, Rebecca Schultz Zavin <rebecca@android.com>,
	Jesper Juhl <jj@chaosbits.net>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Thomas Meyer <thomas@m3y3r.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Marco Stornelli <marco.stornelli@gmail.com>,
	WANG Cong <xiyou.wangcong@gmail.com>,
	linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
	linaro-kernel@lists.linaro.org, patches@linaro.org,
	kernel-team@android.com
Subject: Re: [PATCH 3/8] pstore: Add persistent function tracing
Date: Tue, 17 Jul 2012 17:38:22 -0400	[thread overview]
Message-ID: <1342561102.10332.18.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <20120717200130.GA31678@lizard>

On Tue, 2012-07-17 at 13:01 -0700, Anton Vorontsov wrote:
> On Tue, Jul 17, 2012 at 03:38:18PM -0400, Steven Rostedt wrote:
> [...]
> > > +void notrace pstore_ftrace_call(unsigned long ip, unsigned long parent_ip)
> > 
> > BTW, you can make the entire file 'notrace' without adding annotations
> > by including in the Makefile:
> > 
> > CFLAGS_REMOVE_ftrace.o = -pg
> 
> Actually it was in the first version in the patch, but then I changed
> it 'notrace' for just this func. This is for the case if the file would
> contain some more code which we actually may trace. Doing things fine-
> grained seemed to be better than making the whole file as notrace. Plus
> it is one line less. :-)
> 
> But I have no preference, so I can change it.

I have no preference, it was just an FYI. For just a single function in
a file, it really makes no difference which you use. The Makefile trick
is better for needing to make sure an entire file is not traced.


> 
> > > +{
> > > +	struct pstore_ftrace_record rec = {};
> > > +
> > > +	if (unlikely(oops_in_progress))
> > > +		return;
> > > +
> > > +	rec.ip = ip;
> > > +	rec.parent_ip = parent_ip;
> > > +	pstore_ftrace_encode_cpu(&rec, raw_smp_processor_id());
> > > +	psinfo->write_buf(PSTORE_TYPE_FTRACE, 0, NULL, 0, (void *)&rec,
> > > +			  sizeof(rec), psinfo);
> > > +}
> > 
> > BTW, can any of the called functions go into module code that can be
> > removed? If so, then this is not safe at all. Normal function tracing
> > can not be synced in a preemptible kernel.
> 
> Um. Yes, psinfo->write_buf() might be in the module. Nice catch.
> 
> > Also, I'm starting to wonder if this should be in its own utility
> > (separate debugfs?) than hooking directly into ftrace. Then you don't
> > need to modify ftrace at all and you can do the following:
> > 
> > static struct ftrace_ops trace_ops {
> > 	.func = pstore_ftrace_call;
> > };
> > 
> > then in your write to debugfs file:
> > 
> > 	register_ftrace_function(&trace_ops);
> > 
> > To turn off tracing:
> > 
> > 	unregister_ftrace_function(&trace_ops);
> > 
> > Note, it's safe to use if the trace_ops (or anything the callback calls)
> > is a module. That's because it detects the trace_ops is not kernel core
> > code and will place a wrapper around it that allows the function tracing
> > to by synced with module unload. You still need to unregister the
> > trace_ops before unloading the module, or you can have a crash that way.
> 
> Hehe. Like this? http://lkml.org/lkml/2012/5/26/80 :-D
> 
> So, do you want something like this, but combinded: we don't register
> another tracer, but register our own ftrace_ops? This sounds doable.

Yeah, the combined. That is, don't make a tracer out of it. Use another
mechanism to enable the tracing and not as a tracer
in /debug/tracing/available_tracers. We can probably set up events for
you too, but at a later time.

-- Steve


  reply	other threads:[~2012-07-17 21:38 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-10  0:10 [PATCH v4 0/8] Function tracing support for pstore Anton Vorontsov
2012-07-10  0:10 ` [PATCH 1/8] tracing: Fix initialization failure path in tracing_set_tracer() Anton Vorontsov
2012-07-10  0:10 ` [PATCH 2/8] pstore: Introduce write_buf backend callback Anton Vorontsov
2012-07-10  0:10 ` [PATCH 3/8] pstore: Add persistent function tracing Anton Vorontsov
2012-07-17 19:38   ` Steven Rostedt
2012-07-17 20:01     ` Anton Vorontsov
2012-07-17 21:38       ` Steven Rostedt [this message]
2012-07-17 22:06         ` Anton Vorontsov
2012-07-18  3:47         ` [PATCH] pstore/ftrace: Convert to its own enable/disable debugfs knob Anton Vorontsov
2012-07-18  7:26           ` Anton Vorontsov
2012-07-18 13:13             ` Steven Rostedt
2012-07-18 13:10           ` Steven Rostedt
2012-07-18 18:24             ` [PATCH v2] " Anton Vorontsov
2012-07-18 17:12           ` [PATCH] " Stephen Boyd
2012-07-18 18:50             ` Anton Vorontsov
2012-07-18 18:59               ` Stephen Boyd
2012-07-18 19:30                 ` [PATCH v3] " Anton Vorontsov
2012-08-21  1:46                   ` Anton Vorontsov
2012-08-22  1:07                     ` Steven Rostedt
2012-08-22  2:10                       ` Anton Vorontsov
2012-08-22  2:25                         ` Steven Rostedt
2012-07-10  0:10 ` [PATCH 4/8] tracing/function: Introduce persistent trace option Anton Vorontsov
2012-07-10 12:58   ` Steven Rostedt
2012-07-10  0:10 ` [PATCH 5/8] pstore/ram: Convert to write_buf callback Anton Vorontsov
2012-07-10  0:10 ` [PATCH 6/8] pstore/ram: Add ftrace messages handling Anton Vorontsov
2012-07-10  0:10 ` [PATCH 7/8] pstore/ram: Make tracing log versioned Anton Vorontsov
2012-07-17 16:56   ` Greg Kroah-Hartman
2012-07-17 17:09     ` Anton Vorontsov
2012-07-17 18:09     ` Anton Vorontsov
2012-07-17 18:13       ` [PATCH] pstore: Headers should include all stuff they use Anton Vorontsov
2012-07-17 18:19         ` Greg Kroah-Hartman
2012-07-17 18:37           ` Anton Vorontsov
2012-07-17 19:15             ` Greg Kroah-Hartman
2012-07-17 18:18       ` [PATCH 7/8] pstore/ram: Make tracing log versioned Greg Kroah-Hartman
2012-07-17 19:11     ` [PATCH fixed] " Anton Vorontsov
2012-07-10  0:10 ` [PATCH 8/8] tracing/function: Convert func_set_flag() to a switch statement Anton Vorontsov
2012-07-10 12:01 ` [PATCH v4 0/8] Function tracing support for pstore Arnd Bergmann
2012-07-10 13:00   ` Steven Rostedt
2012-07-16  7:14 ` Anton Vorontsov
2012-07-16 14:53   ` Greg Kroah-Hartman

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=1342561102.10332.18.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=anton.vorontsov@linaro.org \
    --cc=arnd@arndb.de \
    --cc=arve@android.com \
    --cc=ccross@android.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=fweisbec@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jj@chaosbits.net \
    --cc=john.stultz@linaro.org \
    --cc=keescook@chromium.org \
    --cc=kernel-team@android.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marco.stornelli@gmail.com \
    --cc=mingo@redhat.com \
    --cc=patches@linaro.org \
    --cc=rdunlap@xenotime.net \
    --cc=rebecca@android.com \
    --cc=sboyd@codeaurora.org \
    --cc=shuahkhan@gmail.com \
    --cc=thomas@m3y3r.de \
    --cc=tony.luck@intel.com \
    --cc=xiyou.wangcong@gmail.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

all inboxes | Powered by JetHome®