Greeting, FYI, we noticed BUG:spinlock_bad_magic_on_CPU due to commit (built with gcc-11): commit: 56718b9a847cc1fb7e5e4a3ef2e076e6ea3482f3 ("[PATCH RFC] tick/nohz: fix data races in get_cpu_idle_time_us()") url: https://github.com/intel-lab-lkp/linux/commits/Yu-Liao/tick-nohz-fix-data-races-in-get_cpu_idle_time_us/20230128-120617 base: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git 5af6ce7049365952f7f023155234fe091693ead1 patch link: https://lore.kernel.org/all/20230128020051.2328465-1-liaoyu15@huawei.com/ patch subject: [PATCH RFC] tick/nohz: fix data races in get_cpu_idle_time_us() in testcase: kernel-selftests version: kernel-selftests-x86_64-d4cf28ee-1_20230110 with following parameters: group: group-01 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: 4 threads Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz (Skylake) with 16G 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/202302061304.e7a0e377-oliver.sang@intel.com [ 78.048403][ T0] BUG: spinlock bad magic on CPU#3, swapper/3/0 [ 78.054523][ T0] lock: 0xffff88837f5ac3a0, .magic: 00000000, .owner: /-1, .owner_cpu: 0 [ 78.063433][ T0] CPU: 3 PID: 0 Comm: swapper/3 Not tainted 6.2.0-rc5-00200-g56718b9a847c #1 [ 78.072057][ T0] Hardware name: HP HP Z238 Microtower Workstation/8183, BIOS N51 Ver. 01.63 10/05/2017 [ 78.081637][ T0] Call Trace: [ 78.084789][ T0] [ 78.087593][ T0] dump_stack_lvl (lib/dump_stack.c:107 (discriminator 4)) [ 78.091970][ T0] do_raw_spin_lock (kernel/locking/spinlock_debug.c:85 kernel/locking/spinlock_debug.c:114) [ 78.096691][ T0] ? rwlock_bug+0x90/0x90 [ 78.101499][ T0] ? lock_downgrade (kernel/locking/lockdep.c:5320) [ 78.106221][ T0] _raw_spin_lock_irqsave (kernel/locking/spinlock.c:162) [ 78.111289][ T0] ? tick_nohz_idle_enter (kernel/time/tick-sched.c:680 (discriminator 3) kernel/time/tick-sched.c:1173 (discriminator 3)) [ 78.116442][ T0] tick_nohz_idle_enter (kernel/time/tick-sched.c:680 (discriminator 3) kernel/time/tick-sched.c:1173 (discriminator 3)) [ 78.121437][ T0] do_idle (include/linux/cpumask.h:444 include/linux/cpumask.h:1030 kernel/sched/idle.c:284) [ 78.125285][ T0] cpu_startup_entry (kernel/sched/idle.c:399 (discriminator 1)) [ 78.129919][ T0] start_secondary (arch/x86/kernel/smpboot.c:198 arch/x86/kernel/smpboot.c:232) [ 78.134544][ T0] ? set_cpu_sibling_map (arch/x86/kernel/smpboot.c:216) [ 78.139874][ T0] secondary_startup_64_no_verify (arch/x86/kernel/head_64.S:358) [ 78.145638][ T0] To reproduce: git clone https://github.com/intel/lkp-tests.git cd lkp-tests sudo bin/lkp install job.yaml # job file is attached in this email bin/lkp split-job --compatible job.yaml # generate the yaml file for lkp run sudo bin/lkp run generated-yaml-file # if come across any failure that blocks the test, # please remove ~/.lkp and /lkp dir to run from a clean state. -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests