From: Frederic Weisbecker <frederic@kernel.org>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@meta.com, rostedt@goodmis.org
Subject: Re: [PATCH RFC v2 rcu] Fix get_state_synchronize_rcu_full() GP-start detection
Date: Sat, 25 Jan 2025 15:56:16 +0100 [thread overview]
Message-ID: <Z5T7kF7LKIuk05FR@pavilion.home> (raw)
In-Reply-To: <d7bbe2cd-d889-40e9-8d46-fb8772fed6db@paulmck-laptop>
Le Fri, Jan 24, 2025 at 04:01:55PM -0800, Paul E. McKenney a écrit :
> On Sat, Jan 25, 2025 at 12:03:58AM +0100, Frederic Weisbecker wrote:
> > Le Fri, Dec 13, 2024 at 11:49:49AM -0800, Paul E. McKenney a écrit :
> > > diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h
> > > index 2f9c9272cd486..d2a91f705a4ab 100644
> > > --- a/kernel/rcu/rcu.h
> > > +++ b/kernel/rcu/rcu.h
> > > @@ -162,7 +162,7 @@ static inline bool rcu_seq_done_exact(unsigned long *sp, unsigned long s)
> > > {
> > > unsigned long cur_s = READ_ONCE(*sp);
> > >
> > > - return ULONG_CMP_GE(cur_s, s) || ULONG_CMP_LT(cur_s, s - (2 * RCU_SEQ_STATE_MASK + 1));
> > > + return ULONG_CMP_GE(cur_s, s) || ULONG_CMP_LT(cur_s, s - (3 * RCU_SEQ_STATE_MASK + 1));
> >
> > This might need a comment.
>
> Good point! Would you like to propose one?
Ok.
>
> > The way I understand it is that rcu_state.gp_seq might be seen started while
> > root_rnp->gp_seq is not. So rcu_seq_snap() on the started rcu_state.gp_seq
> > may return maximum 2 full GPs ahead of root_rnp->gp_seq. And therefore it takes below
> > 2 GPs to safely deduce we wrapped around.
>
> Exactly!
>
> > Should it be ULONG_CMP_LT(cur_s, s - (2 * (RCU_SEQ_STATE_MASK + 1))) ?
>
> Quite possibly. I freely admit that I allowed a bit of slop because
> time was of the essence (holidays and all that) and also it does not
> hurt much to lose a couple of counts out of a 2^32 cycle, to say nothing
> of the common-case 2^64 cycle. It would not hurt to be exact, but it
> would be necessary to convince ourselves that we were not off by one in
> the wrong direction.
>
> I would be happy to see a patch, as long as it was sufficiently
> convincing.
I'm not so much concerned about being exact but rather about making
sure we still understand what we did within one year. We can leave one
more grace period than what we expect out of paranoia but, the most
important is that we comment about what we expect and why. Let me
prepare a patch for that.
In the meantime for your patch:
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
>
> > Or am I missing something?
>
> Not that I can see. So the answer is probably "yes". ;-)
Thanks! :-)
>
> Thanx, Paul
next prev parent reply other threads:[~2025-01-25 14:56 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-13 0:59 [PATCH RFC rcu] Fix get_state_synchronize_rcu_full() GP-start detection Paul E. McKenney
2024-12-13 19:49 ` [PATCH RFC v2 " Paul E. McKenney
2025-01-24 14:49 ` Frederic Weisbecker
2025-01-24 15:58 ` Paul E. McKenney
2025-01-24 16:42 ` Frederic Weisbecker
2025-01-24 19:40 ` Paul E. McKenney
2025-01-24 22:25 ` Frederic Weisbecker
2025-01-24 22:50 ` Paul E. McKenney
2025-01-24 23:03 ` Frederic Weisbecker
2025-01-25 0:01 ` Paul E. McKenney
2025-01-25 14:56 ` Frederic Weisbecker [this message]
2025-01-25 18:39 ` Paul E. McKenney
2025-01-27 1:13 ` Joel Fernandes
2025-01-27 1:22 ` Joel Fernandes
2025-01-27 2:03 ` Paul E. McKenney
2025-01-27 2:55 ` Joel Fernandes
2025-01-27 2:58 ` Joel Fernandes
2025-01-27 16:49 ` Paul E. McKenney
2025-01-27 18:45 ` Joel Fernandes
2025-02-11 0:28 ` Joel Fernandes
2025-02-11 1:22 ` Joel Fernandes
2025-02-12 10:14 ` Paul E. McKenney
2025-02-12 10:42 ` Paul E. McKenney
2025-01-24 1:49 ` [PATCH RFC " Joel Fernandes
2025-01-24 14:56 ` Frederic Weisbecker
2025-01-24 20:21 ` Joel Fernandes
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=Z5T7kF7LKIuk05FR@pavilion.home \
--to=frederic@kernel.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox