History

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

Masami Hiramatsu committed 6 years ago

Commit a838dea1 parent ac343da1 file · +8 −1Browse files

Unified · Split

kernel/trace/trace_events.c+8−1
@@ -38,6 +38,7 @@ DEFINE_MUTEX(event_mutex); · 37 unmodified lines
3838 LIST_HEAD(ftrace_events);
3939 static LIST_HEAD(ftrace_generic_fields);
4040 static LIST_HEAD(ftrace_common_fields);
41+static bool eventdir_initialized;
4142
4243 #define GFP_TRACE (GFP_KERNEL | __GFP_ZERO)
4344
@@ -2486,7 +2487,10 @@ __trace_add_new_event(struct trace_event_call *call, struct trace_array *tr) · 2442 unmodified lines
24862487 if (!file)
24872488 return -ENOMEM;
24882489
2489− return event_create_dir(tr->event_dir, file);
2490+ if (eventdir_initialized)
2491+ return event_create_dir(tr->event_dir, file);
2492+ else
2493+ return event_define_fields(call);
24902494 }
24912495
24922496 /*
@@ -3478,6 +3482,9 @@ __init int event_trace_init(void) · 985 unmodified lines
34783482 if (ret)
34793483 pr_warn("Failed to register trace events module notifier\n");
34803484 #endif
3485+
3486+ eventdir_initialized = true;
3487+
34813488 return 0;
34823489 }
34833490

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