mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/6] [GIT PULL] tracing: various fixes
@ 2009-09-14 16:33 Steven Rostedt
  2009-09-14 16:33 ` [PATCH 1/6] tracing: add static to generated TRACE_EVENT functions Steven Rostedt
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Steven Rostedt @ 2009-09-14 16:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker


Ingo,

Please pull the latest tip/tracing/core tree, which can be found at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/tracing/core


Li Zefan (3):
      tracing: fix F_printk() typos
      ftrace: add compile-time check on F_printk()
      tracing: remove some unused macros

Steven Rostedt (3):
      tracing: add static to generated TRACE_EVENT functions
      tracing: have TRACE_EVENT macro use __flags to not shadow parameter
      tracing: make testing syscall events a separate configuration

----
 include/trace/ftrace.h       |    8 ++--
 kernel/trace/Kconfig         |   12 +++++++
 kernel/trace/trace_entries.h |   27 +++++----------
 kernel/trace/trace_events.c  |   14 ++++++++-
 kernel/trace/trace_export.c  |   71 ++++++++++++++++++++++++-----------------
 5 files changed, 79 insertions(+), 53 deletions(-)
-- 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/6] tracing: add static to generated TRACE_EVENT functions
  2009-09-14 16:33 [PATCH 0/6] [GIT PULL] tracing: various fixes Steven Rostedt
@ 2009-09-14 16:33 ` Steven Rostedt
  2009-09-14 16:33 ` [PATCH 2/6] tracing: have TRACE_EVENT macro use __flags to not shadow parameter Steven Rostedt
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2009-09-14 16:33 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Jaswinder Singh Rajput

[-- Attachment #1: 0001-tracing-add-static-to-generated-TRACE_EVENT-function.patch --]
[-- Type: text/plain, Size: 1714 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

Some of the generated functions used in the TRACE_EVENT macros are
not declared static, but they are not global.

Discovered by sparse.

Reported-by: Jaswinder Singh Rajput <jaswinder@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 include/trace/ftrace.h      |    4 ++--
 kernel/trace/trace_events.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 308bafd..fa8ce03 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -254,7 +254,7 @@ ftrace_format_##call(struct ftrace_event_call *unused,			\
 
 #undef TRACE_EVENT
 #define TRACE_EVENT(call, proto, args, tstruct, assign, print)		\
-enum print_line_t							\
+static enum print_line_t						\
 ftrace_raw_output_##call(struct trace_iterator *iter, int flags)	\
 {									\
 	struct trace_seq *s = &iter->seq;				\
@@ -317,7 +317,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags)	\
 
 #undef TRACE_EVENT
 #define TRACE_EVENT(call, proto, args, tstruct, func, print)		\
-int									\
+static int								\
 ftrace_define_fields_##call(struct ftrace_event_call *event_call)	\
 {									\
 	struct ftrace_raw_##call field;					\
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index adbed12..0fa8f9f 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -1154,7 +1154,7 @@ static int trace_module_notify(struct notifier_block *self,
 }
 #endif /* CONFIG_MODULES */
 
-struct notifier_block trace_module_nb = {
+static struct notifier_block trace_module_nb = {
 	.notifier_call = trace_module_notify,
 	.priority = 0,
 };
-- 
1.6.3.3

-- 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/6] tracing: have TRACE_EVENT macro use __flags to not shadow parameter
  2009-09-14 16:33 [PATCH 0/6] [GIT PULL] tracing: various fixes Steven Rostedt
  2009-09-14 16:33 ` [PATCH 1/6] tracing: add static to generated TRACE_EVENT functions Steven Rostedt
@ 2009-09-14 16:33 ` Steven Rostedt
  2009-09-14 16:33 ` [PATCH 3/6] tracing: fix F_printk() typos Steven Rostedt
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2009-09-14 16:33 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Jaswinder Singh Rajput

