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
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -38,6 +38,7 @@ DEFINE_MUTEX(event_mutex); · 37 unmodified lines | |||
| 38 | LIST_HEAD(ftrace_events); | 38 | LIST_HEAD(ftrace_events); |
| 39 | static LIST_HEAD(ftrace_generic_fields); | 39 | static LIST_HEAD(ftrace_generic_fields); |
| 40 | static LIST_HEAD(ftrace_common_fields); | 40 | static LIST_HEAD(ftrace_common_fields); |
| 41 | static 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 | #endif | 3484 | #endif |
| 3485 | |||
| 3486 | eventdir_initialized = true; | ||
| 3487 | |||
| 3481 | return 0; | 3488 | return 0; |
| 3482 | } | 3489 | } |
| 3483 | 3490 | ||