[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <159974153790.478751.3475515065034825374.stgit@devnote2>
Date: Thu, 10 Sep 2020 21:38:58 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>,
Jonathan Corbet <corbet@....net>
Cc: mhiramat@...nel.org, linux-kernel@...r.kernel.org,
linux-doc@...r.kernel.org, Randy Dunlap <rdunlap@...radead.org>,
Ingo Molnar <mingo@...nel.org>
Subject: [PATCH 3/6] 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.
Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
---
kernel/trace/trace_events.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index a2531301b44f..720b0d72ea52 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -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);
}
/*
@@ -3483,6 +3487,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;
}
Powered by blists - more mailing lists