[-- Attachment #1: 0002-tracing-have-TRACE_EVENT-macro-use-__flags-to-not-sh.patch --]
[-- Type: text/plain, Size: 1073 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

The generated functions of TRACE_EVENT uses "flags" in one of the
sub macros which shadows a parameter in the outside macro.

Simple fix is to make the submacro use __flags instead.

Discovered by sparse.

Reported-by: Jaswinder Singh Rajput <jaswinder@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 include/trace/ftrace.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index fa8ce03..72a3b43 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -239,9 +239,9 @@ ftrace_format_##call(struct ftrace_event_call *unused,			\
 #undef __print_flags
 #define __print_flags(flag, delim, flag_array...)			\
 	({								\
-		static const struct trace_print_flags flags[] =		\
+		static const struct trace_print_flags __flags[] =	\
 			{ flag_array, { -1, NULL }};			\
-		ftrace_print_flags_seq(p, delim, flag, flags);		\
+		ftrace_print_flags_seq(p, delim, flag, __flags);	\
 	})
 
 #undef __print_symbolic
-- 
1.6.3.3

-- 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/6] tracing: fix F_printk() typos
  2009-09-14 16:33 [PATCH 0/6] [GIT PULL] tracing: various fixes Steven Rostedt
  2009-09-14 16:33 ` [PATCH 1/6] tracing: add static to generated TRACE_EVENT functions Steven Rostedt
  2009-09-14 16:33 ` [PATCH 2/6] tracing: have TRACE_EVENT macro use __flags to not shadow parameter Steven Rostedt
@ 2009-09-14 16:33 ` Steven Rostedt
  2009-09-14 16:33 ` [PATCH 4/6] ftrace: add compile-time check on F_printk() Steven Rostedt
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2009-09-14 16:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Li Zefan

[-- Attachment #1: 0003-tracing-fix-F_printk-typos.patch --]
[-- Type: text/plain, Size: 2731 bytes --]

From: Li Zefan <lizf@cn.fujitsu.com>

I found some typos in F_printk(), so I wrote compile-time check
for it, and triggered some compile errors and warnings.

I've fixed them on x86_32, but I have no x86_64 in my hand, so there
may still be some compile warnings on 64bits.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4AADF60B.5070407@cn.fujitsu.com>

[ tested on x86_64, and works fine ]

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_entries.h |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/kernel/trace/trace_entries.h b/kernel/trace/trace_entries.h
index c866d34..0c10095 100644
--- a/kernel/trace/trace_entries.h
+++ b/kernel/trace/trace_entries.h
@@ -78,7 +78,7 @@ FTRACE_ENTRY(funcgraph_entry, ftrace_graph_ent_entry,
 		__field_desc(	int,		graph_ent,	depth		)
 	),
 
-	F_printk("--> %lx (%d)", __entry->graph_ent.func, __entry->depth)
+	F_printk("--> %lx (%d)", __entry->func, __entry->depth)
 );
 
 /* Function return entry */
@@ -97,8 +97,8 @@ FTRACE_ENTRY(funcgraph_exit, ftrace_graph_ret_entry,
 
 	F_printk("<-- %lx (%d) (start: %llx  end: %llx) over: %d",
 		 __entry->func, __entry->depth,
-		 __entry->calltime, __entry->rettim,
-		 __entrty->depth)
+		 __entry->calltime, __entry->rettime,
+		 __entry->depth)
 );
 
 /*
@@ -133,7 +133,7 @@ FTRACE_ENTRY(context_switch, ctx_switch_entry,
 		FTRACE_CTX_FIELDS
 	),
 
-	F_printk(b"%u:%u:%u  ==> %u:%u:%u [%03u]",
+	F_printk("%u:%u:%u  ==> %u:%u:%u [%03u]",
 		 __entry->prev_pid, __entry->prev_prio, __entry->prev_state,
 		 __entry->next_pid, __entry->next_prio, __entry->next_state,
 		 __entry->next_cpu
@@ -257,8 +257,8 @@ FTRACE_ENTRY(mmiotrace_rw, trace_mmiotrace_rw,
 		__field_desc(	unsigned char,	rw,	width	)
 	),
 
-	F_printk("%lx %lx %lx %d %lx %lx",
-		 __entry->phs, __entry->value, __entry->pc,
+	F_printk("%lx %lx %lx %d %x %x",
+		 (unsigned long)__entry->phys, __entry->value, __entry->pc,
 		 __entry->map_id, __entry->opcode, __entry->width)
 );
 
@@ -275,8 +275,8 @@ FTRACE_ENTRY(mmiotrace_map, trace_mmiotrace_map,
 		__field_desc(	unsigned char,	map,	opcode	)
 	),
 
-	F_printk("%lx %lx %lx %d %lx",
-		 __entry->phs, __entry->virt, __entry->len,
+	F_printk("%lx %lx %lx %d %x",
+		 (unsigned long)__entry->phys, __entry->virt, __entry->len,
 		 __entry->map_id, __entry->opcode)
 );
 
@@ -370,7 +370,7 @@ FTRACE_ENTRY(kmem_alloc, kmemtrace_alloc_entry,
 		__field(	int,			node		)
 	),
 
-	F_printk("type:%u call_site:%lx ptr:%p req:%lu alloc:%lu"
+	F_printk("type:%u call_site:%lx ptr:%p req:%zi alloc:%zi"
 		 " flags:%x node:%d",
 		 __entry->type_id, __entry->call_site, __entry->ptr,
 		 __entry->bytes_req, __entry->bytes_alloc,
-- 
1.6.3.3

-- 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 4/6] ftrace: add compile-time check on F_printk()
  2009-09-14 16:33 [PATCH 0/6] [GIT PULL] tracing: various fixes Steven Rostedt
                   ` (2 preceding siblings ...)
  2009-09-14 16:33 ` [PATCH 3/6] tracing: fix F_printk() typos Steven Rostedt
@ 2009-09-14 16:33 ` Steven Rostedt
  2009-09-14 16:34 ` [PATCH 5/6] tracing: remove some unused macros Steven Rostedt
  2009-09-14 16:34 ` [PATCH 6/6] tracing: make testing syscall events a separate configuration Steven Rostedt
  5 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2009-09-14 16:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Li Zefan

[-- Attachment #1: 0004-ftrace-add-compile-time-check-on-F_printk.patch --]
[-- Type: text/plain, Size: 2177 bytes --]

From: Li Zefan <lizf@cn.fujitsu.com>

Make sure F_printk() has corrent format and args, and make sure
changes in F_STRUCT() won't break F_printk().

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4AADF6CC.1060809@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_export.c |   45 +++++++++++++++++++++++++++++++++++++++---
 1 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
index 4cb29d8..2435d55 100644
--- a/kernel/trace/trace_export.c
+++ b/kernel/trace/trace_export.c
@@ -23,6 +23,47 @@
 #define __field_struct(type, item)
 
 #undef __field
+#define __field(type, item)				type item;
+
+#undef __field_desc
+#define __field_desc(type, container, item)		type item;
+
+#undef __array
+#define __array(type, item, size)			type item[size];
+
+#undef __array_desc
+#define __array_desc(type, container, item, size)	type item[size];
+
+#undef __dynamic_array
+#define __dynamic_array(type, item)			type item[];
+
+#undef F_STRUCT
+#define F_STRUCT(args...)				args
+
+#undef F_printk
+#define F_printk(fmt, args...) fmt, args
+
+#undef FTRACE_ENTRY
+#define FTRACE_ENTRY(name, struct_name, id, tstruct, print)	\
+struct ____ftrace_##name {					\
+	tstruct							\
+};								\
+static void __used ____ftrace_check_##name(void)		\
+{								\
+	struct ____ftrace_##name *__entry = NULL;		\
+								\
+	/* force cmpile-time check on F_printk() */		\
+	printk(print);						\
+}
+
+#undef FTRACE_ENTRY_DUP
+#define FTRACE_ENTRY_DUP(name, struct_name, id, tstruct, print)	\
+	FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print))
+
+#include "trace_entries.h"
+
+
+#undef __field
 #define __field(type, item)						\
 	ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t"	\
 			       "offset:%zu;\tsize:%zu;\n",		\
@@ -88,10 +129,6 @@ ftrace_format_##name(struct ftrace_event_call *unused,			\
 	return ret;							\
 }
 
