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:	Fri, 20 May 2016 17:59:21 -0700
From:	Davidlohr Bueso <>
To:	Peter Zijlstra <>
Cc:	Waiman Long <>,,,,,,
Subject: Re: sem_lock() vs qspinlocks

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 of when the lock is and isn't
contended (as returned to by the user). Ie avoiding crap like:

atomic_read(&lock->val) && atomic_read(&lock->val) != _Q_LOCKED_VAL

In any case, falsely returning for the 'locked, uncontended' case, vs completely
ignoring waiters is probably the lesser evil :).


Powered by blists - more mailing lists