The IRQ disable/enable tracepoints are currently gated behind TRACE_IRQFLAGS, a hidden config that cannot be selected directly by users. It is only enabled when selected by PROVE_LOCKING or IRQSOFF_TRACER, both of which carry overhead beyond what is needed for just the tracepoints.
Introduce TRACE_IRQFLAGS_TOGGLE, a user-selectable config that enables the irq_disable and irq_enable tracepoints independently. It is mutually exclusive with TRACE_IRQFLAGS and mirrors how TRACE_PREEMPT_TOGGLE works for preemption tracepoints. Make this option depend on CONFIG_JUMP_LABEL to avoid a circular header dependency. Without TRACE_IRQFLAGS, irqflags.h must check the static key before invoking the tracepoint. Using tracepoint_enabled() for this check pulls in tracepoint_defs.h, which eventually includes atomic.h and cmpxchg.h, circling back to irqflags.h. Enforcing CONFIG_JUMP_LABEL allows the use of static_key_false() directly, avoiding the inclusion of the full tracepoint header chain and preventing the cycle. Signed-off-by: Wander Lairson Costa <[email protected]> --- kernel/trace/Kconfig | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index e007459ecf361..8bea77b5f1200 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig @@ -162,7 +162,7 @@ config RING_BUFFER_ALLOW_SWAP config PREEMPTIRQ_TRACEPOINTS bool - depends on TRACE_PREEMPT_TOGGLE || TRACE_IRQFLAGS + depends on TRACE_PREEMPT_TOGGLE || TRACE_IRQFLAGS || TRACE_IRQFLAGS_TOGGLE select TRACING default y help @@ -418,6 +418,17 @@ config TRACE_PREEMPT_TOGGLE Enables hooks into preemption disable and enable paths for tracing or latency measurement. +config TRACE_IRQFLAGS_TOGGLE + bool "IRQ disable/enable tracing hooks" + default n + depends on TRACE_IRQFLAGS_SUPPORT && JUMP_LABEL && !TRACE_IRQFLAGS + help + Enables hooks into IRQ disable and enable paths for tracing. + + This provides the irq_disable and irq_enable tracepoints + without pulling in the full TRACE_IRQFLAGS infrastructure + used by lockdep and the irqsoff latency tracer. + config IRQSOFF_TRACER bool "Interrupts-off Latency Tracer" default n -- 2.53.0
