public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Pekka Paalanen <pq@iki.fi>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Mathieu Desnoyers <compudj@krystal.dyndns.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Steven Rostedt <srostedt@redhat.com>
Subject: Re: [PATCH 6/6] ftrace: take advantage of variable length entries
Date: Wed, 1 Oct 2008 09:54:19 +0200	[thread overview]
Message-ID: <20081001075419.GA24509@elte.hu> (raw)
In-Reply-To: <alpine.DEB.1.10.0809301341300.6224@gandalf.stny.rr.com>


* 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;

  parent reply	other threads:[~2008-10-01  7:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-30  3:02 [PATCH 0/6] ftrace: port to the new ring_buffer Steven Rostedt
2008-09-30  3:02 ` [PATCH 1/6] ftrace: give time for wakeup test to run Steven Rostedt
2008-09-30  3:02 ` [PATCH 2/6] Unified trace buffer Steven Rostedt
2008-09-30  9:45   ` Ingo Molnar
2008-09-30 11:53     ` Ingo Molnar
2008-09-30 12:06     ` Steven Rostedt
2008-09-30  3:02 ` [PATCH 3/6] ring_buffer: add paranoid check for buffer page Steven Rostedt
2008-09-30  3:02 ` [PATCH 4/6] ring_buffer: reset buffer page when freeing Steven Rostedt
2008-09-30  3:02 ` [PATCH 5/6] ftrace: make work with new ring buffer Steven Rostedt
2008-09-30  3:02 ` [PATCH 6/6] ftrace: take advantage of variable length entries Steven Rostedt
2008-09-30 17:33   ` Pekka Paalanen
2008-09-30 17:45     ` Steven Rostedt
2008-10-01  4:42       ` Steven Rostedt
2008-10-01  7:54       ` Ingo Molnar [this message]
2008-10-01 14:52         ` Steven Rostedt
2008-10-01 14:52         ` [PATCH] ftrace: type cast verifier Steven Rostedt
2008-10-01 17:42           ` Ingo Molnar
2008-10-01 17:47             ` Ingo Molnar
2008-09-30  7:45 ` [PATCH 0/6] ftrace: port to the new ring_buffer Ingo Molnar
2008-09-30  8:23   ` Ingo Molnar
2008-09-30  8:30     ` Ingo Molnar
2008-09-30  9:13       ` Ingo Molnar
2008-09-30 12:04       ` Steven Rostedt
2008-09-30 12:04     ` Steven Rostedt

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=20081001075419.GA24509@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@linux-foundation.org \
    --cc=compudj@krystal.dyndns.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=pq@iki.fi \
    --cc=rostedt@goodmis.org \
    --cc=srostedt@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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