public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Byungchul Park <byungchul.park@lge.com>
Cc: jiangshanlai@gmail.com, josh@joshtriplett.org,
	rostedt@goodmis.org, mathieu.desnoyers@efficios.com,
	linux-kernel@vger.kernel.org, kernel-team@lge.com
Subject: Re: [QUESTION] srcu: Remove the SCAN2 state
Date: Thu, 22 Feb 2018 08:54:25 -0800	[thread overview]
Message-ID: <20180222165425.GE2855@linux.vnet.ibm.com> (raw)
In-Reply-To: <fb00133e-776b-50c7-1a46-b56c3339622b@lge.com>

On Thu, Feb 22, 2018 at 02:05:18PM +0900, Byungchul Park wrote:
> On 2/22/2018 11:11 AM, Paul E. McKenney wrote:
> >On Thu, Feb 22, 2018 at 08:57:27AM +0900, Byungchul Park wrote:
> >>Hello,
> >>
> >>I'm sorry for bothering you, and I seem to be obviously missing
> >>something, but I'm really wondering why we check try_check_zero()
> >>again in the state, SCAN1, for the previous srcu_idx.
> >>
> >>I mean, since we've already checked try_check_zero() in the previous
> >>grace period and gotten 'true' as a return value, all readers who see
> >>the flipped idx via srcu_flip() won't update the src_{lock,unlock}_count
> >>for the previous idx until it gets flipped back again.
> >>
> >>Is there any reasons we check try_check_zero() again in the state, SCAN1?
> >>Is there any problems if the following patch's applied?
> >
> >Indeed there are!  Removing the second scan exposes us to a nasty race
> >condition where a reader is preempted (or interrupted or whatever) just
> 
> Indeed! I missed the cases. It should be as it is.
> 
> Thanks a lot for pointing it out.

Heh!  Everyone I know, myself included, who has written such an algorithm
has had this bug in their initial version.  In one case, the algorithm
was published in a high-end journal and the bug not spotted for more than
a decade.  I suppose I could brag about Mathieu's and my offerings having
been corrected before we published, but the fact remains that an earlier
publication of mine gave the aforementioned algorithm from the high-end
journal as an alternative implementation, and I did not spot the bug.
Nor did any of my co-authors.  ;-)

							Thanx, Paul

> >after fetching its counter.  A detailed explanation for an essentially
> 
> -- 
> Thanks,
> Byungchul
> 

      reply	other threads:[~2018-02-22 16:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-21 23:57 [QUESTION] srcu: Remove the SCAN2 state Byungchul Park
2018-02-22  2:11 ` Paul E. McKenney
2018-02-22  5:05   ` Byungchul Park
2018-02-22 16:54     ` Paul E. McKenney [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=20180222165425.GE2855@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=byungchul.park@lge.com \
    --cc=jiangshanlai@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=kernel-team@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --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