Skip to contentSkip to conversation

10a0e6f3d3: BUG:KCSAN:data-race_in__tmigr_cpu_activate/print_report

linus:master kernel test robot 2 participants 2 messages Jan 3, 2025 – Jan 4, 2025

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw

Hello,

kernel test robot noticed "BUG:KCSAN:data-race_in__tmigr_cpu_activate/print_report" on:

commit: 10a0e6f3d3db7dcfe36e578923e5f038f1d2b72a ("timers/migration: Move hierarchy setup into cpuhotplug prepare callback")
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master

[test failed on linus/master ccb98ccef0e543c2bd4ef1a72270461957f3d8d0]
[test failed on linux-next/master 8155b4ef3466f0e289e8fcc9e6e62f3f4dceeac2]

in testcase: trinity
version:
with following parameters:

	runtime: 300s
	group: group-00
	nr_groups: 5

config: x86_64-randconfig-003-20241231
compiler: gcc-12
test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G

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

we observed the issue happens randomly, but keeps clean on parent.

facd40aa5c4699f9 10a0e6f3d3db7dcfe36e578923e
---------------- ---------------------------
fail:runs %reproduction fail:runs
| | |
:48 17% 8:48 dmesg.BUG:KCSAN:data-race_in__tmigr_cpu_activate/print_report

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]

[   30.027314][    T0] BUG: KCSAN: data-race in __tmigr_cpu_activate / print_report
[   30.027314][    T0]
[   30.027314][    T0] write to 0xffff88842fc28004 of 1 bytes by task 0 on cpu 0:
[ 30.027314][ T0] __tmigr_cpu_activate (kernel/time/timer_migration.c:689)
[ 30.027314][ T0] tmigr_cpu_activate (kernel/time/timer_migration.c:713)
[ 30.027314][ T0] timer_clear_idle (kernel/time/timer.c:2380 (discriminator 22))
[ 30.027314][ T0] tick_nohz_restart_sched_tick (kernel/time/tick-sched.c:1097)
[ 30.027314][ T0] tick_nohz_idle_exit (kernel/time/tick-sched.c:1442 kernel/time/tick-sched.c:1483)
[ 30.027314][ T0] do_idle (arch/x86/include/asm/bitops.h:75 include/linux/sched/idle.h:36 kernel/sched/idle.c:346)
[ 30.027314][ T0] cpu_startup_entry (kernel/sched/idle.c:429 (discriminator 1))
[ 30.027314][ T0] kernel_init (init/main.c:1459)
[ 30.027314][ T0] do_initcalls (init/main.c:1333)
[ 30.027314][ T0] clear_bss (arch/x86/kernel/head64.c:381)
[ 30.027314][ T0] reserve_bios_regions (arch/x86/kernel/ebda.c:57)
[ 30.027314][ T0] common_startup_64 (arch/x86/kernel/head_64.S:421)
[   30.027314][    T0]
[   30.027314][    T0] read to 0xffff88842fc28004 of 1 bytes by task 0 on cpu 1:
[ 30.027314][ T0] print_report (kernel/kcsan/report.c:395)
[ 30.027314][ T0] kcsan_report_known_origin (kernel/kcsan/report.c:504 kernel/kcsan/report.c:694)
[ 30.027314][ T0] kcsan_setup_watchpoint (kernel/kcsan/core.c:678)
[ 30.027314][ T0] tmigr_next_groupevt (kernel/time/timer_migration.c:576)
[ 30.027314][ T0] tmigr_update_events (kernel/time/timer_migration.c:618 kernel/time/timer_migration.c:853)
[ 30.027314][ T0] tmigr_inactive_up (kernel/time/timer_migration.c:1327)
[ 30.027314][ T0] __walk_groups+0x50/0x77
[ 30.027314][ T0] walk_groups (kernel/time/timer_migration.c:501 (discriminator 9))
[ 30.027314][ T0] __tmigr_cpu_deactivate (kernel/time/timer_migration.c:1351)
[ 30.027314][ T0] tmigr_cpu_deactivate (kernel/time/timer_migration.c:1374)
[ 30.027314][ T0] __get_next_timer_interrupt (kernel/time/timer.c:2192 kernel/time/timer.c:2267)
[ 30.027314][ T0] timer_base_try_to_set_idle (kernel/time/timer.c:2357)
[ 30.027314][ T0] tick_nohz_stop_tick (kernel/time/tick-sched.c:987)
[ 30.027314][ T0] tick_nohz_idle_stop_tick (kernel/time/tick-sched.c:1228)
[ 30.027314][ T0] cpuidle_idle_call (kernel/sched/idle.c:191)
[ 30.027314][ T0] do_idle (kernel/sched/idle.c:334)
[ 30.027314][ T0] cpu_startup_entry (kernel/sched/idle.c:429 (discriminator 1))
[ 30.027314][ T0] common_cpu_up (arch/x86/kernel/smpboot.c:850)
[ 30.027314][ T0] common_startup_64 (arch/x86/kernel/head_64.S:421)
[   30.027314][    T0]
[   30.027314][    T0] value changed: 0x00 -> 0x01
[   30.027314][    T0]
[   30.027314][    T0] Reported by Kernel Concurrency Sanitizer on:
[   30.027314][    T0] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G                T  6.10.0-rc6-00002-g10a0e6f3d3db #1
[   30.027314][    T0] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
[   30.027314][    T0] ==================================================================

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

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

