[PATCHv3] PowerPC: Fix a race condition when eliding a lock

Peter Bergner bergner@vnet.ibm.com
Tue Sep 1 21:43:00 GMT 2015


On Tue, 2015-09-01 at 17:46 -0300, Adhemerval Zanella wrote:
> On 01-09-2015 16:38, Peter Bergner wrote:
> > /* Definitions used for TEXASR Failure code (bits 0:6), they need to be even
> >    because tabort. always sets the first bit.  */
[snip]
> Indeed the 'odd' comment does not make sense and we should just remove it
> (I misread texasr definition).  My initial idea was define some codes
> that set the persistent failures and some that do not.  I think I best
> approach would be:
> 
> /* tabort will set TEXASR(0:31) = ((_ABORT_LOCK_BUSY & 0xff) << 24) | 0x1
>    and the TEXASR persistent bit is bit 25 (32-7).  Only the syscall
>    code means a persistent error that should trigger a default lock
>    acquisition.  */
> #define _ABORT_SYSCALL         0x1   /* Syscall issued.  */
> #define _ABORT_LOCK_BUSY       0x2   /* Lock already used.  */
> #define _ABORT_NESTED_TRYLOCK  0x4   /* Write operation in trylock.  */

So according to this, only the syscall is deemed persistent.


> I think we can use '__builtin_tabortwci' since the transactional aborts
> here are not meant to be persistent (the syscall one are done in syscall
> wrappers).

If we decide that these uses of the explicit tabort*s are really
to be treated as not persistent, then I agree we could use the
conditional tabort[wd]c[i] instructions, but it seems Paul thinks
otherwise.  I guess we should let Paul describe why.

Peter






More information about the Libc-alpha mailing list