This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] PowerPC: Fix a race condition when eliding a lock
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, Torvald Riegel <triegel at redhat dot com>
- Cc: Tulio Magno Quites Machado Filho <tuliom at linux dot vnet dot ibm dot com>, libc-alpha at sourceware dot org, munroesj at linux dot vnet dot ibm dot com
- Date: Tue, 25 Aug 2015 13:09:12 -0400
- Subject: Re: [PATCH v2] PowerPC: Fix a race condition when eliding a lock
- Authentication-results: sourceware.org; auth=none
- References: <55BAEE77 dot 9000501 at redhat dot com> <1440084054-32243-1-git-send-email-tuliom at linux dot vnet dot ibm dot com> <55D628C2 dot 3080305 at redhat dot com> <55D62FD3 dot 8090109 at linaro dot org> <1440150735 dot 6240 dot 74 dot camel at localhost dot localdomain> <55DBE899 dot 2080908 at redhat dot com> <1440500727 dot 27492 dot 128 dot camel at localhost dot localdomain> <55DC786C dot 8080108 at redhat dot com> <1440520639 dot 27492 dot 190 dot camel at localhost dot localdomain> <55DC9C24 dot 5090401 at linaro dot org>
On 08/25/2015 12:47 PM, Adhemerval Zanella wrote:
> I do not know which is better, since it will tie the ELIDE_LOCK implementation
> with current internal pthread definitions.
I prefer the idea of passing an inline function to ELIDE_LOCK
and have the inline funciton do what it needs to compute is_lock_free
and then return the result. This leaves ELIDE_LOCK simpler.
However, I'm not really for one way or the other, they are roughly
all the same. The inline function is just a cleaner interface and puts
the evaluation of is_lock_free all in one place to be inlined by the
compiler.
I think the end result of Torvald's comments is that when we switch to
C11 atomics, we'll need to reference __lock with atomic_load rleaxed, so
we might as well start today.
c.