Add the format of: trace_instance=foo,sched:sched_switch,irq_handler_entry,initcall That will create the "foo" instance and enable the sched_switch event (here were the "sched" system is explicitly specified), the irq_handler_entry event, and all events under the system initcall. Link: https://lkml.kernel.org/r/20230207173026.386114535@goodmis.org
Unified · Split
| @@ -6278,6 +6278,20 @@ · 6277 unmodified lines | |||
| 6278 | 6278 | ||
| 6279 | /sys/kernel/tracing/instances | 6279 | /sys/kernel/tracing/instances |
| 6280 | 6280 | ||
| 6281 | Events can be enabled at the time the instance is created | ||
| 6282 | via: | ||
| 6283 | |||
| 6284 | trace_instance=<name>,<system1>:<event1>,<system2>:<event2> | ||
| 6285 | |||
| 6286 | Note, the "<system*>:" portion is optional if the event is | ||
| 6287 | unique. | ||
| 6288 | |||
| 6289 | trace_instance=foo,sched:sched_switch,irq_handler_entry,initcall | ||
| 6290 | |||
| 6291 | will enable the "sched_switch" event (note, the "sched:" is optional, and | ||
| 6292 | the same thing would happen if it was left off). The irq_handler_entry | ||
| 6293 | event, and all events under the "initcall" system. | ||
| 6294 | |||
| 6281 | trace_options=[option-list] | 6295 | trace_options=[option-list] |
| 6282 | [FTRACE] Enable or disable tracer options at boot. | 6296 | [FTRACE] Enable or disable tracer options at boot. |
| 6283 | The option-list is a comma delimited list of options | 6297 | The option-list is a comma delimited list of options |
| @@ -10188,6 +10188,10 @@ __init static void enable_instances(void) · 10187 unmodified lines | |||
| 10188 | } | 10188 | } |
| 10189 | /* Allow user space to delete it */ | 10189 | /* Allow user space to delete it */ |
| 10190 | trace_array_put(tr); | 10190 | trace_array_put(tr); |
| 10191 | |||
| 10192 | while ((tok = strsep(&curr_str, ","))) { | ||
| 10193 | early_enable_events(tr, tok, true); | ||
| 10194 | } | ||
| 10191 | } | 10195 | } |
| 10192 | } | 10196 | } |
| 10193 | 10197 | ||
| @@ -1334,6 +1334,8 @@ DECLARE_PER_CPU(int, trace_buffered_event_cnt); · 1333 unmodified lines | |||
| 1334 | void trace_buffered_event_disable(void); | 1334 | void trace_buffered_event_disable(void); |
| 1335 | void trace_buffered_event_enable(void); | 1335 | void trace_buffered_event_enable(void); |
| 1336 | 1336 | ||
| 1337 | void early_enable_events(struct trace_array *tr, char *buf, bool disable_first); | ||
| 1338 | |||
| 1337 | static inline void | 1339 | static inline void |
| 1338 | __trace_event_discard_commit(struct trace_buffer *buffer, | 1340 | __trace_event_discard_commit(struct trace_buffer *buffer, |
| 1339 | struct ring_buffer_event *event) | 1341 | struct ring_buffer_event *event) |
| @@ -3750,10 +3750,9 @@ static __init int event_trace_memsetup(void) · 3749 unmodified lines | |||
| 3750 | return 0; | 3750 | return 0; |
| 3751 | } | 3751 | } |
| 3752 | 3752 | ||
| 3753 | static __init void | 3753 | __init void |
| 3754 | early_enable_events(struct trace_array *tr, bool disable_first) | 3754 | early_enable_events(struct trace_array *tr, char *buf, bool disable_first) |
| 3755 | { | 3755 | { |
| 3756 | char *buf = bootup_event_buf; | ||
| 3757 | char *token; | 3756 | char *token; |
| 3758 | int ret; | 3757 | int ret; |
| 3759 | 3758 | ||
| @@ -3806,7 +3805,7 @@ static __init int event_trace_enable(void) · 46 unmodified lines | |||
| 3806 | */ | 3805 | */ |
| 3807 | __trace_early_add_events(tr); | 3806 | __trace_early_add_events(tr); |
| 3808 | 3807 | ||
| 3809 | early_enable_events(tr, false); | 3808 | early_enable_events(tr, bootup_event_buf, false); |
| 3810 | 3809 | ||
| 3811 | trace_printk_start_comm(); | 3810 | trace_printk_start_comm(); |
| 3812 | 3811 | ||
| @@ -3834,7 +3833,7 @@ static __init int event_trace_enable_again(void) · 21 unmodified lines | |||
| 3834 | if (!tr) | 3833 | if (!tr) |
| 3835 | return -ENODEV; | 3834 | return -ENODEV; |
| 3836 | 3835 | ||
| 3837 | early_enable_events(tr, true); | 3836 | early_enable_events(tr, bootup_event_buf, true); |
| 3838 | 3837 | ||
| 3839 | return 0; | 3838 | return 0; |
| 3840 | } | 3839 | } |