* [PATCH 1/2] tracing: initialize return value for __ftrace_set_clr_event
2009-05-08 20:36 [PATCH 0/2] [GIT PULL] tracing: updates for tip Steven Rostedt
@ 2009-05-08 20:36 ` Steven Rostedt
2009-05-10 6:19 ` Li Zefan
2009-05-08 20:36 ` [PATCH 2/2] tracing: add trace_set_clr_event to export event enabling function Steven Rostedt
2009-05-09 4:27 ` [PATCH 0/2] [GIT PULL] tracing: updates for tip Ingo Molnar
2 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2009-05-08 20:36 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Li Zefan
[-- Attachment #1: 0001-tracing-initialize-return-value-for-__ftrace_set_cl.patch --]
[-- Type: text/plain, Size: 1112 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
Commit 8f31bfe538ebafac187d2d4465a92e1d9ee6d8c2
tracing/events: clean up for ftrace_set_clr_event()
Moved out the code for ftrace_set_clr_event into a helper funciton but
did not initialize the return value. As a result, we do not warn about
a typo in the echoing of events in set_event.
This patch restores the old warning:
# echo foobar > set_event
-bash: echo: write error: Invalid argument
[ Impact: restore warning of invalid entries to set_event ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_events.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index df394bc..2eecb87 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -118,7 +118,7 @@ static int __ftrace_set_clr_event(const char *match, const char *sub,
const char *event, int set)
{
struct ftrace_event_call *call;
- int ret;
+ int ret = -EINVAL;
mutex_lock(&event_mutex);
list_for_each_entry(call, &ftrace_events, list) {
--
1.6.2.4
--
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/2] tracing: add trace_set_clr_event to export event enabling function
2009-05-08 20:36 [PATCH 0/2] [GIT PULL] tracing: updates for tip Steven Rostedt
2009-05-08 20:36 ` [PATCH 1/2] tracing: initialize return value for __ftrace_set_clr_event Steven Rostedt
@ 2009-05-08 20:36 ` Steven Rostedt
2009-05-09 4:27 ` [PATCH 0/2] [GIT PULL] tracing: updates for tip Ingo Molnar
2 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2009-05-08 20:36 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Li Zefan
[-- Attachment #1: 0002-tracing-add-trace_set_clr_event-to-export-event-ena.patch --]
[-- Type: text/plain, Size: 1940 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
Other parts of the kernel may need to be able to enable or disable
specific events. Especially parts that create trace events.
[ Impact: allow enabling of trace events by those that create the event ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
include/linux/ftrace_event.h | 2 ++
kernel/trace/trace_events.c | 17 +++++++++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 662c1be..bae51dd 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -127,6 +127,8 @@ extern int trace_define_field(struct ftrace_event_call *call, char *type,
#define is_signed_type(type) (((type)(-1)) < 0)
+int trace_set_clr_event(const char *system, const char *event, int set);
+
/*
* The double __builtin_constant_p is because gcc will give us an error
* if we try to allocate the static variable to fmt if it is not a
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 2eecb87..0eec0c5 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -177,6 +177,23 @@ static int ftrace_set_clr_event(char *buf, int set)
return __ftrace_set_clr_event(match, sub, event, set);
}
+/**
+ * trace_set_clr_event - enable or disable an event
+ * @system: system name to match (NULL for any system)
+ * @event: event name to match (NULL for all events, within system)
+ * @set: 1 to enable, 0 to disable
+ *
+ * This is a way for other parts of the kernel to enable or disable
+ * event recording.
+ *
+ * Returns 0 on success, -EINVAL if the parameters do not match any
+ * registered events.
+ */
+int trace_set_clr_event(const char *system, const char *event, int set)
+{
+ return __ftrace_set_clr_event(NULL, system, event, set);
+}
+
/* 128 should be much more than enough */
#define EVENT_BUF_SIZE 127
--
1.6.2.4
--
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 0/2] [GIT PULL] tracing: updates for tip
2009-05-08 20:36 [PATCH 0/2] [GIT PULL] tracing: updates for tip Steven Rostedt
2009-05-08 20:36 ` [PATCH 1/2] tracing: initialize return value for __ftrace_set_clr_event Steven Rostedt
2009-05-08 20:36 ` [PATCH 2/2] tracing: add trace_set_clr_event to export event enabling function Steven Rostedt
@ 2009-05-09 4:27 ` Ingo Molnar
2 siblings, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2009-05-09 4:27 UTC (permalink / raw)
To: Steven Rostedt; +Cc: linux-kernel, Andrew Morton, Li Zefan
* Steven Rostedt <rostedt@goodmis.org> wrote:
> Ingo,
>
> The first patch fixes a uninitialized variable. What bothers me
> about this, is that gcc did not warn about it. My gcc warns about
> a ton of variables that might not being initialized, but missed
> one that actually is not!
>
> I wonder if it is only my version of gcc: 4.2.2
> :-/
>
> Please pull the latest tip/tracing/ftrace-1 tree, which can be found at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
> tip/tracing/ftrace-1
>
>
> Steven Rostedt (2):
> tracing: initialize return value for __ftrace_set_clr_event
> tracing: add trace_set_clr_event to export event enabling function
>
> ----
> include/linux/ftrace_event.h | 2 ++
> kernel/trace/trace_events.c | 19 ++++++++++++++++++-
> 2 files changed, 20 insertions(+), 1 deletions(-)
Pulled, thanks Steve!
Note, the above branch gave conflicts in ring_buffer.c. But i pulled
at commit 4671c79 from your tree which gave the same diffstat:
Fast forward
include/linux/ftrace_event.h | 2 ++
kernel/trace/trace_events.c | 19 ++++++++++++++++++-
2 files changed, 20 insertions(+), 1 deletions(-)
Please double-check that i got the right bits. Thanks,
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread