mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Huang <mmpgouride@gmail.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>,
	Peter Zijlstra <peterz@infradead.org>, RCU <rcu@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-team@meta.com, Steven Rostedt <rostedt@goodmis.org>,
	andrii@kernel.org
Subject: Re: [PATCH rcu] srcu: Guarantee non-negative return value from srcu_read_lock()
Date: Thu, 24 Oct 2024 00:56:19 +0800	[thread overview]
Message-ID: <181BFA9D-92C8-4ACC-BE50-8C752EB9B8E8@gmail.com> (raw)
In-Reply-To: <e0bc0674-9309-4749-b74d-e0aa6b40a552@paulmck-laptop>

On Oct 24, 2024, at 00:40, Paul E. McKenney <paulmck@kernel.org> wrote:
> 
> On Wed, Oct 23, 2024 at 02:58:07PM +0800, Alan Huang wrote:
>> On Oct 22, 2024, at 22:26, Paul E. McKenney <paulmck@kernel.org> wrote:
>>> 
>>> On Tue, Oct 22, 2024 at 12:13:12AM -0700, Christoph Hellwig wrote:
>>>> On Tue, Oct 22, 2024 at 09:10:18AM +0200, Peter Zijlstra wrote:
>>>>> Ah, well, the thing that got us here is that we (Andrii and me) wanted
>>>>> to use -1 as an 'invalid' value to indicate SRCU is not currently in
>>>>> use.
>>>>> 
>>>>> So it all being int is really rather convenient :-)
>>>> 
>>>> Then please document that use.  Maybe even with a symolic name for
>>>> -1 that clearly describes these uses.
>>> 
>>> Would this work?
>>> 
>>> #define SRCU_INVALID_INDEX -1
>> 
>> Is there any similar guarantee of the return value of get_state_synchronize_rcu
>> or start_poll_synchronize_rcu, like invalid value?
> 
> Yes, there is a get_completed_synchronize_rcu() function that returns a
> value that causes poll_state_synchronize_rcu() to always return true.
> There is also a get_completed_synchronize_rcu_full() function that
> returns a value that causes poll_state_synchronize_rcu_full() to always
> return true.

This is exactly the API I was searching for, didn’t read the doc thoroughly : )

Thanks!

> 
> There has been some discussion of another set of values that cause
> poll_state_synchronize_rcu() and poll_state_synchronize_rcu_full() to
> always return false, but there is not yet a use case for this.  Easy to
> provide if required, but why further explode the RCU API unless it really
> is required?
> 
> Thanx, Paul
> 
>>> Whatever the name, maybe Peter and Andrii define this under #ifndef
>>> right now, and we get it into include/linux/srcu.h over time.
>>> 
>>> Or is there a better way?  Or name, for that matter.
>>> 
>>> Thanx, Paul
>>> 
>> 


      reply	other threads:[~2024-10-23 16:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21 22:13 Paul E. McKenney
2024-10-21 23:50 ` Andrii Nakryiko
2024-10-22  0:21   ` Paul E. McKenney
2024-10-22  2:01     ` Andrii Nakryiko
2024-10-22  3:30       ` Paul E. McKenney
2024-10-22  3:40         ` Andrii Nakryiko
2024-10-22  7:07         ` Peter Zijlstra
2024-10-22 14:27           ` Paul E. McKenney
2024-10-22  6:51 ` Christoph Hellwig
2024-10-22  7:06   ` Peter Zijlstra
2024-10-22  7:07     ` Christoph Hellwig
2024-10-22  7:10       ` Peter Zijlstra
2024-10-22  7:13         ` Christoph Hellwig
2024-10-22 14:26           ` Paul E. McKenney
2024-10-22 17:29             ` Andrii Nakryiko
2024-10-23  6:40               ` Christoph Hellwig
2024-10-23 16:34                 ` Andrii Nakryiko
2024-10-23 16:46                   ` Alan Huang
2024-10-23 16:59                     ` Andrii Nakryiko
2024-10-23  6:58             ` Alan Huang
2024-10-23 16:40               ` Paul E. McKenney
2024-10-23 16:56                 ` Alan Huang [this message]

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=181BFA9D-92C8-4ACC-BE50-8C752EB9B8E8@gmail.com \
    --to=mmpgouride@gmail.com \
    --cc=andrii@kernel.org \
    --cc=hch@infradead.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.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®