[<prev] [next>] [day] [month] [year] [list]
Message-ID: <158504139248.28353.2678997832857467483.tip-bot2@tip-bot2>
Date: Tue, 24 Mar 2020 09:16:32 -0000
From: "tip-bot2 for Paul E. McKenney" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: "Paul E. McKenney" <paulmck@...nel.org>, x86 <x86@...nel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: [tip: core/rcu] rcutorture: Add READ_ONCE() to rcu_torture_count and
rcu_torture_batch
The following commit has been merged into the core/rcu branch of tip:
Commit-ID: f042a436c8dc9f9cfe8ed1ee5de372697269657d
Gitweb: https://git.kernel.org/tip/f042a436c8dc9f9cfe8ed1ee5de372697269657d
Author: Paul E. McKenney <paulmck@...nel.org>
AuthorDate: Fri, 03 Jan 2020 16:27:00 -08:00
Committer: Paul E. McKenney <paulmck@...nel.org>
CommitterDate: Thu, 20 Feb 2020 16:03:31 -08:00
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@...nel.org>
---
kernel/rcu/rcutorture.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 124160a..0b9ce9a 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--) {
Powered by blists - more mailing lists