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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 21 May 2016 09:40:21 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Waiman Long <waiman.long@....com>
Cc:	Davidlohr Bueso <dave@...olabs.net>, manfred@...orfullife.com,
	mingo@...nel.org, torvalds@...ux-foundation.org,
	ggherdovich@...e.com, mgorman@...hsingularity.net,
	linux-kernel@...r.kernel.org
Subject: Re: sem_lock() vs qspinlocks

On Sat, May 21, 2016 at 12:01:00AM -0400, Waiman Long wrote:
> On 05/20/2016 08:59 PM, Davidlohr Bueso wrote:
> >On Fri, 20 May 2016, Peter Zijlstra wrote:
> >
> >>On Fri, May 20, 2016 at 04:47:43PM -0400, Waiman Long wrote:
> >>
> >>>>Similarly, and I know you hate it, but afaict, then semantically
> >>>>queued_spin_is_contended() ought to be:
> >>>>
> >>>>-       return atomic_read(&lock->val) & ~_Q_LOCKED_MASK;
> >>>>+       return atomic_read(&lock->val);
> >>>>
> >>
> >>>Looking for contended lock, you need to consider the lock waiters
> >>>also. So
> >>>looking at the whole word is right.
> >>
> >>No, you _only_ need to look at the lock waiters.
> >
> >Is there anyway to do this in a single atomic_read? My thought is that
> >otherwise
> >we could further expand the race window

Its inherently racy, arrival of a contender is subject to timing. No
point in trying to fix what can't be fixed.

> The existing code is doing that, but I would argue that including the
> locked, but uncontended case isn't a bad idea.

It _IS_ a bad idea, you get unconditional lock-breaks.

Its the same as:

#define spin_is_contended(l)	(true)

Because the only reason you're using spin_is_conteded() is if you're
holding it.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