[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090509133306.GA20684@elte.hu>
Date: Sat, 9 May 2009 15:33:06 +0200
From: Ingo Molnar <mingo@...e.hu>
To: Frédéric Weisbecker <fweisbec@...il.com>
Cc: Jason Baron <jbaron@...hat.com>, Tom Zanussi <tzanussi@...il.com>,
linux-kernel@...r.kernel.org, laijs@...fujitsu.com,
rostedt@...dmis.org, peterz@...radead.org,
mathieu.desnoyers@...ymtl.ca, jiayingz@...gle.com,
mbligh@...gle.com, roland@...hat.com, fche@...hat.com
Subject: Re: [RFC] convert ftrace syscall tracer to TRACE_EVENT()
* Frédéric Weisbecker <fweisbec@...il.com> wrote:
> > Secondly, we should reuse the information we get in
> > SYSCALL_DEFINE, to construct the TRACE_EVENT tracepoints
> > directly - without having to list all syscalls again in a
> > separate file.
>
> Indeed, that's not trivial though, but feasible. I'm not sure we
> can reuse the TRACE_EVENT macro directly inside SYSCALL_DEFINE.
> The resulting macro tempest effect that would occur confuses me
> and I have troubles to imagine the result.
Lets take an example. This syscall:
SYSCALL_DEFINE3(sched_setscheduler, pid_t, pid, int, policy,
struct sched_param __user *, param)
Is equivalent to:
SYSCALL_DEFINE3(name, t1, v1, t2, v2, t3, v3)
('t' for type, 'v' for variable/value).
This would transform into the following TRACE_EVENT() construct:
TRACE_EVENT_SYSCALL2():
TRACE_EVENT(sys_##name,
TP_PROTO(t1 v1, t2 v2),
TP_ARGS(v1, v2),
TP_STRUCT__entry(
__field(t1, v1)
__field(t2, v2)
),
TP_fast_assign(
__entry->v1 = v1;
__entry->v2 = v2;
),
TP_printk("%016Lx %016Lx", (u64)__entry->v1, (u64)__entry->v2)
);
We need TRACE_EVENT_SYSCALL[123456] definitions, and that's it.
The only place where we lose type information is the printk format -
but that's not a big issue, as i'd expect the event record to be the
main user of this.
[ In addition to this, we could extend DEFINE_SYSCALL[1..6] with a
(optional) format string definition field, and fill that in for
anything that matters. ]
Note, this assumes that all syscall types can be described via
__field() - i think that's correct. (we dont want to deref strings
as they are untrusted, and there are no arrays in syscall
parameters)
Can you see any complication?
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists