Skip to content

Commit c507e19

Browse files
paulmckrcuurezki
authored andcommitted
rcutorture: ASSERT_EXCLUSIVE_WRITER() for ->rtort_pipe_count updates
It turns out that only one CPU at a time will ever invoke rcu_torture_pipe_update_one() on a given rcu_torture structure. This commit therefore adds three ASSERT_EXCLUSIVE_WRITER() calls to enlist KCSAN's aid in checking this. Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
1 parent f803945 commit c507e19

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

kernel/rcu/rcutorture.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ rcu_torture_pipe_update_one(struct rcu_torture *rp)
466466
i = RCU_TORTURE_PIPE_LEN;
467467
atomic_inc(&rcu_torture_wcount[i]);
468468
WRITE_ONCE(rp->rtort_pipe_count, i + 1);
469+
ASSERT_EXCLUSIVE_WRITER(rp->rtort_pipe_count);
469470
if (rp->rtort_pipe_count >= RCU_TORTURE_PIPE_LEN) {
470471
rp->rtort_mbtest = 0;
471472
return true;
@@ -1399,6 +1400,7 @@ rcu_torture_writer(void *arg)
13991400
if (rp == NULL)
14001401
continue;
14011402
rp->rtort_pipe_count = 0;
1403+
ASSERT_EXCLUSIVE_WRITER(rp->rtort_pipe_count);
14021404
rcu_torture_writer_state = RTWS_DELAY;
14031405
udelay(torture_random(&rand) & 0x3ff);
14041406
rcu_torture_writer_state = RTWS_REPLACE;
@@ -1414,6 +1416,7 @@ rcu_torture_writer(void *arg)
14141416
atomic_inc(&rcu_torture_wcount[i]);
14151417
WRITE_ONCE(old_rp->rtort_pipe_count,
14161418
old_rp->rtort_pipe_count + 1);
1419+
ASSERT_EXCLUSIVE_WRITER(old_rp->rtort_pipe_count);
14171420

14181421
// Make sure readers block polled grace periods.
14191422
if (cur_ops->get_gp_state && cur_ops->poll_gp_state) {

0 commit comments

Comments
 (0)