From: Waiman Long <longman@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will.deacon@arm.com>,
Thomas Gleixner <tglx@linutronix.de>,
Linux List Kernel Mailing <linux-kernel@vger.kernel.org>,
the arch/x86 maintainers <x86@kernel.org>,
Davidlohr Bueso <dave@stgolabs.net>,
Tim Chen <tim.c.chen@linux.intel.com>
Subject: Re: [PATCH 12/12] locking/rwsem: Make MSbit of count as guard bit to fail readlock
Date: Thu, 28 Mar 2019 17:03:30 -0400 [thread overview]
Message-ID: <e597a6c6-49de-302c-b09d-9a9085ebb394@redhat.com> (raw)
In-Reply-To: <CAHk-=wi67qBi9d7zKfECs7ZnVJqbMoMx-ez-ohO39POqD9YR3Q@mail.gmail.com>
On 03/28/2019 04:56 PM, Linus Torvalds wrote:
> On Thu, Mar 28, 2019 at 1:47 PM Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
>> On Thu, Mar 28, 2019 at 11:12 AM Waiman Long <longman@redhat.com> wrote:
>>> With the merging of owner into count for x86-64, there is only 16 bits
>>> left for reader count. It is theoretically possible for an application to
>>> cause more than 64k readers to acquire a rwsem leading to count overflow.
>> Ahh, and here's the thing that makes 16 bits work for readers.
> Hmm. Does it?
>
> Isn't there a race here? We're adding the READ bias, and then noticing
> that it his the guard bit, and then the down_read_failed will make it
> all good again.
>
> But this isn't actually done with preemption disabled, so things
> *could* get preempted in between, and if we have a huge run of bad
> luck, it can still overflow.
>
> Ok, so you need to have a 32k series run of bad luck (and hit
> *exactly* the right small preemption point window every time), and I'm
> certainly willing to say "yeah, not an issue", but maybe it's still
> worth at least documenting?
>
> Linus
I think it is theoretically possible that this can happen, but I doubt
we will ever see that. Will document that possibility in the comment.
Thanks,
Longman
next prev parent reply other threads:[~2019-03-28 21:03 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-28 18:10 [PATCH 00/12] locking/rwsem: Rwsem rearchitecture part 2 Waiman Long
2019-03-28 18:10 ` [PATCH 01/12] locking/rwsem: Implement a new locking scheme Waiman Long
2019-03-28 18:10 ` [PATCH 02/12] locking/rwsem: Implement lock handoff to prevent lock starvation Waiman Long
2019-03-28 18:10 ` [PATCH 03/12] locking/rwsem: Remove rwsem_wake() wakeup optimization Waiman Long
2019-03-28 18:10 ` [PATCH 04/12] locking/rwsem: Make rwsem_spin_on_owner() return owner state Waiman Long
2019-03-28 18:10 ` [PATCH 05/12] locking/rwsem: Ensure an RT task will not spin on reader Waiman Long
2019-03-28 18:11 ` [PATCH 06/12] locking/rwsem: Wake up almost all readers in wait queue Waiman Long
2019-03-28 18:11 ` [PATCH 07/12] locking/rwsem: Enable readers spinning on writer Waiman Long
2019-03-28 18:11 ` [PATCH 08/12] locking/rwsem: Enable count-based spinning on reader Waiman Long
2019-03-28 18:11 ` [PATCH 09/12] locking/rwsem: Add more rwsem owner access helpers Waiman Long
2019-03-28 18:11 ` [PATCH 10/12] locking/rwsem: Merge owner into count on x86-64 Waiman Long
2019-03-28 20:43 ` Linus Torvalds
2019-03-28 18:11 ` [PATCH 11/12] locking/rwsem: Remove redundant computation of writer lock word Waiman Long
2019-03-28 18:11 ` [PATCH 12/12] locking/rwsem: Make MSbit of count as guard bit to fail readlock Waiman Long
2019-03-28 20:47 ` Linus Torvalds
2019-03-28 20:55 ` Waiman Long
2019-03-28 20:56 ` Linus Torvalds
2019-03-28 21:03 ` Waiman Long [this message]
2019-04-03 12:59 ` [PATCH 00/12] locking/rwsem: Rwsem rearchitecture part 2 Peter Zijlstra
2019-04-03 16:08 ` Waiman Long
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=e597a6c6-49de-302c-b09d-9a9085ebb394@redhat.com \
--to=longman@redhat.com \
--cc=dave@stgolabs.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=tim.c.chen@linux.intel.com \
--cc=torvalds@linux-foundation.org \
--cc=will.deacon@arm.com \
--cc=x86@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 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®