From: Steven Rostedt <rostedt@goodmis.org>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Paul Mackerras <paulus@samba.org>,
Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>,
Li Zefan <lizf@cn.fujitsu.com>,
Lai Jiangshan <laijs@cn.fujitsu.com>,
Masami Hiramatsu <mhiramat@redhat.com>,
Jens Axboe <jens.axboe@oracle.com>,
Johannes Berg <johannes@sipsolutions.net>
Subject: Re: [PATCH 02/11] tracing: Introduce TRACE_EVENT_INJECT
Date: Fri, 05 Feb 2010 09:08:20 -0500 [thread overview]
Message-ID: <1265378900.24386.22.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <1265188475-23509-3-git-send-regression-fweisbec@gmail.com>
On Wed, 2010-02-03 at 10:14 +0100, Frederic Weisbecker wrote:
> TRACE_EVENT_INJECT macro is the same as TRACE_EVENT but takes one
> more parameter that defines an "inject" callback to be called when
> the event is enabled.
I was just talking with Johannes about this.
> This is useful when we need to catch up with events that have
> already occured but that are required for the user.
>
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
> Cc: Li Zefan <lizf@cn.fujitsu.com>
> Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
> Cc: Masami Hiramatsu <mhiramat@redhat.com>
> Cc: Jens Axboe <jens.axboe@oracle.com>
> ---
> include/linux/ftrace_event.h | 1 +
> include/linux/tracepoint.h | 3 +++
> include/trace/define_trace.h | 6 ++++++
> include/trace/ftrace.h | 31 ++++++++++++++++++++++++++++++-
> kernel/trace/trace_events.c | 3 +++
> 5 files changed, 43 insertions(+), 1 deletions(-)
>
> diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
> index cd95919..026d39b 100644
> --- a/include/linux/ftrace_event.h
> +++ b/include/linux/ftrace_event.h
> @@ -126,6 +126,7 @@ struct ftrace_event_call {
> int (*show_format)(struct ftrace_event_call *,
> struct trace_seq *);
> int (*define_fields)(struct ftrace_event_call *);
> + void (*inject)(void);
> struct list_head fields;
> int filter_active;
> struct event_filter *filter;
> diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> index f59604e..f114aec 100644
> --- a/include/linux/tracepoint.h
> +++ b/include/linux/tracepoint.h
> @@ -291,5 +291,8 @@ static inline void tracepoint_synchronize_unregister(void)
> #define TRACE_EVENT_FN(name, proto, args, struct, \
> assign, print, reg, unreg) \
> DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
> +#define TRACE_EVENT_INJECT(name, proto, args, struct, \
> + assign, print, inject) \
I would much rather not add this macro and instead make a
register_event_callback() that a process could register.
Actually, I was thinking of something even a bit more functional:
Creating a command file in the event directory along with format,filter
and id.
It would default with: trace, or ftrace if you want it to be specific to
ftrace. Then we could add:
echo perf > command
which would make the call back call the perf command instead of the
ftrace one. Or use >> to call both commands.
So instead of making an unique MACRO that is very stale, I would rather
change the structure to be much more generic.
This way you could do something like:
register_event_command(event, "perf_inject", perf_inject, data);
And when the event is enabled, it would call the perf_inject function.
How does this sound to you?
Note, this may also clean up some of ftrace.h too.
-- Steve
> + DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
>
> #endif /* ifdef TRACE_EVENT (see note above) */
> diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
> index 5acfb1e..41f7ce3 100644
> --- a/include/trace/define_trace.h
> +++ b/include/trace/define_trace.h
> @@ -31,6 +31,11 @@
> assign, print, reg, unreg) \
> DEFINE_TRACE_FN(name, reg, unreg)
>
> +#undef TRACE_EVENT_INJECT
> +#define TRACE_EVENT_INJECT(name, proto, args, tstruct, \
> + assign, print, inject) \
> + DEFINE_TRACE(name)
> +
> #undef DEFINE_EVENT
> #define DEFINE_EVENT(template, name, proto, args) \
> DEFINE_TRACE(name)
> @@ -71,6 +76,7 @@
>
> #undef TRACE_EVENT
> #undef TRACE_EVENT_FN
> +#undef TRACE_EVENT_INJECT
> #undef DECLARE_EVENT_CLASS
> #undef DEFINE_EVENT
> #undef DEFINE_EVENT_PRINT
> diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
> index f2c09e4..869da37 100644
> --- a/include/trace/ftrace.h
> +++ b/include/trace/ftrace.h
> @@ -37,6 +37,26 @@
> PARAMS(print)); \
> DEFINE_EVENT(name, name, PARAMS(proto), PARAMS(args));
>
> +/*
> + * TRACE_EVENT_INJECT creates an event that has an injector callback
> + * to call when the trace event is enabled, usually to trigger
> + * automatically some necessary initial traces.
> + */
> +#undef TRACE_EVENT_INJECT
> +#define TRACE_EVENT_INJECT(name, proto, args, tstruct, \
> + assign, print, inject) \
> + DECLARE_EVENT_CLASS(name, \
> + PARAMS(proto), \
> + PARAMS(args), \
> + PARAMS(tstruct), \
> + PARAMS(assign), \
> + PARAMS(print)); \
> + DEFINE_EVENT_INJECT(name, name, PARAMS(proto), PARAMS(args), inject);
> +
> +#undef DEFINE_EVENT_INJECT
> +#define DEFINE_EVENT_INJECT(template, name, proto, args, inject) \
> + DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args));
> +
>
> #undef __field
> #define __field(type, item) type item;
> @@ -726,7 +746,11 @@ static struct trace_event ftrace_event_type_##call = { \
> #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print)
>
> #undef DEFINE_EVENT
> -#define DEFINE_EVENT(template, call, proto, args) \
> +#define DEFINE_EVENT(template, call, proto, args) \
> + DEFINE_EVENT_INJECT(template, call, PARAMS(proto), PARAMS(proto), NULL)
> +
> +#undef DEFINE_EVENT_INJECT
> +#define DEFINE_EVENT_INJECT(template, call, proto, args, injector) \
> \
> static struct ftrace_event_call __used \
> __attribute__((__aligned__(4))) \
> @@ -739,6 +763,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
> .unregfunc = ftrace_raw_unreg_event_##call, \
> .show_format = ftrace_format_##template, \
> .define_fields = ftrace_define_fields_##template, \
> + .inject = injector, \
> _TRACE_PROFILE_INIT(call) \
> }
>
> @@ -877,6 +902,10 @@ ftrace_profile_templ_##call(struct ftrace_event_call *event_call, \
> __count, irq_flags); \
> }
>
> +#undef DEFINE_EVENT_INJECT
> +#define DEFINE_EVENT_INJECT(template, call, proto, args, inject) \
> + DEFINE_EVENT(template, call, PARAMS(proto), PARAMS(args))
> +
> #undef DEFINE_EVENT
> #define DEFINE_EVENT(template, call, proto, args) \
> static void ftrace_profile_##call(proto) \
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index 189b09b..5c75cc7 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -142,6 +142,9 @@ static int ftrace_event_enable_disable(struct ftrace_event_call *call,
> break;
> }
> call->enabled = 1;
> +
> + if (call->inject)
> + call->inject();
> }
> break;
> }
next prev parent reply other threads:[~2010-02-05 14:08 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-03 9:14 [RFC GIT PULL] perf/trace/lock optimization/scalability improvements Frederic Weisbecker
2010-02-03 9:14 ` [PATCH 01/11] tracing: Add lock_class_init event Frederic Weisbecker
2010-02-03 9:14 ` [PATCH 02/11] tracing: Introduce TRACE_EVENT_INJECT Frederic Weisbecker
2010-02-05 14:08 ` Steven Rostedt [this message]
2010-02-05 14:47 ` Steven Rostedt
2010-02-05 14:53 ` Peter Zijlstra
2010-02-05 15:07 ` Steven Rostedt
2010-02-06 12:20 ` Frederic Weisbecker
2010-02-06 13:19 ` Steven Rostedt
2010-02-10 10:04 ` Frederic Weisbecker
2010-02-10 14:05 ` Steven Rostedt
2010-02-11 18:57 ` Frederic Weisbecker
2010-02-11 19:23 ` Steven Rostedt
2010-02-03 9:14 ` [PATCH 03/11] tracing: Inject lock_class_init events on registration Frederic Weisbecker
2010-02-05 14:13 ` Steven Rostedt
2010-02-05 14:30 ` Peter Zijlstra
2010-02-05 14:44 ` Steven Rostedt
2010-02-03 9:14 ` [PATCH 04/11] tracing: Add lock class id in lock_acquire event Frederic Weisbecker
2010-02-03 9:14 ` [PATCH 05/11] perf: New PERF_EVENT_IOC_INJECT ioctl Frederic Weisbecker
2010-02-03 9:19 ` Frederic Weisbecker
2010-02-03 9:14 ` [PATCH 06/11] perf: Handle injection ioctl with trace events Frederic Weisbecker
2010-02-03 9:14 ` [PATCH 07/11] perf: Handle injection iotcl for tracepoints from perf record Frederic Weisbecker
2010-02-03 9:14 ` [PATCH 08/11] perf/lock: Add support for lock_class_init events Frederic Weisbecker
2010-02-03 9:14 ` [PATCH 09/11] tracing: Remove the lock name from most lock events Frederic Weisbecker
2010-02-03 9:14 ` [PATCH 10/11] tracing/perf: Fix lock events recursions in the fast path Frederic Weisbecker
2010-02-04 15:47 ` Paul E. McKenney
2010-02-05 2:38 ` Lai Jiangshan
2010-02-05 9:45 ` Peter Zijlstra
2010-02-05 9:50 ` Peter Zijlstra
2010-02-05 10:49 ` Ingo Molnar
2010-02-05 12:10 ` Peter Zijlstra
2010-02-05 12:12 ` Peter Zijlstra
2010-02-05 13:01 ` Peter Zijlstra
2010-02-06 11:12 ` Frederic Weisbecker
2010-02-06 11:24 ` Peter Zijlstra
2010-02-06 11:40 ` Frederic Weisbecker
2010-02-06 14:17 ` Peter Zijlstra
2010-02-06 16:10 ` Frederic Weisbecker
2010-02-07 9:45 ` Peter Zijlstra
2010-02-10 10:17 ` Frederic Weisbecker
2010-02-28 22:24 ` Frederic Weisbecker
2010-02-03 9:14 ` [PATCH 11/11] perf lock: Drop the buffers multiplexing dependency Frederic Weisbecker
2010-02-03 10:25 ` [RFC GIT PULL] perf/trace/lock optimization/scalability improvements Jens Axboe
2010-02-03 20:50 ` Frederic Weisbecker
2010-02-03 21:21 ` Jens Axboe
2010-02-03 22:13 ` Frederic Weisbecker
2010-02-04 19:40 ` Jens Axboe
2010-02-06 10:37 ` Frederic Weisbecker
2010-02-03 10:26 ` Ingo Molnar
2010-02-03 21:26 ` Frederic Weisbecker
2010-02-03 10:33 ` Peter Zijlstra
2010-02-03 22:07 ` Frederic Weisbecker
2010-02-04 6:33 ` Ingo Molnar
2010-02-07 17:10 ` Peter Zijlstra
2010-02-10 10:49 ` Frederic Weisbecker
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=1265378900.24386.22.camel@gandalf.stny.rr.com \
--to=rostedt@goodmis.org \
--cc=acme@redhat.com \
--cc=fweisbec@gmail.com \
--cc=jens.axboe@oracle.com \
--cc=johannes@sipsolutions.net \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
--cc=mitake@dcl.info.waseda.ac.jp \
--cc=paulus@samba.org \
--cc=peterz@infradead.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
all inboxes | Powered by JetHome®