From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 4744E1F463 for ; Tue, 17 Dec 2019 21:50:15 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=vXeZpBffldnit53IoH7wfkhVk34Kiyx pI6Wd9LwHYZs5LXFfYaNndH1RTwNAS6MKS39vgMLo6Wb0uY1wjAVhXJPBgBEGaWW dE8O/PaEZQnBBpBoSMvi3FJb3cdknoRgfezVQIYbpCQ9NNGZYctMVqOvIWTvmHlu H7B28omFPnzU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=Akpmgjni8iqfD+AiC4JDiM5VpI0=; b=oG+bJ LQfp2eKcws5kuH6vfGynE1PejabtQqvS+XvjoCKwJ95BI9xAct4II6eDoCN9fskS v8QKRM9PYGd3XOASSsXy4kxf1AP69ZWiv7OgMCkkethHMDd/DBu5qUGFfslVR3V8 8kuHDoO1xY2DTTK+PyvKRovKfaFUIBBY4TNtNM= 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-Unsubscribe: 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-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== 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 18:47:27 -0300 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> 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