forked from luck/tmp_suning_uos_patched
tracing: Enable adding dynamic events early stage
Split the event fields initialization from creating new event directory. This allows the boot-time tracing to define dynamic events before initializing events directory on tracefs. Link: https://lkml.kernel.org/r/159974153790.478751.3475515065034825374.stgit@devnote2 Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
parent
ac343da7bc
commit
a838deab4e
|
@ -38,6 +38,7 @@ DEFINE_MUTEX(event_mutex);
|
|||
LIST_HEAD(ftrace_events);
|
||||
static LIST_HEAD(ftrace_generic_fields);
|
||||
static LIST_HEAD(ftrace_common_fields);
|
||||
static bool eventdir_initialized;
|
||||
|
||||
#define GFP_TRACE (GFP_KERNEL | __GFP_ZERO)
|
||||
|
||||
|
@ -2486,7 +2487,10 @@ __trace_add_new_event(struct trace_event_call *call, struct trace_array *tr)
|
|||
if (!file)
|
||||
return -ENOMEM;
|
||||
|
||||
return event_create_dir(tr->event_dir, file);
|
||||
if (eventdir_initialized)
|
||||
return event_create_dir(tr->event_dir, file);
|
||||
else
|
||||
return event_define_fields(call);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3478,6 +3482,9 @@ __init int event_trace_init(void)
|
|||
if (ret)
|
||||
pr_warn("Failed to register trace events module notifier\n");
|
||||
#endif
|
||||
|
||||
eventdir_initialized = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user