This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [RFC][Patch 2/2] markers: example of irq regular kernel markers
- From: Peter Zijlstra <peterz at infradead dot org>
- To: Mathieu Desnoyers <mathieu dot desnoyers at polymtl dot ca>
- Cc: Masami Hiramatsu <mhiramat at redhat dot com>, Steven Rostedt <rostedt at goodmis dot org>, "Frank Ch. Eigler" <fche at redhat dot com>, Ingo Molnar <mingo at elte dot hu>, LKML <linux-kernel at vger dot kernel dot org>, systemtap-ml <systemtap at sources dot redhat dot com>, Hideo AOKI <haoki at redhat dot com>
- Date: Fri, 20 Jun 2008 22:07:25 +0200
- Subject: Re: [RFC][Patch 2/2] markers: example of irq regular kernel markers
- References: <485BE2C6.1080901@redhat.com> <20080620174529.GB10943@Krystal>
On Fri, 2008-06-20 at 13:45 -0400, Mathieu Desnoyers wrote:
> All this work look good, thanks Masami! Sorry I did not find time to do
> it lately, I've been busy on other things. A small question though :
> since LTTng is configurable both as an external module or as an
> in-kernel tracer, I wonder if it would really hurt to add the format
> strings to DEFINE_TRACE, e.g. :
>
> DEFINE_TRACE(name, prototype, format_string, args...)
>
> which would give :
>
> DEFINE_TRACE(irq_entry, (int irq_id, int kernel_mode), "%d %d",
> irq_id, kernel_mode);
>
> DEFINE_TRACE(irq_exit, (void), MARK_NOARGS);
>
> and calling this in the kernel code :
>
> trace_irq_entry(irq, (regs)?(!user_mode(regs)):(1));
> ...
> trace_irq_exit();
>
> and for quick-and-dirty debug usage, one would add this to kernel code :
>
> trace_mark(subsystem_event, "(int arg, struct task_struct *task)",
> "%d %p", arg, current);
How would this work for:
DEFINE_TRACE(sched_switch, (struct task_struct *prev, struct task_struct *next), prev, next);
You'd want a string like: "%d %d", prev->pid, next->pid
not: "%p %p", prev, next
perhaps we can do something like:
DEFINE_TRACER(sched_switch, (struct task_struct *prev, struct task_struct *next), prev, next,
"%d %d", prev->pid, next->pid);
that defines a default tracer function for the previously defined trace
point. That way its optional, and allows for generic trace points.
Of course, all this could be ruined by reality - C really sucks wrt
forwarding functions.. :-/