Skip to content

Commit 80e935c

Browse files
paulmckrcuFrederic Weisbecker
authored andcommitted
rcutorture: Avoid printing cpu=-1 for no-fault RCU boost failure
If a CPU runs throughout the stalled grace period without passing through a quiescent state, RCU priority boosting cannot help. The rcu_torture_boost_failed() function therefore prints a message flagging the first such CPU. However, if the stall was instead due to (for example) RCU's grace-period kthread being starved of CPU, there will be no such CPU, causing rcu_check_boost_fail() to instead pass back -1 through its cpup CPU-pointer parameter. Therefore, the current message complains about a mythical CPU -1. This commit therefore checks for this situation, and notes that all CPUs have passed through a quiescent state. Signed-off-by: Paul E. McKenney <[email protected]> Reviewed-by: Neeraj Upadhyay <[email protected]> Signed-off-by: Frederic Weisbecker <[email protected]>
1 parent ff9ba8d commit 80e935c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

kernel/rcu/rcutorture.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,8 +1059,13 @@ static bool rcu_torture_boost_failed(unsigned long gp_state, unsigned long *star
10591059
// At most one persisted message per boost test.
10601060
j = jiffies;
10611061
lp = READ_ONCE(last_persist);
1062-
if (time_after(j, lp + mininterval) && cmpxchg(&last_persist, lp, j) == lp)
1063-
pr_info("Boost inversion persisted: No QS from CPU %d\n", cpu);
1062+
if (time_after(j, lp + mininterval) &&
1063+
cmpxchg(&last_persist, lp, j) == lp) {
1064+
if (cpu < 0)
1065+
pr_info("Boost inversion persisted: QS from all CPUs\n");
1066+
else
1067+
pr_info("Boost inversion persisted: No QS from CPU %d\n", cpu);
1068+
}
10641069
return false; // passed on a technicality
10651070
}
10661071
VERBOSE_TOROUT_STRING("rcu_torture_boost boosting failed");

0 commit comments

Comments
 (0)