mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Boqun Feng <boqun.feng@gmail.com>,
	Joel Fernandes <joelagnelf@nvidia.com>,
	Neeraj Upadhyay <neeraj.upadhyay@amd.com>,
	Uladzislau Rezki <urezki@gmail.com>,
	Zqiang <qiang.zhang1211@gmail.com>, rcu <rcu@vger.kernel.org>
Subject: Re: [PATCH 4/5] rcu/exp: Warn on QS requested on dying CPU
Date: Tue, 18 Mar 2025 10:21:48 -0700	[thread overview]
Message-ID: <476d11c8-ff63-4abc-a894-b9dabf92df8b@paulmck-laptop> (raw)
In-Reply-To: <20250314143642.72554-5-frederic@kernel.org>

On Fri, Mar 14, 2025 at 03:36:41PM +0100, Frederic Weisbecker wrote:
> 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.
> 
> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>

But what do we do if this assertion triggers?  And do we want it to take
effect only in kernels built with CONFIG_PROVE_RCU?  Or is such a broken
assumption bad enough to justify a splat in production kernels?

If the answer to the last question is "yes" (and you, not me, work for
a distro, so it is your question to answer):

Reviewed-by: Paul E. McKenney <paulmck@kernel.org>

							Thanx, Paul

> ---
>  kernel/rcu/tree.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 3fe68057d8b4..79dced5fb72e 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -4321,6 +4321,12 @@ void rcutree_report_cpu_dead(void)
>  	 * may introduce a new READ-side while it is actually off the QS masks.
>  	 */
>  	lockdep_assert_irqs_disabled();
> +	/*
> +	 * CPUHP_AP_SMPCFD_DYING was the last call for rcu_exp_handler() execution.
> +	 * The requested QS must have been reported on the last context switch
> +	 * from stop machine to idle.
> +	 */
> +	WARN_ON_ONCE(rdp->cpu_no_qs.b.exp);
>  	// Do any dangling deferred wakeups.
>  	do_nocb_deferred_wakeup(rdp);
>  
> -- 
> 2.48.1
> 

  reply	other threads:[~2025-03-18 17:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-14 14:36 [PATCH 0/5 v2] rcu/exp updates Frederic Weisbecker
2025-03-14 14:36 ` [PATCH 1/5] rcu/exp: Protect against early QS report Frederic Weisbecker
2025-03-15 23:59   ` Joel Fernandes
2025-03-16 11:07     ` Frederic Weisbecker
2025-03-16 14:23       ` Joel Fernandes
2025-03-16 22:24         ` Frederic Weisbecker
2025-03-18 17:17   ` Paul E. McKenney
2025-03-19  8:58     ` Frederic Weisbecker
2025-03-14 14:36 ` [PATCH 2/5] rcu/exp: Remove confusing needless full barrier on task unblock Frederic Weisbecker
2025-03-18 17:18   ` Paul E. McKenney
2025-03-19  9:01     ` Frederic Weisbecker
2025-03-19 14:03       ` Paul E. McKenney
2025-03-14 14:36 ` [PATCH 3/5] rcu/exp: Remove needless CPU up quiescent state report Frederic Weisbecker
2025-03-14 14:36 ` [PATCH 4/5] rcu/exp: Warn on QS requested on dying CPU Frederic Weisbecker
2025-03-18 17:21   ` Paul E. McKenney [this message]
2025-03-19  9:14     ` Frederic Weisbecker
2025-03-14 14:36 ` [PATCH 5/5] rcu/exp: Warn on CPU lagging for too long within hotplug IPI's blindspot Frederic Weisbecker
2025-03-18 17:22   ` Paul E. McKenney
2025-03-19  9:42     ` Frederic Weisbecker
2025-03-19 14:04       ` Paul E. McKenney
2025-04-29 13:42 [PATCH 0/5 v3] rcu/exp updates Frederic Weisbecker
2025-04-29 13:43 ` [PATCH 4/5] rcu/exp: Warn on QS requested on dying CPU Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=476d11c8-ff63-4abc-a894-b9dabf92df8b@paulmck-laptop \
    --to=paulmck@kernel.org \
    --cc=boqun.feng@gmail.com \
    --cc=frederic@kernel.org \
    --cc=joelagnelf@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neeraj.upadhyay@amd.com \
    --cc=qiang.zhang1211@gmail.com \
    --cc=rcu@vger.kernel.org \
    --cc=urezki@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®