[2.6.38] tracing: updates and fixes
Subsystems (3)
Steven Rostedt
maintainerIngo,
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(-)
Steven Rostedt
maintainerPATCH 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
@@ -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
Steven Rostedt
maintainerPATCH 2/7 tracing/trivial: Add missing comma in TRACE_EVENT comment
In reply to Steven RostedtFrom: Mathieu Desnoyers <[email protected]>
Add missing comma within the TRACE_EVENT() example in tracepoint.h.
LKML-Reference: <20110106184532.GA2526@Krystal>
--- include/linux/tracepoint.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/tracepoint.h +1 -1
@@ -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
Steven Rostedt
maintainerPATCH 3/7 tracing: remove duplicate null-pointer check in skb tracepoint
In reply to Steven RostedtFrom: 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
@@ -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
Steven Rostedt
maintainerPATCH 4/7 tracepoint: Add __rcu annotation
In reply to Steven RostedtFrom: 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
@@ -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
Steven Rostedt
maintainerPATCH 5/7 tracing: Fix preempt count leak
In reply to Steven RostedtFrom: 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
@@ -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
Steven Rostedt
maintainerPATCH 6/7 tracing: Fix TRACE_EVENT power tracepoint creation
In reply to Steven RostedtFrom: 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
@@ -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
@@ -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
Steven Rostedt
maintainerPATCH 7/7 dynamic debug: Fix build issue with older gcc
In reply to Steven RostedtFrom: 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
@@ -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
@@ -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