From patchwork Tue Dec 17 21:47:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 181927 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp6351807ile; Tue, 17 Dec 2019 13:50:23 -0800 (PST) X-Google-Smtp-Source: APXvYqwXBLiazFN/HOI+reG2IgyD1cdGCOQ/EqZL0a5ehsMWYJsLEQKvRLm/THPaIU3te4CnXUh9 X-Received: by 2002:aca:ecd3:: with SMTP id k202mr2883628oih.71.1576619423856; Tue, 17 Dec 2019 13:50:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576619423; cv=none; d=google.com; s=arc-20160816; b=TZ75oSFimciD7wGi5K9xsjikNFZxiMbUC8Ub8jvvbwwVYzt73mQC8jxroc13m7Cjis ZXs/heZh0deC/xFi0KHOOchbiTpKjhk8BIPZUWSA6K91gsuhnFLS5bOXGOCBWvvdm8o6 DMBDBY60DSGUEUDc3riwRCPE3QD+y5K3XewnRvEe6YYQTXJb08M0civaIuflLWWC1h5U W92UhviAaQDBSlT79xzJqQd58PseWOlz/wZuYziWygc8yRu7pS1TpC/m44c4NNS55QBf biyOGzleQ2Dnry028pkQec510vLf3xZMt7ogpQLXgx9fSiXdVfndsUJKJd1a5n7rcfKM jwIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=4MEXIdRf8yD53U9/KzkUBR4BOJO14065UJrrJBjCSpg=; b=WJ3d9LmH30hLkfnTjN5Ux39a3rRFb/RzbOvwknHCtQlvOcRS88tKLEhQxiiClv0PQR +okG4L8pMZS+zdvPfSGH04TUdMHBxiCAc/sc+g1cUkNN+g4EXGmCRIXthiEtuS6vHvFs /AYucNpTGzR3kEF6LwGePZGE0H7YnytWVBbfzLG7Ghsv8cRgCvYmQfzvO+vuLHlqsPIf z9+bgRLwmUkt2HcaKNbkf919/qpQeP7FQAv1nyGQrrIGUP47XqhIDT7TwaGSdPDXcnaU yzu4dk/jsdJZFR41DVH8/o/i4Iw2udYdnPZgApcDBrap2RNMKNbBWBwoKtVdok4HUPon Cj7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=R8SQJAT0; dkim=pass header.i=@linaro.org header.s=google header.b="hjjVo78/"; spf=pass (google.com: domain of libc-alpha-return-108177-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108177-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id q127si13482821oic.99.2019.12.17.13.50.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Dec 2019 13:50:23 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-108177-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=R8SQJAT0; dkim=pass header.i=@linaro.org header.s=google header.b="hjjVo78/"; spf=pass (google.com: domain of libc-alpha-return-108177-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-108177-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=oPj6aCFXrVIKj8QeGx70RVLHzQzElDf RZj7NpSGIFA0iVnknPfexq7u7DzBJb0Nk64gmX+5uGMVCJZmV/u0CwCEF6w+Y+N+ 2EXPVNU9+yUhbbQtdGFSgkWEY/J8aQI3jYnJoL4quNF/8fyWvwBR2UQXvVIq0wd5 bDlERuhM+iwQ= 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=R8SQJ AT0cioK7eip4GySMtm0p50G9C9RcstbRJgCVwSw+t92DaMXiQKh5m1TzD7v+JDMV KmjqdTKXctK3ZaVJPuDVPBCgPDhmzsTnv8zEampt/w3QlVs9cCHBlTZKDiAiwOLy E1hhstIGmnWPFRbA+EV7pPDvPXsAd3sXFgPnOc= 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 Delivered-To: mailing list libc-alpha@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 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(-) -- 2.17.1 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