This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 3/4] powerpc: Refactor of _get_timebase_freq
On 13/06/2019 12:11, Raoni Fassina Firmino wrote:
> Since BZ#19767 is at least fixed for powerpc, we can now use the same
> code in an agnostic way for static and shared linkage. Also because all
> vDSO symbol do no fail we can simplify the vDSO calling without most of
> the wrapper macros.
>
> We keep the /proc/cpuinfo parsing as fallback if a kernel is built
> without vDSO support
>
> This implements the solution drafted by Adhemerval Zanella
> <adhemerval.zanella@linaro.org> on the mailing list:
>
> https://www.sourceware.org/ml/libc-alpha/2019-05/msg00658.html
>
> ChangeLog:
>
> 2019-06-13 Raoni Fassina Firmino <raoni@linux.ibm.com>
>
> * sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c
> (__get_timebase_freq): Refactoring.
> ---
> sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c b/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c
> index c245e97526..959c311acb 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c
> +++ b/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c
> @@ -28,12 +28,12 @@ __get_timebase_freq (void)
> {
> hp_timing_t result = 0L;
>
> -#ifdef SHARED
> - /* The vDSO does not return an error (it clear cr0.so on returning). */
> - INTERNAL_SYSCALL_DECL (err);
> - result =
> - INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK (get_tbfreq, err, uint64_t, 0);
> -#else
> + /* The vDSO does not fail (it clears cr0.so on returning). */
> + __typeof (VDSO_SYMBOL(get_tbfreq)) vdsop = VDSO_SYMBOL(get_tbfreq);
> + PTR_DEMANGLE (vdsop);
> + if (vdsop != NULL)
> + return vdsop ();
> +
This will fail on powerpc64 elfv1 because kernel vDSO does not provide ODP
entries (check sysdeps/unix/sysv/linux/powerpc/libc-vdso.h comment about it).
You will need to use VDSO_IFUNC_RET macros, as for gettimeofday and time
powerpc implementation.
As a side note, I will send it shortly a vDSO refactor that would make
use of internal vDSO symbol more simple on powerpc.
> /* We read the information from the /proc filesystem. /proc/cpuinfo
> contains at least one line like:
> timebase : 33333333
> @@ -99,7 +99,6 @@ __get_timebase_freq (void)
> }
> }
> }
> -#endif
>
> return result;
> }
>