Skip to contentSkip to conversation

tracing/preemptirq: Optimize disabled tracepoint overhead

PATCH Superseded Wander Lairson Costa 2 participants 5 messages Jun 30, 2025 – Jul 1, 2025

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover tracing/preemptirq: Optimize disabled tracepoint overhead

This series addresses unnecessary overhead introduced by the preempt/irq tracepoints when they are compiled into the kernel but are not actively enabled (i.e., when tracing is disabled).

These optimizations ensure that when tracing is inactive, the kernel can largely bypass operations that would otherwise incur a passive performance penalty. This makes the impact of disabled preemptirq IRQ and preempt tracing negligible in performance-sensitive environments.

---
Performance Measurements

Measurements were taken using a specialized kernel module [1] to benchmark local_irq_disable/enable() and preempt_disable/enable() call pairs. The kernel used for benchmarking was version 6.16.0-rc2. "Max Average" represents the average of the 1000 highest samples, used to reduce noise from single highest samples.

Each benchmark run collected 10^7 samples in parallel from each CPU for each call pair (used for average, max_avg, and median calculations). The 99th percentile was measured in a separate benchmark run, focused on a single CPU.

The results show that compiling with tracers (Kernel Build:
-master-trace) introduced significant overhead compared to a base kernel without tracers (Kernel Build: -master). After applying these patches (Kernel Build: -patched-trace), the overhead is substantially reduced, approaching the baseline.

x86-64 Metrics

Tests were run on a system equipped with an Intel(R) Xeon(R) Silver 4310 CPU.

IRQ Metrics

Combined Metric average max_avg median percentile
Kernel Build

6.16.0-rc2-master               28     5587      29          23
6.16.0-rc2-master-trace         46     7895      48          32
6.16.0-rc2-patched-trace        30     6030      31          27

Preempt Metrics

Combined Metric average max_avg median percentile
Kernel Build

6.16.0-rc2-master               26     5748      27          20
6.16.0-rc2-master-trace         45     7526      48          26
6.16.0-rc2-patched-trace        27     5479      27          21

AArch64 Metrics

Tests were also conducted on an AArch64 platform.

IRQ Metrics

Combined Metric average max_avg median percentile
Kernel Build

aarch64-6.16.0-rc2-master        28     3298      32          64
aarch64-6.16.0-rc2-master-trace 105     5769      96         128
aarch64-6.16.0-rc2-patched-trace 29     3192      32          64

Preempt Metrics

Combined Metric average max_avg median percentile
Kernel Build

aarch64-6.16.0-rc2-master        27     3371      32          32
aarch64-6.16.0-rc2-master-trace  32     3000      32          64
aarch64-6.16.0-rc2-patched-trace 28     3132      32          64
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Clark Williams <[email protected]>
Cc Gabriele Monaco <[email protected]>
Cc Juri Lelli <[email protected]>

---
References:
[1] https://github.com/walac/tracer-benchmark

--
Changes:
v1: initial patch
v2: enable IRQ tracing when CONFIG_PROVE_LOCKING

Wander Lairson Costa (2):
trace/preemptirq: reduce overhead of irq_enable/disable tracepoints tracing/preemptirq: Optimize preempt_disable/enable() tracepoint
overhead

 include/linux/irqflags.h        | 30 +++++++++++++++++++---------
 include/linux/preempt.h         | 35 ++++++++++++++++++++++++++++++---
 kernel/sched/core.c             | 12 +----------
 kernel/trace/trace_preemptirq.c | 22 +++++++++++++++++++++
 4 files changed, 76 insertions(+), 23 deletions(-)
Signature · 1 line
2.50.0
#1 lore raw

PATCH v2 1/2 trace/preemptirq: reduce overhead of irq_enable/disable tracepoints

The irqsoff tracer is rarely enabled in production systems due to the non-negligible overhead it introduces—even when unused. This is caused by how trace_hardirqs_on/off() are always invoked in local_irq_enable/disable(), evaluate the tracepoint static key.

This patch reduces the overhead in the common case where the tracepoint is disabled by performing the static key check earlier, avoiding the call to trace_hardirqs_on/off() entirely.

This makes the impact of disabled preemptirq IRQ tracing negligible in performance-sensitive environments.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Clark Williams <[email protected]>
Cc Gabriele Monaco <[email protected]>
Cc Juri Lelli <[email protected]>
---
 include/linux/irqflags.h        | 30 +++++++++++++++++++++---------
 kernel/trace/trace_preemptirq.c |  3 +++
 2 files changed, 24 insertions(+), 9 deletions(-)
include/linux/irqflags.h +21 -9
index 57b074e0cfbb..40e456fa3d10 100644
@@ -17,6 +17,7 @@
 #include <linux/cleanup.h>
 #include <asm/irqflags.h>
 #include <asm/percpu.h>
+#include <linux/tracepoint-defs.h>
 
 struct task_struct;
 
@@ -197,9 +198,17 @@ extern void warn_bogus_irq_restore(void);
  */
 #ifdef CONFIG_TRACE_IRQFLAGS
 
+DECLARE_TRACEPOINT(irq_enable);
+DECLARE_TRACEPOINT(irq_disable);
+
+#define __trace_enabled(tp)				\
+	(IS_ENABLED(CONFIG_PROVE_LOCKING) ||		\
+	 tracepoint_enabled(tp))
+
 #define local_irq_enable()				\
 	do {						\
-		trace_hardirqs_on();			\
+		if (__trace_enabled(irq_enable))	\
+			trace_hardirqs_on();		\
 		raw_local_irq_enable();			\
 	} while (0)
 
