gettimeofday / vdso / aarch64 question

Adhemerval Zanella adhemerval.zanella@linaro.org
Thu May 10 18:05:00 GMT 2018



On 10/05/2018 13:22, Steve Ellcey wrote:
> On Thu, 2018-05-10 at 09:42 +0200, Andreas Schwab wrote:
>> On Mai 09 2018, Steve Ellcey <sellcey@cavium.com> wrote:
>>
>>>
>>> +libc_ifunc_hidden (__redirect___gettimeofday, __gettimeofday,
>>> +                    vdso_gettimeofday ?: (void *)
>>> __gettimeofday_syscall)
>>> +# undef libc_hidden_def
>>> +# define libc_hidden_def(name)                               \
>>> +  __hidden_ver1 (__gettimeofday_syscall, __GI___gettimeofday,  \
>>> +               __gettimeofday_syscall);
>>> +weak_alias (__gettimeofday, gettimeofday)
>>> +libc_hidden_weak (gettimeofday)
>> You are (re)defining libc_hidden_def, but don't use it.
>>
>> Andreas.
> 
> Argh.  Staring at it too long to see it.  I have it building now,
> I will submit a patch once the testsuite finishes.
> 
> Steve Ellcey
> 

Keep in mind that different that x86 and powerpc implementations, where
the vDSO symbol does not fail; the arm64 vDSO implements a syscall
fallback in case of underlying hardware requires an out-of-line counter
access (arch_timer_enable_workaround).

Using a ifunc accessors to call vDSO directly will result in a slight
different semantic since generic implementation (kernel/time/time.c)
might return EFAULT in some cases (which won't be handled by ifunc
implementation).  This should not be an issue since POSIX [1] defines
no error code should reserved for the symbol, but it might trigger
some test in LTP.

I recommend you document it on commit log with the rationale to use
ifunc instead of usual INLINE_VSYSCALL.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/ 



More information about the Libc-alpha mailing list