lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 11 Apr 2019 09:16:32 +0200 From: Peter Zijlstra <peterz@...radead.org> To: Waiman Long <longman@...hat.com> Cc: Ingo Molnar <mingo@...hat.com>, Will Deacon <will.deacon@....com>, Thomas Gleixner <tglx@...utronix.de>, linux-kernel@...r.kernel.org, x86@...nel.org, Davidlohr Bueso <dave@...olabs.net>, Linus Torvalds <torvalds@...ux-foundation.org>, Tim Chen <tim.c.chen@...ux.intel.com> Subject: Re: [PATCH-tip v2 02/12] locking/rwsem: Implement lock handoff to prevent lock starvation On Wed, Apr 10, 2019 at 10:25:16PM -0400, Waiman Long wrote: > On 04/10/2019 02:44 PM, Peter Zijlstra wrote: > > However there is another site that fiddles with the HANDOFF bit, namely > > __rwsem_down_write_failed_common(), and that does: > > > > + atomic_long_or(RWSEM_FLAG_HANDOFF, &sem->count); > > > > _OUTSIDE_ of ->wait_lock, which would yield: > > > > CPU0 CPU1 > > > > oldcount = atomic_long_fetch_add(adjustment, &sem->count) > > > > atomic_long_or(HANDOFF) > > > > if (!(oldcount & HANDOFF)) > > adjustment -= HANDOFF; > > > > atomic_long_sub(adjustment) > > > > *whoops*, incremented HANDOFF on HANDOFF. > > > > > > And there's not a comment in sight that would elucidate if this is > > possible or not. > > > > A writer can only set the handoff bit if it is the first waiter in the > queue. If it is the first waiter, a racing __rwsem_mark_wake() will see > that the first waiter is a writer and so won't go into the reader path. > I know I something don't spell out all the conditions that may look > obvious to me but not to others. I will elaborate more in comments. Aah, indeed.
Powered by blists - more mailing lists