diff options
| author | Itai Handler <itai.handler@gmail.com> | 2026-07-23 10:41:38 +0300 |
|---|---|---|
| committer | Paul E. McKenney <paulmck@kernel.org> | 2026-07-30 11:21:14 -0700 |
| commit | 27d73e81195b395270117ff77c47be2ed9b09b12 (patch) | |
| tree | b3080c0a4f14d6076b1c5602f08e796e2c9b69c1 /scripts/patch-kernel | |
| parent | 7f28a4c8f3f723a3b99cc59425e906b429108c48 (diff) | |
| download | linux-27d73e81195b395270117ff77c47be2ed9b09b12.tar.gz linux-27d73e81195b395270117ff77c47be2ed9b09b12.zip | |
rcu: Mark accesses to ->rcu_urgent_qs and ->rcu_need_heavy_qs
rcu_all_qs() and rcu_note_context_switch() read/clear the per-CPU
->rcu_urgent_qs and ->rcu_need_heavy_qs flags with plain raw_cpu_read()
and this_cpu_write(), while the RCU core clears them with WRITE_ONCE() in
rcu_disable_urgency_upon_qs(). KCSAN flags the resulting same-CPU race:
BUG: KCSAN: data-race in rcu_all_qs / rcu_disable_urgency_upon_qs
It is benign -- the flags are advisory and rcu_all_qs() re-reads
->rcu_urgent_qs with smp_load_acquire() before acting on it -- but these
are the last unmarked accesses to the two flags; every other access
already uses READ_ONCE()/WRITE_ONCE()/smp_*. Mark them to match. No
functional change.
Reproduced on a PREEMPT_NONE, CONFIG_KCSAN_INTERRUPT_WATCHER=y kernel with
a pthreads program whose threads (two per CPU) loop reading a large file:
for (;;) {
int fd = open("/proc/kallsyms", O_RDONLY);
while (read(fd, buf, sizeof(buf)) > 0)
;
close(fd);
}
The read()s drive cond_resched() -> rcu_all_qs() while the busy CPUs keep
the grace period urgent, so the RCU core clears the flags concurrently.
Fixes: 2dba13f0b6c2 ("rcu: Switch urgent quiescent-state requests to rcu_data structure")
Signed-off-by: Itai Handler <itai.handler@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'scripts/patch-kernel')
0 files changed, 0 insertions, 0 deletions
