lkml.org 
[lkml]   [2009]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] tracing: adding flags to events
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 :)



\
 
 \ /
  Last update: 2009-05-15 02:23    [W:0.061 / U:1.548 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site