From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9207 Path: news.gmane.org!not-for-mail From: Hauke Mehrtens Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH v3 2/2] mips: add vdso support Date: Tue, 26 Jan 2016 21:26:34 +0100 Message-ID: <1453839994-7649-2-git-send-email-hauke@hauke-m.de> References: <1453839994-7649-1-git-send-email-hauke@hauke-m.de> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1453840024 23771 80.91.229.3 (26 Jan 2016 20:27:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 Jan 2016 20:27:04 +0000 (UTC) Cc: Hauke Mehrtens To: musl@lists.openwall.com Original-X-From: musl-return-9220-gllmg-musl=m.gmane.org@lists.openwall.com Tue Jan 26 21:27:04 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1aOACa-0006Gi-LG for gllmg-musl@m.gmane.org; Tue, 26 Jan 2016 21:27:00 +0100 Original-Received: (qmail 24119 invoked by uid 550); 26 Jan 2016 20:26:57 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 23850 invoked from network); 26 Jan 2016 20:26:50 -0000 X-Mailer: git-send-email 2.7.0.rc3 In-Reply-To: <1453839994-7649-1-git-send-email-hauke@hauke-m.de> X-Spam-Status: No, score=0.0 required=7.0 tests=UNPARSEABLE_RELAY, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on hauke-m.de Xref: news.gmane.org gmane.linux.lib.musl.general:9207 Archived-At: vdso support is available on mips starting with kernel 4.4, see kernel commit a7f4df4e21 "MIPS: VDSO: Add implementations of gettimeofday() and clock_gettime()" for details. In Linux kernel 4.4.0 the mips code returns -ENOSYS in case it can not handle the vdso call and assumes the libc will call the original syscall in this case. Handle this case in musl. Currently Linux kernel 4.4.0 handles the following types: CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE, CLOCK_REALTIME and CLOCK_MONOTONIC. These are some measurements of calling clock_gettime(CLOCK_MONOTONIC, &tp); 1.000.000 times. without vdso: root@OpenWrt:/# time ./vdso-test real 0m 0.95s user 0m 0.24s sys 0m 0.70s with vdso: root@OpenWrt:/# time /usr/bin/vdso-test real 0m 0.35s user 0m 0.34s sys 0m 0.00s Signed-off-by: Hauke Mehrtens --- arch/mips/syscall_arch.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/mips/syscall_arch.h b/arch/mips/syscall_arch.h index e74e0ad..39c0ea3 100644 --- a/arch/mips/syscall_arch.h +++ b/arch/mips/syscall_arch.h @@ -161,3 +161,7 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo if (n == SYS_fstatat) __stat_fix(c); return r2; } + +#define VDSO_USEFUL +#define VDSO_CGT_SYM "__vdso_clock_gettime" +#define VDSO_CGT_VER "LINUX_2.6" -- 2.7.0.rc3