From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 112664 invoked by alias); 17 Dec 2019 21:48:03 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 112065 invoked by uid 89); 17 Dec 2019 21:47:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-pl1-f193.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=4MEXIdRf8yD53U9/KzkUBR4BOJO14065UJrrJBjCSpg=; b=hjjVo78/ORIGUTs7CgfU4zgEESDA6sgJeRrvCiBp8iuxyjpXPsQ/9QuexoSG4f2GgD Tkf6r1l//UKjzP3uJR4pzzNHqZl6y61qy6bIeZo+KdQLXO1rwqfhN1LMtyGTYZTokH1V XLN6Tw4XgF04mBohdW4x4FxaPXL5hhoeORhhgRedW1ByzGsqZVgU98Jl48bcQf9mMFPB DJvLWl8AWIl9dSBy2cOD4tzSyV7mjpxex9qm/UKYVue6XntYwquZD+tvCpL7FFQpU1eJ jhsj3buHAF7L0Q0Cz++RRaCT3SQhAv8pnHkJEIq9M++9MwnWPLvFz4KWvGphaaikIjT8 xeYA== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 15/16] linux: Add support for clock_getres64 vDSO Date: Tue, 17 Dec 2019 21:48:00 -0000 Message-Id: <20191217214728.2886-15-adhemerval.zanella@linaro.org> In-Reply-To: <20191217214728.2886-1-adhemerval.zanella@linaro.org> References: <20191217214728.2886-1-adhemerval.zanella@linaro.org> X-SW-Source: 2019-12/txt/msg00601.txt.bz2 Changes from previous version: - Rename HAVE_CLOCK_GETTIME_VSYSCALL to HAVE_CLOCK_GETTIME64_VSYSCALL on 64 bit time_t architectures. -- No architecture currently defines the vDSO symbol. On archictures with 64-bit time_t the HAVE_CLOCK_GETRES_VSYSCALL is renamed to HAVE_CLOCK_GETRES64_VSYSCALL, it simplifies clock_gettime code. --- sysdeps/unix/sysv/linux/aarch64/sysdep.h | 2 +- sysdeps/unix/sysv/linux/clock_getres.c | 17 ++++++++++------- sysdeps/unix/sysv/linux/dl-vdso-setup.c | 4 ++++ sysdeps/unix/sysv/linux/dl-vdso-setup.h | 3 +++ sysdeps/unix/sysv/linux/powerpc/sysdep.h | 3 ++- sysdeps/unix/sysv/linux/riscv/sysdep.h | 2 +- sysdeps/unix/sysv/linux/s390/sysdep.h | 3 ++- sysdeps/unix/sysv/linux/x86_64/sysdep.h | 2 +- 8 files changed, 24 insertions(+), 12 deletions(-) diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h index 26aa2f9779..f50b3f95b9 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h @@ -160,7 +160,7 @@ # endif /* List of system calls which are supported as vsyscalls. */ -# define HAVE_CLOCK_GETRES_VSYSCALL "__kernel_clock_getres" +# define HAVE_CLOCK_GETRES64_VSYSCALL "__kernel_clock_getres" # define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime" # define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday" diff --git a/sysdeps/unix/sysv/linux/clock_getres.c b/sysdeps/unix/sysv/linux/clock_getres.c index 52671fa641..3d59f11d71 100644 --- a/sysdeps/unix/sysv/linux/clock_getres.c +++ b/sysdeps/unix/sysv/linux/clock_getres.c @@ -30,20 +30,23 @@ __clock_getres64 (clockid_t clock_id, struct __timespec64 *res) { #ifdef __ASSUME_TIME64_SYSCALLS /* 64 bit ABIs or Newer 32-bit ABIs that only support 64-bit time_t. */ -# ifdef __NR_clock_getres_time64 - return INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res); +# ifndef __NR_clock_getres_time64 +# define __NR_clock_getres_time64 __NR_clock_getres +# endif +# ifdef HAVE_CLOCK_GETRES64_VSYSCALL + return INLINE_VSYSCALL (clock_getres_time64, 2, clock_id, res); # else -# ifdef HAVE_CLOCK_GETRES_VSYSCALL - return INLINE_VSYSCALL (clock_getres, 2, clock_id, res); -# else - return INLINE_SYSCALL_CALL (clock_getres, clock_id, res); -# endif + return INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res); # endif #else int r; /* Old 32-bit ABI with possible 64-bit time_t support. */ # ifdef __NR_clock_getres_time64 +# ifdef HAVE_CLOCK_GETRES64_VSYSCALL + r = INLINE_VSYSCALL (clock_getres_time64, 2, clock_id, res); +# else r = INLINE_SYSCALL_CALL (clock_getres_time64, clock_id, res); +# endif if (r == 0 || errno != ENOSYS) return r; # endif diff --git a/sysdeps/unix/sysv/linux/dl-vdso-setup.c b/sysdeps/unix/sysv/linux/dl-vdso-setup.c index b0b692f78c..594316342a 100644 --- a/sysdeps/unix/sysv/linux/dl-vdso-setup.c +++ b/sysdeps/unix/sysv/linux/dl-vdso-setup.c @@ -62,6 +62,10 @@ PROCINFO_CLASS int (*_dl_vdso_getcpu) (unsigned *, unsigned *, void *) RELRO; PROCINFO_CLASS int (*_dl_vdso_clock_getres) (clockid_t, struct timespec *) RELRO; # endif +# ifdef HAVE_CLOCK_GETRES64_VSYSCALL +PROCINFO_CLASS int (*_dl_vdso_clock_getres_time64) (clockid_t, + struct __timespec64 *) RELRO; +# endif /* PowerPC specific ones. */ # ifdef HAVE_GET_TBFREQ diff --git a/sysdeps/unix/sysv/linux/dl-vdso-setup.h b/sysdeps/unix/sysv/linux/dl-vdso-setup.h index 8a89e100c8..036f62b1c4 100644 --- a/sysdeps/unix/sysv/linux/dl-vdso-setup.h +++ b/sysdeps/unix/sysv/linux/dl-vdso-setup.h @@ -41,6 +41,9 @@ setup_vdso_pointers (void) #ifdef HAVE_CLOCK_GETRES_VSYSCALL GLRO(dl_vdso_clock_getres) = dl_vdso_vsym (HAVE_CLOCK_GETRES_VSYSCALL); #endif +#ifdef HAVE_CLOCK_GETRES64_VSYSCALL + GLRO(dl_vdso_clock_getres_time64) = dl_vdso_vsym (HAVE_CLOCK_GETRES64_VSYSCALL); +#endif #ifdef HAVE_GET_TBFREQ GLRO(dl_vdso_get_tbfreq) = dl_vdso_vsym (HAVE_GET_TBFREQ); #endif diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/sysdep.h index c42659a9c4..d36aa6dbcb 100644 --- a/sysdeps/unix/sysv/linux/powerpc/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h @@ -20,10 +20,11 @@ #define VDSO_HASH 123718565 /* List of system calls which are supported as vsyscalls. */ -#define HAVE_CLOCK_GETRES_VSYSCALL "__kernel_clock_getres" #if defined(__PPC64__) || defined(__powerpc64__) +#define HAVE_CLOCK_GETRES64_VSYSCALL "__kernel_clock_getres" #define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime" #else +#define HAVE_CLOCK_GETRES_VSYSCALL "__kernel_clock_getres" #define HAVE_CLOCK_GETTIME_VSYSCALL "__kernel_clock_gettime" #endif #define HAVE_GETCPU_VSYSCALL "__kernel_getcpu" diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h index 7f43595cb0..201bf9a91b 100644 --- a/sysdeps/unix/sysv/linux/riscv/sysdep.h +++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h @@ -125,7 +125,7 @@ # define VDSO_HASH 182943605 /* List of system calls which are supported as vsyscalls. */ -# define HAVE_CLOCK_GETRES_VSYSCALL "__vdso_clock_getres" +# define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres" # define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime" # define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" # define HAVE_GETCPU_VSYSCALL "__vdso_getcpu" diff --git a/sysdeps/unix/sysv/linux/s390/sysdep.h b/sysdeps/unix/sysv/linux/s390/sysdep.h index 030bd59ad0..2df5705050 100644 --- a/sysdeps/unix/sysv/linux/s390/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/sysdep.h @@ -20,10 +20,11 @@ #define VDSO_HASH 123718585 /* List of system calls which are supported as vsyscalls. */ -#define HAVE_CLOCK_GETRES_VSYSCALL "__kernel_clock_getres" #ifdef __s390x__ +#define HAVE_CLOCK_GETRES64_VSYSCALL "__kernel_clock_getres" #define HAVE_CLOCK_GETTIME64_VSYSCALL "__kernel_clock_gettime" #else +#define HAVE_CLOCK_GETRES_VSYSCALL "__kernel_clock_getres" #define HAVE_CLOCK_GETTIME_VSYSCALL "__kernel_clock_gettime" #endif #define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday" diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index 57a64dce31..8a699de6b7 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -378,7 +378,7 @@ # define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" # define HAVE_TIME_VSYSCALL "__vdso_time" # define HAVE_GETCPU_VSYSCALL "__vdso_getcpu" -# define HAVE_CLOCK_GETRES_VSYSCALL "__vdso_clock_getres" +# define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres" # define SINGLE_THREAD_BY_GLOBAL 1 -- 2.17.1