From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, paulus@samba.org, hpa@zytor.com,
mingo@redhat.com, rostedt@goodmis.org, a.p.zijlstra@chello.nl,
tglx@linutronix.de, mingo@elte.hu
Subject: [tip:tracing/ftrace] ftrace: ensure every event gets an id
Date: Fri, 20 Mar 2009 10:19:38 GMT [thread overview]
Message-ID: <tip-28bea271e58e429eccfad3d7ee2ad12d6ee015bf@git.kernel.org> (raw)
In-Reply-To: <20090319194233.464914218@chello.nl>
Commit-ID: 28bea271e58e429eccfad3d7ee2ad12d6ee015bf
Gitweb: http://git.kernel.org/tip/28bea271e58e429eccfad3d7ee2ad12d6ee015bf
Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Thu, 19 Mar 2009 20:26:14 +0100
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 20 Mar 2009 10:17:06 +0100
ftrace: ensure every event gets an id
Impact: widen user-space visibe event IDs to all events
Previously only TRACE_EVENT events got ids, because only they
generated raw output which needs to be demuxed from the trace.
In order to provide a unique ID for each event, register everybody,
regardless.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <20090319194233.464914218@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/trace/trace_events_stage_3.h | 15 ++++++++++++++-
kernel/trace/trace_output.c | 5 +++++
2 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/kernel/trace/trace_events_stage_3.h b/kernel/trace/trace_events_stage_3.h
index ae2e323..4c26d97 100644
--- a/kernel/trace/trace_events_stage_3.h
+++ b/kernel/trace/trace_events_stage_3.h
@@ -130,7 +130,19 @@ static void ftrace_unreg_event_##call(void) \
{ \
unregister_trace_##call(ftrace_event_##call); \
} \
-
+ \
+static struct ftrace_event_call event_##call; \
+ \
+static int ftrace_init_event_##call(void) \
+{ \
+ int id; \
+ \
+ id = register_ftrace_event(NULL); \
+ if (!id) \
+ return -ENODEV; \
+ event_##call.id = id; \
+ return 0; \
+}
#undef TRACE_FORMAT
#define TRACE_FORMAT(call, proto, args, fmt) \
@@ -140,6 +152,7 @@ __attribute__((__aligned__(4))) \
__attribute__((section("_ftrace_events"))) event_##call = { \
.name = #call, \
.system = __stringify(TRACE_SYSTEM), \
+ .raw_init = ftrace_init_event_##call, \
.regfunc = ftrace_reg_event_##call, \
.unregfunc = ftrace_unreg_event_##call, \
}
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index b451417..19261fd 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -481,6 +481,11 @@ int register_ftrace_event(struct trace_event *event)
mutex_lock(&trace_event_mutex);
+ if (!event) {
+ ret = next_event_type++;
+ goto out;
+ }
+
if (!event->type)
event->type = next_event_type++;
else if (event->type > __TRACE_LAST_TYPE) {
next prev parent reply other threads:[~2009-03-20 10:20 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-19 19:26 [PATCH 00/10] tracepoint perf counter events and new ABI Peter Zijlstra
2009-03-19 19:26 ` [PATCH 01/10] perf_counter: fix uninitialized usage of event_list Peter Zijlstra
2009-03-20 10:24 ` [tip:perfcounters/core] " Peter Zijlstra
2009-03-19 19:26 ` [PATCH 02/10] perf_counter: generic context switch event Peter Zijlstra
2009-03-20 10:24 ` [tip:perfcounters/core] " Peter Zijlstra
2009-03-19 19:26 ` [PATCH 03/10] ftrace: provide an id file for each event Peter Zijlstra
2009-03-20 10:19 ` [tip:tracing/ftrace] " Peter Zijlstra
2009-03-19 19:26 ` [PATCH 04/10] ftrace: ensure every event gets an id Peter Zijlstra
2009-03-20 10:19 ` Peter Zijlstra [this message]
2009-03-19 19:26 ` [PATCH 05/10] ftrace: event profile hooks Peter Zijlstra
2009-03-20 10:19 ` [tip:tracing/ftrace] " Peter Zijlstra
2009-03-19 19:26 ` [PATCH 06/10] perf_counter: fix up counter free paths Peter Zijlstra
2009-03-20 10:25 ` [tip:perfcounters/core] " Peter Zijlstra
2009-03-19 19:26 ` [PATCH 07/10] perf_counter: hook up the tracepoint events Peter Zijlstra
2009-03-20 10:25 ` [tip:perfcounters/core] " Peter Zijlstra
2009-03-22 8:57 ` Ingo Molnar
2009-07-29 1:01 ` Jeff Garzik
2009-07-29 8:35 ` Peter Zijlstra
2009-07-29 8:59 ` Jeff Garzik
2009-07-29 9:12 ` Peter Zijlstra
2009-08-02 13:09 ` [tip:perfcounters/core] tracing, perf_counter: Add help text to CONFIG_EVENT_PROFILE tip-bot for Peter Zijlstra
2009-03-19 19:26 ` [PATCH 08/10] perf_counter: revamp syscall input ABI Peter Zijlstra
2009-03-20 10:25 ` [tip:perfcounters/core] " Peter Zijlstra
2009-03-19 19:26 ` [PATCH 09/10] perf_counter: unify irq output code Peter Zijlstra
2009-03-20 10:25 ` [tip:perfcounters/core] " Peter Zijlstra
2009-03-19 19:26 ` [PATCH 10/10] perf_counter: powerpc: clean up perc_counter_interrupt Peter Zijlstra
2009-03-19 22:17 ` Paul Mackerras
2009-03-20 8:54 ` Ingo Molnar
2009-03-20 10:25 ` [tip:perfcounters/core] " Paul Mackerras
2009-03-20 9:27 ` [PATCH 00/10] tracepoint perf counter events and new ABI Ingo Molnar
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=tip-28bea271e58e429eccfad3d7ee2ad12d6ee015bf@git.kernel.org \
--to=a.p.zijlstra@chello.nl \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=paulus@samba.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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