This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCHv4 0/2] tunables for glibc
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Siddhesh Poyarekar <siddhesh at sourceware dot org>
- Cc: GNU C Library <libc-alpha at sourceware dot org>, "Carlos O'Donell" <carlos at redhat dot com>, Florian Weimer <fweimer at redhat dot com>
- Date: Tue, 23 Aug 2016 12:07:53 -0700
- Subject: Re: [PATCHv4 0/2] tunables for glibc
- Authentication-results: sourceware.org; auth=none
- References: <1471291484-27379-1-git-send-email-siddhesh@sourceware.org>
On Mon, Aug 15, 2016 at 1:04 PM, Siddhesh Poyarekar
<siddhesh@sourceware.org> wrote:
> Hi,
>
> After another episode of disappearance, here is an updated iteration of the
> tunables patch with suggestions from Florian, Carlos and H. J. incorporated.
> Changes since the last version:
>
> - Fixed mallopt behaviour using a set of intermediate functions that the
> callback and __libc_mallopt use. I did not make them into direct callbacks
> because the callbacks are built only when tunables is enabled.
>
> - Loads of comment and documentation fixes based on Carlos' and Florian's
> suggestions
>
> - Call __init_tunables even earlier to ensure that tunables are initialized
> before get_cpu_features is called.
>
__tunables_init is called too late for static executables:
Breakpoint 2, __libc_start_main (main=0x400400 <main>, argc=1,
argv=0x7fffffffde18, init=0x401d10 <__libc_csu_init>,
fini=0x401da0 <__libc_csu_fini>, rtld_fini=0x0, stack_end=0x7fffffffde08)
at ../sysdeps/x86/libc-start.c:37
37 init_cpu_features (&_dl_x86_cpu_features);
(gdb) bt
#0 __libc_start_main (main=0x400400 <main>, argc=1, argv=0x7fffffffde18,
init=0x401d10 <__libc_csu_init>, fini=0x401da0 <__libc_csu_fini>,
rtld_fini=0x0, stack_end=0x7fffffffde08) at ../sysdeps/x86/libc-start.c:37
#1 0x0000000000400aea in _start () at ../sysdeps/x86_64/start.S:120
(gdb) c
Continuing.
Breakpoint 3, __tunables_init (envp=envp@entry=0x7fffffffde28)
at dl-tunables.c:208
208 {
(gdb) bt
#0 __tunables_init (envp=envp@entry=0x7fffffffde28) at dl-tunables.c:208
#1 0x0000000000447ceb in __libc_init_first (argc=argc@entry=1,
argv=argv@entry=0x7fffffffde18, envp=0x7fffffffde28)
at ../csu/init-first.c:81
#2 0x00000000004013f8 in generic_start_main (main=main@entry=0x400400 <main>,
argc=argc@entry=1, argv=argv@entry=0x7fffffffde18,
init=init@entry=0x401d10 <__libc_csu_init>,
fini=fini@entry=0x401da0 <__libc_csu_fini>, rtld_fini=rtld_fini@entry=0x0,
stack_end=0x7fffffffde08) at ../csu/libc-start.c:225
#3 0x0000000000401702 in __libc_start_main (main=0x400400 <main>, argc=1,
argv=0x7fffffffde18, init=0x401d10 <__libc_csu_init>,
fini=0x401da0 <__libc_csu_fini>, rtld_fini=0x0, stack_end=0x7fffffffde08)
at ../sysdeps/x86/libc-start.c:38
#4 0x0000000000400aea in _start () at ../sysdeps/x86_64/start.S:120
(gdb)
It needs to be called before init_cpu_features on x86.
--
H.J.