mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 00:03:58 +0100	[thread overview]
Message-ID: <Z5QcXoE0lrS6yIBt@pavilion.home> (raw)
In-Reply-To: <da5065c4-79ba-431f-9d7e-1ca314394443@paulmck-laptop>

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.

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.

Should it be ULONG_CMP_LT(cur_s, s - (2 * (RCU_SEQ_STATE_MASK + 1))) ?

Or am I missing something?

Thanks.

  parent reply	other threads:[~2025-01-24 23:04 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-13  0:59 [PATCH RFC " 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 [this message]
2025-01-25  0:01     ` Paul E. McKenney
2025-01-25 14:56       ` Frederic Weisbecker
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=Z5QcXoE0lrS6yIBt@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

all inboxes | Powered by JetHome®