From: Frederic Weisbecker <frederic@kernel.org>
To: Z qiang <qiang.zhang1211@gmail.com>
Cc: "Paul E. McKenney" <paulmck@kernel.org>,
Neeraj Upadhyay <neeraj.upadhyay@kernel.org>,
rcu@vger.kernel.org
Subject: Re: One-off rcu_nocb_rdp_deoffload bug
Date: Fri, 4 Oct 2024 01:50:09 +0200 [thread overview]
Message-ID: <Zv8tsbnYDgFNfSPq@pavilion.home> (raw)
In-Reply-To: <CALm+0cXA8LJM7RWO5uqowkN3-gZYidPuyXZoHOJi10cJja1qPQ@mail.gmail.com>
Le Thu, Oct 03, 2024 at 10:01:57PM +0800, Z qiang a écrit :
> When the rcuoc kthreads process rcu callback, before invoke
> rcu_segcblist_add_len(&rdp->cblist, -count),
> the rcu_barrier() can insert rcu_barrier_callback() func to offline
> cpu rdp's->list.
Excellent analysis! Indeed we can have:
CPU 0 CPU 1 CPU 2
----- ----- -------
// deoffload // nocb_cb_wait // rcutorture
rcu_barrier()
rcu_segcblist_entrain()
rcu_segcblist_add_len(1);
rcu_do_batch()
rcu_barrier_callback()
rcu_barrier()
// still see len == 1
rcu_segcblist_entrain()
rcu_segcblist_add_len(1);
// decrement len
rcu_segcblist_add_len(-1);
kthread_parkme()
// Warn because there is
// still a pending barrier
WARN_ON_ONCE(rcu_segcblist_n_cbs(&rdp->cblist));
And the worst is that the second rcu_barrier() is ignored.
>
> 6,5408,150692937,-,caller=T453;rcu: rcu_callback func: rcu_barrier_callback
>
> Maybe we can wait until rcu_segcblist_n_cbs(&rdp->cblist) return zero
> and then invoke kthread_parkme() in rcuoc kthreads.
> Any thoughts ?
Sounds good, or simply make sure that rdp->nocb_cb_sleep == false before
parking? Since kthread_park() should only be called after rcu_barrier() and
then rdp->nocb_cb_sleep shouldn't be set to true as long as there is a pending
one? Well we can also add a WARN_ON_ONCE(rcu_segcblist_n_cbs(&rdp->cblist))
before calling kthread_park().
Would you like to send the fix?
Thanks.
next prev parent reply other threads:[~2024-10-03 23:50 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
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 [this message]
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=Zv8tsbnYDgFNfSPq@pavilion.home \
--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.