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: Carlos Eduardo Seo <cseo at linux dot vnet dot ibm dot com>
- To: "Carlos O'Donell" <carlos at redhat dot com>
- Cc: munroesj 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: Mon, 31 Aug 2015 18:57:31 -0300
- 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> <1440643271 dot 31963 dot 17 dot camel at oc7878010663> <1440643752 dot 3213 dot 4 dot camel at oc7878010663> <55DF11D0 dot 2090100 at redhat dot com>
Hi Carlos
Thanks for your suggestions. I have a couple questions:
> On Aug 27, 2015, at 10:34 AM, Carlos O'Donell <carlos@redhat.com> wrote:
>
> On 08/26/2015 10:49 PM, Steven Munroe wrote:
>> I really should not work after 9:00PM ... :(
>>
>>> 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.
>>>
>> Before Library init/ctors and main() get control for the main thread.
>
> That sounds like a good design goal. In which case you also have to do
> this before auditing libraries are initialized. Therefore it has to happen
> very early, earlier than TLS_INIT_TP for the main thread, so you may need
> to do it in dl_platform_init(), though you'll have to check.
I was running some tests with dl_platform_init() (calling the init_hwcapinfo() code in there to populate my global variables) and it works fine in the dynamic linking case, but it does not seem to work for the static case, even though I see a placeholder for DL_PLATFORM_INIT in elf/dl-support.c. Am I missing something?
>
> The code comments should make these assumptions clear e.g. early init.
>
>>> 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.
>>>
>> before: Library init/ctors and main() get control for the main thread,
>> and before any new thread gets control from clone.
>
> That also sounds good. You'll likely need to do this in the nptl code
> that starts the thread e.g. createthread.c via TLS_DEFINE_INIT_TP.
Iâm not sure if I understand what you mean by this. What exactly needs to be done in TLS_DEFINE_INIT_TP?
Thanks,
--
Carlos Eduardo Seo
Software Engineer - Linux on Power Toolchain
cseo@linux.vnet.ibm.com