Hello, kernel test robot noticed WARNING:inconsistent_lock_state due to commit (built with gcc-11): commit: 5c96ad64023a42311dd0b34d92fe212ac59156c6 ("shmem: stable directory cookies") git://git.kernel.org/cgit/linux/kernel/git/cel/linux topic-shmem-stable-dir-cookies in testcase: kernel-selftests version: kernel-selftests-x86_64-60acb023-1_20230329 with following parameters: group: netfilter test: nft_conntrack_helper.sh test-description: The kernel contains a set of "self tests" under the tools/testing/selftests/ directory. These are intended to be small unit tests to exercise individual code paths in the kernel. test-url: https://www.kernel.org/doc/Documentation/kselftest.txt on test machine: 8 threads Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (Skylake) with 28G memory caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace): If you fix the issue, kindly add following tag | Reported-by: kernel test robot | Link: https://lore.kernel.org/oe-lkp/202304021838.5460a00b-yujie.liu@intel.com [ 39.614760][ C2] WARNING: inconsistent lock state [ 39.619806][ C2] 6.3.0-rc4-00001-g5c96ad64023a #1 Not tainted [ 39.625889][ C2] -------------------------------- [ 39.630934][ C2] inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage. [ 39.637709][ C2] systemd/1 [HC0[0]:SC1[1]:HE0:SE0] takes: [ 39.643476][ C2] ffff888753b48158 (&xa->xa_lock#3){+.?.}-{2:2}, at: xa_destroy (lib/xarray.c:2214) [ 39.652005][ C2] {SOFTIRQ-ON-W} state was registered at: [ 39.657654][ C2] __lock_acquire (kernel/locking/lockdep.c:5010) [ 39.662485][ C2] lock_acquire (kernel/locking/lockdep.c:467 kernel/locking/lockdep.c:5671 kernel/locking/lockdep.c:5634) [ 39.667012][ C2] _raw_spin_lock (include/linux/spinlock_api_smp.h:134 kernel/locking/spinlock.c:154) [ 39.671540][ C2] shmem_dir_entry_add (include/linux/xarray.h:965 mm/shmem.c:2943) [ 39.676586][ C2] shmem_mknod (mm/shmem.c:3012) [ 39.680943][ C2] vfs_mknod (fs/namei.c:3916) [ 39.685212][ C2] devtmpfs_work_loop (drivers/base/devtmpfs.c:228 drivers/base/devtmpfs.c:393 drivers/base/devtmpfs.c:408) [ 39.690262][ C2] devtmpfsd (devtmpfs.c:?) [ 39.694387][ C2] kthread (kernel/kthread.c:376) [ 39.698496][ C2] ret_from_fork (arch/x86/entry/entry_64.S:314) [ 39.702936][ C2] irq event stamp: 2111293 [ 39.707288][ C2] hardirqs last enabled at (2111292): kasan_quarantine_put (arch/x86/include/asm/irqflags.h:42 (discriminator 1) arch/x86/include/asm/irqflags.h:77 (discriminator 1) arch/x86/include/asm/irqflags.h:135 (discriminator 1) mm/kasan/quarantine.c:242 (discriminator 1)) [ 39.717278][ C2] hardirqs last disabled at (2111293): _raw_spin_lock_irqsave (include/linux/spinlock_api_smp.h:108 kernel/locking/spinlock.c:162) [ 39.727400][ C2] softirqs last enabled at (2110870): __do_softirq (arch/x86/include/asm/preempt.h:27 kernel/softirq.c:415 kernel/softirq.c:600) [ 39.736802][ C2] softirqs last disabled at (2111249): __irq_exit_rcu (kernel/softirq.c:445 kernel/softirq.c:650) [ 39.746408][ C2] [ 39.746408][ C2] other info that might help us debug this: [ 39.754440][ C2] Possible unsafe locking scenario: [ 39.754440][ C2] [ 39.761832][ C2] CPU0 [ 39.765061][ C2] ---- [ 39.768290][ C2] lock(&xa->xa_lock#3); [ 39.772565][ C2] [ 39.775968][ C2] lock(&xa->xa_lock#3); [ 39.780442][ C2] [ 39.780442][ C2] *** DEADLOCK *** [ 39.780442][ C2] [ 39.788540][ C2] 2 locks held by systemd/1: [ 39.793068][ C2] #0: ffff888100073018 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault (arch/x86/include/asm/current.h:41 mm/memory.c:5625 mm/memory.c:5618) [ 39.802285][ C2] #1: ffffffff84b2b780 (rcu_callback){....}-{0:0}, at: rcu_do_batch (include/linux/rcupdate.h:327 kernel/rcu/tree.c:2107) [ 39.811330][ C2] [ 39.811330][ C2] stack backtrace: [ 39.817183][ C2] CPU: 2 PID: 1 Comm: systemd Not tainted 6.3.0-rc4-00001-g5c96ad64023a #1 [ 39.825702][ C2] Hardware name: Dell Inc. OptiPlex 7040/0Y7WYT, BIOS 1.2.8 01/26/2016 [ 39.833876][ C2] Call Trace: [ 39.837107][ C2] [ 39.839906][ C2] dump_stack_lvl (lib/dump_stack.c:108) [ 39.844364][ C2] mark_lock_irq (kernel/locking/lockdep.c:3934 kernel/locking/lockdep.c:3976 kernel/locking/lockdep.c:4179) [ 39.848907][ C2] ? print_usage_bug+0x660/0x660 [ 39.854430][ C2] ? stack_trace_save (kernel/stacktrace.c:123) [ 39.859218][ C2] ? filter_irq_stacks (kernel/stacktrace.c:114) [ 39.864090][ C2] ? is_bpf_text_address (include/linux/rcupdate.h:332 include/linux/rcupdate.h:806 kernel/bpf/core.c:721) [ 39.869227][ C2] ? lock_release (kernel/locking/lockdep.c:467 kernel/locking/lockdep.c:5691) [ 39.873755][ C2] ? save_trace (kernel/locking/lockdep.c:586) [ 39.878112][ C2] mark_lock+0x4ce/0xac0 [ 39.882901][ C2] ? mark_lock_irq (kernel/locking/lockdep.c:4594) [ 39.887606][ C2] mark_usage (kernel/locking/lockdep.c:4530) [ 39.891791][ C2] __lock_acquire (kernel/locking/lockdep.c:5010) [ 39.896497][ C2] ? mark_lock_irq (kernel/locking/lockdep.c:4594) [ 39.901198][ C2] ? slab_free_freelist_hook (mm/slub.c:1807) [ 39.906680][ C2] ? mark_usage (kernel/locking/lockdep.c:4914) [ 39.911123][ C2] ? __irq_exit_rcu (kernel/softirq.c:445 kernel/softirq.c:650) [ 39.915909][ C2] ? irq_exit_rcu (kernel/softirq.c:664) [ 39.922411][ C2] ? sysvec_apic_timer_interrupt (arch/x86/kernel/apic/apic.c:1107 (discriminator 14)) [ 39.928153][ C2] ? mark_usage (kernel/locking/lockdep.c:4560) [ 39.932595][ C2] lock_acquire (kernel/locking/lockdep.c:467 kernel/locking/lockdep.c:5671 kernel/locking/lockdep.c:5634) [ 39.937036][ C2] ? xa_destroy (lib/xarray.c:2214) [ 39.941423][ C2] ? lock_release (kernel/locking/lockdep.c:5637) [ 39.946039][ C2] ? mark_usage (kernel/locking/lockdep.c:4914) [ 39.950507][ C2] _raw_spin_lock_irqsave (include/linux/spinlock_api_smp.h:111 kernel/locking/spinlock.c:162) [ 39.955640][ C2] ? xa_destroy (lib/xarray.c:2214) [ 39.960001][ C2] xa_destroy (lib/xarray.c:2214) [ 39.964191][ C2] ? xas_free_nodes (lib/xarray.c:2208) [ 39.968984][ C2] ? lock_release (kernel/locking/lockdep.c:5637) [ 39.973609][ C2] ? kmem_cache_free (mm/slub.c:3787 mm/slub.c:3809) [ 39.978509][ C2] shmem_free_in_core_inode (mm/shmem.c:2987 mm/shmem.c:4038) [ 39.983826][ C2] rcu_do_batch (include/linux/rcupdate.h:332 kernel/rcu/tree.c:2114) [ 39.988271][ C2] ? rcu_check_gp_kthread_starvation (kernel/rcu/tree.c:2051) [ 39.994527][ C2] ? mark_held_locks (kernel/locking/lockdep.c:4237) [ 39.999227][ C2] ? lockdep_hardirqs_on_prepare (kernel/locking/lockdep.c:4599 kernel/locking/lockdep.c:4530) [ 40.005744][ C2] ? note_gp_changes (arch/x86/include/asm/irqflags.h:42 (discriminator 1) arch/x86/include/asm/irqflags.h:77 (discriminator 1) arch/x86/include/asm/irqflags.h:135 (discriminator 1) kernel/rcu/tree.c:1234 (discriminator 1)) [ 40.010620][ C2] rcu_core (kernel/rcu/tree.c:2374) [ 40.014717][ C2] __do_softirq (arch/x86/include/asm/jump_label.h:27 include/linux/jump_label.h:207 include/trace/events/irq.h:142 kernel/softirq.c:572) [ 40.019163][ C2] __irq_exit_rcu (kernel/softirq.c:445 kernel/softirq.c:650) [ 40.023779][ C2] irq_exit_rcu (kernel/softirq.c:664) [ 40.027961][ C2] sysvec_apic_timer_interrupt (arch/x86/kernel/apic/apic.c:1107 (discriminator 14)) [ 40.033529][ C2] [ 40.036442][ C2] [ 40.039327][ C2] asm_sysvec_apic_timer_interrupt (arch/x86/include/asm/idtentry.h:645) [ 40.045257][ C2] RIP: 0010:lock_acquire (kernel/locking/lockdep.c:5637) [ 40.050502][ C2] Code: ff ff 48 83 c4 20 65 0f c1 05 82 a1 cd 7e 83 f8 01 0f 85 80 02 00 00 48 83 7c 24 08 00 74 01 fb 48 b8 00 00 00 00 00 fc ff df <48> 01 c3 48 c7 03 00 00 00 00 48 c7 43 08 00 00 00 00 48 8b 84 24 All code ======== 0: ff (bad) 1: ff 48 83 decl -0x7d(%rax) 4: c4 (bad) 5: 20 65 0f and %ah,0xf(%rbp) 8: c1 05 82 a1 cd 7e 83 roll $0x83,0x7ecda182(%rip) # 0x7ecda191 f: f8 clc 10: 01 0f add %ecx,(%rdi) 12: 85 80 02 00 00 48 test %eax,0x48000002(%rax) 18: 83 7c 24 08 00 cmpl $0x0,0x8(%rsp) 1d: 74 01 je 0x20 1f: fb sti 20: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax 27: fc ff df 2a:* 48 01 c3 add %rax,%rbx <-- trapping instruction 2d: 48 c7 03 00 00 00 00 movq $0x0,(%rbx) 34: 48 c7 43 08 00 00 00 movq $0x0,0x8(%rbx) 3b: 00 3c: 48 rex.W 3d: 8b .byte 0x8b 3e: 84 .byte 0x84 3f: 24 .byte 0x24 Code starting with the faulting instruction =========================================== 0: 48 01 c3 add %rax,%rbx 3: 48 c7 03 00 00 00 00 movq $0x0,(%rbx) a: 48 c7 43 08 00 00 00 movq $0x0,0x8(%rbx) 11: 00 12: 48 rex.W 13: 8b .byte 0x8b 14: 84 .byte 0x84 15: 24 .byte 0x24 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests