Skip to contentSkip to conversation

[2.6.38] tracing: updates and fixes

GIT PULL New Steven Rostedt 1 participant 8 messages Jan 8, 2011

Subsystems (3)
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

Ingo,

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

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

Jason Baron (1):
dynamic debug: Fix build issue with older gcc

Lai Jiangshan (1):
tracepoint: Add __rcu annotation

Li Zefan (1):
tracing: Fix preempt count leak

Mathieu Desnoyers (3):
tracing/trivial: Add missing comma in TRACE_EVENT comment
tracing: remove duplicate null-pointer check in skb tracepoint
tracing: Fix TRACE_EVENT power tracepoint creation

Steven Rostedt (1):
tracing: Include module.h in define_trace.h

----

 include/linux/dynamic_debug.h |   18 ++++--------------
 include/linux/tracepoint.h    |    4 ++--
 include/trace/define_trace.h  |   10 ++++++++++
 include/trace/events/skb.h    |    4 +---
 kernel/Makefile               |    1 +
 kernel/trace/Makefile         |    2 +-
 kernel/trace/trace.c          |    6 ++----
 lib/dynamic_debug.c           |    9 ++++-----
 8 files changed, 25 insertions(+), 29 deletions(-)
author maintainer
#1 lore raw

PATCH 1/7 tracing: Include module.h in define_trace.h

From: Steven Rostedt <[email protected]>

While doing some developing, Peter Zijlstra and I have found that if a CREATE_TRACE_POINTS include is done before module.h is included, it can break the build.

We have been lucky so far that this has not broke the build since module.h is included in almost everything.

---
 include/trace/define_trace.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
include/trace/define_trace.h +10 -0
index b0b4eb2..da39b22 100644
@@ -21,6 +21,16 @@
 #undef CREATE_TRACE_POINTS
 
 #include <linux/stringify.h>
+/*
+ * module.h includes tracepoints, and because ftrace.h
+ * pulls in module.h:
+ *  trace/ftrace.h -> linux/ftrace_event.h -> linux/perf_event.h ->
+ *  linux/ftrace.h -> linux/module.h
+ * we must include module.h here before we play with any of
+ * the TRACE_EVENT() macros, otherwise the tracepoints included
+ * by module.h may break the build.
+ */
+#include <linux/module.h>
 
 #undef TRACE_EVENT
 #define TRACE_EVENT(name, proto, args, tstruct, assign, print)	\
Signature · 1 line
1.7.2.3
author maintainer
#6 lore raw

PATCH 6/7 tracing: Fix TRACE_EVENT power tracepoint creation

In reply to Steven Rostedt

From: Mathieu Desnoyers <[email protected]>

DEFINE_TRACE should also exist when CONFIG_EVENT_TRACING=n. Otherwise, setting only TRACEPOINTS=y is broken.

LKML-Reference: <20101028153117.GA4051@Krystal>

---
 kernel/Makefile       |    1 +
 kernel/trace/Makefile |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)
kernel/Makefile +1 -0
index 0b5ff08..e0f2831 100644
@@ -100,6 +100,7 @@ obj-$(CONFIG_FUNCTION_TRACER) += trace/
 obj-$(CONFIG_TRACING) += trace/
 obj-$(CONFIG_X86_DS) += trace/
 obj-$(CONFIG_RING_BUFFER) += trace/
+obj-$(CONFIG_TRACEPOINTS) += trace/
 obj-$(CONFIG_SMP) += sched_cpupri.o
 obj-$(CONFIG_IRQ_WORK) += irq_work.o
 obj-$(CONFIG_PERF_EVENTS) += perf_event.o
kernel/trace/Makefile +1 -1
index 53f3381..761c510 100644
@@ -52,7 +52,7 @@ obj-$(CONFIG_EVENT_TRACING) += trace_event_perf.o
 endif
 obj-$(CONFIG_EVENT_TRACING) += trace_events_filter.o
 obj-$(CONFIG_KPROBE_EVENT) += trace_kprobe.o
-obj-$(CONFIG_EVENT_TRACING) += power-traces.o
+obj-$(CONFIG_TRACEPOINTS) += power-traces.o
 ifeq ($(CONFIG_TRACING),y)
 obj-$(CONFIG_KGDB_KDB) += trace_kdb.o
 endif
Signature · 1 line
1.7.2.3
author maintainer
#4 lore raw

PATCH 4/7 tracepoint: Add __rcu annotation

In reply to Steven Rostedt

From: Lai Jiangshan <[email protected]>

Add __rcu annotation to :

	(struct tracepoint)->funcs

LKML-Reference: <[email protected]>

---
 include/linux/tracepoint.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/tracepoint.h +1 -1
index 899103c..c681461 100644
@@ -32,7 +32,7 @@ struct tracepoint {
 	int state;			/* State. */
 	void (*regfunc)(void);
 	void (*unregfunc)(void);
-	struct tracepoint_func *funcs;
+	struct tracepoint_func __rcu *funcs;
 } __attribute__((aligned(32)));		/*
 					 * Aligned on 32 bytes because it is
 					 * globally visible and gcc happily
Signature · 1 line
1.7.2.3
author maintainer
#3 lore raw

PATCH 3/7 tracing: remove duplicate null-pointer check in skb tracepoint

In reply to Steven Rostedt

From: Mathieu Desnoyers <[email protected]>

The check for NULL skb in the kfree_skb trace event is a duplicate from the check already done in its only caller, kfree_skb(). Remove this duplicate check.

LKML-Reference: <20110106175319.GA30610@Krystal>

---
 include/trace/events/skb.h |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
include/trace/events/skb.h +1 -3
index 75ce9d5..f10293c 100644
@@ -25,9 +25,7 @@ TRACE_EVENT(kfree_skb,
 
 	TP_fast_assign(
 		__entry->skbaddr = skb;
-		if (skb) {
-			__entry->protocol = ntohs(skb->protocol);
-		}
+		__entry->protocol = ntohs(skb->protocol);
 		__entry->location = location;
 	),
 
Signature · 1 line
1.7.2.3
author maintainer
#7 lore raw

PATCH 7/7 dynamic debug: Fix build issue with older gcc

In reply to Steven Rostedt

From: Jason Baron <[email protected]>

On older gcc (3.3) dynamic debug fails to compile:

include/net/inet_connection_sock.h: In function `inet_csk_reset_xmit_timer':
include/net/inet_connection_sock.h:236: error: duplicate label declaration do_printk' include/net/inet_connection_sock.h:219: error: this is a previous declaration include/net/inet_connection_sock.h:236: error: duplicate label declaration out' include/net/inet_connection_sock.h:219: error: this is a previous declaration include/net/inet_connection_sock.h:236: error: duplicate label do_printk' include/net/inet_connection_sock.h:236: error: duplicate label out'

Fix, by reverting the usage of JUMP_LABEL() in dynamic debug for now.

---
 include/linux/dynamic_debug.h |   18 ++++--------------
 lib/dynamic_debug.c           |    9 ++++-----
 2 files changed, 8 insertions(+), 19 deletions(-)
include/linux/dynamic_debug.h +4 -14
index a90b389..1c70028 100644
@@ -44,34 +44,24 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
 extern int ddebug_remove_module(const char *mod_name);
 
 #define dynamic_pr_debug(fmt, ...) do {					\
-	__label__ do_printk;						\
-	__label__ out;							\
 	static struct _ddebug descriptor				\
 	__used								\
 	__attribute__((section("__verbose"), aligned(8))) =		\
 	{ KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__,		\
 		_DPRINTK_FLAGS_DEFAULT };				\
-	JUMP_LABEL(&descriptor.enabled, do_printk);			\
-	goto out;							\
-do_printk:								\
-	printk(KERN_DEBUG pr_fmt(fmt),	##__VA_ARGS__);			\
-out:	;								\
+	if (unlikely(descriptor.enabled))				\
+		printk(KERN_DEBUG pr_fmt(fmt),	##__VA_ARGS__);		\
 	} while (0)
 
 
 #define dynamic_dev_dbg(dev, fmt, ...) do {				\
-	__label__ do_printk;						\
-	__label__ out;							\
 	static struct _ddebug descriptor				\
 	__used								\
 	__attribute__((section("__verbose"), aligned(8))) =		\
 	{ KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__,		\
 		_DPRINTK_FLAGS_DEFAULT };				\
-	JUMP_LABEL(&descriptor.enabled, do_printk);			\
-	goto out;							\
-do_printk:								\
-	dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__);		\
-out:	;								\
+	if (unlikely(descriptor.enabled))				\
+		dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__);	\
 	} while (0)
 
 #else
lib/dynamic_debug.c +4 -5
index 3094318..b335acb 100644
@@ -141,11 +141,10 @@ static void ddebug_change(const struct ddebug_query *query,
 			else if (!dp->flags)
 				dt->num_enabled++;
 			dp->flags = newflags;
-			if (newflags) {
-				jump_label_enable(&dp->enabled);
-			} else {
-				jump_label_disable(&dp->enabled);
-			}
+			if (newflags)
+				dp->enabled = 1;
+			else
+				dp->enabled = 0;
 			if (verbose)
 				printk(KERN_INFO
 					"ddebug: changed %s:%d [%s]%s %s\n",
Signature · 1 line
1.7.2.3
author maintainer
#2 lore raw

PATCH 2/7 tracing/trivial: Add missing comma in TRACE_EVENT comment

In reply to Steven Rostedt

From: Mathieu Desnoyers <[email protected]>

Add missing comma within the TRACE_EVENT() example in tracepoint.h.

LKML-Reference: <20110106184532.GA2526@Krystal>

CC Frederic Weisbecker <[email protected]>
CC Ingo Molnar <[email protected]>
CC Thomas Gleixner <[email protected]>
---
 include/linux/tracepoint.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/tracepoint.h +1 -1
index d3e4f87..899103c 100644
@@ -326,7 +326,7 @@ do_trace:								\
  *		memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
  *		__entry->next_pid	= next->pid;
  *		__entry->next_prio	= next->prio;
- *	)
+ *	),
  *
  *	*
  *	* Formatted output of a trace record via TP_printk().
Signature · 1 line
1.7.2.3
author maintainer
#5 lore raw

PATCH 5/7 tracing: Fix preempt count leak

In reply to Steven Rostedt

From: Li Zefan <[email protected]>

While running my ftrace stress test, this showed up:

BUG: sleeping function called from invalid context at mm/mmap.c:233

...
note: cat[3293] exited with preempt_count 1

The bug was introduced by commit 91e86e560d0b3ce4c5fc64fd2bbb99f856a30a4e ("tracing: Fix recursive user stack trace")

LKML-Reference: <[email protected]>

---
 kernel/trace/trace.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
kernel/trace/trace.c +2 -4
index f8cf959..dc53ecb 100644
@@ -1313,12 +1313,10 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
 
 	__this_cpu_inc(user_stack_count);
 
-
-
 	event = trace_buffer_lock_reserve(buffer, TRACE_USER_STACK,
 					  sizeof(*entry), flags, pc);
 	if (!event)
-		return;
+		goto out_drop_count;
 	entry	= ring_buffer_event_data(event);
 
 	entry->tgid		= current->tgid;
@@ -1333,8 +1331,8 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
 	if (!filter_check_discard(call, entry, buffer, event))
 		ring_buffer_unlock_commit(buffer, event);
 
+ out_drop_count:
 	__this_cpu_dec(user_stack_count);
-
  out:
 	preempt_enable();
 }
Signature · 1 line
1.7.2.3