lkml.org 
[lkml]   [2009]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] perfcounters: Support for ftrace event records sampling
From
Date
On Fri, 2009-08-07 at 12:38 +0200, Peter Zijlstra wrote:
> > +static void ftrace_profile_##call(proto) \
> > +{ \
> > + struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
> > + struct ftrace_event_call *event_call = &event_##call; \
> > + extern void perf_tpcounter_event(int, u64, u64, void *, int); \
> > + struct ftrace_raw_##call *entry; \
> > + u64 __addr = 0, __count = 1; \
> > + unsigned long irq_flags; \
> > + int __entry_size; \
> > + int __data_size; \
> > + int pc; \
> > + \
> > + local_save_flags(irq_flags); \
> > + pc = preempt_count(); \
> > + \
> > + __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
> > + __entry_size = __data_size + sizeof(*entry); \
> > + \
> > + do { \
> > + char raw_data[__entry_size]; \
> > + struct trace_entry *ent; \
> > + \
> > + entry = (struct ftrace_raw_##call *)raw_data; \
> > + ent = &entry->ent; \
> > + tracing_generic_entry_update(ent, irq_flags, pc); \
> > + ent->type = event_call->id; \
> > + \
> > + tstruct \
> > + \
> > + { assign; } \
> > + \
> > + perf_tpcounter_event(event_call->id, __addr, __count, entry,\
> > + __entry_size); \
> > + } while (0); \
> > + \
> > +}
>
> ok, so the one concern I have here is that the data needs to fit on the
> stack. What if someone puts a large string in the data?

Also, how NMI safe is all that?



\
 
 \ /
  Last update: 2009-08-07 22:13    [W:0.072 / U:2.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site