2022-05-27 06:11:25

by Zqiang

[permalink] [raw]
Subject: [PATCH] rcu: Cleanup RCU urgency state for offline CPU

When an RCU grace period starts and at this time the CPU is in
the process of going offline, if the RCU gp-fqs occurs during the
time period when the CPU has passed the stop-machine but has not
yet entered the idle loop, and this CPU have not report quiescent
state yet, its urgent flags maybe is set, for example due to cbovld
is true, but this CPUs rcu urgent flags is not cleanup in rcu_report_dead()
when report qs. however for CPU that have been report qs, its rcu
urgent flags should cleanup, so add rcu_disable_urgency_upon_qs()
in rcu_report_dead() when CPU report qs.

Signed-off-by: Zqiang <[email protected]>
---
kernel/rcu/tree.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 02233b17cce0..6a01a48fe56d 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -4536,6 +4536,7 @@ void rcu_report_dead(unsigned int cpu)
rdp->rcu_ofl_gp_flags = READ_ONCE(rcu_state.gp_flags);
if (rnp->qsmask & mask) { /* RCU waiting on outgoing CPU? */
/* Report quiescent state -before- changing ->qsmaskinitnext! */
+ rcu_disable_urgency_upon_qs(rdp);
rcu_report_qs_rnp(mask, rnp, rnp->gp_seq, flags);
raw_spin_lock_irqsave_rcu_node(rnp, flags);
}
--
2.25.1



2022-05-28 20:21:33

by Paul E. McKenney

[permalink] [raw]
Subject: Re: [PATCH] rcu: Cleanup RCU urgency state for offline CPU

On Thu, May 26, 2022 at 09:55:12AM +0800, Zqiang wrote:
> When an RCU grace period starts and at this time the CPU is in
> the process of going offline, if the RCU gp-fqs occurs during the
> time period when the CPU has passed the stop-machine but has not
> yet entered the idle loop, and this CPU have not report quiescent
> state yet, its urgent flags maybe is set, for example due to cbovld
> is true, but this CPUs rcu urgent flags is not cleanup in rcu_report_dead()
> when report qs. however for CPU that have been report qs, its rcu
> urgent flags should cleanup, so add rcu_disable_urgency_upon_qs()
> in rcu_report_dead() when CPU report qs.
>
> Signed-off-by: Zqiang <[email protected]>

Good catch, thank you!

I have queued this on -rcu, and it will become visible on kernel.org
on my next rebase. Assuming good test results and no objections from
reviews, I will submit this not to the current merge window, but to
the next merge window (v5.20).

Thanx, Paul