Re: [PATCH] locking: detect spin_lock_irq() call with disabled interrupts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Pavel,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/locking/core]
[also build test ERROR on sysctl/sysctl-next akpm-mm/mm-nonmm-unstable tip/master linus/master v6.15 next-20250606]
[cannot apply to mcgrof/sysctl-next tip/auto-latest]
[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/Pavel-Tikhomirov/locking-detect-spin_lock_irq-call-with-disabled-interrupts/20250606-175911
base:   tip/locking/core
patch link:    https://lore.kernel.org/r/20250606095741.46775-1-ptikhomirov%40virtuozzo.com
patch subject: [PATCH] locking: detect spin_lock_irq() call with disabled interrupts
config: riscv-randconfig-002-20250606 (https://download.01.org/0day-ci/archive/20250606/202506062318.7g54PAh3-lkp@xxxxxxxxx/config)
compiler: riscv64-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250606/202506062318.7g54PAh3-lkp@xxxxxxxxx/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 <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506062318.7g54PAh3-lkp@xxxxxxxxx/

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/mmzone.h:8,
                    from include/linux/gfp.h:7,
                    from include/linux/mm.h:7,
                    from arch/riscv/kernel/asm-offsets.c:8:
>> include/linux/spinlock.h:375:1: warning: data definition has no type or storage class
    DECLARE_STATIC_KEY_MAYBE(CONFIG_DEBUG_SPINLOCK_IRQ_WITH_DISABLED_INTERRUPTS_BY_DEFAULT,
    ^~~~~~~~~~~~~~~~~~~~~~~~
>> include/linux/spinlock.h:375:1: error: type defaults to 'int' in declaration of 'DECLARE_STATIC_KEY_MAYBE' [-Werror=implicit-int]
>> include/linux/spinlock.h:376:5: warning: parameter names (without types) in function declaration
        debug_spin_lock_irq_with_disabled_interrupts);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/spinlock.h: In function 'spin_lock_irq':
>> include/linux/spinlock.h:382:6: error: implicit declaration of function 'static_branch_unlikely' [-Werror=implicit-function-declaration]
     if (static_branch_unlikely(&debug_spin_lock_irq_with_disabled_interrupts)) {
         ^~~~~~~~~~~~~~~~~~~~~~
>> include/linux/spinlock.h:382:30: error: 'debug_spin_lock_irq_with_disabled_interrupts' undeclared (first use in this function)
     if (static_branch_unlikely(&debug_spin_lock_irq_with_disabled_interrupts)) {
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/spinlock.h:382:30: note: each undeclared identifier is reported only once for each function it appears in
>> include/linux/spinlock.h:384:4: error: implicit declaration of function 'static_branch_disable'; did you mean 'stack_trace_save'? [-Werror=implicit-function-declaration]
       static_branch_disable(&debug_spin_lock_irq_with_disabled_interrupts);
       ^~~~~~~~~~~~~~~~~~~~~
       stack_trace_save
   include/linux/spinlock.h: In function 'spin_unlock_irq':
   include/linux/spinlock.h:415:30: error: 'debug_spin_lock_irq_with_disabled_interrupts' undeclared (first use in this function)
     if (static_branch_unlikely(&debug_spin_lock_irq_with_disabled_interrupts)) {
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
   make[3]: *** [scripts/Makefile.build:98: arch/riscv/kernel/asm-offsets.s] Error 1 shuffle=2202685202
   make[3]: Target 'prepare' not remade because of errors.
   make[2]: *** [Makefile:1275: prepare0] Error 2 shuffle=2202685202
   make[2]: Target 'prepare' not remade because of errors.
   make[1]: *** [Makefile:248: __sub-make] Error 2 shuffle=2202685202
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [Makefile:248: __sub-make] Error 2 shuffle=2202685202
   make: Target 'prepare' not remade because of errors.


vim +375 include/linux/spinlock.h

   373	
   374	#ifdef CONFIG_DEBUG_SPINLOCK
 > 375	DECLARE_STATIC_KEY_MAYBE(CONFIG_DEBUG_SPINLOCK_IRQ_WITH_DISABLED_INTERRUPTS_BY_DEFAULT,
 > 376				 debug_spin_lock_irq_with_disabled_interrupts);
   377	#endif
   378	
   379	static __always_inline void spin_lock_irq(spinlock_t *lock)
   380	{
   381	#ifdef CONFIG_DEBUG_SPINLOCK
 > 382		if (static_branch_unlikely(&debug_spin_lock_irq_with_disabled_interrupts)) {
   383			if (raw_irqs_disabled()) {
 > 384				static_branch_disable(&debug_spin_lock_irq_with_disabled_interrupts);
   385				WARN(1, "spin_lock_irq() called with irqs disabled!\n");
   386			}
   387		}
   388	#endif
   389		raw_spin_lock_irq(&lock->rlock);
   390	}
   391	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux