From: paulmck@kernel.org
To: rcu@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com,
mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com,
akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org,
rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com,
fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org,
"Paul E. McKenney" <paulmck@kernel.org>
Subject: [PATCH tip/core/rcu 13/18] rcutorture: Add READ_ONCE() to rcu_torture_count and rcu_torture_batch
Date: Fri, 14 Feb 2020 16:41:20 -0800 [thread overview]
Message-ID: <20200215004125.16953-7-paulmck@kernel.org> (raw)
In-Reply-To: <20200215003634.GA16227@paulmck-ThinkPad-P72>
From: "Paul E. McKenney" <paulmck@kernel.org>
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>
---
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--) {
--
2.9.5
next prev parent reply other threads:[~2020-02-15 0:41 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-15 0:36 [PATCH tip/core/rcu 0/18] Torture-test updates for v5.7 Paul E. McKenney
2020-02-15 0:36 ` [PATCH tip/core/rcu 01/18] rcutorture: Suppress forward-progress complaints during early boot paulmck
2020-02-15 0:36 ` [PATCH tip/core/rcu 02/18] torture: Make results-directory date format completion-friendly paulmck
2020-02-15 0:36 ` [PATCH tip/core/rcu 03/18] rcutorture: Refrain from callback flooding during boot paulmck
2020-02-15 0:36 ` [PATCH tip/core/rcu 04/18] torture: Forgive -EBUSY from boottime CPU-hotplug operations paulmck
2020-02-15 0:36 ` [PATCH tip/core/rcu 05/18] rcutorture: Allow boottime stall warnings to be suppressed paulmck
2020-02-15 0:36 ` [PATCH tip/core/rcu 06/18] rcutorture: Suppress boottime bad-sequence warnings paulmck
2020-02-15 0:41 ` [PATCH tip/core/rcu 07/18] torture: Allow disabling of boottime CPU-hotplug torture operations paulmck
2020-02-15 0:41 ` [PATCH tip/core/rcu 08/18] rcutorture: Add 100-CPU configuration paulmck
2020-02-15 0:41 ` [PATCH tip/core/rcu 09/18] rcutorture: Summarize summary of build and run results paulmck
2020-02-15 0:41 ` [PATCH tip/core/rcu 10/18] rcutorture: Make kvm-find-errors.sh abort on bad directory paulmck
2020-02-15 0:41 ` [PATCH tip/core/rcu 11/18] rcutorture: Fix rcu_torture_one_read()/rcu_torture_writer() data race paulmck
2020-02-15 0:41 ` [PATCH tip/core/rcu 12/18] rcutorture: Fix stray access to rcu_fwd_cb_nodelay paulmck
2020-02-15 0:41 ` paulmck [this message]
2020-02-15 0:41 ` [PATCH tip/core/rcu 14/18] rcutorture: Annotation lockless accesses to rcu_torture_current paulmck
2020-02-15 0:41 ` [PATCH tip/core/rcu 15/18] rcuperf: Measure memory footprint during kfree_rcu() test paulmck
2020-02-15 0:41 ` [PATCH tip/core/rcu 16/18] rcutorture: Make rcu_torture_barrier_cbs() post from corresponding CPU paulmck
2020-02-15 0:41 ` [PATCH tip/core/rcu 17/18] rcutorture: Manually clean up after rcu_barrier() failure paulmck
2020-02-15 0:41 ` [PATCH tip/core/rcu 18/18] rcutorture: Set KCSAN Kconfig options to detect more data races paulmck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200215004125.16953-7-paulmck@kernel.org \
--to=paulmck@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=edumazet@google.com \
--cc=fweisbec@gmail.com \
--cc=jiangshanlai@gmail.com \
--cc=joel@joelfernandes.org \
--cc=josh@joshtriplett.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome