* [PATCH 0/5] tracing/core: various fixes
@ 2009-05-26 2:04 Frederic Weisbecker
2009-05-26 2:04 ` [PATCH 1/5] tracing: add trace_event_read_lock() Frederic Weisbecker
` (6 more replies)
0 siblings, 7 replies; 12+ messages in thread
From: Frederic Weisbecker @ 2009-05-26 2:04 UTC (permalink / raw)
To: Ingo Molnar
Cc: LKML, Frederic Weisbecker, Lai Jiangshan, Steven Rostedt,
Li Zefan, Pekka Enberg, Zhaolei, Tom Zanussi
Hi Ingo, Steven,
I've gathered various tracing fixes that were posted recently.
Note: the commit b11c53e12f94a46b50bccc7a1a953d7ca1d54a31
(ftrace: Add task_comm support for trace_event)
looks good to me. This v3 solves the two following unhandled
dependencies in v1:
ENABLE_EVENT_TRACING -> CONTEXT_SWITCH_TRACER
EVENT_TRACING -> CONTEXT_SWITCH_TRACER
The latter is tricky because CONTEXT_SWITCH_TRACER depends
on CONFIG_FTRACE (the tracers menu) from which EVENT_TRACING
is excluded. A build error can then occur if something selects
CONFIG_TRACING elsewhere.
The fix written by Zhaolei follows the {ENABLE_}EVENT_TRACING
view: we now have CONTEXT_SWITCH_TRACER and ENABLE_CONTEXT_SWITCH_TRACER.
The former is used by EVENT_TRACING to record cmdlines.
The latter selects CONTEXT_SWITCH_TRACER plus CONFIG_TRACING.
To sum up, ENABLE_CONTEXT_SWITCH_TRACER acts only as a "relay".
It looks good to me, tell me and Zhaolei if you have doubts
about it.
Thanks.
The following changes since commit 5537937696c55530447c20aa27daccb8d0d29b33:
Ming Lei (1):
ftrace: fix check for return value of register_module_notifier in event_trace_init
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
tracing/core
Lai Jiangshan (1):
tracing: add trace_event_read_lock()
Li Zefan (1):
tracing/events: change the type of __str_loc_item to unsigned short
Pekka Enberg (1):
kmemtrace: fix kernel parameter documentation
Zhaolei (2):
ftrace: Add task_comm support for trace_event
ftrace: clean up of using ftrace_event_enable_disable()
Documentation/kernel-parameters.txt | 10 --------
include/trace/ftrace.h | 2 +-
kernel/trace/Kconfig | 9 +++++-
kernel/trace/trace.c | 8 ++++++
kernel/trace/trace_events.c | 42 +++++++++++++---------------------
kernel/trace/trace_output.c | 25 +++++++++++++++-----
kernel/trace/trace_output.h | 2 +
7 files changed, 52 insertions(+), 46 deletions(-)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/5] tracing: add trace_event_read_lock()
2009-05-26 2:04 [PATCH 0/5] tracing/core: various fixes Frederic Weisbecker
@ 2009-05-26 2:04 ` Frederic Weisbecker
2009-05-26 2:04 ` [PATCH 2/5] tracing/events: change the type of __str_loc_item to unsigned short Frederic Weisbecker
` (5 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Frederic Weisbecker @ 2009-05-26 2:04 UTC (permalink / raw)
To: Ingo Molnar
Cc: LKML, Lai Jiangshan, Steven Rostedt, Li Zefan, Pekka Enberg,
Zhaolei, Tom Zanussi, Frederic Weisbecker
From: Lai Jiangshan <laijs@cn.fujitsu.com>
I found that there is nothing to protect event_hash in
ftrace_find_event(). Rcu protects the event hashlist
but not the event itself while we use it after its extraction
through ftrace_find_event().
This lack of a proper locking in this spot opens a race
window between any event dereferencing and module removal.
Eg:
--Task A--
print_trace_line(trace) {
event = find_ftrace_event(trace)
--Task B--
trace_module_remove_events(mod) {
list_trace_events_module(ev, mod) {
unregister_ftrace_event(ev->event) {
hlist_del(ev->event->node)
list_del(....)
}
}
}
|--> module removed, the event has been dropped
--Task A--
event->print(trace); // Dereferencing freed memory
If the event retrieved belongs to a module and this module
is concurrently removed, we may end up dereferencing a data
from a freed module.
RCU could solve this, but it would add latency to the kernel and
forbid tracers output callbacks to call any sleepable code.
So this fix converts 'trace_event_mutex' to a read/write semaphore,
and adds trace_event_read_lock() to protect ftrace_find_event().
[ Impact: fix possible freed memory dereference in ftrace ]
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <4A114806.7090302@cn.fujitsu.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
kernel/trace/trace.c | 8 ++++++++
kernel/trace/trace_output.c | 25 ++++++++++++++++++-------
kernel/trace/trace_output.h | 2 ++
3 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index dd40d23..02d32ba 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1569,12 +1569,14 @@ static void *s_start(struct seq_file *m, loff_t *pos)
p = s_next(m, p, &l);
}
+ trace_event_read_lock();
return p;
}
static void s_stop(struct seq_file *m, void *p)
{
atomic_dec(&trace_record_cmdline_disabled);
+ trace_event_read_unlock();
}
static void print_lat_help_header(struct seq_file *m)
@@ -1817,6 +1819,7 @@ static int trace_empty(struct trace_iterator *iter)
return 1;
}
+/* Called with trace_event_read_lock() held. */
static enum print_line_t print_trace_line(struct trace_iterator *iter)
{
enum print_line_t ret;
@@ -3008,6 +3011,7 @@ waitagain:
offsetof(struct trace_iterator, seq));
iter->pos = -1;
+ trace_event_read_lock();
while (find_next_entry_inc(iter) != NULL) {
enum print_line_t ret;
int len = iter->seq.len;
@@ -3024,6 +3028,7 @@ waitagain:
if (iter->seq.len >= cnt)
break;
}
+ trace_event_read_unlock();
/* Now copy what we have to the user */
sret = trace_seq_to_user(&iter->seq, ubuf, cnt);
@@ -3146,6 +3151,8 @@ static ssize_t tracing_splice_read_pipe(struct file *filp,
goto out_err;
}
+ trace_event_read_lock();
+
/* Fill as many pages as possible. */
for (i = 0, rem = len; i < PIPE_BUFFERS && rem; i++) {
pages[i] = alloc_page(GFP_KERNEL);
@@ -3168,6 +3175,7 @@ static ssize_t tracing_splice_read_pipe(struct file *filp,
trace_seq_init(&iter->seq);
}
+ trace_event_read_unlock();
mutex_unlock(&iter->mutex);
spd.nr_pages = i;
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index 489c0e8..7136420 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -14,7 +14,7 @@
/* must be a power of 2 */
#define EVENT_HASHSIZE 128
-static DEFINE_MUTEX(trace_event_mutex);
+static DECLARE_RWSEM(trace_event_mutex);
static struct hlist_head event_hash[EVENT_HASHSIZE] __read_mostly;
static int next_event_type = __TRACE_LAST_TYPE + 1;
@@ -466,6 +466,7 @@ static int task_state_char(unsigned long state)
* @type: the type of event to look for
*
* Returns an event of type @type otherwise NULL
+ * Called with trace_event_read_lock() held.
*/
struct trace_event *ftrace_find_event(int type)
{
@@ -475,7 +476,7 @@ struct trace_event *ftrace_find_event(int type)
key = type & (EVENT_HASHSIZE - 1);
- hlist_for_each_entry_rcu(event, n, &event_hash[key], node) {
+ hlist_for_each_entry(event, n, &event_hash[key], node) {
if (event->type == type)
return event;
}
@@ -513,6 +514,16 @@ static int trace_search_list(struct list_head **list)
return last + 1;
}
+void trace_event_read_lock(void)
+{
+ down_read(&trace_event_mutex);
+}
+
+void trace_event_read_unlock(void)
+{
+ up_read(&trace_event_mutex);
+}
+
/**
* register_ftrace_event - register output for an event type
* @event: the event type to register
@@ -533,7 +544,7 @@ int register_ftrace_event(struct trace_event *event)
unsigned key;
int ret = 0;
- mutex_lock(&trace_event_mutex);
+ down_write(&trace_event_mutex);
if (WARN_ON(!event))
goto out;
@@ -581,11 +592,11 @@ int register_ftrace_event(struct trace_event *event)
key = event->type & (EVENT_HASHSIZE - 1);
- hlist_add_head_rcu(&event->node, &event_hash[key]);
+ hlist_add_head(&event->node, &event_hash[key]);
ret = event->type;
out:
- mutex_unlock(&trace_event_mutex);
+ up_write(&trace_event_mutex);
return ret;
}
@@ -597,10 +608,10 @@ EXPORT_SYMBOL_GPL(register_ftrace_event);
*/
int unregister_ftrace_event(struct trace_event *event)
{
- mutex_lock(&trace_event_mutex);
+ down_write(&trace_event_mutex);
hlist_del(&event->node);
list_del(&event->list);
- mutex_unlock(&trace_event_mutex);
+ up_write(&trace_event_mutex);
return 0;
}
diff --git a/kernel/trace/trace_output.h b/kernel/trace/trace_output.h
index 6e220a8..ac240e7 100644
--- a/kernel/trace/trace_output.h
+++ b/kernel/trace/trace_output.h
@@ -20,6 +20,8 @@ extern int seq_print_user_ip(struct trace_seq *s, struct mm_struct *mm,
extern int trace_print_context(struct trace_iterator *iter);
extern int trace_print_lat_context(struct trace_iterator *iter);
+extern void trace_event_read_lock(void);
+extern void trace_event_read_unlock(void);
extern struct trace_event *ftrace_find_event(int type);
extern enum print_line_t trace_nop_print(struct trace_iterator *iter,
--
1.6.2.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/5] tracing/events: change the type of __str_loc_item to unsigned short
2009-05-26 2:04 [PATCH 0/5] tracing/core: various fixes Frederic Weisbecker
2009-05-26 2:04 ` [PATCH 1/5] tracing: add trace_event_read_lock() Frederic Weisbecker
@ 2009-05-26 2:04 ` Frederic Weisbecker
2009-05-26 2:04 ` [PATCH 3/5] kmemtrace: fix kernel parameter documentation Frederic Weisbecker
` (4 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Frederic Weisbecker @ 2009-05-26 2:04 UTC (permalink / raw)
To: Ingo Molnar
Cc: LKML, Li Zefan, Lai Jiangshan, Steven Rostedt, Pekka Enberg,
Zhaolei, Tom Zanussi, Frederic Weisbecker
From: Li Zefan <lizf@cn.fujitsu.com>
When defining a dynamic size string, we add __str_loc_##item to the
trace entry, and it stores the location of the actual string in
entry->_str_data[]
'unsigned short' should be sufficient to store this information, thus
we save 2 bytes per dyn-size string in the ring buffer.
[ Impact: reduce memory occupied by dyn-size strings in ring buffer ]
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <4A14EDB6.2050507@cn.fujitsu.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
include/trace/ftrace.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index edb02bc..b5ff2e8 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -25,7 +25,7 @@
#define __field(type, item) type item;
#undef __string
-#define __string(item, src) int __str_loc_##item;
+#define __string(item, src) unsigned short __str_loc_##item;
#undef TP_STRUCT__entry
#define TP_STRUCT__entry(args...) args
--
1.6.2.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/5] kmemtrace: fix kernel parameter documentation
2009-05-26 2:04 [PATCH 0/5] tracing/core: various fixes Frederic Weisbecker
2009-05-26 2:04 ` [PATCH 1/5] tracing: add trace_event_read_lock() Frederic Weisbecker
2009-05-26 2:04 ` [PATCH 2/5] tracing/events: change the type of __str_loc_item to unsigned short Frederic Weisbecker
@ 2009-05-26 2:04 ` Frederic Weisbecker
2009-05-26 2:04 ` [PATCH 4/5] ftrace: Add task_comm support for trace_event Frederic Weisbecker
` (3 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Frederic Weisbecker @ 2009-05-26 2:04 UTC (permalink / raw)
To: Ingo Molnar
Cc: LKML, Pekka Enberg, Lai Jiangshan, Steven Rostedt, Li Zefan,
Zhaolei, Tom Zanussi, Eduard - Gabriel Munteanu,
Frederic Weisbecker
From: Pekka Enberg <penberg@cs.helsinki.fi>
The kmemtrace.enable kernel parameter no longer works. To enable
kmemtrace at boot-time, you must pass "ftrace=kmemtrace" instead.
[ Impact: remove obsolete kernel parameter documentation ]
Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
LKML-Reference: <alpine.DEB.2.00.0905241112190.10296@rocky>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
Documentation/kernel-parameters.txt | 10 ----------
1 files changed, 0 insertions(+), 10 deletions(-)
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index e87bdbf..9243dd8 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -56,7 +56,6 @@ parameter is applicable:
ISAPNP ISA PnP code is enabled.
ISDN Appropriate ISDN support is enabled.
JOY Appropriate joystick support is enabled.
- KMEMTRACE kmemtrace is enabled.
LIBATA Libata driver is enabled
LP Printer support is enabled.
LOOP Loopback device support is enabled.
@@ -1054,15 +1053,6 @@ and is between 256 and 4096 characters. It is defined in the file
use the HighMem zone if it exists, and the Normal
zone if it does not.
- kmemtrace.enable= [KNL,KMEMTRACE] Format: { yes | no }
- Controls whether kmemtrace is enabled
- at boot-time.
-
- kmemtrace.subbufs=n [KNL,KMEMTRACE] Overrides the number of
- subbufs kmemtrace's relay channel has. Set this
- higher than default (KMEMTRACE_N_SUBBUFS in code) if
- you experience buffer overruns.
-
kgdboc= [HW] kgdb over consoles.
Requires a tty driver that supports console polling.
(only serial suported for now)
--
1.6.2.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 4/5] ftrace: Add task_comm support for trace_event
2009-05-26 2:04 [PATCH 0/5] tracing/core: various fixes Frederic Weisbecker
` (2 preceding siblings ...)
2009-05-26 2:04 ` [PATCH 3/5] kmemtrace: fix kernel parameter documentation Frederic Weisbecker
@ 2009-05-26 2:04 ` Frederic Weisbecker
2009-05-26 2:04 ` [PATCH 5/5] ftrace: clean up of using ftrace_event_enable_disable() Frederic Weisbecker
` (2 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Frederic Weisbecker @ 2009-05-26 2:04 UTC (permalink / raw)
To: Ingo Molnar
Cc: LKML, Zhaolei, Lai Jiangshan, Steven Rostedt, Li Zefan,
Pekka Enberg, Tom Zanussi, Frederic Weisbecker
From: Zhaolei <zhaolei@cn.fujitsu.com>
If we enable a trace event alone without any tracer running (such as
function tracer, sched switch tracer, etc...) it can't output enough
task command information.
We need to use the tracing_{start/stop}_cmdline_record() helpers
which are designed to keep track of cmdlines for any tasks that
were scheduled during the tracing.
Before this patch:
# echo 1 > debugfs/tracing/events/sched/sched_switch/enable
# cat debugfs/tracing/trace
# tracer: nop
#
# TASK-PID CPU# TIMESTAMP FUNCTION
# | | | | |
<...>-2289 [000] 526276.724790: sched_switch: task bash:2289 [120] ==> sshd:2287 [120]
<...>-2287 [000] 526276.725231: sched_switch: task sshd:2287 [120] ==> bash:2289 [120]
<...>-2289 [000] 526276.725452: sched_switch: task bash:2289 [120] ==> sshd:2287 [120]
<...>-2287 [000] 526276.727181: sched_switch: task sshd:2287 [120] ==> swapper:0 [140]
<idle>-0 [000] 526277.032734: sched_switch: task swapper:0 [140] ==> events/0:5 [115]
<...>-5 [000] 526277.032782: sched_switch: task events/0:5 [115] ==> swapper:0 [140]
...
After this patch:
# tracer: nop
#
# TASK-PID CPU# TIMESTAMP FUNCTION
# | | | | |
bash-2269 [000] 527347.989229: sched_switch: task bash:2269 [120] ==> sshd:2267 [120]
sshd-2267 [000] 527347.990960: sched_switch: task sshd:2267 [120] ==> bash:2269 [120]
bash-2269 [000] 527347.991143: sched_switch: task bash:2269 [120] ==> sshd:2267 [120]
sshd-2267 [000] 527347.992959: sched_switch: task sshd:2267 [120] ==> swapper:0 [140]
<idle>-0 [000] 527348.531989: sched_switch: task swapper:0 [140] ==> events/0:5 [115]
events/0-5 [000] 527348.532115: sched_switch: task events/0:5 [115] ==> swapper:0 [140]
...
Changelog:
v1->v2: Update Kconfig to select CONTEXT_SWITCH_TRACER in
ENABLE_EVENT_TRACING
v2->v3: v2 can solve problem that was caused by config EVENT_TRACING
alone, but when CONFIG_FTRACE is off and CONFIG_TRACING is
selected by other config, compile fail happened again.
This version solves it.
[ Impact: fix incomplete output of event tracing ]
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <4A14FDFE.2080402@cn.fujitsu.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
kernel/trace/Kconfig | 9 +++++++--
kernel/trace/trace_events.c | 6 ++++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index f61be30..a508b9d 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -49,6 +49,11 @@ config FTRACE_NMI_ENTER
default y
config EVENT_TRACING
+ select CONTEXT_SWITCH_TRACER
+ bool
+
+config CONTEXT_SWITCH_TRACER
+ select MARKERS
bool
config TRACING
@@ -176,10 +181,10 @@ config SCHED_TRACER
This tracer tracks the latency of the highest priority task
to be scheduled in, starting from the point it has woken up.
-config CONTEXT_SWITCH_TRACER
+config ENABLE_CONTEXT_SWITCH_TRACER
bool "Trace process context switches"
select TRACING
- select MARKERS
+ select CONTEXT_SWITCH_TRACER
help
This tracer gets called from the context switch and records
all switching of tasks.
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 9e91c4a..9b246eb 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -85,6 +85,7 @@ static void ftrace_clear_events(void)
if (call->enabled) {
call->enabled = 0;
+ tracing_stop_cmdline_record();
call->unregfunc();
}
}
@@ -99,12 +100,14 @@ static void ftrace_event_enable_disable(struct ftrace_event_call *call,
case 0:
if (call->enabled) {
call->enabled = 0;
+ tracing_stop_cmdline_record();
call->unregfunc();
}
break;
case 1:
if (!call->enabled) {
call->enabled = 1;
+ tracing_start_cmdline_record();
call->regfunc();
}
break;
@@ -1058,6 +1061,7 @@ static void trace_module_remove_events(struct module *mod)
found = true;
if (call->enabled) {
call->enabled = 0;
+ tracing_stop_cmdline_record();
call->unregfunc();
}
if (call->event)
@@ -1262,11 +1266,13 @@ static __init void event_trace_self_tests(void)
}
call->enabled = 1;
+ tracing_start_cmdline_record();
call->regfunc();
event_test_stuff();
call->unregfunc();
+ tracing_stop_cmdline_record();
call->enabled = 0;
pr_cont("OK\n");
--
1.6.2.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 5/5] ftrace: clean up of using ftrace_event_enable_disable()
2009-05-26 2:04 [PATCH 0/5] tracing/core: various fixes Frederic Weisbecker
` (3 preceding siblings ...)
2009-05-26 2:04 ` [PATCH 4/5] ftrace: Add task_comm support for trace_event Frederic Weisbecker
@ 2009-05-26 2:04 ` Frederic Weisbecker
2009-05-26 18:55 ` [GIT PULL v2][PATCH 0/10] tracing/core: various fixes Frederic Weisbecker
2009-05-26 19:46 ` [PATCH 0/5] " Steven Rostedt
6 siblings, 0 replies; 12+ messages in thread
From: Frederic Weisbecker @ 2009-05-26 2:04 UTC (permalink / raw)
To: Ingo Molnar
Cc: LKML, Zhaolei, Lai Jiangshan, Steven Rostedt, Li Zefan,
Pekka Enberg, Tom Zanussi, Frederic Weisbecker
From: Zhaolei <zhaolei@cn.fujitsu.com>
Always use ftrace_event_enable_disable() to enable/disable an event
so that we can factorize out the event toggling code.
[ Impact: factorize and cleanup event tracing code ]
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <4A14FDFE.2080402@cn.fujitsu.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
kernel/trace/trace_events.c | 44 +++++++++++++-----------------------------
1 files changed, 14 insertions(+), 30 deletions(-)
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 9b246eb..6c81f9c 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -76,26 +76,9 @@ static void trace_destroy_fields(struct ftrace_event_call *call)
#endif /* CONFIG_MODULES */
-static void ftrace_clear_events(void)
-{
- struct ftrace_event_call *call;
-
- mutex_lock(&event_mutex);
- list_for_each_entry(call, &ftrace_events, list) {
-
- if (call->enabled) {
- call->enabled = 0;
- tracing_stop_cmdline_record();
- call->unregfunc();
- }
- }
- mutex_unlock(&event_mutex);
-}
-
static void ftrace_event_enable_disable(struct ftrace_event_call *call,
int enable)
{
-
switch (enable) {
case 0:
if (call->enabled) {
@@ -114,6 +97,17 @@ static void ftrace_event_enable_disable(struct ftrace_event_call *call,
}
}
+static void ftrace_clear_events(void)
+{
+ struct ftrace_event_call *call;
+
+ mutex_lock(&event_mutex);
+ list_for_each_entry(call, &ftrace_events, list) {
+ ftrace_event_enable_disable(call, 0);
+ }
+ mutex_unlock(&event_mutex);
+}
+
/*
* __ftrace_set_clr_event(NULL, NULL, NULL, set) will set/unset all events.
*/
@@ -1059,11 +1053,7 @@ static void trace_module_remove_events(struct module *mod)
list_for_each_entry_safe(call, p, &ftrace_events, list) {
if (call->mod == mod) {
found = true;
- if (call->enabled) {
- call->enabled = 0;
- tracing_stop_cmdline_record();
- call->unregfunc();
- }
+ ftrace_event_enable_disable(call, 0);
if (call->event)
unregister_ftrace_event(call->event);
debugfs_remove_recursive(call->dir);
@@ -1265,15 +1255,9 @@ static __init void event_trace_self_tests(void)
continue;
}
- call->enabled = 1;
- tracing_start_cmdline_record();
- call->regfunc();
-
+ ftrace_event_enable_disable(call, 1);
event_test_stuff();
-
- call->unregfunc();
- tracing_stop_cmdline_record();
- call->enabled = 0;
+ ftrace_event_enable_disable(call, 0);
pr_cont("OK\n");
}
--
1.6.2.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [GIT PULL v2][PATCH 0/10] tracing/core: various fixes
2009-05-26 2:04 [PATCH 0/5] tracing/core: various fixes Frederic Weisbecker
` (4 preceding siblings ...)
2009-05-26 2:04 ` [PATCH 5/5] ftrace: clean up of using ftrace_event_enable_disable() Frederic Weisbecker
@ 2009-05-26 18:55 ` Frederic Weisbecker
2009-05-26 21:30 ` Steven Rostedt
2009-05-26 19:46 ` [PATCH 0/5] " Steven Rostedt
6 siblings, 1 reply; 12+ messages in thread
From: Frederic Weisbecker @ 2009-05-26 18:55 UTC (permalink / raw)
To: Ingo Molnar
Cc: LKML, Lai Jiangshan, Steven Rostedt, Li Zefan, Pekka Enberg,
Zhaolei, Tom Zanussi
On Tue, May 26, 2009 at 04:04:45AM +0200, Frederic Weisbecker wrote:
> Hi Ingo, Steven,
>
> I've gathered various tracing fixes that were posted recently.
I based this topic against tracing/core whereas the latest
tracing changes were on tracing/ftrace.
But tracing/ftrace contains the v1 of:
ftrace: Add task_comm support for trace_event
ftrace: clean up of using ftrace_event_enable_disable()
And my pull request contains the v3 of this pair, fixing
some build issue.
As you suggested, I've cherry picked the missing patches
from tracing/ftrace to my tracing/core based tree.
This new pull request then adds 5 Steven's patches that
were on tracing/ftrace.
I'm not posting them because they have been submitted
in LKML already.
Thanks.
The following changes since commit 5537937696c55530447c20aa27daccb8d0d29b33:
Ming Lei (1):
ftrace: fix check for return value of register_module_notifier in event_trace_init
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
tracing/core-2
Lai Jiangshan (1):
tracing: add trace_event_read_lock()
Li Zefan (1):
tracing/events: change the type of __str_loc_item to unsigned short
Pekka Enberg (1):
kmemtrace: fix kernel parameter documentation
Steven Rostedt (5):
tracing: add __print_flags for events
tracing: add previous task state info to sched switch event
tracing: add flag output for kmem events
tracing: add __print_symbolic to trace events
tracing: convert irq events to use __print_symbolic
Zhaolei (2):
ftrace: Add task_comm support for trace_event
ftrace: clean up of using ftrace_event_enable_disable()
Documentation/kernel-parameters.txt | 10 ----
include/linux/ftrace_event.h | 16 ++++++-
include/trace/events/irq.h | 23 +++++++--
include/trace/events/kmem.h | 53 ++++++++++++++++++---
include/trace/events/sched.h | 9 +++-
include/trace/ftrace.h | 24 +++++++++-
kernel/trace/Kconfig | 9 +++-
kernel/trace/trace.c | 8 +++
kernel/trace/trace_events.c | 42 ++++++----------
kernel/trace/trace_output.c | 89 ++++++++++++++++++++++++++++++++---
kernel/trace/trace_output.h | 2 +
11 files changed, 223 insertions(+), 62 deletions(-)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/5] tracing/core: various fixes
2009-05-26 2:04 [PATCH 0/5] tracing/core: various fixes Frederic Weisbecker
` (5 preceding siblings ...)
2009-05-26 18:55 ` [GIT PULL v2][PATCH 0/10] tracing/core: various fixes Frederic Weisbecker
@ 2009-05-26 19:46 ` Steven Rostedt
2009-05-26 20:06 ` Frederic Weisbecker
6 siblings, 1 reply; 12+ messages in thread
From: Steven Rostedt @ 2009-05-26 19:46 UTC (permalink / raw)
To: Frederic Weisbecker
Cc: Ingo Molnar, LKML, Lai Jiangshan, Li Zefan, Pekka Enberg,
Zhaolei, Tom Zanussi
I'm just coming back off of a holiday.
On Tue, 26 May 2009, Frederic Weisbecker wrote:
> Hi Ingo, Steven,
>
> I've gathered various tracing fixes that were posted recently.
>
> Note: the commit b11c53e12f94a46b50bccc7a1a953d7ca1d54a31
> (ftrace: Add task_comm support for trace_event)
> looks good to me. This v3 solves the two following unhandled
> dependencies in v1:
>
> ENABLE_EVENT_TRACING -> CONTEXT_SWITCH_TRACER
> EVENT_TRACING -> CONTEXT_SWITCH_TRACER
>
> The latter is tricky because CONTEXT_SWITCH_TRACER depends
> on CONFIG_FTRACE (the tracers menu) from which EVENT_TRACING
> is excluded. A build error can then occur if something selects
> CONFIG_TRACING elsewhere.
>
> The fix written by Zhaolei follows the {ENABLE_}EVENT_TRACING
> view: we now have CONTEXT_SWITCH_TRACER and ENABLE_CONTEXT_SWITCH_TRACER.
>
> The former is used by EVENT_TRACING to record cmdlines.
> The latter selects CONTEXT_SWITCH_TRACER plus CONFIG_TRACING.
> To sum up, ENABLE_CONTEXT_SWITCH_TRACER acts only as a "relay".
The sched_switch tracer is very light weight. Not sure we need to keep
it separate.
Basically, when tracing is enabled, we should simply get the event tracer
and the sched_switch tracer for free. The configs get a bit tricky with
dependencies. I'll take a look at it.
-- Steve
>
> It looks good to me, tell me and Zhaolei if you have doubts
> about it.
>
> Thanks.
>
> The following changes since commit 5537937696c55530447c20aa27daccb8d0d29b33:
> Ming Lei (1):
> ftrace: fix check for return value of register_module_notifier in event_trace_init
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
> tracing/core
>
> Lai Jiangshan (1):
> tracing: add trace_event_read_lock()
>
> Li Zefan (1):
> tracing/events: change the type of __str_loc_item to unsigned short
>
> Pekka Enberg (1):
> kmemtrace: fix kernel parameter documentation
>
> Zhaolei (2):
> ftrace: Add task_comm support for trace_event
> ftrace: clean up of using ftrace_event_enable_disable()
>
> Documentation/kernel-parameters.txt | 10 --------
> include/trace/ftrace.h | 2 +-
> kernel/trace/Kconfig | 9 +++++-
> kernel/trace/trace.c | 8 ++++++
> kernel/trace/trace_events.c | 42 +++++++++++++---------------------
> kernel/trace/trace_output.c | 25 +++++++++++++++-----
> kernel/trace/trace_output.h | 2 +
> 7 files changed, 52 insertions(+), 46 deletions(-)
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/5] tracing/core: various fixes
2009-05-26 19:46 ` [PATCH 0/5] " Steven Rostedt
@ 2009-05-26 20:06 ` Frederic Weisbecker
2009-05-26 21:10 ` Steven Rostedt
0 siblings, 1 reply; 12+ messages in thread
From: Frederic Weisbecker @ 2009-05-26 20:06 UTC (permalink / raw)
To: Steven Rostedt
Cc: Ingo Molnar, LKML, Lai Jiangshan, Li Zefan, Pekka Enberg,
Zhaolei, Tom Zanussi
On Tue, May 26, 2009 at 03:46:24PM -0400, Steven Rostedt wrote:
>
> I'm just coming back off of a holiday.
>
>
> On Tue, 26 May 2009, Frederic Weisbecker wrote:
>
> > Hi Ingo, Steven,
> >
> > I've gathered various tracing fixes that were posted recently.
> >
> > Note: the commit b11c53e12f94a46b50bccc7a1a953d7ca1d54a31
> > (ftrace: Add task_comm support for trace_event)
> > looks good to me. This v3 solves the two following unhandled
> > dependencies in v1:
> >
> > ENABLE_EVENT_TRACING -> CONTEXT_SWITCH_TRACER
> > EVENT_TRACING -> CONTEXT_SWITCH_TRACER
> >
> > The latter is tricky because CONTEXT_SWITCH_TRACER depends
> > on CONFIG_FTRACE (the tracers menu) from which EVENT_TRACING
> > is excluded. A build error can then occur if something selects
> > CONFIG_TRACING elsewhere.
> >
> > The fix written by Zhaolei follows the {ENABLE_}EVENT_TRACING
> > view: we now have CONTEXT_SWITCH_TRACER and ENABLE_CONTEXT_SWITCH_TRACER.
> >
> > The former is used by EVENT_TRACING to record cmdlines.
> > The latter selects CONTEXT_SWITCH_TRACER plus CONFIG_TRACING.
> > To sum up, ENABLE_CONTEXT_SWITCH_TRACER acts only as a "relay".
>
> The sched_switch tracer is very light weight. Not sure we need to keep
> it separate.
>
> Basically, when tracing is enabled, we should simply get the event tracer
> and the sched_switch tracer for free. The configs get a bit tricky with
> dependencies. I'll take a look at it.
>
> -- Steve
So, should I zap these patches from the pull request?
Or do you think about a delta solution?
Thanks,
Frederic.
> >
> > It looks good to me, tell me and Zhaolei if you have doubts
> > about it.
> >
> > Thanks.
> >
> > The following changes since commit 5537937696c55530447c20aa27daccb8d0d29b33:
> > Ming Lei (1):
> > ftrace: fix check for return value of register_module_notifier in event_trace_init
> >
> > are available in the git repository at:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
> > tracing/core
> >
> > Lai Jiangshan (1):
> > tracing: add trace_event_read_lock()
> >
> > Li Zefan (1):
> > tracing/events: change the type of __str_loc_item to unsigned short
> >
> > Pekka Enberg (1):
> > kmemtrace: fix kernel parameter documentation
> >
> > Zhaolei (2):
> > ftrace: Add task_comm support for trace_event
> > ftrace: clean up of using ftrace_event_enable_disable()
> >
> > Documentation/kernel-parameters.txt | 10 --------
> > include/trace/ftrace.h | 2 +-
> > kernel/trace/Kconfig | 9 +++++-
> > kernel/trace/trace.c | 8 ++++++
> > kernel/trace/trace_events.c | 42 +++++++++++++---------------------
> > kernel/trace/trace_output.c | 25 +++++++++++++++-----
> > kernel/trace/trace_output.h | 2 +
> > 7 files changed, 52 insertions(+), 46 deletions(-)
> >
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/5] tracing/core: various fixes
2009-05-26 20:06 ` Frederic Weisbecker
@ 2009-05-26 21:10 ` Steven Rostedt
0 siblings, 0 replies; 12+ messages in thread
From: Steven Rostedt @ 2009-05-26 21:10 UTC (permalink / raw)
To: Frederic Weisbecker
Cc: Ingo Molnar, LKML, Lai Jiangshan, Li Zefan, Pekka Enberg,
Zhaolei, Tom Zanussi
On Tue, 26 May 2009, Frederic Weisbecker wrote:
>
>
> So, should I zap these patches from the pull request?
> Or do you think about a delta solution?
No, keep the config changes out for now.
-- Steve
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [GIT PULL v2][PATCH 0/10] tracing/core: various fixes
2009-05-26 18:55 ` [GIT PULL v2][PATCH 0/10] tracing/core: various fixes Frederic Weisbecker
@ 2009-05-26 21:30 ` Steven Rostedt
2009-05-26 22:22 ` Frederic Weisbecker
0 siblings, 1 reply; 12+ messages in thread
From: Steven Rostedt @ 2009-05-26 21:30 UTC (permalink / raw)
To: Frederic Weisbecker
Cc: Ingo Molnar, LKML, Lai Jiangshan, Li Zefan, Pekka Enberg,
Zhaolei, Tom Zanussi
On Tue, 26 May 2009, Frederic Weisbecker wrote:
> Steven Rostedt (5):
> tracing: add __print_flags for events
> tracing: add previous task state info to sched switch event
> tracing: add flag output for kmem events
> tracing: add __print_symbolic to trace events
> tracing: convert irq events to use __print_symbolic
>
> Zhaolei (2):
> ftrace: Add task_comm support for trace_event
> ftrace: clean up of using ftrace_event_enable_disable()
BTW, these are in tip/tracing/ftrace :-/
-- Steve
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [GIT PULL v2][PATCH 0/10] tracing/core: various fixes
2009-05-26 21:30 ` Steven Rostedt
@ 2009-05-26 22:22 ` Frederic Weisbecker
0 siblings, 0 replies; 12+ messages in thread
From: Frederic Weisbecker @ 2009-05-26 22:22 UTC (permalink / raw)
To: Steven Rostedt
Cc: Ingo Molnar, LKML, Lai Jiangshan, Li Zefan, Pekka Enberg,
Zhaolei, Tom Zanussi
On Tue, May 26, 2009 at 05:30:43PM -0400, Steven Rostedt wrote:
>
> On Tue, 26 May 2009, Frederic Weisbecker wrote:
> > Steven Rostedt (5):
> > tracing: add __print_flags for events
> > tracing: add previous task state info to sched switch event
> > tracing: add flag output for kmem events
> > tracing: add __print_symbolic to trace events
> > tracing: convert irq events to use __print_symbolic
> >
> > Zhaolei (2):
> > ftrace: Add task_comm support for trace_event
> > ftrace: clean up of using ftrace_event_enable_disable()
>
> BTW, these are in tip/tracing/ftrace :-/
Yes. I prepared the first request against tracing/core
and have discovered today what was in tracing/ftrace :)
But Zhaolei's patches are not the same. The v1 is on
tracing/ftrace, it doesn't contain the fix for the build
error. Then Ingo suggested me to cherry-pick the missing
patches in tracing/core from tracing/ftrace. And here came
the second pull request.
So, may be I should send a new request containing the last
fixes but against tracing/ftrace. So that we'll have
the same result without the kconfig tricks that solve the
build error.
Hm?
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2009-05-26 22:25 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-26 2:04 [PATCH 0/5] tracing/core: various fixes Frederic Weisbecker
2009-05-26 2:04 ` [PATCH 1/5] tracing: add trace_event_read_lock() Frederic Weisbecker
2009-05-26 2:04 ` [PATCH 2/5] tracing/events: change the type of __str_loc_item to unsigned short Frederic Weisbecker
2009-05-26 2:04 ` [PATCH 3/5] kmemtrace: fix kernel parameter documentation Frederic Weisbecker
2009-05-26 2:04 ` [PATCH 4/5] ftrace: Add task_comm support for trace_event Frederic Weisbecker
2009-05-26 2:04 ` [PATCH 5/5] ftrace: clean up of using ftrace_event_enable_disable() Frederic Weisbecker
2009-05-26 18:55 ` [GIT PULL v2][PATCH 0/10] tracing/core: various fixes Frederic Weisbecker
2009-05-26 21:30 ` Steven Rostedt
2009-05-26 22:22 ` Frederic Weisbecker
2009-05-26 19:46 ` [PATCH 0/5] " Steven Rostedt
2009-05-26 20:06 ` Frederic Weisbecker
2009-05-26 21:10 ` Steven Rostedt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.