From: "Paul E. McKenney" <paulmck@kernel.org>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, rcu <rcu@vger.kernel.org>,
Uladzislau Rezki <urezki@gmail.com>,
Neeraj Upadhyay <quic_neeraju@quicinc.com>,
Boqun Feng <boqun.feng@gmail.com>,
Joel Fernandes <joel@joelfernandes.org>
Subject: Re: [PATCH 05/10] rcu: Assume IRQS disabled from rcu_report_dead()
Date: Mon, 2 Oct 2023 08:41:34 -0700 [thread overview]
Message-ID: <d8c5364e-45ed-47bf-afe3-25cd17ec2f08@paulmck-laptop> (raw)
In-Reply-To: <20230908203603.5865-6-frederic@kernel.org>
On Fri, Sep 08, 2023 at 10:35:58PM +0200, Frederic Weisbecker wrote:
> rcu_report_dead() is the last RCU word from the CPU down through the
> hotplug path. It is called in the idle loop right before the CPU shuts
> down for good. Because it removes the CPU from the grace period state
> machine and reports an ultimate quiescent state if necessary, no further
> use of RCU is allowed. Therefore it is expected that IRQs are disabled
> upon calling this function and are not to be re-enabled again until the
> CPU shuts down.
>
> Remove the IRQs disablement from that function and verify instead that
> it is actually called with IRQs disabled as it is expected at that
> special point in the idle path.
>
> Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Reviewed-by: Paul E. McKenney <paulmck@kernel.org>
> ---
> kernel/rcu/tree.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index a83ecab77917..8b5ebef32e17 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -4553,11 +4553,16 @@ void rcu_cpu_starting(unsigned int cpu)
> */
> void rcu_report_dead(unsigned int cpu)
> {
> - unsigned long flags, seq_flags;
> + unsigned long flags;
> unsigned long mask;
> struct rcu_data *rdp = per_cpu_ptr(&rcu_data, cpu);
> struct rcu_node *rnp = rdp->mynode; /* Outgoing CPU's rdp & rnp. */
>
> + /*
> + * IRQS must be disabled from now on and until the CPU dies, or an interrupt
> + * may introduce a new READ-side while it is actually off the QS masks.
> + */
> + lockdep_assert_irqs_disabled();
> // Do any dangling deferred wakeups.
> do_nocb_deferred_wakeup(rdp);
>
> @@ -4565,7 +4570,6 @@ void rcu_report_dead(unsigned int cpu)
>
> /* Remove outgoing CPU from mask in the leaf rcu_node structure. */
> mask = rdp->grpmask;
> - local_irq_save(seq_flags);
> arch_spin_lock(&rcu_state.ofl_lock);
> raw_spin_lock_irqsave_rcu_node(rnp, flags); /* Enforce GP memory-order guarantee. */
> rdp->rcu_ofl_gp_seq = READ_ONCE(rcu_state.gp_seq);
> @@ -4579,8 +4583,6 @@ void rcu_report_dead(unsigned int cpu)
> WRITE_ONCE(rnp->qsmaskinitnext, rnp->qsmaskinitnext & ~mask);
> raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
> arch_spin_unlock(&rcu_state.ofl_lock);
> - local_irq_restore(seq_flags);
> -
> rdp->cpu_started = false;
> }
>
> --
> 2.41.0
>
next prev parent reply other threads:[~2023-10-02 15:41 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-08 20:35 [PATCH 00/10] rcu cleanups Frederic Weisbecker
2023-09-08 20:35 ` [PATCH 01/10] rcu: Use rcu_segcblist_segempty() instead of open coding it Frederic Weisbecker
2023-10-02 15:38 ` Paul E. McKenney
2023-09-08 20:35 ` [PATCH 02/10] rcu: Rename jiffies_till_flush to jiffies_lazy_flush Frederic Weisbecker
2023-09-09 1:07 ` Joel Fernandes
2023-09-10 19:48 ` Frederic Weisbecker
2023-09-08 20:35 ` [PATCH 03/10] rcu/nocb: Remove needless LOAD-ACQUIRE Frederic Weisbecker
2023-09-09 1:48 ` Joel Fernandes
2023-09-09 1:50 ` Joel Fernandes
2023-09-10 21:17 ` Frederic Weisbecker
2023-09-08 20:35 ` [PATCH 04/10] rcu/nocb: Remove needless full barrier after callback advancing Frederic Weisbecker
2023-09-09 4:31 ` Joel Fernandes
2023-09-09 18:22 ` Boqun Feng
2023-09-10 4:09 ` Joel Fernandes
2023-09-10 10:22 ` Paul E. McKenney
2023-09-10 20:17 ` Frederic Weisbecker
2023-09-10 20:29 ` Frederic Weisbecker
2023-09-08 20:35 ` [PATCH 05/10] rcu: Assume IRQS disabled from rcu_report_dead() Frederic Weisbecker
2023-10-02 15:41 ` Paul E. McKenney [this message]
2023-09-08 20:35 ` [PATCH 06/10] rcu: Assume rcu_report_dead() is always called locally Frederic Weisbecker
2023-10-02 15:45 ` Paul E. McKenney
2023-09-08 20:36 ` [PATCH 07/10] rcu: Conditionally build CPU-hotplug teardown callbacks Frederic Weisbecker
2023-10-04 16:57 ` Paul E. McKenney
2023-09-08 20:36 ` [PATCH 08/10] rcu: Standardize explicit CPU-hotplug calls Frederic Weisbecker
2023-10-02 15:47 ` Paul E. McKenney
2023-09-08 20:36 ` [PATCH 09/10] rcu: Remove references to rcu_migrate_callbacks() from diagrams Frederic Weisbecker
2023-10-02 15:52 ` Paul E. McKenney
2023-09-08 20:36 ` [PATCH 10/10] rcu: Comment why callbacks migration can't wait for CPUHP_RCUTREE_PREP Frederic Weisbecker
2023-10-02 15:48 ` Paul E. McKenney
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=d8c5364e-45ed-47bf-afe3-25cd17ec2f08@paulmck-laptop \
--to=paulmck@kernel.org \
--cc=boqun.feng@gmail.com \
--cc=frederic@kernel.org \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_neeraju@quicinc.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®