This is a note to let you know that I've just added the patch titled tracing: Consolidate trace_add/remove_event_call back to the nolock functions to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: tracing-consolidate-trace_add-remove_event_call-back-to-the-nolock-functions.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From stable+bounces-43482-greg=kroah.com@xxxxxxxxxxxxxxx Thu May 9 04:30:26 2024 From: George Guo <dongtai.guo@xxxxxxxxx> Date: Thu, 9 May 2024 10:29:23 +0800 Subject: tracing: Consolidate trace_add/remove_event_call back to the nolock functions To: gregkh@xxxxxxxxxxxxxxxxxxx, rostedt@xxxxxxxxxxx, mhiramat@xxxxxxxxxx, tom.zanussi@xxxxxxxxxxxxxxx Cc: stable@xxxxxxxxxxxxxxx, George Guo <guodongtai@xxxxxxxxxx> Message-ID: <20240509022931.3513365-6-dongtai.guo@xxxxxxxxx> From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx> commit 7e1413edd6194a9807aa5f3ac0378b9b4b9da879 upstream. The trace_add/remove_event_call_nolock() functions were added to allow the tace_add/remove_event_call() code be called when the event_mutex lock was already taken. Now that all callers are done within the event_mutex, there's no reason to have two different interfaces. Remove the current wrapper trace_add/remove_event_call()s and rename the _nolock versions back to the original names. Link: http://lkml.kernel.org/r/154140866955.17322.2081425494660638846.stgit@devbox Acked-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx> Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx> Signed-off-by: George Guo <guodongtai@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- include/linux/trace_events.h | 2 -- kernel/trace/trace_events.c | 30 ++++-------------------------- kernel/trace/trace_events_hist.c | 6 +++--- 3 files changed, 7 insertions(+), 31 deletions(-) --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -529,8 +529,6 @@ extern int trace_event_raw_init(struct t extern int trace_define_field(struct trace_event_call *call, const char *type, const char *name, int offset, int size, int is_signed, int filter_type); -extern int trace_add_event_call_nolock(struct trace_event_call *call); -extern int trace_remove_event_call_nolock(struct trace_event_call *call); extern int trace_add_event_call(struct trace_event_call *call); extern int trace_remove_event_call(struct trace_event_call *call); extern int trace_event_get_offsets(struct trace_event_call *call); --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -2312,7 +2312,8 @@ __trace_early_add_new_event(struct trace struct ftrace_module_file_ops; static void __add_event_to_tracers(struct trace_event_call *call); -int trace_add_event_call_nolock(struct trace_event_call *call) +/* Add an additional event_call dynamically */ +int trace_add_event_call(struct trace_event_call *call) { int ret; lockdep_assert_held(&event_mutex); @@ -2327,17 +2328,6 @@ int trace_add_event_call_nolock(struct t return ret; } -/* Add an additional event_call dynamically */ -int trace_add_event_call(struct trace_event_call *call) -{ - int ret; - - mutex_lock(&event_mutex); - ret = trace_add_event_call_nolock(call); - mutex_unlock(&event_mutex); - return ret; -} - /* * Must be called under locking of trace_types_lock, event_mutex and * trace_event_sem. @@ -2383,8 +2373,8 @@ static int probe_remove_event_call(struc return 0; } -/* no event_mutex version */ -int trace_remove_event_call_nolock(struct trace_event_call *call) +/* Remove an event_call */ +int trace_remove_event_call(struct trace_event_call *call) { int ret; @@ -2398,18 +2388,6 @@ int trace_remove_event_call_nolock(struc return ret; } - -/* Remove an event_call */ -int trace_remove_event_call(struct trace_event_call *call) -{ - int ret; - - mutex_lock(&event_mutex); - ret = trace_remove_event_call_nolock(call); - mutex_unlock(&event_mutex); - - return ret; -} #define for_each_event(event, start, end) \ for (event = start; \ --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -980,7 +980,7 @@ static int register_synth_event(struct s call->data = event; call->tp = event->tp; - ret = trace_add_event_call_nolock(call); + ret = trace_add_event_call(call); if (ret) { pr_warn("Failed to register synthetic event: %s\n", trace_event_name(call)); @@ -989,7 +989,7 @@ static int register_synth_event(struct s ret = set_synth_event_print_fmt(call); if (ret < 0) { - trace_remove_event_call_nolock(call); + trace_remove_event_call(call); goto err; } out: @@ -1004,7 +1004,7 @@ static int unregister_synth_event(struct struct trace_event_call *call = &event->call; int ret; - ret = trace_remove_event_call_nolock(call); + ret = trace_remove_event_call(call); return ret; } Patches currently in stable-queue which might be from kroah.com@xxxxxxxxxxxxxxx are queue-4.19/tracing-consolidate-trace_add-remove_event_call-back-to-the-nolock-functions.patch queue-4.19/tracing-split-up-onmatch-action-data.patch queue-4.19/tracing-remove-unnecessary-var_ref-destroy-in-track_data_destroy.patch queue-4.19/tracing-use-str_has_prefix-helper-for-histogram-code.patch queue-4.19/tracing-simplify-creation-and-deletion-of-synthetic-events.patch queue-4.19/tracing-refactor-hist-trigger-action-code.patch queue-4.19/string.h-add-str_has_prefix-helper-function.patch queue-4.19/tracing-remove-unneeded-synth_event_mutex.patch queue-4.19/tracing-add-unified-dynamic-event-framework.patch queue-4.19/tracing-use-dyn_event-framework-for-synthetic-events.patch queue-4.19/tracing-use-str_has_prefix-instead-of-using-fixed-sizes.patch queue-4.19/tracing-generalize-hist-trigger-onmax-and-save-action.patch queue-4.19/tracing-have-the-historgram-use-the-result-of-str_has_prefix-for-len-of-prefix.patch