Re: [PATCH] btrfs: sink RCU protection to _btrfs_printk()

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-lkp,org.kernel.vger.linux-btrfs
Message-ID <[email protected]>

Hello,

kernel test robot noticed "WARNING:suspicious_RCU_usage" on:

commit: a7bc95298723a9c79cc429adfb7dc1f37ff55a8d ("[PATCH] btrfs: sink RCU protection to _btrfs_printk()")
url: https://github.com/intel-lab-lkp/linux/commits/David-Sterba/btrfs-sink-RCU-protection-to-_btrfs_printk/20260205-194735
base: https://git.kernel.org/cgit/linux/kernel/git/kdave/linux.git for-next
patch link: https://lore.kernel.org/all/[email protected]/
patch subject: [PATCH] btrfs: sink RCU protection to _btrfs_printk()

in testcase: perf-sanity-tests
version: 
with following parameters:

	perf_compiler: clang
	group: group-02



config: x86_64-rhel-9.4-bpf
compiler: gcc-14
test machine: 64 threads 2 sockets Intel(R) Xeon(R) Gold 6346 CPU @ 3.10GHz (Ice Lake) with 256G memory

(please refer to attached dmesg/kmsg for entire log/backtrace)



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-lkp/[email protected]



kern  :warn  : [  282.723760] [   T5053] WARNING: suspicious RCU usage
kern  :warn  : [  282.723764] [   T5053] 6.19.0-rc8-00144-ga7bc95298723 #1 Tainted: G S
kern  :warn  : [  282.723768] [   T5053] -----------------------------
kern  :warn  : [  282.723769] [   T5053] fs/btrfs/volumes.h:856 suspicious rcu_dereference_check() usage!
kern  :warn  : [  282.723773] [   T5053]
other info that might help us debug this:

kern  :warn  : [  282.723775] [   T5053]
rcu_scheduler_active = 2, debug_locks = 1
kern  :warn  : [  282.723778] [   T5053] 4 locks held by mount/5053:
kern  :warn  : [  282.723780] [   T5053]  #0: ff1100058fa07c70 (&fc->uapi_mutex){+.+.}-{4:4}, at: __do_sys_fsconfig (fs/fsopen.c:472)

kern  :warn  : [  282.733684] [   T5053]  #1: ff1100080763a0e0 (&type->s_umount_key#45
user  :notice: [  282.739077] [    T979]   File "/usr/bin/py3clean", line 209, in <module>
kern  :warn  : [  282.746062] [   T5053] /1

kern  :warn  : [  282.758521] [   T5053] ){+.+.}-{4:4}, at: alloc_super (fs/super.c:346)
user  :notice: [  282.768758] [    T979]     main()
kern  :warn  : [  282.776531] [   T5053]  #2: ff110005cb3fb8d8 (&fs_devs->device_list_mutex){+.+.}-{4:4}

kern  :warn  : [  282.790726] [   T5053] , at: btrfs_init_dev_stats (fs/btrfs/volumes.c:7975) btrfs
user  :notice: [  282.793082] [    T979]     ~~~~^^
kern  :warn  : [  282.799023] [   T5053]  #3:

kern  :warn  : [  282.807834] [   T5053] ff1100019d555d18 (btrfs-dev-00
user  :notice: [  282.810637] [    T979]   File "/usr/bin/py3clean", line 195, in main
kern  :warn  : [  282.815878] [   T5053] ){.+.+}-{4:4}, at: btrfs_tree_read_lock_nested (arch/x86/include/asm/jump_label.h:37 include/trace/events/btrfs.h:2293 fs/btrfs/locking.c:147) btrfs

kern  :warn  : [  282.826610] [   T5053]
stack backtrace:
kern  :warn  : [  282.826616] [   T5053] CPU: 9 UID: 0 PID: 5053 Comm: mount Tainted: G S                  6.19.0-rc8-00144-ga7bc95298723 #1 PREEMPT(full)
kern  :warn  : [  282.826622] [   T5053] Tainted: [S]=CPU_OUT_OF_SPEC
kern  :warn  : [  282.826624] [   T5053] Hardware name: Inspur NF5180M6/NF5180M6, BIOS 06.00.04 04/12/2022
kern  :warn  : [  282.826626] [   T5053] Call Trace:
kern  :warn  : [  282.826630] [   T5053]  <TASK>
kern  :warn  : [  282.826632] [   T5053]  dump_stack_lvl (lib/dump_stack.c:122)
kern  :warn  : [  282.826640] [   T5053]  lockdep_rcu_suspicious.cold (kernel/locking/lockdep.c:6877)
kern  :warn  : [  282.826648] [   T5053] btrfs_dev_name (fs/btrfs/volumes.h:856 (discriminator 9) fs/btrfs/volumes.h:851 (discriminator 9)) btrfs
kern  :warn  : [  282.826845] [   T5053] btrfs_device_init_dev_stats (fs/btrfs/volumes.c:8119 (discriminator 6) fs/btrfs/volumes.c:7957 (discriminator 6)) btrfs
kern  :warn  : [  282.827048] [   T5053]  ? __pfx_btrfs_device_init_dev_stats (fs/btrfs/volumes.c:7921) btrfs
kern  :warn  : [  282.827256] [   T5053]  ? kasan_save_track (mm/kasan/common.c:70 (discriminator 1) mm/kasan/common.c:79 (discriminator 1))
kern  :warn  : [  282.827262] [   T5053]  ? __kasan_slab_alloc (mm/kasan/common.c:340 mm/kasan/common.c:366)
kern  :warn  : [  282.827267] [   T5053]  ? __rcu_read_lock (kernel/rcu/tree_plugin.h:416 (discriminator 2))
kern  :warn  : [  282.827273] [   T5053]  ? kmem_cache_alloc_noprof (include/trace/events/kmem.h:12 (discriminator 2) mm/slub.c:5273 (discriminator 2))
kern  :warn  : [  282.827280] [   T5053]  ? btrfs_init_dev_stats (fs/btrfs/volumes.c:7970) btrfs
kern  :warn  : [  282.827494] [   T5053] btrfs_init_dev_stats (fs/btrfs/volumes.c:7977) btrfs
kern  :warn  : [  282.827707] [   T5053] open_ctree (fs/btrfs/disk-io.c:3546) btrfs
kern  :warn  : [  282.827910] [   T5053] btrfs_get_tree_super.cold (fs/btrfs/super.c:982 fs/btrfs/super.c:1944) btrfs
kern  :warn  : [  282.828112] [   T5053] btrfs_get_tree_subvol (fs/btrfs/super.c:2087) btrfs
kern  :warn  : [  282.828315] [   T5053]  vfs_get_tree (fs/super.c:1751)
kern  :warn  : [  282.828322] [   T5053]  vfs_cmd_create (fs/fsopen.c:231)
kern  :warn  : [  282.828328] [   T5053]  __do_sys_fsconfig (fs/fsopen.c:474)
kern  :warn  : [  282.828333] [   T5053]  ? __pfx___do_sys_fsconfig (fs/fsopen.c:356)
kern  :warn  : [  282.828337] [   T5053]  ? do_faccessat (fs/open.c:530)
kern  :warn  : [  282.828345] [   T5053]  ? __pfx_do_faccessat (fs/open.c:465)
kern  :warn  : [  282.828352] [   T5053]  ? do_syscall_64 (arch/x86/include/asm/irqflags.h:42 arch/x86/include/asm/irqflags.h:119 include/linux/entry-common.h:108 arch/x86/entry/syscall_64.c:90)
kern  :warn  : [  282.828360] [   T5053]  do_syscall_64 (arch/x86/entry/syscall_64.c:63 (discriminator 1) arch/x86/entry/syscall_64.c:94 (discriminator 1))
kern  :warn  : [  282.828364] [   T5053]  ? do_syscall_64 (include/linux/irq-entry-common.h:298 include/linux/entry-common.h:196 arch/x86/entry/syscall_64.c:100)
kern  :warn  : [  282.828371] [   T5053]  ? do_syscall_64 (arch/x86/entry/syscall_64.c:113)
kern  :warn  : [  282.828376] [   T5053]  ? do_syscall_64 (include/linux/irq-entry-common.h:298 include/linux/entry-common.h:196 arch/x86/entry/syscall_64.c:100)
kern  :warn  : [  282.828382] [   T5053]  ? do_syscall_64 (arch/x86/entry/syscall_64.c:113)
kern  :warn  : [  282.828386] [   T5053]  ? __pfx_from_kgid_munged (kernel/user_namespace.c:534)
kern  :warn  : [  282.828392] [   T5053]  ? do_syscall_64 (include/linux/irq-entry-common.h:298 include/linux/entry-common.h:196 arch/x86/entry/syscall_64.c:100)
kern  :warn  : [  282.828396] [   T5053]  ? do_syscall_64 (include/linux/irq-entry-common.h:298 include/linux/entry-common.h:196 arch/x86/entry/syscall_64.c:100)
kern  :warn  : [  282.828402] [   T5053]  ? do_syscall_64 (arch/x86/entry/syscall_64.c:113)
kern  :warn  : [  282.828406] [   T5053]  ? do_syscall_64 (arch/x86/entry/syscall_64.c:113)
kern  :warn  : [  282.828409] [   T5053]  ? do_syscall_64 (include/linux/irq-entry-common.h:298 include/linux/entry-common.h:196 arch/x86/entry/syscall_64.c:100)
kern  :warn  : [  282.828415] [   T5053]  ? do_syscall_64 (arch/x86/entry/syscall_64.c:113)
kern  :warn  : [  282.828418] [   T5053]  ? lockdep_hardirqs_on_prepare (kernel/locking/lockdep.c:4629 (discriminator 4))
kern  :warn  : [  282.828423] [   T5053]  ? clear_bhb_loop (arch/x86/entry/entry_64.S:1549)
kern  :warn  : [  282.828430] [   T5053]  entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:131)
kern  :warn  : [  282.828434] [   T5053] RIP: 0033:0x7f5027d8b4aa
kern  :warn  : [  282.828458] [   T5053] Code: 73 01 c3 48 8b 0d 4e 59 0d 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 49 89 ca b8 af 01 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 1e 59 0d 00 f7 d8 64 89 01 48
All code
========
   0:	73 01                	jae    0x3
   2:	c3                   	ret
   3:	48 8b 0d 4e 59 0d 00 	mov    0xd594e(%rip),%rcx        # 0xd5958
   a:	f7 d8                	neg    %eax
   c:	64 89 01             	mov    %eax,%fs:(%rcx)
   f:	48 83 c8 ff          	or     $0xffffffffffffffff,%rax
  13:	c3                   	ret
  14:	66 2e 0f 1f 84 00 00 	cs nopw 0x0(%rax,%rax,1)
  1b:	00 00 00 
  1e:	66 90                	xchg   %ax,%ax
  20:	49 89 ca             	mov    %rcx,%r10
  23:	b8 af 01 00 00       	mov    $0x1af,%eax
  28:	0f 05                	syscall
  2a:*	48 3d 01 f0 ff ff    	cmp    $0xfffffffffffff001,%rax		<-- trapping instruction
  30:	73 01                	jae    0x33
  32:	c3                   	ret
  33:	48 8b 0d 1e 59 0d 00 	mov    0xd591e(%rip),%rcx        # 0xd5958
  3a:	f7 d8                	neg    %eax
  3c:	64 89 01             	mov    %eax,%fs:(%rcx)
  3f:	48                   	rex.W