@@ -207,31 +216,34 @@ extern void warn_bogus_irq_restore(void);
 	do {						\
 		bool was_disabled = raw_irqs_disabled();\
 		raw_local_irq_disable();		\
-		if (!was_disabled)			\
+		if (__trace_enabled(irq_disable) &&	\
+		    !was_disabled)			\
 			trace_hardirqs_off();		\
 	} while (0)
 
 #define local_irq_save(flags)				\
 	do {						\
 		raw_local_irq_save(flags);		\
-		if (!raw_irqs_disabled_flags(flags))	\
+		if (__trace_enabled(irq_disable) &&	\
+		    !raw_irqs_disabled_flags(flags))	\
 			trace_hardirqs_off();		\
 	} while (0)
 
 #define local_irq_restore(flags)			\
 	do {						\
-		if (!raw_irqs_disabled_flags(flags))	\
+		if (__trace_enabled(irq_enable) &&	\
+		    !raw_irqs_disabled_flags(flags))	\
 			trace_hardirqs_on();		\
 		raw_local_irq_restore(flags);		\
 	} while (0)
 
-#define safe_halt()				\
-	do {					\
-		trace_hardirqs_on();		\
-		raw_safe_halt();		\
+#define safe_halt()					\
+	do {						\
+		if (__trace_enabled(irq_enable))	\
+			trace_hardirqs_on();		\
+		raw_safe_halt();			\
 	} while (0)
 
-
 #else /* !CONFIG_TRACE_IRQFLAGS */
 
 #define local_irq_enable()	do { raw_local_irq_enable(); } while (0)
kernel/trace/trace_preemptirq.c +3 -0
index 0c42b15c3800..90ee65db4516 100644
@@ -111,6 +111,9 @@ void trace_hardirqs_off(void)
 }
 EXPORT_SYMBOL(trace_hardirqs_off);
 NOKPROBE_SYMBOL(trace_hardirqs_off);
+
+EXPORT_TRACEPOINT_SYMBOL(irq_disable);
+EXPORT_TRACEPOINT_SYMBOL(irq_enable);
 #endif /* CONFIG_TRACE_IRQFLAGS */
 
 #ifdef CONFIG_TRACE_PREEMPT_TOGGLE
Signature · 1 line
2.50.0
#2 lore raw

Re: [PATCH v2 1/2] trace/preemptirq: reduce overhead of irq_enable/disable tracepoints

kernel test robot noticed the following build errors:

Hi Wander,

kernel test robot noticed the following build errors:

[auto build test ERROR on trace/for-next]
[also build test ERROR on tip/sched/core linus/master v6.16-rc4 next-20250701] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Wander-Lairson-Costa/trace-preemptirq-reduce-overhead-of-irq_enable-disable-tracepoints/20250701-035446
base:   https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace for-next
patch link:    https://lore.kernel.org/r/20250630195243.701516-2-wander%40redhat.com
patch subject: [PATCH v2 1/2] trace/preemptirq: reduce overhead of irq_enable/disable tracepoints
config: arm-randconfig-004-20250701 (https://download.01.org/0day-ci/archive/20250701/[email protected]/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project e04c938cc08a90ae60440ce22d072ebc69d67ee8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250701/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from kernel/bounds.c:13:
In file included from include/linux/log2.h:12:
In file included from include/linux/bitops.h:68:
In file included from arch/arm/include/asm/bitops.h:28:
In file included from include/linux/irqflags.h:20:
In file included from include/linux/tracepoint-defs.h:11:
In file included from include/linux/atomic.h:7:
In file included from arch/arm/include/asm/atomic.h:16:
In file included from arch/arm/include/asm/cmpxchg.h:124:
include/asm-generic/cmpxchg-local.h:26:2: error: call to undeclared function 'raw_local_irq_save'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

      26 |         raw_local_irq_save(flags);
         |         ^
   include/asm-generic/cmpxchg-local.h:26:2: note: did you mean 'arch_local_irq_save'?
   arch/arm/include/asm/irqflags.h:72:29: note: 'arch_local_irq_save' declared here
      72 | static inline unsigned long arch_local_irq_save(void)
         |                             ^
   arch/arm/include/asm/irqflags.h:71:29: note: expanded from macro 'arch_local_irq_save'
      71 | #define arch_local_irq_save arch_local_irq_save
         |                             ^
   In file included from kernel/bounds.c:13:
   In file included from include/linux/log2.h:12:
   In file included from include/linux/bitops.h:68:
   In file included from arch/arm/include/asm/bitops.h:28:
   In file included from include/linux/irqflags.h:20:
   In file included from include/linux/tracepoint-defs.h:11:
   In file included from include/linux/atomic.h:7:
   In file included from arch/arm/include/asm/atomic.h:16:
   In file included from arch/arm/include/asm/cmpxchg.h:124:
   include/asm-generic/cmpxchg-local.h:47:2: error: call to undeclared function 'raw_local_irq_restore'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      47 |         raw_local_irq_restore(flags);
         |         ^
   include/asm-generic/cmpxchg-local.h:47:2: note: did you mean 'arch_local_irq_restore'?
   arch/arm/include/asm/irqflags.h:169:20: note: 'arch_local_irq_restore' declared here
     169 | static inline void arch_local_irq_restore(unsigned long flags)
         |                    ^
   arch/arm/include/asm/irqflags.h:168:32: note: expanded from macro 'arch_local_irq_restore'
     168 | #define arch_local_irq_restore arch_local_irq_restore
         |                                ^
   In file included from kernel/bounds.c:13:
   In file included from include/linux/log2.h:12:
   In file included from include/linux/bitops.h:68:
   In file included from arch/arm/include/asm/bitops.h:28:
   In file included from include/linux/irqflags.h:20:
   In file included from include/linux/tracepoint-defs.h:11:
   In file included from include/linux/atomic.h:7:
   In file included from arch/arm/include/asm/atomic.h:16:
   In file included from arch/arm/include/asm/cmpxchg.h:124:
   include/asm-generic/cmpxchg-local.h:60:2: error: call to undeclared function 'raw_local_irq_save'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      60 |         raw_local_irq_save(flags);
         |         ^
   include/asm-generic/cmpxchg-local.h:64:2: error: call to undeclared function 'raw_local_irq_restore'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      64 |         raw_local_irq_restore(flags);
         |         ^
   In file included from kernel/bounds.c:13:
   In file included from include/linux/log2.h:12:
   In file included from include/linux/bitops.h:68:
   In file included from arch/arm/include/asm/bitops.h:28:
   In file included from include/linux/irqflags.h:20:
   In file included from include/linux/tracepoint-defs.h:11:
   In file included from include/linux/atomic.h:7:
   In file included from arch/arm/include/asm/atomic.h:16:
   In file included from arch/arm/include/asm/cmpxchg.h:148:
>> include/asm-generic/cmpxchg.h:33:3: error: call to undeclared function 'local_irq_save'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      33 |                 local_irq_save(flags);
         |                 ^
>> include/asm-generic/cmpxchg.h:36:3: error: call to undeclared function 'local_irq_restore'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
      36 |                 local_irq_restore(flags);
         |                 ^
   In file included from kernel/bounds.c:13:
   In file included from include/linux/log2.h:12:
   In file included from include/linux/bitops.h:68:
   In file included from arch/arm/include/asm/bitops.h:28:
   In file included from include/linux/irqflags.h:20:
   In file included from include/linux/tracepoint-defs.h:11:
   In file included from include/linux/atomic.h:7:
>> arch/arm/include/asm/atomic.h:215:2: error: call to undeclared function 'raw_local_irq_save'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     215 |         raw_local_irq_save(flags);
         |         ^
>> arch/arm/include/asm/atomic.h:219:2: error: call to undeclared function 'raw_local_irq_restore'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     219 |         raw_local_irq_restore(flags);
         |         ^
   arch/arm/include/asm/atomic.h:232:1: error: call to undeclared function 'raw_local_irq_save'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     232 | ATOMIC_OPS(add, +=, add)
         | ^
   arch/arm/include/asm/atomic.h:228:2: note: expanded from macro 'ATOMIC_OPS'
     228 |         ATOMIC_OP(op, c_op, asm_op)                                     \
         |         ^
   arch/arm/include/asm/atomic.h:167:2: note: expanded from macro 'ATOMIC_OP'
     167 |         raw_local_irq_save(flags);                                      \
         |         ^
   arch/arm/include/asm/atomic.h:232:1: error: call to undeclared function 'raw_local_irq_restore'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   arch/arm/include/asm/atomic.h:228:2: note: expanded from macro 'ATOMIC_OPS'
     228 |         ATOMIC_OP(op, c_op, asm_op)                                     \
         |         ^
   arch/arm/include/asm/atomic.h:169:2: note: expanded from macro 'ATOMIC_OP'
     169 |         raw_local_irq_restore(flags);                                   \
         |         ^
   arch/arm/include/asm/atomic.h:232:1: error: call to undeclared function 'raw_local_irq_save'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   arch/arm/include/asm/atomic.h:229:2: note: expanded from macro 'ATOMIC_OPS'
     229 |         ATOMIC_OP_RETURN(op, c_op, asm_op)                              \
         |         ^
   arch/arm/include/asm/atomic.h:178:2: note: expanded from macro 'ATOMIC_OP_RETURN'
     178 |         raw_local_irq_save(flags);                                      \
         |         ^
   arch/arm/include/asm/atomic.h:232:1: error: call to undeclared function 'raw_local_irq_restore'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   arch/arm/include/asm/atomic.h:229:2: note: expanded from macro 'ATOMIC_OPS'
     229 |         ATOMIC_OP_RETURN(op, c_op, asm_op)                              \
         |         ^
   arch/arm/include/asm/atomic.h:181:2: note: expanded from macro 'ATOMIC_OP_RETURN'
     181 |         raw_local_irq_restore(flags);                                   \
         |         ^
   arch/arm/include/asm/atomic.h:232:1: error: call to undeclared function 'raw_local_irq_save'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   arch/arm/include/asm/atomic.h:230:2: note: expanded from macro 'ATOMIC_OPS'
     230 |         ATOMIC_FETCH_OP(op, c_op, asm_op)
         |         ^
   arch/arm/include/asm/atomic.h:192:2: note: expanded from macro 'ATOMIC_FETCH_OP'
     192 |         raw_local_irq_save(flags);                                      \
         |         ^
   arch/arm/include/asm/atomic.h:232:1: error: call to undeclared function 'raw_local_irq_restore'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   arch/arm/include/asm/atomic.h:230:2: note: expanded from macro 'ATOMIC_OPS'
     230 |         ATOMIC_FETCH_OP(op, c_op, asm_op)
         |         ^
   arch/arm/include/asm/atomic.h:195:2: note: expanded from macro 'ATOMIC_FETCH_OP'
     195 |         raw_local_irq_restore(flags);                                   \
         |         ^
   arch/arm/include/asm/atomic.h:233:1: error: call to undeclared function 'raw_local_irq_save'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     233 | ATOMIC_OPS(sub, -=, sub)
         | ^
   arch/arm/include/asm/atomic.h:228:2: note: expanded from macro 'ATOMIC_OPS'
     228 |         ATOMIC_OP(op, c_op, asm_op)                                     \
         |         ^
   arch/arm/include/asm/atomic.h:167:2: note: expanded from macro 'ATOMIC_OP'
     167 |         raw_local_irq_save(flags);                                      \
         |         ^
   arch/arm/include/asm/atomic.h:233:1: error: call to undeclared function 'raw_local_irq_restore'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   arch/arm/include/asm/atomic.h:228:2: note: expanded from macro 'ATOMIC_OPS'
     228 |         ATOMIC_OP(op, c_op, asm_op)                                     \
         |         ^
   arch/arm/include/asm/atomic.h:169:2: note: expanded from macro 'ATOMIC_OP'
     169 |         raw_local_irq_restore(flags);                                   \
         |         ^
   arch/arm/include/asm/atomic.h:233:1: error: call to undeclared function 'raw_local_irq_save'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   arch/arm/include/asm/atomic.h:229:2: note: expanded from macro 'ATOMIC_OPS'
     229 |         ATOMIC_OP_RETURN(op, c_op, asm_op)                              \
         |         ^
   arch/arm/include/asm/atomic.h:178:2: note: expanded from macro 'ATOMIC_OP_RETURN'
     178 |         raw_local_irq_save(flags);                                      \
         |         ^
   arch/arm/include/asm/atomic.h:233:1: error: call to undeclared function 'raw_local_irq_restore'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   arch/arm/include/asm/atomic.h:229:2: note: expanded from macro 'ATOMIC_OPS'
     229 |         ATOMIC_OP_RETURN(op, c_op, asm_op)                              \
         |         ^
   arch/arm/include/asm/atomic.h:181:2: note: expanded from macro 'ATOMIC_OP_RETURN'
     181 |         raw_local_irq_restore(flags);                                   \
         |         ^
   arch/arm/include/asm/atomic.h:233:1: error: call to undeclared function 'raw_local_irq_save'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
   arch/arm/include/asm/atomic.h:230:2: note: expanded from macro 'ATOMIC_OPS'
     230 |         ATOMIC_FETCH_OP(op, c_op, asm_op)
         |         ^
   arch/arm/include/asm/atomic.h:192:2: note: expanded from macro 'ATOMIC_FETCH_OP'
     192 |         raw_local_irq_save(flags);                                      \
         |         ^

fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[3]: *** [scripts/Makefile.build:98: kernel/bounds.s] Error 1 shuffle=3679043308 make[3]: Target 'prepare' not remade because of errors.
make[2]: *** [Makefile:1274: prepare0] Error 2 shuffle=3679043308 make[2]: Target 'prepare' not remade because of errors.
make[1]: *** [Makefile:248: __sub-make] Error 2 shuffle=3679043308 make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:248: __sub-make] Error 2 shuffle=3679043308
make: Target 'prepare' not remade because of errors.

vim +/local_irq_save +33 include/asm-generic/cmpxchg.h

b4816afa398670 David Howells 2012-03-28  22  
b4816afa398670 David Howells 2012-03-28  23  static inline
82b993e8249ae3 Mark Rutland  2021-05-25  24  unsigned long __generic_xchg(unsigned long x, volatile void *ptr, int size)
b4816afa398670 David Howells 2012-03-28  25  {
b4816afa398670 David Howells 2012-03-28  26  	unsigned long ret, flags;
b4816afa398670 David Howells 2012-03-28  27  
b4816afa398670 David Howells 2012-03-28  28  	switch (size) {
b4816afa398670 David Howells 2012-03-28  29  	case 1:
b4816afa398670 David Howells 2012-03-28  30  #ifdef __xchg_u8
b4816afa398670 David Howells 2012-03-28  31  		return __xchg_u8(x, ptr);
b4816afa398670 David Howells 2012-03-28  32  #else
b4816afa398670 David Howells 2012-03-28 @33  		local_irq_save(flags);
b4816afa398670 David Howells 2012-03-28  34  		ret = *(volatile u8 *)ptr;
656e9007ef5862 Arnd Bergmann 2023-03-02  35  		*(volatile u8 *)ptr = (x & 0xffu);
b4816afa398670 David Howells 2012-03-28 @36  		local_irq_restore(flags);
b4816afa398670 David Howells 2012-03-28  37  		return ret;
b4816afa398670 David Howells 2012-03-28  38  #endif /* __xchg_u8 */
b4816afa398670 David Howells 2012-03-28  39  
b4816afa398670 David Howells 2012-03-28  40  	case 2:
b4816afa398670 David Howells 2012-03-28  41  #ifdef __xchg_u16
b4816afa398670 David Howells 2012-03-28  42  		return __xchg_u16(x, ptr);
b4816afa398670 David Howells 2012-03-28  43  #else
b4816afa398670 David Howells 2012-03-28  44  		local_irq_save(flags);
b4816afa398670 David Howells 2012-03-28  45  		ret = *(volatile u16 *)ptr;
656e9007ef5862 Arnd Bergmann 2023-03-02  46  		*(volatile u16 *)ptr = (x & 0xffffu);
b4816afa398670 David Howells 2012-03-28  47  		local_irq_restore(flags);
b4816afa398670 David Howells 2012-03-28  48  		return ret;
b4816afa398670 David Howells 2012-03-28  49  #endif /* __xchg_u16 */
b4816afa398670 David Howells 2012-03-28  50  
b4816afa398670 David Howells 2012-03-28  51  	case 4:
b4816afa398670 David Howells 2012-03-28  52  #ifdef __xchg_u32
b4816afa398670 David Howells 2012-03-28  53  		return __xchg_u32(x, ptr);
b4816afa398670 David Howells 2012-03-28  54  #else
b4816afa398670 David Howells 2012-03-28  55  		local_irq_save(flags);
b4816afa398670 David Howells 2012-03-28  56  		ret = *(volatile u32 *)ptr;
656e9007ef5862 Arnd Bergmann 2023-03-02  57  		*(volatile u32 *)ptr = (x & 0xffffffffu);
b4816afa398670 David Howells 2012-03-28  58  		local_irq_restore(flags);
b4816afa398670 David Howells 2012-03-28  59  		return ret;
b4816afa398670 David Howells 2012-03-28  60  #endif /* __xchg_u32 */
b4816afa398670 David Howells 2012-03-28  61  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#3 lore raw

PATCH v2 2/2 tracing/preemptirq: Optimize preempt_disable/enable() tracepoint overhead

In reply to Wander Lairson Costa

Similar to the IRQ tracepoint, the preempt tracepoints are typically disabled in production systems due to the significant overhead they introduce even when not in use.

The overhead primarily comes from two sources: First, when tracepoints are compiled into the kernel, preempt_count_add() and preempt_count_sub() become external function calls rather than inlined operations. Second, these functions perform unnecessary preempt_count() checks even when the tracepoint itself is disabled.

This optimization introduces an early check of the tracepoint static key, which allows us to skip both the function call overhead and the redundant preempt_count() checks when tracing is disabled. The change maintains all existing functionality when tracing is active while significantly reducing overhead for the common case where tracing is inactive.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Clark Williams <[email protected]>
Cc Gabriele Monaco <[email protected]>
Cc Juri Lelli <[email protected]>
---
 include/linux/preempt.h         | 35 ++++++++++++++++++++++++++++++---
 kernel/sched/core.c             | 12 +----------
 kernel/trace/trace_preemptirq.c | 19 ++++++++++++++++++
 3 files changed, 52 insertions(+), 14 deletions(-)
include/linux/preempt.h +32 -3
index b0af8d4ef6e6..d13c755cd934 100644
@@ -10,6 +10,7 @@
 #include <linux/linkage.h>
 #include <linux/cleanup.h>
 #include <linux/types.h>
+#include <linux/tracepoint-defs.h>
 
 /*
  * We put the hardirq and softirq counter into the preemption
@@ -191,17 +192,45 @@ static __always_inline unsigned char interrupt_context_level(void)
  */
 #define in_atomic_preempt_off() (preempt_count() != PREEMPT_DISABLE_OFFSET)
 
-#if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_TRACE_PREEMPT_TOGGLE)
+#if defined(CONFIG_DEBUG_PREEMPT)
 extern void preempt_count_add(int val);
 extern void preempt_count_sub(int val);
-#define preempt_count_dec_and_test() \
-	({ preempt_count_sub(1); should_resched(0); })
+#elif defined(CONFIG_TRACE_PREEMPT_TOGGLE)
+extern void __trace_preempt_on(void);
+extern void __trace_preempt_off(void);
+
+DECLARE_TRACEPOINT(preempt_enable);
+DECLARE_TRACEPOINT(preempt_disable);
+
+#define __preempt_trace_enabled(type) \
+	(tracepoint_enabled(preempt_##type) && preempt_count() == val)
+
+static inline void preempt_count_add(int val)
+{
+	__preempt_count_add(val);
+
+	if (__preempt_trace_enabled(disable))
+		__trace_preempt_off();
+}
+
+static inline void preempt_count_sub(int val)
+{
+	if (__preempt_trace_enabled(enable))
+		__trace_preempt_on();
+
+	__preempt_count_sub(val);
+}
 #else
 #define preempt_count_add(val)	__preempt_count_add(val)
 #define preempt_count_sub(val)	__preempt_count_sub(val)
 #define preempt_count_dec_and_test() __preempt_count_dec_and_test()
 #endif
 
+#if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_TRACE_PREEMPT_TOGGLE)
+#define preempt_count_dec_and_test() \
+	({ preempt_count_sub(1); should_resched(0); })
+#endif
+
 #define __preempt_count_inc() __preempt_count_add(1)
 #define __preempt_count_dec() __preempt_count_sub(1)
 
kernel/sched/core.c +1 -11
index 8988d38d46a3..4feba4738d79 100644
@@ -5840,8 +5840,7 @@ static inline void sched_tick_start(int cpu) { }
 static inline void sched_tick_stop(int cpu) { }
 #endif
 
-#if defined(CONFIG_PREEMPTION) && (defined(CONFIG_DEBUG_PREEMPT) || \
-				defined(CONFIG_TRACE_PREEMPT_TOGGLE))
+#if defined(CONFIG_PREEMPTION) && defined(CONFIG_DEBUG_PREEMPT)
 /*
  * If the value passed in is equal to the current preempt count
  * then we just disabled preemption. Start timing the latency.
@@ -5850,30 +5849,24 @@ static inline void preempt_latency_start(int val)
 {
 	if (preempt_count() == val) {
 		unsigned long ip = get_lock_parent_ip();
-#ifdef CONFIG_DEBUG_PREEMPT
 		current->preempt_disable_ip = ip;
-#endif
 		trace_preempt_off(CALLER_ADDR0, ip);
 	}
 }
 
 void preempt_count_add(int val)
 {
-#ifdef CONFIG_DEBUG_PREEMPT
 	/*
 	 * Underflow?
 	 */
 	if (DEBUG_LOCKS_WARN_ON((preempt_count() < 0)))
 		return;
-#endif
 	__preempt_count_add(val);
-#ifdef CONFIG_DEBUG_PREEMPT
 	/*
 	 * Spinlock count overflowing soon?
 	 */
 	DEBUG_LOCKS_WARN_ON((preempt_count() & PREEMPT_MASK) >=
 				PREEMPT_MASK - 10);
-#endif
 	preempt_latency_start(val);
 }
 EXPORT_SYMBOL(preempt_count_add);
@@ -5891,7 +5884,6 @@ static inline void preempt_latency_stop(int val)
 
 void preempt_count_sub(int val)
 {
-#ifdef CONFIG_DEBUG_PREEMPT
 	/*
 	 * Underflow?
 	 */
@@ -5903,14 +5895,12 @@ void preempt_count_sub(int val)
 	if (DEBUG_LOCKS_WARN_ON((val < PREEMPT_MASK) &&
 			!(preempt_count() & PREEMPT_MASK)))
 		return;
-#endif
 
 	preempt_latency_stop(val);
 	__preempt_count_sub(val);
 }
 EXPORT_SYMBOL(preempt_count_sub);
 NOKPROBE_SYMBOL(preempt_count_sub);
-
 #else
 static inline void preempt_latency_start(int val) { }
 static inline void preempt_latency_stop(int val) { }
kernel/trace/trace_preemptirq.c +19 -0
index 90ee65db4516..deb2428b34a2 100644
@@ -118,6 +118,25 @@ EXPORT_TRACEPOINT_SYMBOL(irq_enable);
 
 #ifdef CONFIG_TRACE_PREEMPT_TOGGLE
 
+#if !defined(CONFIG_DEBUG_PREEMPT)
+EXPORT_SYMBOL(__tracepoint_preempt_disable);
+EXPORT_SYMBOL(__tracepoint_preempt_enable);
+
+void __trace_preempt_on(void)
+{
+	trace_preempt_on(CALLER_ADDR0, get_lock_parent_ip());
+}
+EXPORT_SYMBOL(__trace_preempt_on);
+NOKPROBE_SYMBOL(__trace_preempt_on);
+
+void __trace_preempt_off(void)
+{
+	trace_preempt_off(CALLER_ADDR0, get_lock_parent_ip());
+}
+EXPORT_SYMBOL(__trace_preempt_off);
+NOKPROBE_SYMBOL(__trace_preempt_off);
+#endif /* !CONFIG_DEBUG_PREEMPT */
+
 void trace_preempt_on(unsigned long a0, unsigned long a1)
 {
 	trace(preempt_enable, TP_ARGS(a0, a1));
Signature · 1 line
2.50.0
#4 lore raw

Re: [PATCH v2 2/2] tracing/preemptirq: Optimize preempt_disable/enable() tracepoint overhead

kernel test robot noticed the following build errors:

Hi Wander,

kernel test robot noticed the following build errors:

[auto build test ERROR on trace/for-next]
[also build test ERROR on tip/sched/core linus/master v6.16-rc4 next-20250701] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Wander-Lairson-Costa/trace-preemptirq-reduce-overhead-of-irq_enable-disable-tracepoints/20250701-035446
base:   https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace for-next
patch link:    https://lore.kernel.org/r/20250630195243.701516-3-wander%40redhat.com
patch subject: [PATCH v2 2/2] tracing/preemptirq: Optimize preempt_disable/enable() tracepoint overhead
config: powerpc-randconfig-003-20250701 (https://download.01.org/0day-ci/archive/20250701/[email protected]/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project e04c938cc08a90ae60440ce22d072ebc69d67ee8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250701/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from arch/powerpc/kernel/asm-offsets.c:12:
In file included from include/linux/compat.h:14:
In file included from include/linux/sem.h:5:
In file included from include/uapi/linux/sem.h:5:
In file included from include/linux/ipc.h:7:
In file included from include/linux/rhashtable-types.h:12:
In file included from include/linux/alloc_tag.h:11:
In file included from include/linux/preempt.h:13:
In file included from include/linux/tracepoint-defs.h:11:
In file included from include/linux/atomic.h:7:
In file included from arch/powerpc/include/asm/atomic.h:11:
In file included from arch/powerpc/include/asm/cmpxchg.h:755:
In file included from include/asm-generic/cmpxchg-local.h:6:
include/linux/irqflags.h:201:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]

     201 | DECLARE_TRACEPOINT(irq_enable);
         | ^
         | int
   include/linux/irqflags.h:201:20: error: a parameter list without types is only allowed in a function definition
     201 | DECLARE_TRACEPOINT(irq_enable);
         |                    ^
   include/linux/irqflags.h:202:1: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
     202 | DECLARE_TRACEPOINT(irq_disable);
         | ^
         | int
   include/linux/irqflags.h:202:20: error: a parameter list without types is only allowed in a function definition
     202 | DECLARE_TRACEPOINT(irq_disable);
         |                    ^
   include/linux/irqflags.h:277:47: error: call to undeclared function 'tracepoint_enabled'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     277 | DEFINE_LOCK_GUARD_0(irq, local_irq_disable(), local_irq_enable())
         |                                               ^
   include/linux/irqflags.h:210:7: note: expanded from macro 'local_irq_enable'
     210 |                 if (__trace_enabled(irq_enable))        \
         |                     ^
   include/linux/irqflags.h:206:3: note: expanded from macro '__trace_enabled'
     206 |          tracepoint_enabled(tp))
         |          ^
   include/linux/irqflags.h:277:47: error: use of undeclared identifier 'irq_enable'
     277 | DEFINE_LOCK_GUARD_0(irq, local_irq_disable(), local_irq_enable())
         |                                               ^~~~~~~~~~~~~~~~~~
   include/linux/irqflags.h:210:23: note: expanded from macro 'local_irq_enable'
     210 |                 if (__trace_enabled(irq_enable))        \
         |                                     ^~~~~~~~~~
   include/linux/irqflags.h:277:26: error: call to undeclared function 'tracepoint_enabled'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     277 | DEFINE_LOCK_GUARD_0(irq, local_irq_disable(), local_irq_enable())
         |                          ^
   include/linux/irqflags.h:219:7: note: expanded from macro 'local_irq_disable'
     219 |                 if (__trace_enabled(irq_disable) &&     \
         |                     ^
   include/linux/irqflags.h:206:3: note: expanded from macro '__trace_enabled'
     206 |          tracepoint_enabled(tp))
         |          ^
   include/linux/irqflags.h:277:26: error: use of undeclared identifier 'irq_disable'
     277 | DEFINE_LOCK_GUARD_0(irq, local_irq_disable(), local_irq_enable())
         |                          ^~~~~~~~~~~~~~~~~~~
   include/linux/irqflags.h:219:23: note: expanded from macro 'local_irq_disable'
     219 |                 if (__trace_enabled(irq_disable) &&     \
         |                                     ^~~~~~~~~~~
   include/linux/irqflags.h:280:7: error: call to undeclared function 'tracepoint_enabled'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     280 |                     local_irq_restore(_T->flags),
         |                     ^
   include/linux/irqflags.h:234:7: note: expanded from macro 'local_irq_restore'
     234 |                 if (__trace_enabled(irq_enable) &&      \
         |                     ^
   include/linux/irqflags.h:206:3: note: expanded from macro '__trace_enabled'
     206 |          tracepoint_enabled(tp))
         |          ^
   include/linux/irqflags.h:280:7: error: use of undeclared identifier 'irq_enable'
     280 |                     local_irq_restore(_T->flags),
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/irqflags.h:234:23: note: expanded from macro 'local_irq_restore'
     234 |                 if (__trace_enabled(irq_enable) &&      \
         |                                     ^~~~~~~~~~
   include/linux/irqflags.h:279:7: error: call to undeclared function 'tracepoint_enabled'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     279 |                     local_irq_save(_T->flags),
         |                     ^
   include/linux/irqflags.h:227:7: note: expanded from macro 'local_irq_save'
     227 |                 if (__trace_enabled(irq_disable) &&     \
         |                     ^
   include/linux/irqflags.h:206:3: note: expanded from macro '__trace_enabled'
     206 |          tracepoint_enabled(tp))
         |          ^
   include/linux/irqflags.h:279:7: error: use of undeclared identifier 'irq_disable'
     279 |                     local_irq_save(_T->flags),
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/irqflags.h:227:23: note: expanded from macro 'local_irq_save'
     227 |                 if (__trace_enabled(irq_disable) &&     \
         |                                     ^~~~~~~~~~~
   In file included from arch/powerpc/kernel/asm-offsets.c:12:
   In file included from include/linux/compat.h:15:
   In file included from include/linux/socket.h:8:
   In file included from include/linux/uio.h:9:
   In file included from include/linux/mm_types.h:8:
   In file included from include/linux/kref.h:16:
   In file included from include/linux/spinlock.h:312:
>> include/linux/spinlock_api_smp.h:151:2: error: use of undeclared identifier '__tracepoint_irq_enable'; did you mean '__tracepoint_preempt_enable'?
     151 |         local_irq_restore(flags);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/irqflags.h:234:7: note: expanded from macro 'local_irq_restore'
     234 |                 if (__trace_enabled(irq_enable) &&      \
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/irqflags.h:206:3: note: expanded from macro '__trace_enabled'
     206 |          tracepoint_enabled(tp))
         |          ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/tracepoint-defs.h:92:27: note: expanded from macro 'tracepoint_enabled'
      92 |         static_branch_unlikely(&(__tracepoint_##tp).key)
         |                                  ^~~~~~~~~~~~~~~~~
   <scratch space>:103:1: note: expanded from here
     103 | __tracepoint_irq_enable
         | ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/preempt.h:202:1: note: '__tracepoint_preempt_enable' declared here
     202 | DECLARE_TRACEPOINT(preempt_enable);
         | ^
   include/linux/tracepoint-defs.h:88:27: note: expanded from macro 'DECLARE_TRACEPOINT'
      88 |         extern struct tracepoint __tracepoint_##tp
         |                                  ^
   <scratch space>:104:1: note: expanded from here
     104 | __tracepoint_preempt_enable
         | ^
   In file included from arch/powerpc/kernel/asm-offsets.c:12:
   In file included from include/linux/compat.h:15:
   In file included from include/linux/socket.h:8:
   In file included from include/linux/uio.h:9:
   In file included from include/linux/mm_types.h:8:
   In file included from include/linux/kref.h:16:
   In file included from include/linux/spinlock.h:312:
>> include/linux/spinlock_api_smp.h:151:2: error: use of undeclared identifier '__tracepoint_irq_enable'; did you mean '__tracepoint_preempt_enable'?
     151 |         local_irq_restore(flags);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/irqflags.h:234:7: note: expanded from macro 'local_irq_restore'
     234 |                 if (__trace_enabled(irq_enable) &&      \
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/irqflags.h:206:3: note: expanded from macro '__trace_enabled'
     206 |          tracepoint_enabled(tp))
         |          ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/tracepoint-defs.h:92:27: note: expanded from macro 'tracepoint_enabled'
      92 |         static_branch_unlikely(&(__tracepoint_##tp).key)
         |                                  ^~~~~~~~~~~~~~~~~
   <scratch space>:103:1: note: expanded from here
     103 | __tracepoint_irq_enable
         | ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/preempt.h:202:1: note: '__tracepoint_preempt_enable' declared here
     202 | DECLARE_TRACEPOINT(preempt_enable);
         | ^
   include/linux/tracepoint-defs.h:88:27: note: expanded from macro 'DECLARE_TRACEPOINT'
      88 |         extern struct tracepoint __tracepoint_##tp
         |                                  ^
   <scratch space>:104:1: note: expanded from here
     104 | __tracepoint_preempt_enable
         | ^
   In file included from arch/powerpc/kernel/asm-offsets.c:12:
   In file included from include/linux/compat.h:15:
   In file included from include/linux/socket.h:8:
   In file included from include/linux/uio.h:9:
   In file included from include/linux/mm_types.h:8:
   In file included from include/linux/kref.h:16:
   In file included from include/linux/spinlock.h:312:
>> include/linux/spinlock_api_smp.h:151:2: error: use of undeclared identifier '__tracepoint_irq_enable'; did you mean '__tracepoint_preempt_enable'?
     151 |         local_irq_restore(flags);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/irqflags.h:234:7: note: expanded from macro 'local_irq_restore'
     234 |                 if (__trace_enabled(irq_enable) &&      \
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/irqflags.h:206:3: note: expanded from macro '__trace_enabled'
     206 |          tracepoint_enabled(tp))
         |          ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/tracepoint-defs.h:92:27: note: expanded from macro 'tracepoint_enabled'
      92 |         static_branch_unlikely(&(__tracepoint_##tp).key)
         |                                  ^~~~~~~~~~~~~~~~~
   <scratch space>:103:1: note: expanded from here
     103 | __tracepoint_irq_enable
         | ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/preempt.h:202:1: note: '__tracepoint_preempt_enable' declared here
     202 | DECLARE_TRACEPOINT(preempt_enable);
         | ^
   include/linux/tracepoint-defs.h:88:27: note: expanded from macro 'DECLARE_TRACEPOINT'
      88 |         extern struct tracepoint __tracepoint_##tp
         |                                  ^
   <scratch space>:104:1: note: expanded from here
     104 | __tracepoint_preempt_enable
         | ^
   In file included from arch/powerpc/kernel/asm-offsets.c:12:
   In file included from include/linux/compat.h:15:
   In file included from include/linux/socket.h:8:
   In file included from include/linux/uio.h:9:
   In file included from include/linux/mm_types.h:8:
   In file included from include/linux/kref.h:16:
   In file included from include/linux/spinlock.h:312:
>> include/linux/spinlock_api_smp.h:151:2: error: use of undeclared identifier '__tracepoint_irq_enable'; did you mean '__tracepoint_preempt_enable'?
     151 |         local_irq_restore(flags);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/irqflags.h:234:7: note: expanded from macro 'local_irq_restore'
     234 |                 if (__trace_enabled(irq_enable) &&      \
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/irqflags.h:206:3: note: expanded from macro '__trace_enabled'
     206 |          tracepoint_enabled(tp))
         |          ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/tracepoint-defs.h:92:27: note: expanded from macro 'tracepoint_enabled'
      92 |         static_branch_unlikely(&(__tracepoint_##tp).key)
         |                                  ^~~~~~~~~~~~~~~~~
   <scratch space>:103:1: note: expanded from here
     103 | __tracepoint_irq_enable
         | ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/preempt.h:202:1: note: '__tracepoint_preempt_enable' declared here
     202 | DECLARE_TRACEPOINT(preempt_enable);
         | ^
   include/linux/tracepoint-defs.h:88:27: note: expanded from macro 'DECLARE_TRACEPOINT'
      88 |         extern struct tracepoint __tracepoint_##tp
         |                                  ^
   <scratch space>:104:1: note: expanded from here
     104 | __tracepoint_preempt_enable
         | ^
   In file included from arch/powerpc/kernel/asm-offsets.c:12:
   In file included from include/linux/compat.h:15:
   In file included from include/linux/socket.h:8:
   In file included from include/linux/uio.h:9:
   In file included from include/linux/mm_types.h:8:
   In file included from include/linux/kref.h:16:
   In file included from include/linux/spinlock.h:312:
   include/linux/spinlock_api_smp.h:159:2: error: use of undeclared identifier '__tracepoint_irq_enable'; did you mean '__tracepoint_preempt_enable'?
     159 |         local_irq_enable();
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/irqflags.h:210:7: note: expanded from macro 'local_irq_enable'
     210 |                 if (__trace_enabled(irq_enable))        \
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/irqflags.h:206:3: note: expanded from macro '__trace_enabled'
     206 |          tracepoint_enabled(tp))
         |          ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/tracepoint-defs.h:92:27: note: expanded from macro 'tracepoint_enabled'
      92 |         static_branch_unlikely(&(__tracepoint_##tp).key)
         |                                  ^~~~~~~~~~~~~~~~~
   <scratch space>:108:1: note: expanded from here
     108 | __tracepoint_irq_enable
         | ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/preempt.h:202:1: note: '__tracepoint_preempt_enable' declared here
     202 | DECLARE_TRACEPOINT(preempt_enable);
         | ^
   include/linux/tracepoint-defs.h:88:27: note: expanded from macro 'DECLARE_TRACEPOINT'
      88 |         extern struct tracepoint __tracepoint_##tp
         |                                  ^
   <scratch space>:104:1: note: expanded from here
     104 | __tracepoint_preempt_enable
         | ^
   In file included from arch/powerpc/kernel/asm-offsets.c:12:
   In file included from include/linux/compat.h:15:
   In file included from include/linux/socket.h:8:
   In file included from include/linux/uio.h:9:
   In file included from include/linux/mm_types.h:8:
   In file included from include/linux/kref.h:16:
   In file included from include/linux/spinlock.h:312:
   include/linux/spinlock_api_smp.h:159:2: error: use of undeclared identifier '__tracepoint_irq_enable'; did you mean '__tracepoint_preempt_enable'?
     159 |         local_irq_enable();
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/irqflags.h:210:7: note: expanded from macro 'local_irq_enable'
     210 |                 if (__trace_enabled(irq_enable))        \
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/irqflags.h:206:3: note: expanded from macro '__trace_enabled'
     206 |          tracepoint_enabled(tp))
         |          ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/tracepoint-defs.h:92:27: note: expanded from macro 'tracepoint_enabled'
      92 |         static_branch_unlikely(&(__tracepoint_##tp).key)
         |                                  ^~~~~~~~~~~~~~~~~
   <scratch space>:108:1: note: expanded from here
     108 | __tracepoint_irq_enable
         | ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/preempt.h:202:1: note: '__tracepoint_preempt_enable' declared here
     202 | DECLARE_TRACEPOINT(preempt_enable);
         | ^
   include/linux/tracepoint-defs.h:88:27: note: expanded from macro 'DECLARE_TRACEPOINT'
      88 |         extern struct tracepoint __tracepoint_##tp
         |                                  ^
   <scratch space>:104:1: note: expanded from here
     104 | __tracepoint_preempt_enable
         | ^
   In file included from arch/powerpc/kernel/asm-offsets.c:12:
   In file included from include/linux/compat.h:15:
   In file included from include/linux/socket.h:8:
   In file included from include/linux/uio.h:9:
   In file included from include/linux/mm_types.h:8:
   In file included from include/linux/kref.h:16:
   In file included from include/linux/spinlock.h:312:
   include/linux/spinlock_api_smp.h:159:2: error: use of undeclared identifier '__tracepoint_irq_enable'; did you mean '__tracepoint_preempt_enable'?
     159 |         local_irq_enable();
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/irqflags.h:210:7: note: expanded from macro 'local_irq_enable'
     210 |                 if (__trace_enabled(irq_enable))        \
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~

include/linux/irqflags.h:206:3: note: expanded from macro '__trace_enabled'
206 | tracepoint_enabled(tp))

vim +151 include/linux/spinlock_api_smp.h

69d0ee7377eef80 Heiko Carstens  2009-08-31  145  
9c1721aa4994f66 Thomas Gleixner 2009-12-03  146  static inline void __raw_spin_unlock_irqrestore(raw_spinlock_t *lock,
69d0ee7377eef80 Heiko Carstens  2009-08-31  147  					    unsigned long flags)
69d0ee7377eef80 Heiko Carstens  2009-08-31  148  {
5facae4f3549b5c Qian Cai        2019-09-19  149  	spin_release(&lock->dep_map, _RET_IP_);
9828ea9d75c38fe Thomas Gleixner 2009-12-03  150  	do_raw_spin_unlock(lock);
69d0ee7377eef80 Heiko Carstens  2009-08-31 @151  	local_irq_restore(flags);
69d0ee7377eef80 Heiko Carstens  2009-08-31  152  	preempt_enable();
69d0ee7377eef80 Heiko Carstens  2009-08-31  153  }
69d0ee7377eef80 Heiko Carstens  2009-08-31  154  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki