Skip to content

Commit 635bdb9

Browse files
paulmckrcuNeeraj Upadhyay (AMD)
authored andcommitted
rcutorture: Start rcu_torture_writer() after rcu_torture_reader()
Testing of rcutorture's SRCU-P scenario on a large arm64 system resulted in rcu_torture_writer() forward-progress failures, but these same tests passed on x86. After some off-list discussion of possible memory-ordering causes for these failures, Boqun showed that these were in fact due to reordering, but by the scheduler, not by the memory system. On x86, rcu_torture_writer() would have run quickly enough that by the time the rcu_torture_updown() kthread started, the rcu_torture_current variable would already be initialized, thus avoiding a bug in which a NULL value would cause rcu_torture_updown() to do an extra call to srcu_up_read_fast(). This commit therefore moves creation of the rcu_torture_writer() kthread after that of the rcu_torture_reader() kthreads. This results in deterministic failures on x86. What about the double-srcu_up_read_fast() bug? Boqun has the fix. But let's also fix the test while we are at it! Reported-by: Joel Fernandes <[email protected]> Reported-by: Boqun Feng <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> Signed-off-by: Joel Fernandes <[email protected]> Signed-off-by: Neeraj Upadhyay (AMD) <[email protected]>
1 parent 9ea40db commit 635bdb9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

kernel/rcu/rcutorture.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4246,11 +4246,6 @@ rcu_torture_init(void)
42464246
/* Start up the kthreads. */
42474247

42484248
rcu_torture_write_types();
4249-
firsterr = torture_create_kthread(rcu_torture_writer, NULL,
4250-
writer_task);
4251-
if (torture_init_error(firsterr))
4252-
goto unwind;
4253-
42544249
if (nrealfakewriters > 0) {
42554250
fakewriter_tasks = kcalloc(nrealfakewriters,
42564251
sizeof(fakewriter_tasks[0]),
@@ -4283,6 +4278,12 @@ rcu_torture_init(void)
42834278
if (torture_init_error(firsterr))
42844279
goto unwind;
42854280
}
4281+
4282+
firsterr = torture_create_kthread(rcu_torture_writer, NULL,
4283+
writer_task);
4284+
if (torture_init_error(firsterr))
4285+
goto unwind;
4286+
42864287
nrealnocbers = nocbs_nthreads;
42874288
if (WARN_ON(nrealnocbers < 0))
42884289
nrealnocbers = 1;

0 commit comments

Comments
 (0)