Skip to contentSkip to conversation

18ce3c9e4c: BUG:spinlock_bad_magic_on_CPU

linux-next:master kernel test robot 2 participants 2 messages Mar 5, 2024 Memory management

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw

Hello,

kernel test robot noticed "BUG:spinlock_bad_magic_on_CPU" on:

commit: 18ce3c9e4c2d7cc1b7eaf1e8cc95be8e34209dac ("mm/zswap: global lru and shrinker shared by all zswap_pools")
https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master

[test failed on linux-next/master 67908bf6954b7635d33760ff6dfc189fc26ccc89]

in testcase: boot

compiler: clang-17
test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G

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

+----------------------------------------------------+------------+------------+
|                                                    | acc2918c08 | 18ce3c9e4c |
+----------------------------------------------------+------------+------------+
| BUG:spinlock_bad_magic_on_CPU                      | 0          | 12         |
+----------------------------------------------------+------------+------------+

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]

[   88.645344][    T8] BUG: spinlock bad magic on CPU#0, kworker/0:1/8
[ 88.645699][ T8] lock: zswap+0xd0/0x110, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0 
[   88.646351][    T8] CPU: 0 PID: 8 Comm: kworker/0:1 Tainted: G        W       TN 6.8.0-rc5-00353-g18ce3c9e4c2d #1
[   88.646922][    T8] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
[   88.647458][    T8] Workqueue: cgroup_destroy css_killed_work_fn
[   88.647785][    T8] Call Trace:
[   88.648049][    T8]  <TASK>
[ 88.648308][ T8] dump_stack_lvl (lib/dump_stack.c:107) 
[ 88.648557][ T8] do_raw_spin_lock (kernel/locking/spinlock_debug.c:?) 
[ 88.648807][ T8] zswap_memcg_offline_cleanup (mm/zswap.c:784) 
[ 88.649104][ T8] mem_cgroup_css_offline (mm/memcontrol.c:5675) 
[ 88.649382][ T8] ? __cfi_mem_cgroup_css_offline (mm/memcontrol.c:5654) 
[ 88.649689][ T8] css_killed_work_fn (kernel/cgroup/cgroup.c:5523) 
[ 88.650030][ T8] ? process_scheduled_works (kernel/workqueue.c:2608) 
[ 88.650451][ T8] process_scheduled_works (kernel/workqueue.c:2638) 
[ 88.650752][ T8] worker_thread (kernel/workqueue.c:?) 
[ 88.651006][ T8] ? __cfi_worker_thread (kernel/workqueue.c:2733) 
[ 88.651278][ T8] kthread (kernel/kthread.c:390) 
[ 88.651498][ T8] ? __cfi_kthread (kernel/kthread.c:341) 
[ 88.651745][ T8] ret_from_fork (arch/x86/kernel/process.c:153) 
[ 88.652030][ T8] ? __cfi_kthread (kernel/kthread.c:341) 
[ 88.652427][ T8] ret_from_fork_asm (arch/x86/entry/entry_64.S:250) 
[   88.652682][    T8]  </TASK>

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

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw
Quoted 33 lines · kernel test robot

Hello,

kernel test robot noticed "BUG:spinlock_bad_magic_on_CPU" on:

commit: 18ce3c9e4c2d7cc1b7eaf1e8cc95be8e34209dac ("mm/zswap: global lru and shrinker shared by all zswap_pools")
https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master

[test failed on linux-next/master 67908bf6954b7635d33760ff6dfc189fc26ccc89]

in testcase: boot

compiler: clang-17
test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G

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

+----------------------------------------------------+------------+------------+
|                                                    | acc2918c08 | 18ce3c9e4c |
+----------------------------------------------------+------------+------------+
| BUG:spinlock_bad_magic_on_CPU                      | 0          | 12         |
+----------------------------------------------------+------------+------------+

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]

Quoted 10 lines
[   88.645344][    T8] BUG: spinlock bad magic on CPU#0, kworker/0:1/8
[ 88.645699][ T8] lock: zswap+0xd0/0x110, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0 
[   88.646351][    T8] CPU: 0 PID: 8 Comm: kworker/0:1 Tainted: G        W       TN 6.8.0-rc5-00353-g18ce3c9e4c2d #1
[   88.646922][    T8] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
[   88.647458][    T8] Workqueue: cgroup_destroy css_killed_work_fn
[   88.647785][    T8] Call Trace:
[   88.648049][    T8]  <TASK>
[ 88.648308][ T8] dump_stack_lvl (lib/dump_stack.c:107) 
[ 88.648557][ T8] do_raw_spin_lock (kernel/locking/spinlock_debug.c:?) 
[ 88.648807][ T8] zswap_memcg_offline_cleanup (mm/zswap.c:784) 

Hmm, zswap is not enabled so this new spinlock is not initialized at all...

Maybe it's better to take Nhat's suggestion to change static struct zswap {} to multiple static variables, to keep in consistent with other global variables in zswap.

I will fix it and sent out a hotfix after testing.

Thanks.