tracing/core: various fixes
Subsystems (3)
cover tracing/core: various fixes
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_TRACEREVENT_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(-)
PATCH 1/5 tracing: add trace_event_read_lock()
From: Lai Jiangshan <[email protected]>
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 ]
LKML-Reference: <[email protected]>
--- kernel/trace/trace.c | 8 ++++++++ kernel/trace/trace_output.c | 25 ++++++++++++++++++------- kernel/trace/trace_output.h | 2 ++ 3 files changed, 28 insertions(+), 7 deletions(-)
kernel/trace/trace.c +8 -0
@@ -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;
kernel/trace/trace_output.c +18 -7
@@ -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 ; }
kernel/trace/trace_output.h +2 -0
@@ -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,
Signature · 1 line
1.6.2.3
PATCH 2/5 tracing/events: change the type of __str_loc_item to unsigned short
In reply to Frederic WeisbeckerFrom: Li Zefan <[email protected]>
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 ]
LKML-Reference: <[email protected]>
--- include/trace/ftrace.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/trace/ftrace.h +1 -1
@@ -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
Signature · 1 line
1.6.2.3
PATCH 3/5 kmemtrace: fix kernel parameter documentation
In reply to Frederic WeisbeckerFrom: Pekka Enberg <[email protected]>
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 ]
LKML-Reference: <alpine.DEB.2.00.0905241112190.10296@rocky>
--- Documentation/kernel-parameters.txt | 10 ---------- 1 files changed, 0 insertions(+), 10 deletions(-)
Documentation/kernel-parameters.txt +0 -10
@@ -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)
Signature · 1 line
1.6.2.3
PATCH 4/5 ftrace: Add task_comm support for trace_event
In reply to Frederic WeisbeckerFrom: Zhaolei <[email protected]>
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_TRACINGv2->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 ]
LKML-Reference: <[email protected]>
--- kernel/trace/Kconfig | 9 +++++++-- kernel/trace/trace_events.c | 6 ++++++ 2 files changed, 13 insertions(+), 2 deletions(-)
kernel/trace/Kconfig +7 -2
@@ -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.
kernel/trace/trace_events.c +6 -0
@@ -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" );
Signature · 1 line
1.6.2.3
PATCH 5/5 ftrace: clean up of using ftrace_event_enable_disable()
In reply to Frederic WeisbeckerFrom: Zhaolei <[email protected]>
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 ]
LKML-Reference: <[email protected]>
--- kernel/trace/trace_events.c | 44 +++++++++++++----------------------------- 1 files changed, 14 insertions(+), 30 deletions(-)
kernel/trace/trace_events.c +14 -30
@@ -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" ); }
Signature · 1 line
1.6.2.3
Quoted 3 lines · Frederic Weisbecker
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(-)
Steven Rostedt
maintainerQuoted 10 lines · Frederic Weisbecker
Steven Rostedt (5):
tracing: add__print_flagsfor events
tracing: add previous task state info to sched switch event
tracing: add flag output for kmem events
tracing: add__print_symbolicto trace events
tracing: convert irq events to use__print_symbolicZhaolei (2):
ftrace: Addtask_commsupport fortrace_event
ftrace: clean up of usingftrace_event_enable_disable()
BTW, these are in tip/tracing/ftrace :-/
-- Steve
Quoted 9 lines · Steven Rostedt
Quoted 7 lines · Frederic Weisbecker
Steven Rostedt (5):
tracing: add__print_flagsfor events
tracing: add previous task state info to sched switch event
tracing: add flag output for kmem events
tracing: add__print_symbolicto trace events
tracing: convert irq events to use__print_symbolic
Quoted 5 lines
Quoted 3 lines
Zhaolei (2):
ftrace: Addtask_commsupport fortrace_event
ftrace: clean up of usingftrace_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?
Steven Rostedt
maintainerI'm just coming back off of a holiday.
Quoted 17 lines · Frederic Weisbecker
Hi Ingo, Steven,
I've gathered various tracing fixes that were posted recently.
Note: the commit
b11c53e12f94a46b50bccc7a1a953d7ca1d54a31
(ftrace: Addtask_commsupport fortrace_event)
looks good to me. This v3 solves the two following unhandled dependencies in v1:
ENABLE_EVENT_TRACING->CONTEXT_SWITCH_TRACEREVENT_TRACING->CONTEXT_SWITCH_TRACERThe latter is tricky because
CONTEXT_SWITCH_TRACERdepends onCONFIG_FTRACE(the tracers menu) from whichEVENT_TRACINGis excluded. A build error can then occur if something selectsCONFIG_TRACINGelsewhere.
Quoted 6 lines
The fix written by Zhaolei follows the {ENABLE_}EVENT_TRACING
view: we now haveCONTEXT_SWITCH_TRACERandENABLE_CONTEXT_SWITCH_TRACER.The former is used by
EVENT_TRACINGto record cmdlines. The latter selectsCONTEXT_SWITCH_TRACERplusCONFIG_TRACING. To sum up,ENABLE_CONTEXT_SWITCH_TRACERacts 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
Quoted 37 lines
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 ofregister_module_notifierinevent_trace_initare available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
tracing/coreLai Jiangshan (1):
tracing: addtrace_event_read_lock()Li Zefan (1):
tracing/events: change the type of__str_loc_itemto unsigned shortPekka Enberg (1):
kmemtrace: fix kernel parameter documentationZhaolei (2):
ftrace: Addtask_commsupport fortrace_event
ftrace: clean up of usingftrace_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(-)
Quoted 30 lines · Steven Rostedt
I'm just coming back off of a holiday.
Quoted 17 lines · Frederic Weisbecker
Hi Ingo, Steven,
I've gathered various tracing fixes that were posted recently.
Note: the commit
b11c53e12f94a46b50bccc7a1a953d7ca1d54a31
(ftrace: Addtask_commsupport fortrace_event)
looks good to me. This v3 solves the two following unhandled dependencies in v1:
ENABLE_EVENT_TRACING->CONTEXT_SWITCH_TRACEREVENT_TRACING->CONTEXT_SWITCH_TRACERThe latter is tricky because
CONTEXT_SWITCH_TRACERdepends onCONFIG_FTRACE(the tracers menu) from whichEVENT_TRACINGis excluded. A build error can then occur if something selectsCONFIG_TRACINGelsewhere.Quoted 6 lines
The fix written by Zhaolei follows the {ENABLE_}EVENT_TRACING
view: we now haveCONTEXT_SWITCH_TRACERandENABLE_CONTEXT_SWITCH_TRACER.The former is used by
EVENT_TRACINGto record cmdlines. The latter selectsCONTEXT_SWITCH_TRACERplusCONFIG_TRACING. To sum up,ENABLE_CONTEXT_SWITCH_TRACERacts only as a "relay".
Quoted 8 lines
The
sched_switchtracer 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_switchtracer 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.
Quoted 37 lines
Quoted 37 lines
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 ofregister_module_notifierinevent_trace_initare available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
tracing/coreLai Jiangshan (1):
tracing: addtrace_event_read_lock()Li Zefan (1):
tracing/events: change the type of__str_loc_itemto unsigned shortPekka Enberg (1):
kmemtrace: fix kernel parameter documentationZhaolei (2):
ftrace: Addtask_commsupport fortrace_event
ftrace: clean up of usingftrace_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(-)
Steven Rostedt
maintainerQuoted 4 lines · Frederic Weisbecker
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