Hello,

kernel test robot noticed "BUG:KCSAN:data-race_in__tmigr_cpu_activate/print_report" on:

commit: 10a0e6f3d3db7dcfe36e578923e5f038f1d2b72a ("timers/migration: Move hierarchy setup into cpuhotplug prepare callback")
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master

[test failed on linus/master ccb98ccef0e543c2bd4ef1a72270461957f3d8d0]
[test failed on linux-next/master 8155b4ef3466f0e289e8fcc9e6e62f3f4dceeac2]

in testcase: trinity
version:
with following parameters:

	runtime: 300s
	group: group-00
	nr_groups: 5

config: x86_64-randconfig-003-20241231
compiler: gcc-12
test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G

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

we observed the issue happens randomly, but keeps clean on parent.

facd40aa5c4699f9 10a0e6f3d3db7dcfe36e578923e
---------------- ---------------------------
fail:runs %reproduction fail:runs
| | |
:48 17% 8:48 dmesg.BUG:KCSAN:data-race_in__tmigr_cpu_activate/print_report

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]

[   30.027314][    T0] BUG: KCSAN: data-race in __tmigr_cpu_activate / print_report
[   30.027314][    T0]
[   30.027314][    T0] write to 0xffff88842fc28004 of 1 bytes by task 0 on cpu 0:
[ 30.027314][ T0] __tmigr_cpu_activate (kernel/time/timer_migration.c:689)
[ 30.027314][ T0] tmigr_cpu_activate (kernel/time/timer_migration.c:713)
[ 30.027314][ T0] timer_clear_idle (kernel/time/timer.c:2380 (discriminator 22))
[ 30.027314][ T0] tick_nohz_restart_sched_tick (kernel/time/tick-sched.c:1097)
[ 30.027314][ T0] tick_nohz_idle_exit (kernel/time/tick-sched.c:1442 kernel/time/tick-sched.c:1483)
[ 30.027314][ T0] do_idle (arch/x86/include/asm/bitops.h:75 include/linux/sched/idle.h:36 kernel/sched/idle.c:346)
[ 30.027314][ T0] cpu_startup_entry (kernel/sched/idle.c:429 (discriminator 1))
[ 30.027314][ T0] kernel_init (init/main.c:1459)
[ 30.027314][ T0] do_initcalls (init/main.c:1333)
[ 30.027314][ T0] clear_bss (arch/x86/kernel/head64.c:381)
[ 30.027314][ T0] reserve_bios_regions (arch/x86/kernel/ebda.c:57)
[ 30.027314][ T0] common_startup_64 (arch/x86/kernel/head_64.S:421)
Quoted 8 lines
[   30.027314][    T0]
[   30.027314][    T0] read to 0xffff88842fc28004 of 1 bytes by task 0 on cpu 1:
[ 30.027314][ T0] print_report (kernel/kcsan/report.c:395)
[ 30.027314][ T0] kcsan_report_known_origin (kernel/kcsan/report.c:504 kernel/kcsan/report.c:694)
[ 30.027314][ T0] kcsan_setup_watchpoint (kernel/kcsan/core.c:678)
[ 30.027314][ T0] tmigr_next_groupevt (kernel/time/timer_migration.c:576)
[ 30.027314][ T0] tmigr_update_events (kernel/time/timer_migration.c:618 kernel/time/timer_migration.c:853)
[ 30.027314][ T0] tmigr_inactive_up (kernel/time/timer_migration.c:1327)

It looks like the .ignore flag accesses and I think it should be tagged as a voluntary data_race().

Let me cook a patch for that.

Thanks.