This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCHv2] powerpc: ABI change - add HWCAP/HWCAP2/platform info to TCB


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?




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]