| @@ -3131,14 +3131,13 @@ static inline int register_event_cmds(void) { return 0; } · 3130 unmodified lines |
| 3131 | 3131 | #endif /* CONFIG_DYNAMIC_FTRACE */ |
| 3132 | 3132 | |
| 3133 | 3133 | /* |
| 3134 | | − * The top level array has already had its trace_event_file |
| 3135 | | − * descriptors created in order to allow for early events to |
| 3136 | | − * be recorded. This function is called after the tracefs has been |
| 3137 | | − * initialized, and we now have to create the files associated |
| 3138 | | − * to the events. |
| 3134 | + * The top level array and trace arrays created by boot-time tracing |
| 3135 | + * have already had its trace_event_file descriptors created in order |
| 3136 | + * to allow for early events to be recorded. |
| 3137 | + * This function is called after the tracefs has been initialized, |
| 3138 | + * and we now have to create the files associated to the events. |
| 3139 | 3139 | */ |
| 3140 | | −static __init void |
| 3141 | | −__trace_early_add_event_dirs(struct trace_array *tr) |
| 3140 | +static void __trace_early_add_event_dirs(struct trace_array *tr) |
| 3142 | 3141 | { |
| 3143 | 3142 | struct trace_event_file *file; |
| 3144 | 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 have |
| 3157 | | − * a list of events that can be enabled. This must be done before |
| 3158 | | − * the filesystem is set up in order to allow events to be traced |
| 3159 | | − * early. |
| 3155 | + * For early boot up, the top trace array and the trace arrays created |
| 3156 | + * by boot-time tracing require to have a list of events that can be |
| 3157 | + * enabled. This must be done before the filesystem is set up in order |
| 3158 | + * to allow events to be traced early. |
| 3160 | 3159 | */ |
| 3161 | | −static __init void |
| 3162 | | −__trace_early_add_events(struct trace_array *tr) |
| 3160 | +void __trace_early_add_events(struct trace_array *tr) |
| 3163 | 3161 | { |
| 3164 | 3162 | struct trace_event_call *call; |
| 3165 | 3163 | int ret; |
| @@ -3290,7 +3288,11 @@ int event_trace_add_tracer(struct dentry *parent, struct trace_array *tr) · 124 unmodified lines |
| 3290 | 3288 | goto out; |
| 3291 | 3289 | |
| 3292 | 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 | 3296 | up_write(&trace_event_sem); |
| 3295 | 3297 | |
| 3296 | 3298 | out: |