Code starting with the faulting instruction
===========================================
   0:	48 3d 01 f0 ff ff    	cmp    $0xfffffffffffff001,%rax
   6:	73 01                	jae    0x9
   8:	c3                   	ret
   9:	48 8b 0d 1e 59 0d 00 	mov    0xd591e(%rip),%rcx        # 0xd592e
  10:	f7 d8                	neg    %eax
  12:	64 89 01             	mov    %eax,%fs:(%rcx)
  15:	48                   	rex.W
kern  :warn  : [  282.828462] [   T5053] RSP: 002b:00007ffde3afb828 EFLAGS: 00000246 ORIG_RAX: 00000000000001af
kern  :warn  : [  282.828466] [   T5053] RAX: ffffffffffffffda RBX: 0000561df73281d0 RCX: 00007f5027d8b4aa
kern  :warn  : [  282.828469] [   T5053] RDX: 0000000000000000 RSI: 0000000000000006 RDI: 0000000000000003
kern  :warn  : [  282.828472] [   T5053] RBP: 0000561df7329ca0 R08: 0000000000000000 R09: 0000000000000000
kern  :warn  : [  282.828474] [   T5053] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
kern  :warn  : [  282.828476] [   T5053] R13: 00007f5027f1d580 R14: 00007f5027f1f26c R15: 00007f5027f04a23
kern  :warn  : [  282.828490] [   T5053]  </TASK>
kern  :info  : [  282.828501] [   T5053] BTRFS info (device nvme0n1p4): bdev /dev/nvme0n1p4 errs: wr 0, rd 0, flush 0, corrupt 3073, gen 0
user  :notice: [  282.829495] [    T979]     pfiles = set(dpf.from_package(options.package))
kern  :info  : [  282.868038] [   T5053] BTRFS info (device nvme0n1p4): enabling ssd optimizations

kern  :info  : [  282.871066] [   T5053] BTRFS info (device nvme0n1p4): turning on async discard
kern  :info  : [  282.871071] [   T5053] BTRFS info (device nvme0n1p4): enabling disk space caching



The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20260213/[email protected]



-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.