Skip to content

Commit fc39760

Browse files
Frederic WeisbeckerNeeraj Upadhyay (AMD)
authored andcommitted
rcu/exp: Warn on QS requested on dying CPU
It is not possible to send an IPI to a dying CPU that has passed the CPUHP_TEARDOWN_CPU stage. Remaining unhandled IPIs are handled later at CPUHP_AP_SMPCFD_DYING stage by stop machine. This is the last opportunity for RCU exp handler to request an expedited quiescent state. And the upcoming final context switch between stop machine and idle must have reported the requested context switch. Therefore, it should not be possible to observe a pending requested expedited quiescent state when RCU finally stops watching the outgoing CPU. Once IPIs aren't possible anymore, the QS for the target CPU will be reported on its behalf by the RCU exp kworker. Provide an assertion to verify those expectations. Reviewed-by: Paul E. McKenney <[email protected]> Signed-off-by: Frederic Weisbecker <[email protected]> Signed-off-by: Joel Fernandes <[email protected]> Signed-off-by: Neeraj Upadhyay (AMD) <[email protected]>
1 parent bf0a574 commit fc39760

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

kernel/rcu/tree.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4356,6 +4356,12 @@ void rcutree_report_cpu_dead(void)
43564356
* may introduce a new READ-side while it is actually off the QS masks.
43574357
*/
43584358
lockdep_assert_irqs_disabled();
4359+
/*
4360+
* CPUHP_AP_SMPCFD_DYING was the last call for rcu_exp_handler() execution.
4361+
* The requested QS must have been reported on the last context switch
4362+
* from stop machine to idle.
4363+
*/
4364+
WARN_ON_ONCE(rdp->cpu_no_qs.b.exp);
43594365
// Do any dangling deferred wakeups.
43604366
do_nocb_deferred_wakeup(rdp);
43614367

0 commit comments

Comments
 (0)