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

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/trace/trace_events.c+8−1
@@ -38,6 +38,7 @@ DEFINE_MUTEX(event_mutex); · 37 unmodified lines
38LIST_HEAD(ftrace_events);38LIST_HEAD(ftrace_events);
39static LIST_HEAD(ftrace_generic_fields);39static LIST_HEAD(ftrace_generic_fields);
40static LIST_HEAD(ftrace_common_fields);40static LIST_HEAD(ftrace_common_fields);
41static bool eventdir_initialized;
41 42
42#define GFP_TRACE (GFP_KERNEL | __GFP_ZERO)43#define GFP_TRACE (GFP_KERNEL | __GFP_ZERO)
43 44
@@ -2486,7 +2487,10 @@ __trace_add_new_event(struct trace_event_call *call, struct trace_array *tr) · 2442 unmodified lines
2486 if (!file)2487 if (!file)
2487 return -ENOMEM;2488 return -ENOMEM;
2488 2489
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);
2490}2494}
2491 2495
2492/*2496/*
@@ -3478,6 +3482,9 @@ __init int event_trace_init(void) · 985 unmodified lines
3478 if (ret)3482 if (ret)
3479 pr_warn("Failed to register trace events module notifier\n");3483 pr_warn("Failed to register trace events module notifier\n");
3480#endif3484#endif
3485
3486 eventdir_initialized = true;
3487
3481 return 0;3488 return 0;
3482}3489}
3483 3490

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