diff options
| author | Paul E. McKenney <paulmck@kernel.org> | 2026-09-18 17:25:23 -0700 |
|---|---|---|
| committer | Thomas Gleixner <tglx@kernel.org> | 2026-09-29 21:07:15 +0200 |
| commit | bb41ece16463b76b4d73fc47e6648fd823236765 (patch) | |
| tree | 559e97dba117de3b9eb8a0f37b4a8c9ea5ba18c8 /kernel | |
| parent | 1159ad0a6aaa414dc726a33ccdcb702752d1b8eb (diff) | |
| download | linux-next-bb41ece16463b76b4d73fc47e6648fd823236765.tar.gz linux-next-bb41ece16463b76b4d73fc47e6648fd823236765.zip | |
timers/migration: Mark racy updates to tmigr_event::ignore field
The tmigr_event structure's ignore field is sometimes accessed locklessly,
but the __tmigr_cpu_activate(), tmigr_cpu_new_timer(), and
__tmigr_cpu_deactivate() functions do not mark accesses to this field.
Therefore, use READ_ONCE() for the tmigr_cpu_new_timer() function's
lockless load and WRITE_ONCE() for the __tmigr_cpu_activate() and
__tmigr_cpu_deactivate() functions' stores.
KCSAN located this issue.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260919002523.3133928-2-paulmck@kernel.org
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/time/timer_migration.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c index 059d43355e65..f920e73fff51 100644 --- a/kernel/time/timer_migration.c +++ b/kernel/time/timer_migration.c @@ -715,7 +715,7 @@ static void __tmigr_cpu_activate(struct tmigr_cpu *tmc) trace_tmigr_cpu_active(tmc); - tmc->cpuevt.ignore = true; + WRITE_ONCE(tmc->cpuevt.ignore, true); WRITE_ONCE(tmc->wakeup, KTIME_MAX); walk_groups(&tmigr_active_up, &data, tmc); @@ -1258,7 +1258,7 @@ u64 tmigr_cpu_new_timer(u64 nextexp) ret = READ_ONCE(tmc->wakeup); if (nextexp != KTIME_MAX) { if (nextexp != tmc->cpuevt.nextevt.expires || - tmc->cpuevt.ignore) { + READ_ONCE(tmc->cpuevt.ignore)) { ret = tmigr_new_timer(tmc, nextexp); /* * Make sure the reevaluation of timers in idle path @@ -1362,7 +1362,7 @@ static u64 __tmigr_cpu_deactivate(struct tmigr_cpu *tmc, u64 nextexp) * or CPU goes offline. */ if (nextexp != KTIME_MAX) - tmc->cpuevt.ignore = false; + WRITE_ONCE(tmc->cpuevt.ignore, false); walk_groups(&tmigr_inactive_up, &data, tmc); return data.firstexp; |
