Skip to content

Commit 1a84c0b

Browse files
rostedtgregkh
authored andcommitted
tracing: Do not use PERF enums when perf is not defined
commit 8eb1518642738c6892bd629b46043513a3bf1a6a 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 <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Douglas Raillard <[email protected]> Link: https://lore.kernel.org/[email protected] Fixes: 21581dd4e7ff ("tracing: Ensure module defining synth event cannot be unloaded while tracing") Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Steven Rostedt (Google) <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 14a6b65 commit 1a84c0b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

kernel/trace/trace_events_synth.c

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

883883
switch (type) {
884-
case TRACE_REG_REGISTER:
884+
#ifdef CONFIG_PERF_EVENTS
885885
case TRACE_REG_PERF_REGISTER:
886+
#endif
887+
case TRACE_REG_REGISTER:
886888
if (!try_module_get(event->mod))
887889
return -EBUSY;
888890
break;
@@ -893,8 +895,10 @@ static int synth_event_reg(struct trace_event_call *call,
893895
int ret = trace_event_reg(call, type, data);
894896

895897
switch (type) {
896-
case TRACE_REG_UNREGISTER:
898+
#ifdef CONFIG_PERF_EVENTS
897899
case TRACE_REG_PERF_UNREGISTER:
900+
#endif
901+
case TRACE_REG_UNREGISTER:
898902
module_put(event->mod);
899903
break;
900904
default:

0 commit comments

Comments
 (0)