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: [PATCH, resend] Add x86 32 bit vDSO time function support


On 12-01-2015 17:00, H.J. Lu wrote:
> On Mon, Jan 12, 2015 at 9:35 AM, Adhemerval Zanella
> <azanella@linux.vnet.ibm.com> wrote:
>> On 12-01-2015 13:59, H.J. Lu wrote:
>>> On Mon, Jan 12, 2015 at 6:49 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>> On Mon, Jan 12, 2015 at 6:28 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>> On Mon, Jan 12, 2015 at 5:51 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>>> On Tue, Jan 6, 2015 at 6:35 AM, Adhemerval Zanella
>>>>>> <azanella@linux.vnet.ibm.com> wrote:
>>>>>>> Ping.
>>>>>>>
>>>>>>> On 09-12-2014 13:32, Adhemerval Zanella wrote:
>>>>>>>> Linux 3.15 adds support for clock_gettime, gettimeofday, and time vDSO
>>>>>>>> (commit id 37c975545ec63320789962bf307f000f08fabd48).  This patch adds
>>>>>>>> GLIBC supports to use such symbol when they are avaiable.
>>>>>>>>
>>>>>>>> Along with x86 vDSO support, this patch cleanup x86_64 code by moving
>>>>>>>> all common code to x86 common folder.  Only init-first.c is different
>>>>>>>> between implementations.
>>>>>>>>
>>>>>>>> Tested on x86 and x86_64 with a 3.5.0 and a 3.16 kernel.
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> 2014-12-09  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
>>>>>>>>           Stefani Seibold  <stefani@seibold.net>
>>>>>>>>
>>>>>>>>       * sysdeps/unix/sysv/linux/x86_64/Makefile [$(subdir) = elf]
>>>>>>>>       (sysdep_routines): Add dl-vdso here, ...
>>>>>>>>       * sysdeps/unix/sysv/linux/x86/Makefile [$(subdir) = elf]
>>>>>>>>       (sysdep_routines): ... not here.
>>>>>>>>       * sysdeps/unix/sysv/linux/i386/gettimeofday.c: New file: set syscall
>>>>>>>>       fallback when vDSO is not presented.
>>>>>>>>       * sysdeps/unix/sysv/linux/x86_64/init-first.c (__vdso_clock_gettime):
>>>>>>>>       Define with libc_hidden_proto/libc_hidden_data_def definitions.
>>>>>>>>       (_libc_vdso_platform_setup): Rename to __vdso_platform_setup.
>>>>>>>>       * sysdeps/unix/sysv/linux/i386/init-first.c: New file: likewise.
>>>>>>>>       * sysdeps/unix/sysv/linux/i386/time.c: New file: likewise.
>>>>>>>>       * sysdeps/unix/sysv/linux/x86_64/bits/libc-vdso.h: Moved to ...
>>>>>>>>       * sysdeps/unix/sysv/linux/x86/libc-vdso.h: ... here.
>>>>>>>>       * sysdeps/unix/sysv/linux/x86_64/clock_gettime.c: Move to ...
>>>>>>>>       * sysdeps/unix/sysv/linux/x86/clock_gettime.c: ... here.
>>>>>>>>       * sysdeps/unix/sysv/linux/x86_64/gettimeofday.c: Move to ...
>>>>>>>>       * sysdeps/unix/sysv/linux/x86/gettimeofday.c: ... here.  Also added
>>>>>>>>       fallback configurable symbol when vDSO is not available.
>>>>>>>>       * sysdeps/unix/sysv/linux/x86_64/time.c: Move to ...
>>>>>>>>       * sysdeps/unix/sysv/linux/x86/time.c: ... here.  Also refactored to
>>>>>>>>       be able to redefine fallback symbol when vDSO is not available.
>>>>>>>>       * sysdeps/unix/sysv/linux/x86_64/timespec_get.c: Move to ...
>>>>>>>>       * sysdeps/unix/sysv/linux/x86/timespec_get.c: ... here.
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> +# include <dl-vdso.h>
>>>>>>>> +# include <errno.h>
>>>>>>>> +
>>>>>>>> +/* If the vDSO is not available we fall back on the syscall.  */
>>>>>>>> +static int
>>>>>>>> +__gettimeofday_syscall (struct timeval *tv, struct timezone *tz)
>>>>>>>> +{
>>>>>>>> +  return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
>>>>>>>> +}
>>>>>>>> +# define GETTIMEOFAY_FALLBACK (void*) (&__gettimeofday_syscall)
>>>>>>>> +# undef libc_ifunc_hidden_def
>>>>>>>> +# define libc_ifunc_hidden_def(name)  \
>>>>>>>> +  libc_ifunc_hidden_def1 (__GI_##name, __gettimeofday_syscall)
>>>>>> Why do you define __GI___gettimeofday to __gettimeofday_syscall
>>>>>> instead of the ifunc version? The x86-64 ifunc  works fine.
>>>>>>
>>>>>> --
>>>>>> H.J.
>>>>> Why isn't __GI_time IFUNC
>>>>>
>>>>> 5822: 000a3360    21 FUNC    LOCAL  DEFAULT   13 __GI_time
>>>>>
>>>> The key to call local IFUNC function is that we HAVE to tell GCC
>>>> it is a global function, not local so that it will go through PLT.
>>>> Otherwise GCC will perform optimization which will break local
>>>> IFUNC.  I will see what I can do.
>>>>
>>> This requires too many changes with unknown benefits at this stage.  OK with
>>> copyright year update and sysdeps/unix/sysv/linux/x86_64/x32/init-first.c
>>> fix.
>>>
>>> Thanks.
>>>
>> The idea of this patch is to just provide IFUNC calls externally to GLIBC, internal
>> calls are still by the syscall.  I didn't really dig into the issues, but what I
>> could tell i386 suffers from the same issue as powerpc32: __gettimeofday is resolved
>> as a local call and thus no PLT is created, although the IFUNC is still called.
> The problem on i386 is EBX wasn't set up for calling IFUNC via PLT since
> it is local.
>
>> I will change the copyright and the x32 and push, thanks for the review.
>>
Pushed as ca677d3c3cd0eba7d1f03092517aea553a0e8569.



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