From: Frederic Weisbecker <frederic@kernel.org>
To: "Paul E. McKenney" <paulmck@kernel.org>,
Neeraj Upadhyay <neeraj.upadhyay@kernel.org>
Cc: Z qiang <qiang.zhang1211@gmail.com>, rcu@vger.kernel.org
Subject: Re: One-off rcu_nocb_rdp_deoffload bug
Date: Thu, 5 Sep 2024 20:41:02 +0200 [thread overview]
Message-ID: <Ztn7PpfFiYDRBjWX@localhost.localdomain> (raw)
In-Reply-To: <Ztn5MOwk4nIfTWv-@localhost.localdomain>
Le Thu, Sep 05, 2024 at 08:32:16PM +0200, Frederic Weisbecker a écrit :
> Le Wed, Sep 04, 2024 at 06:52:36AM -0700, Paul E. McKenney a écrit :
> > > Yes, I'm preparing an update for the offending patch (which has one more
> > > embarassing issue while I'm going through it again).
> >
> > Very good, thank you!
>
> So my proposal for a replacement patch is this (to replace the patch
> of the same name in Neeraj tree):
FYI, the diffstat against the previous version of the same patch is as follows.
The rationale being:
1) rdp->nocb_cb_kthread doesn't need to be protected by nocb_gp_kthread_mutex
2) Once rcuoc is parked, we really _must_ observe the callback list counter decremented
after the barrier's completion.
3) This fixes another issue: rcuoc must be parked _before_
rcu_nocb_queue_toggle_rdp() is called, otherwise a nocb locked sequence
within rcuoc would race with rcuog clearing SEGCBLIST_OFFLOADED concurrently,
leaving the nocb locked forever.
diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h
index 755ada098035..97b99cd06923 100644
--- a/kernel/rcu/tree_nocb.h
+++ b/kernel/rcu/tree_nocb.h
@@ -1056,6 +1056,13 @@ static int rcu_nocb_rdp_deoffload(struct rcu_data *rdp)
/* Flush all callbacks from segcblist and bypass */
rcu_barrier();
+ /*
+ * Make sure the rcuoc kthread isn't in the middle of a nocb locked
+ * sequence while offloading is deactivated, along with nocb locking.
+ */
+ if (rdp->nocb_cb_kthread)
+ kthread_park(rdp->nocb_cb_kthread);
+
rcu_nocb_lock_irqsave(rdp, flags);
WARN_ON_ONCE(rcu_cblist_n_cbs(&rdp->nocb_bypass));
WARN_ON_ONCE(rcu_segcblist_n_cbs(&rdp->cblist));
@@ -1064,13 +1071,11 @@ static int rcu_nocb_rdp_deoffload(struct rcu_data *rdp)
wake_gp = rcu_nocb_queue_toggle_rdp(rdp);
mutex_lock(&rdp_gp->nocb_gp_kthread_mutex);
+
if (rdp_gp->nocb_gp_kthread) {
if (wake_gp)
wake_up_process(rdp_gp->nocb_gp_kthread);
- if (rdp->nocb_cb_kthread)
- kthread_park(rdp->nocb_cb_kthread);
-
swait_event_exclusive(rdp->nocb_state_wq,
rcu_nocb_rdp_deoffload_wait_cond(rdp));
} else {
next prev parent reply other threads:[~2024-09-05 18:41 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-19 19:44 One-off rcu_nocb_rdp_deoffload bug Paul E. McKenney
2024-08-20 11:07 ` Z qiang
[not found] ` <CAFTL4hzY09QEGE+sTqc02d2LkuH_ObYKiuVTfGnrtwjtYiwt4A@mail.gmail.com>
2024-08-20 17:46 ` Paul E. McKenney
2024-09-04 12:59 ` Paul E. McKenney
2024-09-04 13:48 ` Frederic Weisbecker
2024-09-04 13:52 ` Paul E. McKenney
2024-09-05 18:32 ` Frederic Weisbecker
2024-09-05 18:41 ` Frederic Weisbecker [this message]
2024-09-06 6:04 ` Paul E. McKenney
2024-09-06 6:32 ` Neeraj upadhyay
2024-09-06 7:48 ` Paul E. McKenney
2024-09-06 13:12 ` Frederic Weisbecker
2024-09-06 16:28 ` Paul E. McKenney
2024-09-07 9:17 ` Neeraj upadhyay
2024-09-07 9:29 ` Paul E. McKenney
2024-09-07 9:33 ` Paul E. McKenney
2024-10-03 14:01 ` Z qiang
2024-10-03 23:50 ` Frederic Weisbecker
2024-10-08 2:13 ` Z qiang
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=Ztn7PpfFiYDRBjWX@localhost.localdomain \
--to=frederic@kernel.org \
--cc=neeraj.upadhyay@kernel.org \
--cc=paulmck@kernel.org \
--cc=qiang.zhang1211@gmail.com \
--cc=rcu@vger.kernel.org \
/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.