All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <frederic@kernel.org>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: "Joel Fernandes (Google)" <joel@joelfernandes.org>,
	rcu@vger.kernel.org, linux-kernel@vger.kernel.org,
	rushikesh.s.kadam@intel.com, urezki@gmail.com,
	neeraj.iitr10@gmail.com, rostedt@goodmis.org,
	youssefesmat@google.com, surenb@google.com
Subject: Re: [PATCH v8 01/13] rcu: Fix missing nocb gp wake on rcu_barrier()
Date: Fri, 14 Oct 2022 16:40:19 +0200	[thread overview]
Message-ID: <20221014144019.GB1108603@lothringen> (raw)
In-Reply-To: <20221014142127.GE4221@paulmck-ThinkPad-P17-Gen-1>

On Fri, Oct 14, 2022 at 07:21:27AM -0700, Paul E. McKenney wrote:
> On Tue, Oct 11, 2022 at 06:01:30PM +0000, Joel Fernandes (Google) wrote:
> > From: Frederic Weisbecker <frederic@kernel.org>
> > 
> > Upon entraining a callback to a NOCB CPU, no further wake up is
> > issued on the corresponding nocb_gp kthread. As a result, the callback
> > and all the subsequent ones on that CPU may be ignored, at least until
> > an RCU_NOCB_WAKE_FORCE timer is ever armed or another NOCB CPU belonging
> > to the same group enqueues a callback on an empty queue.
> > 
> > Here is a possible bad scenario:
> > 
> > 1) CPU 0 is NOCB unlike all other CPUs.
> > 2) CPU 0 queues a callback
> 
> Call it CB1.
> 
> > 2) The grace period related to that callback elapses
> > 3) The callback is moved to the done list (but is not invoked yet),
> >    there are no more pending callbacks for CPU 0
> 
> So CB1 is on ->cblist waiting to be invoked, correct?
> 
> > 4) CPU 1 calls rcu_barrier() and sends an IPI to CPU 0
> > 5) CPU 0 entrains the callback but doesn't wake up nocb_gp
> 
> And CB1 must still be there because otherwise the IPI handler would not
> have entrained the callback, correct?  If so, we have both CB1 and the
> rcu_barrier() callback (call it CB2) in ->cblist, but on the done list.
> 
> > 6) CPU 1 blocks forever, unless CPU 0 ever queues enough further
> >    callbacks to arm an RCU_NOCB_WAKE_FORCE timer.
> 
> Except that -something- must have already been prepared to wake up in
> order to invoke CB1.  And that something would invoke CB2 along with CB1,
> given that they are both on the done list.  If there is no such wakeup
> already, then the hang could occur with just CB1, without the help of CB2.

Heh good point. I was confused with CB1 on RCU_DONE_TAIL and the possibility
for CB2 to be entrained on RCU_WAIT_TAIL. But that's indeed not supposed to
happen. Ok so this patch indeed doesn't make sense outside lazy.

> > This is also required to make sure lazy callbacks in future patches
> > don't end up making rcu_barrier() wait for multiple seconds.
> 
> But I do see that the wakeup is needed in the lazy case, and if I remember
> correctly, the ten-second rcu_barrier() delay really did happen.  If I
> understand correctly, for this to happen, all of the callbacks must be
> in the bypass list, that is, ->cblist must be empty.
> 
> So has the scenario steps 1-6 called out above actually happened in the
> absence of lazy callbacks?

Nope, so I guess we can have the pending check around rcu_nocb_flush_bypass()
only...

Thanks!

  reply	other threads:[~2022-10-14 14:40 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-11 18:01 [PATCH v8 00/13] rcu: call_rcu() power improvements Joel Fernandes (Google)
2022-10-11 18:01 ` [PATCH v8 01/13] rcu: Fix missing nocb gp wake on rcu_barrier() Joel Fernandes (Google)
2022-10-14 14:21   ` Paul E. McKenney
2022-10-14 14:40     ` Frederic Weisbecker [this message]
2022-10-14 15:03       ` Paul E. McKenney
2022-10-14 15:19         ` Joel Fernandes
2022-10-14 15:46           ` Paul E. McKenney
2022-10-14 20:47             ` Frederic Weisbecker
2022-10-16 15:16               ` Paul E. McKenney
2022-10-16 15:56                 ` Joel Fernandes
2022-10-11 18:01 ` [PATCH v8 02/13] rcu: Make call_rcu() lazy to save power Joel Fernandes (Google)
2022-10-11 23:10   ` Frederic Weisbecker
2022-10-12 19:54     ` Joel Fernandes
2022-10-14 15:45       ` Paul E. McKenney
2022-10-11 18:01 ` [PATCH v8 03/13] rcu: Refactor code a bit in rcu_nocb_do_flush_bypass() Joel Fernandes (Google)
2022-10-11 18:01 ` [PATCH v8 04/13] rcu: shrinker for lazy rcu Joel Fernandes (Google)
2022-10-11 18:01 ` [PATCH v8 05/13] rcuscale: Add laziness and kfree tests Joel Fernandes (Google)
2022-10-11 18:01 ` [PATCH v8 06/13] percpu-refcount: Use call_rcu_flush() for atomic switch Joel Fernandes (Google)
2022-10-11 18:01 ` [PATCH v8 07/13] rcu/sync: Use call_rcu_flush() instead of call_rcu Joel Fernandes (Google)
2022-10-11 18:01 ` [PATCH v8 08/13] rcu/rcuscale: Use call_rcu_flush() for async reader test Joel Fernandes (Google)
2022-10-11 18:01 ` [PATCH v8 09/13] rcu/rcutorture: Use call_rcu_flush() where needed Joel Fernandes (Google)
2022-10-11 18:01 ` [PATCH v8 10/13] scsi/scsi_error: Use call_rcu_flush() instead of call_rcu() Joel Fernandes (Google)
2022-10-11 18:01 ` [PATCH v8 11/13] workqueue: Make queue_rcu_work() use call_rcu_flush() Joel Fernandes (Google)
2022-10-11 18:01 ` [PATCH v8 12/13] rxrpc: Use call_rcu_flush() instead of call_rcu() Joel Fernandes (Google)
2022-10-11 18:01 ` [PATCH v8 13/13] rcu/debug: Add wake-up debugging for lazy callbacks Joel Fernandes (Google)

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=20221014144019.GB1108603@lothringen \
    --to=frederic@kernel.org \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neeraj.iitr10@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=rushikesh.s.kadam@intel.com \
    --cc=surenb@google.com \
    --cc=urezki@gmail.com \
    --cc=youssefesmat@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.