public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Christoph Hellwig <hch@infradead.org>,
	Ingo Molnar <mingo@elte.hu>,
	Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [RFC] tracing: adding flags to events
Date: Fri, 15 May 2009 02:20:28 +0200	[thread overview]
Message-ID: <20090515002027.GB8051@nowhere> (raw)
In-Reply-To: <alpine.DEB.2.00.0905142000540.30591@gandalf.stny.rr.com>

On Thu, May 14, 2009 at 08:01:20PM -0400, Steven Rostedt wrote:
> 
> 
> 
> On Fri, 15 May 2009, Frederic Weisbecker wrote:
> 
> > On Thu, May 14, 2009 at 07:18:23PM -0400, Steven Rostedt wrote:
> > > > > +
> > > > >  #undef TRACE_EVENT
> > > > >  #define TRACE_EVENT(call, proto, args, tstruct, assign, print)		\
> > > > >  enum print_line_t							\
> > > > > @@ -127,6 +132,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags)	\
> > > > >  	struct trace_seq *s = &iter->seq;				\
> > > > >  	struct ftrace_raw_##call *field;				\
> > > > >  	struct trace_entry *entry;					\
> > > > > +	struct trace_seq *p;						\
> > > > >  	int ret;							\
> > > > >  									\
> > > > >  	entry = iter->ent;						\
> > > > > @@ -138,7 +144,9 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags)	\
> > > > >  									\
> > > > >  	field = (typeof(field))entry;					\
> > > > >  									\
> > > > > +	p = &get_cpu_var(ftrace_event_seq);				\
> > > > >  	ret = trace_seq_printf(s, #call ": " print);			\
> > > > > +	put_cpu();							\
> > > > 
> > > > 
> > > > 
> > > > I don't understand the role of this per-cpu trace_seq variable.
> > > > It doesn't seem to be used.
> > > 
> > > See it now? ;-)
> > 
> > 
> > Still not :-)
> > 
> > I don't understand, it doesn't seem to be used. May be I'm too
> > much sleepy to understand...
> 
> That's because you cut out an important detail ;-)
> 
> > > +#define __print_flags(flag, x...) ftrace_print_flags_seq(p, flag, x)
> 


Aah, ok.
Then it returns the seq buffer and matches the %s of the real
trace_seq_printf.

Wow tricky! And by disabling preemption and using per_cpu, we ensure it won't be
concurrently modified because we are in the read callback/always in user context.

Thanks, now I can go to sleep without this pain of doubt :)


  reply	other threads:[~2009-05-15  0:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-14 19:45 [RFC] tracing: adding flags to events Steven Rostedt
2009-05-14 20:33 ` Frederic Weisbecker
2009-05-14 23:18   ` Steven Rostedt
2009-05-14 23:58     ` Frederic Weisbecker
2009-05-15  0:01       ` Steven Rostedt
2009-05-15  0:20         ` Frederic Weisbecker [this message]
2009-05-15  2:18 ` Li Zefan
2009-05-15  2:27   ` Steven Rostedt
2009-05-15 16:57 ` Christoph Hellwig

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=20090515002027.GB8051@nowhere \
    --to=fweisbec@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    /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