Skip to contentSkip to conversation

tracing: updates for tip

GIT PULL In review Steven Rostedt 3 participants 5 messages May 8, 2009 – May 10, 2009

Subsystems (2)
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

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(-)
author maintainer
#1 lore raw

PATCH 1/2 tracing: initialize return value for __ftrace_set_clr_event

From: Steven Rostedt <[email protected]>

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 ]

---
 kernel/trace/trace_events.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/trace_events.c +1 -1
index df394bc..2eecb87 100644
@@ -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) {
Signature · 3 lines
1.6.2.4

-- 
#2 lore raw

Re: [PATCH 1/2] tracing: initialize return value for __ftrace_set_clr_event

kernel/trace/trace_events.c static int __ftrace_set_clr_event(const char *match, const char *sub, · line 122

Quoted 7 lines
kernel/trace/trace_events.c +1 -1
@@ -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;
 

Thanks! Seems gcc is not good enough to warn on this may-be-used-uninitialized..

--
Zefan

author maintainer
#3 lore raw

PATCH 2/2 tracing: add trace_set_clr_event to export event enabling function

In reply to Steven Rostedt

From: Steven Rostedt <[email protected]>

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 ]

---
 include/linux/ftrace_event.h |    2 ++
 kernel/trace/trace_events.c  |   17 +++++++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
include/linux/ftrace_event.h +2 -0
index 662c1be..bae51dd 100644
@@ -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
kernel/trace/trace_events.c +17 -0
index 2eecb87..0eec0c5 100644
@@ -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
 
Signature · 3 lines
1.6.2.4

-- 
#4 lore raw
In reply to Steven Rostedt
Quoted 16 lines · Steven Rostedt

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

Quoted 8 lines

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