summaryrefslogtreecommitdiffstats
path: root/kernel/rcu
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2020-01-03 16:27:00 -0800
committerPaul E. McKenney <paulmck@kernel.org>2020-02-20 16:03:31 -0800
commitf042a436c8dc9f9cfe8ed1ee5de372697269657d (patch)
treef026309a51c6ff18e4e5f53a027f7977344dfca5 /kernel/rcu
parent102c14d2f87976e8390d2cb892ccd14e3532e020 (diff)
downloadlinux-stable-f042a436c8dc9f9cfe8ed1ee5de372697269657d.tar.gz
linux-stable-f042a436c8dc9f9cfe8ed1ee5de372697269657d.tar.bz2
linux-stable-f042a436c8dc9f9cfe8ed1ee5de372697269657d.zip
rcutorture: Add READ_ONCE() to rcu_torture_count and rcu_torture_batch
The rcutorture rcu_torture_count and rcu_torture_batch per-CPU variables are read locklessly, so this commit adds the READ_ONCE() to a load in order to avoid various types of compiler vandalism^Woptimization. This data race was reported by KCSAN. Not appropriate for backporting due to failure being unlikely and due to this being rcutorture. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'kernel/rcu')
-rw-r--r--kernel/rcu/rcutorture.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 124160a610fa..0b9ce9a00623 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -1413,8 +1413,8 @@ rcu_torture_stats_print(void)
for_each_possible_cpu(cpu) {
for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) {
- pipesummary[i] += per_cpu(rcu_torture_count, cpu)[i];
- batchsummary[i] += per_cpu(rcu_torture_batch, cpu)[i];
+ pipesummary[i] += READ_ONCE(per_cpu(rcu_torture_count, cpu)[i]);
+ batchsummary[i] += READ_ONCE(per_cpu(rcu_torture_batch, cpu)[i]);
}
}
for (i = RCU_TORTURE_PIPE_LEN - 1; i >= 0; i--) {