[PATCHv3] powerpc: Fix write-after-destroy in lock elision

Torvald Riegel triegel@redhat.com
Mon Jan 2 19:33:00 GMT 2017


On Mon, 2017-01-02 at 16:15 -0200, Adhemerval Zanella wrote:
> 
> On 02/01/2017 15:39, Torvald Riegel wrote:
> > It uses the lock, so can be concurrent with other accesses (that use
> > atomics).  Thus, it must use atomics too to prevent data races.
> 
> Indeed, we need to use atomic decrement on this one as well.  I am not
> sure if is needed to use a stronger semantic than relaxed.

adapt_count is just a hint, as is explained in the comments in the
similar patch I had sent for x86.  Given that it's just a hint, lost
updates are harmless for correctness, and the decrement does not need to
be atomic.  The invididual loads and stores of a decrement should be
though, to avoid data races.



More information about the Libc-alpha mailing list