-#undef FTRACE_ENTRY_DUP
-#define FTRACE_ENTRY_DUP(name, struct_name, id, tstruct, print)	\
-	FTRACE_ENTRY(name, struct_name, id, PARAMS(tstruct), PARAMS(print))
-
 #include "trace_entries.h"
 
 
-- 
1.6.3.3

-- 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 5/6] tracing: remove some unused macros
  2009-09-14 16:33 [PATCH 0/6] [GIT PULL] tracing: various fixes Steven Rostedt
                   ` (3 preceding siblings ...)
  2009-09-14 16:33 ` [PATCH 4/6] ftrace: add compile-time check on F_printk() Steven Rostedt
@ 2009-09-14 16:34 ` Steven Rostedt
  2009-09-14 16:34 ` [PATCH 6/6] tracing: make testing syscall events a separate configuration Steven Rostedt
  5 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2009-09-14 16:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Li Zefan

[-- Attachment #1: 0005-tracing-remove-some-unused-macros.patch --]
[-- Type: text/plain, Size: 1932 bytes --]

From: Li Zefan <lizf@cn.fujitsu.com>

- remove FTRACE_ENTRY_STRUCT_ONLY()
- remove TRACE_XXX() macros

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4AADF6E6.3080606@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace_entries.h |    9 ---------
 kernel/trace/trace_export.c  |   26 --------------------------
 2 files changed, 0 insertions(+), 35 deletions(-)

diff --git a/kernel/trace/trace_entries.h b/kernel/trace/trace_entries.h
index 0c10095..a431748 100644
--- a/kernel/trace/trace_entries.h
+++ b/kernel/trace/trace_entries.h
@@ -116,15 +116,6 @@ FTRACE_ENTRY(funcgraph_exit, ftrace_graph_ret_entry,
 	__field(	unsigned char,	next_state	)	\
 	__field(	unsigned int,	next_cpu	)
 
-#if 0
-FTRACE_ENTRY_STRUCT_ONLY(ctx_switch_entry,
-
-	F_STRUCT(
-		FTRACE_CTX_FIELDS
-	)
-);
-#endif
-
 FTRACE_ENTRY(context_switch, ctx_switch_entry,
 
 	TRACE_CTX,
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
index 2435d55..9753fcc 100644
--- a/kernel/trace/trace_export.c
+++ b/kernel/trace/trace_export.c
@@ -209,32 +209,6 @@ ftrace_define_fields_##name(struct ftrace_event_call *event_call)	\
 #undef __dynamic_array
 #define __dynamic_array(type, item)
 
-
-#undef TRACE_ZERO_CHAR
-#define TRACE_ZERO_CHAR(arg)
-
-#undef TRACE_FIELD
-#define TRACE_FIELD(type, item, assign)\
-	entry->item = assign;
-
-#undef TRACE_FIELD
-#define TRACE_FIELD(type, item, assign)\
-	entry->item = assign;
-
-#undef TRACE_FIELD_SIGN
-#define TRACE_FIELD_SIGN(type, item, assign, is_signed)	\
-	TRACE_FIELD(type, item, assign)
-
-#undef TP_CMD
-#define TP_CMD(cmd...)	cmd
-
-#undef TRACE_ENTRY
-#define TRACE_ENTRY	entry
-
-#undef TRACE_FIELD_SPECIAL
-#define TRACE_FIELD_SPECIAL(type_item, item, len, cmd)	\
-	cmd;
-
 #undef FTRACE_ENTRY
 #define FTRACE_ENTRY(call, struct_name, type, tstruct, print)		\
 static int ftrace_raw_init_event_##call(void);				\
-- 
1.6.3.3

-- 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 6/6] tracing: make testing syscall events a separate configuration
  2009-09-14 16:33 [PATCH 0/6] [GIT PULL] tracing: various fixes Steven Rostedt
                   ` (4 preceding siblings ...)
  2009-09-14 16:34 ` [PATCH 5/6] tracing: remove some unused macros Steven Rostedt
@ 2009-09-14 16:34 ` Steven Rostedt
  5 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2009-09-14 16:34 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Parag Warudkar

[-- Attachment #1: 0006-tracing-make-testing-syscall-events-a-separate-confi.patch --]
[-- Type: text/plain, Size: 2697 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

Parag noticed that the number of event tests has increased tremendously:

grep "Testing event" dmesg.31rc9 |wc -l
100

grep "Testing event" dmesg.31git |wc -l
1172

This is due to the testing of every syscall event when ftrace self
test is enabled. This adds a bit more time to kernel boot up and can
affect development by slowing down the time it takes between reboots.

This option makes the testing of the syscall events into a separate
config, to still be able to test most of ftrace internals at boot up
but not have to wait for all the syscall events to be tested.

The syscall event testing only tests the enabling and disabling of
the trace point, since the syscalls are not executed. What really needs
to be done is to somehow have a userspace tool test the syscall tracepoints
as well.

Reported-by: Parag Warudkar <parag.lkml@gmail.com>
LKML-Reference: <f7848160909130815l3e768a30n3b28808bbe5c254b@mail.gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/Kconfig        |   12 ++++++++++++
 kernel/trace/trace_events.c |   12 ++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 1ea0d12..aa002ce 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -469,6 +469,18 @@ config FTRACE_STARTUP_TEST
 	  functioning properly. It will do tests on all the configured
 	  tracers of ftrace.
 
+config EVENT_TRACE_TEST_SYSCALLS
+	bool "Run selftest on syscall events"
+	depends on FTRACE_STARTUP_TEST
+	help
+	 This option will also enable testing every syscall event.
+	 It only enables the event and disables it and runs various loads
+	 with the event enabled. This adds a bit more time for kernel boot
+	 up since it runs this on every system call defined.
+
+	 TBD - enable a way to actually call the syscalls as we test their
+	       events
+
 config MMIOTRACE
 	bool "Memory mapped IO tracing"
 	depends on HAVE_MMIOTRACE_SUPPORT && PCI
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 0fa8f9f..787f0fb 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -1326,6 +1326,18 @@ static __init void event_trace_self_tests(void)
 		if (!call->regfunc)
 			continue;
 
+/*
+ * Testing syscall events here is pretty useless, but
+ * we still do it if configured. But this is time consuming.
+ * What we really need is a user thread to perform the
+ * syscalls as we test.
+ */
+#ifndef CONFIG_EVENT_TRACE_TEST_SYSCALLS
+		if (call->system &&
+		    strcmp(call->system, "syscalls") == 0)
+			continue;
+#endif
+
 		pr_info("Testing event %s: ", call->name);
 
 		/*
-- 
1.6.3.3

-- 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-09-14 16:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-14 16:33 [PATCH 0/6] [GIT PULL] tracing: various fixes Steven Rostedt
2009-09-14 16:33 ` [PATCH 1/6] tracing: add static to generated TRACE_EVENT functions Steven Rostedt
2009-09-14 16:33 ` [PATCH 2/6] tracing: have TRACE_EVENT macro use __flags to not shadow parameter Steven Rostedt
2009-09-14 16:33 ` [PATCH 3/6] tracing: fix F_printk() typos Steven Rostedt
2009-09-14 16:33 ` [PATCH 4/6] ftrace: add compile-time check on F_printk() Steven Rostedt
2009-09-14 16:34 ` [PATCH 5/6] tracing: remove some unused macros Steven Rostedt
2009-09-14 16:34 ` [PATCH 6/6] tracing: make testing syscall events a separate configuration Steven Rostedt

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®