This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCHv2] powerpc: ABI change - add HWCAP/HWCAP2/platform info to TCB
- From: Steven Munroe <munroesj at linux dot vnet dot ibm dot com>
- To: "Carlos O'Donell" <carlos at redhat dot com>
- Cc: Carlos Eduardo Seo <cseo at linux dot vnet dot ibm dot com>, GNU C Library <libc-alpha at sourceware dot org>, "Steven J. Munroe" <sjmunroe at us dot ibm dot com>, Tulio Machado <tuliom at linux dot vnet dot ibm dot com>
- Date: Wed, 26 Aug 2015 21:41:11 -0500
- Subject: Re: [PATCHv2] powerpc: ABI change - add HWCAP/HWCAP2/platform info to TCB
- Authentication-results: sourceware.org; auth=none
- References: <C6F0963E-DA8E-48B3-B6F6-8D6A4C399AED at linux dot vnet dot ibm dot com> <55DE2452 dot 1000907 at redhat dot com>
- Reply-to: munroesj at linux dot vnet dot ibm dot com
On Wed, 2015-08-26 at 16:40 -0400, Carlos O'Donell wrote:
> On 08/12/2015 03:56 PM, Carlos Eduardo Seo wrote:
> > - versioned symbol to track this change.
> > - no âsetâ API in ppc.h
> > - no per-thread initialization
> > - added platform number (derived from AT_PLATFORM string) for future implementation of __builtin_cpu_is() in gcc.
>
> Getting there, probably two more iterations.
>
> You have concurrency issues.
>
Thanks to both Carlos'. I will have to careful about how I say this to
both ...
I think the comments and documentation should be explicit with the
following assumptions.
The initialization of the static variables __tcb_hwcap, __tcb_platform
and __tcb_hwcap_init must occur before main() gets control and before
any other threads can exist.
The TCB fields hwcap and at_platform must be initialized from the
corresponding static variables before: Library init/ctors get control
for the main thread, and before any new thread gets control from clone.
As these are aligned words/dwords the stores are effective atomic
relaxed MO in the PowerISA. In addition the stores to the static
variables (__tcb_hwcap, __tcb_platform) occur while only one thread
exists and the kernel will enforce sequential consistency before the
child of the clone syscall can execute any load from static variable
__tcb_hwcap, or __tcb_platform. As to copy (load of __tcb_hwcap,
__tcb_platform and store or TCB fields hwcap and at_platform) always
occurs within a single thread and copies to thread local storage, there
is no data race.
Does this help?