This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: Coldfire __lll_lock fails under heavy system stress
On Thu, Nov 1, 2012 at 12:51 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> On Thu, 1 Nov 2012, Ed Slas wrote:
>
>> Thanks for your time. I understand the kernel's atomic_cmpxchg_32() is
>> most likely the issue, but note that most of the other platforms use a
>> atomic lock in user space, then resort to the kernel to arbitrate
>> contentions. The Coldfire port makes the atomic_cmpxchg_32 kernel call
>> first, when there is a user space atomic lock available (TAS
>> instruction).
>
> I don't believe TAS is sufficient to implement a general
> compare-and-exchange operation, such as is expected by NPTL. The syscall
> is used because the ColdFire architecture has neither an atomic
> compare-and-exchange instruction, nor load-locked / store-conditional that
> are used on some other architectures to implement compare-and-exchange in
> userspace.
Correct, TAS is not sufficient. You really do need to be able to CAS
in both userspace *and* in the kernel for futexes to be useful.
One defect on HP-PARISC was that our kernel-helper CAS didn't
coordinate with the futex syscall.
We fixed this by having the kernel-helper CAS use the same locks as
the futex syscall would use in order to complete the futex operation
when required.
Cheers,
Carlos.