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]
Message-ID: <20160520152800.GP3205@twins.programming.kicks-ass.net>
Date:	Fri, 20 May 2016 17:28:00 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Davidlohr Bueso <dave@...olabs.net>
Cc:	manfred@...orfullife.com, Waiman.Long@....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 Fri, May 20, 2016 at 05:05:05PM +0200, Peter Zijlstra wrote:
> On Fri, May 20, 2016 at 08:00:49AM -0700, Davidlohr Bueso wrote:
> > On Fri, 20 May 2016, Peter Zijlstra wrote:
> > 
> > >On Thu, May 19, 2016 at 10:39:26PM -0700, Davidlohr Bueso wrote:
> > >> In addition, this makes me wonder if queued_spin_is_locked() should then be:
> > >>
> > >>-	return atomic_read(&lock->val);
> > >>+	return atomic_read(&lock->val) & _Q_LOCKED_MASK;
> > >>
> > >>And avoid considering pending waiters as locked.
> > >
> > >Probably
> > 
> > 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);
> 
> Nah, that would make it return true for (0,0,1), ie. uncontended locked.

FWIW, the only usage of spin_is_contended() should be for lock breaking,
see spin_needbreak().

This also means that

  #define spin_is_contended(l) (false)

is a valid implementation, where the only down-side is worse latency.

This is done (together with GENERIC_LOCKBREAK), to allow trivial
test-and-set spinlock implementations; as these cannot tell if the lock
is contended.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