Skip to content

Commit 47ee832

Browse files
rostedtgregkh
authored andcommitted
tracing: Do not use PERF enums when perf is not defined
commit 8eb1518 upstream. An update was made to up the module ref count when a synthetic event is registered for both trace and perf events. But if perf is not configured in, the perf enums used will cause the kernel to fail to build. Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Douglas Raillard <douglas.raillard@arm.com> Link: https://lore.kernel.org/20250323152151.528b5ced@batman.local.home Fixes: 21581dd ("tracing: Ensure module defining synth event cannot be unloaded while tracing") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202503232230.TeREVy8R-lkp@intel.com/ Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 661f09d commit 47ee832

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

kernel/trace/trace_events_synth.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,8 +865,10 @@ static int synth_event_reg(struct trace_event_call *call,
865865
struct synth_event *event = container_of(call, struct synth_event, call);
866866

867867
switch (type) {
868-
case TRACE_REG_REGISTER:
868+
#ifdef CONFIG_PERF_EVENTS
869869
case TRACE_REG_PERF_REGISTER:
870+
#endif
871+
case TRACE_REG_REGISTER:
870872
if (!try_module_get(event->mod))
871873
return -EBUSY;
872874
break;
@@ -877,8 +879,10 @@ static int synth_event_reg(struct trace_event_call *call,
877879
int ret = trace_event_reg(call, type, data);
878880

879881
switch (type) {
880-
case TRACE_REG_UNREGISTER:
882+
#ifdef CONFIG_PERF_EVENTS
881883
case TRACE_REG_PERF_UNREGISTER:
884+
#endif
885+
case TRACE_REG_UNREGISTER:
882886
module_put(event->mod);
883887
break;
884888
default:

0 commit comments

Comments
 (0)