lkml.org 
[lkml]   [2008]   [Oct]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 6/6] ftrace: take advantage of variable length entries

* Steven Rostedt <rostedt@goodmis.org> wrote:

> > > struct trace_entry *entry = iter->ent;
> > > - struct mmiotrace_map *m = &entry->field.mmiomap;
> > > + struct mmiotrace_map *m = (struct mmiotrace_map *)entry;
> >
> > This is different style than above, missing the struct
> > trace_mmiotrace_map intermediate step. Looks like a bug,
> > since struct mmiotrace_map is not the first field in
> > struct trace_mmiotrace_map.
>
> Crap! yes this is a bug. Thanks for pointing this out.

hm, there's a significant amount of type casts, see the grep below.

The ringbuffer becoming type-opaque has exactly these kinds of dangers,
and as i suggested a few days ago, please think about a debug mode that
stores the record type in the trace entry and validates it on extraction
or something like that.

That might even be a robustness feature: the tracer should not crash if
the trace buffer gets corrupted. ftrace had that invariant before, i
think we should try to keep as many aspects of it as possible.

Ingo

------------->
ring_buffer.c: page = (struct buffer_page *)virt_to_page(addr);
ring_buffer.c: cpu_buffer->reader_page = (struct buffer_page *)virt_to_page(addr);
ring_buffer.c:static void rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer);
ring_buffer.c: page = (struct buffer_page *)virt_to_page(addr);
trace_boot.c: struct trace_boot *field = (struct trace_boot *)entry;
trace.c:static DEFINE_PER_CPU(struct trace_array_cpu, global_trace_cpu);
trace.c:static DEFINE_PER_CPU(struct trace_array_cpu, max_data);
trace.c: cont = (struct trace_field_cont *)ent;
trace.c: struct ftrace_entry *field = (struct ftrace_entry *)entry;
trace.c: (struct ctx_switch_entry *)entry;
trace.c: struct special_entry *field = (struct special_entry *)entry;
trace.c: struct stack_entry *field = (struct stack_entry *)entry;
trace.c: struct print_entry *field = (struct print_entry *)entry;
trace.c: struct ftrace_entry *field = (struct ftrace_entry *)entry;
trace.c: (struct ctx_switch_entry *)entry;
trace.c: struct special_entry *field = (struct special_entry *)entry;
trace.c: struct stack_entry *field = (struct stack_entry *)entry;
trace.c: struct print_entry *field = (struct print_entry *)entry;
trace.c: struct ftrace_entry *field = (struct ftrace_entry *)entry;
trace.c: (struct ctx_switch_entry *)entry;
trace.c: struct special_entry *field = (struct special_entry *)entry;
trace.c: struct print_entry *field = (struct print_entry *)entry;
trace.c: struct ftrace_entry *field = (struct ftrace_entry *)entry;
trace.c: (struct ctx_switch_entry *)entry;
trace.c: struct special_entry *field = (struct special_entry *)entry;
trace.c: struct ftrace_entry *field = (struct ftrace_entry *)entry;
trace.c: (struct ctx_switch_entry *)entry;
trace.c: struct special_entry *field = (struct special_entry *)entry;
trace.c: struct seq_file *m = (struct seq_file *)file->private_data;
trace.c: offsetof(struct trace_iterator, seq));
trace.c: offsetof(struct trace_iterator, seq));
trace_mmiotrace.c: (struct trace_mmiotrace_rw *)entry;
trace_mmiotrace.c: struct mmiotrace_map *m = (struct mmiotrace_map *)entry;
trace_mmiotrace.c: struct print_entry *print = (struct print_entry *)entry;
trace_sched_wakeup.c:static void __wakeup_reset(struct trace_array *tr);
trace_sysprof.c:static DEFINE_PER_CPU(struct hrtimer, stack_trace_hrtimer);
trace_sysprof.c: stack = ((char *)regs + sizeof(struct pt_regs));
trace_sysprof.c: regs = (struct pt_regs *)current->thread.sp0 - 1;


\
 
 \ /
  Last update: 2008-10-01 09:57    [W:0.108 / U:1.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site