History

tracing/boot: Initialize per-instance event list in early boot

Initialize per-instance event list in early boot time (before initializing instance directory on tracefs). This fixes boot-time tracing to correctly handle the boot-time per-instance settings. Link: https://lkml.kernel.org/r/160096560826.182763.17110991546046128881.stgit@devnote2

Masami Hiramatsu committed 6 years ago

Commit 720dee51 parent fd264ce3 files · +19 −15Browse files

Unified · Split

3 files
  1. kernel/trace/trace.c +2 −1
  2. kernel/trace/trace.h +1 −0
  3. kernel/trace/trace_events.c +16 −14
kernel/trace/trace.c+2−1
@@ -8700,7 +8700,8 @@ static struct trace_array *trace_array_create(const char *name) · 8699 unmodified lines
8700 ret = trace_array_create_dir(tr);8700 ret = trace_array_create_dir(tr);
8701 if (ret)8701 if (ret)
8702 goto out_free_tr;8702 goto out_free_tr;
8703 }8703 } else
8704 __trace_early_add_events(tr);
8704 8705
8705 list_add(&tr->list, &ftrace_trace_arrays);8706 list_add(&tr->list, &ftrace_trace_arrays);
8706 8707
kernel/trace/trace.h+1−0
@@ -1658,6 +1658,7 @@ extern void trace_event_enable_tgid_record(bool enable); · 1657 unmodified lines
1658extern int event_trace_init(void);1658extern int event_trace_init(void);
1659extern int event_trace_add_tracer(struct dentry *parent, struct trace_array *tr);1659extern int event_trace_add_tracer(struct dentry *parent, struct trace_array *tr);
1660extern int event_trace_del_tracer(struct trace_array *tr);1660extern int event_trace_del_tracer(struct trace_array *tr);
1661extern void __trace_early_add_events(struct trace_array *tr);
1661 1662
1662extern struct trace_event_file *__find_event_file(struct trace_array *tr,1663extern struct trace_event_file *__find_event_file(struct trace_array *tr,
1663 const char *system,1664 const char *system,
kernel/trace/trace_events.c+16−14
@@ -3131,14 +3131,13 @@ static inline int register_event_cmds(void) { return 0; } · 3130 unmodified lines
3131#endif /* CONFIG_DYNAMIC_FTRACE */3131#endif /* CONFIG_DYNAMIC_FTRACE */
3132 3132
3133/*3133/*
3134 * The top level array has already had its trace_event_file3134 * The top level array and trace arrays created by boot-time tracing
3135 * descriptors created in order to allow for early events to3135 * have already had its trace_event_file descriptors created in order
3136 * be recorded. This function is called after the tracefs has been3136 * to allow for early events to be recorded.
3137 * initialized, and we now have to create the files associated3137 * This function is called after the tracefs has been initialized,
3138 * to the events.3138 * and we now have to create the files associated to the events.
3139 */3139 */
3140static __init void3140static void __trace_early_add_event_dirs(struct trace_array *tr)
3141__trace_early_add_event_dirs(struct trace_array *tr)
3142{3141{
3143 struct trace_event_file *file;3142 struct trace_event_file *file;
3144 int ret;3143 int ret;
@@ -3153,13 +3152,12 @@ __trace_early_add_event_dirs(struct trace_array *tr) · 8 unmodified lines
3153}3152}
3154 3153
3155/*3154/*
3156 * For early boot up, the top trace array requires to have3155 * For early boot up, the top trace array and the trace arrays created
3157 * a list of events that can be enabled. This must be done before3156 * by boot-time tracing require to have a list of events that can be
3158 * the filesystem is set up in order to allow events to be traced3157 * enabled. This must be done before the filesystem is set up in order
3159 * early.3158 * to allow events to be traced early.
3160 */3159 */
3161static __init void3160void __trace_early_add_events(struct trace_array *tr)
3162__trace_early_add_events(struct trace_array *tr)
3163{3161{
3164 struct trace_event_call *call;3162 struct trace_event_call *call;
3165 int ret;3163 int ret;
@@ -3290,7 +3288,11 @@ int event_trace_add_tracer(struct dentry *parent, struct trace_array *tr) · 124 unmodified lines
3290 goto out;3288 goto out;
3291 3289
3292 down_write(&trace_event_sem);3290 down_write(&trace_event_sem);
3293 __trace_add_event_dirs(tr);3291 /* If tr already has the event list, it is initialized in early boot. */
3292 if (unlikely(!list_empty(&tr->events)))
3293 __trace_early_add_event_dirs(tr);
3294 else
3295 __trace_add_event_dirs(tr);
3294 up_write(&trace_event_sem);3296 up_write(&trace_event_sem);
3295 3297
3296 out:3298 out:

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t