* [PATCH v2]: arch: arm64: vdso: export the symbols for time()
@ 2020-06-15 14:38 Mark Salyzyn
2020-06-23 14:44 ` Will Deacon
0 siblings, 1 reply; 3+ messages in thread
From: Mark Salyzyn @ 2020-06-15 14:38 UTC (permalink / raw)
To: linux-kernel
Cc: kernel-team, Chiawei Wang, Mark Salyzyn, Catalin Marinas,
Will Deacon, Thomas Gleixner, Vincenzo Frascino, Enrico Weigelt,
Greg Kroah-Hartman, Alexios Zavras, linux-arm-kernel,
Allison Randal
From: Chiawei Wang <chiaweiwang@google.com>
__cvdso_time() can be found in vDSO implementation,
but the symbols for time() are not exported.
Export the symbols and run bionic-benchmarks.
BEFORE:
bionic-benchmarks32 --bionic_extra BM_time_time
-----------------------------------------------------
Benchmark Time CPU Iterations
-----------------------------------------------------
BM_time_time 83.6 ns 83.5 ns 8385964
bionic-benchmarks64 --bionic_extra BM_time_time
-----------------------------------------------------
Benchmark Time CPU Iterations
-----------------------------------------------------
BM_time_time 63.5 ns 63.4 ns 11037509
AFTER:
bionic-benchmarks32 --bionic_extra BM_time_time
-----------------------------------------------------
Benchmark Time CPU Iterations
-----------------------------------------------------
BM_time_time 8.57 ns 8.56 ns 81887312
bionic-benchmarks64 --bionic_extra BM_time_time
-----------------------------------------------------
Benchmark Time CPU Iterations
-----------------------------------------------------
BM_time_time 7.52 ns 7.51 ns 93253809
Signed-off-by: Chiawei Wang <chiaweiwang@google.com>
Signed-off-by: Mark Salyzyn <salyzyn@android.com>
Cc: linux-kernel@vger.kernel.org
Cc: kernel-team@android.com
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Enrico Weigelt <info@metux.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alexios Zavras <alexios.zavras@intel.com>
Cc: linux-arm-kernel@lists.infradead.org
---
v2:
- add prototypes in both vgettimeofday.c
- use __kernel_old_time_t instead of time_t
---
arch/arm64/include/asm/vdso/compat_gettimeofday.h | 12 ++++++++++++
arch/arm64/include/asm/vdso/gettimeofday.h | 10 ++++++++++
arch/arm64/kernel/vdso/vdso.lds.S | 1 +
arch/arm64/kernel/vdso/vgettimeofday.c | 5 +++++
arch/arm64/kernel/vdso32/vdso.lds.S | 1 +
arch/arm64/kernel/vdso32/vgettimeofday.c | 5 +++++
6 files changed, 34 insertions(+)
diff --git a/arch/arm64/include/asm/vdso/compat_gettimeofday.h b/arch/arm64/include/asm/vdso/compat_gettimeofday.h
index b6907ae78e53..d0a5655785bd 100644
--- a/arch/arm64/include/asm/vdso/compat_gettimeofday.h
+++ b/arch/arm64/include/asm/vdso/compat_gettimeofday.h
@@ -14,8 +14,20 @@
#define VDSO_HAS_CLOCK_GETRES 1
+#define VDSO_HAS_TIME 1
+
#define BUILD_VDSO32 1
+extern int __vdso_clock_gettime(clockid_t clock,
+ struct old_timespec32 *ts);
+extern int __vdso_clock_gettime64(clockid_t clock,
+ struct __kernel_timespec *ts);
+extern int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
+ struct timezone *tz);
+extern int __vdso_clock_getres(clockid_t clock_id,
+ struct old_timespec32 *res);
+extern __kernel_old_time_t time(__kernel_old_time_t *time);
+
static __always_inline
int gettimeofday_fallback(struct __kernel_old_timeval *_tv,
struct timezone *_tz)
diff --git a/arch/arm64/include/asm/vdso/gettimeofday.h b/arch/arm64/include/asm/vdso/gettimeofday.h
index afba6ba332f8..e0dcf0dce6c0 100644
--- a/arch/arm64/include/asm/vdso/gettimeofday.h
+++ b/arch/arm64/include/asm/vdso/gettimeofday.h
@@ -11,6 +11,16 @@
#define VDSO_HAS_CLOCK_GETRES 1
+#define VDSO_HAS_TIME 1
+
+extern int __kernel_clock_gettime(clockid_t clock,
+ struct __kernel_timespec *ts);
+extern int __kernel_gettimeofday(struct __kernel_old_timeval *tv,
+ struct timezone *tz);
+extern int __kernel_clock_getres(clockid_t clock_id,
+ struct __kernel_timespec *res);
+extern __kernel_old_time_t __vdso_time(__kernel_old_time_t *time);
+
static __always_inline
int gettimeofday_fallback(struct __kernel_old_timeval *_tv,
struct timezone *_tz)
diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S
index 7ad2d3a0cd48..61dddb0af1a5 100644
--- a/arch/arm64/kernel/vdso/vdso.lds.S
+++ b/arch/arm64/kernel/vdso/vdso.lds.S
@@ -77,6 +77,7 @@ VERSION
__kernel_gettimeofday;
__kernel_clock_gettime;
__kernel_clock_getres;
+ __kernel_time;
local: *;
};
}
diff --git a/arch/arm64/kernel/vdso/vgettimeofday.c b/arch/arm64/kernel/vdso/vgettimeofday.c
index 4236cf34d7d9..9a9058ba1f89 100644
--- a/arch/arm64/kernel/vdso/vgettimeofday.c
+++ b/arch/arm64/kernel/vdso/vgettimeofday.c
@@ -23,3 +23,8 @@ int __kernel_clock_getres(clockid_t clock_id,
{
return __cvdso_clock_getres(clock_id, res);
}
+
+__kernel_old_time_t __vdso_time(__kernel_old_time_t *time)
+{
+ return __cvdso_time(time);
+}
diff --git a/arch/arm64/kernel/vdso32/vdso.lds.S b/arch/arm64/kernel/vdso32/vdso.lds.S
index a3944927eaeb..2222c78451b4 100644
--- a/arch/arm64/kernel/vdso32/vdso.lds.S
+++ b/arch/arm64/kernel/vdso32/vdso.lds.S
@@ -69,6 +69,7 @@ VERSION
__kernel_rt_sigreturn_arm;
__kernel_rt_sigreturn_thumb;
__vdso_clock_gettime64;
+ __vdso_time;
local: *;
};
}
diff --git a/arch/arm64/kernel/vdso32/vgettimeofday.c b/arch/arm64/kernel/vdso32/vgettimeofday.c
index 5acff29c5991..7eb988fa06d8 100644
--- a/arch/arm64/kernel/vdso32/vgettimeofday.c
+++ b/arch/arm64/kernel/vdso32/vgettimeofday.c
@@ -30,6 +30,11 @@ int __vdso_clock_getres(clockid_t clock_id,
return __cvdso_clock_getres_time32(clock_id, res);
}
+__kernel_old_time_t time(__kernel_old_time_t *time)
+{
+ return __cvdso_time(time);
+}
+
/* Avoid unresolved references emitted by GCC */
void __aeabi_unwind_cpp_pr0(void)
--
2.27.0.290.gba653c62da-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2]: arch: arm64: vdso: export the symbols for time()
2020-06-15 14:38 [PATCH v2]: arch: arm64: vdso: export the symbols for time() Mark Salyzyn
@ 2020-06-23 14:44 ` Will Deacon
[not found] ` <CAJ-C09j3ZZOZDPLiS+8-9Ypd1hYtfJY5LUym8z79xAUKS11VUA@mail.gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Will Deacon @ 2020-06-23 14:44 UTC (permalink / raw)
To: Mark Salyzyn
Cc: linux-kernel, kernel-team, Chiawei Wang, Catalin Marinas,
Thomas Gleixner, Vincenzo Frascino, Enrico Weigelt,
Greg Kroah-Hartman, Alexios Zavras, linux-arm-kernel,
Allison Randal
On Mon, Jun 15, 2020 at 07:38:24AM -0700, Mark Salyzyn wrote:
> From: Chiawei Wang <chiaweiwang@google.com>
>
> __cvdso_time() can be found in vDSO implementation,
> but the symbols for time() are not exported.
>
> Export the symbols and run bionic-benchmarks.
>
> BEFORE:
> bionic-benchmarks32 --bionic_extra BM_time_time
> -----------------------------------------------------
> Benchmark Time CPU Iterations
> -----------------------------------------------------
> BM_time_time 83.6 ns 83.5 ns 8385964
>
> bionic-benchmarks64 --bionic_extra BM_time_time
> -----------------------------------------------------
> Benchmark Time CPU Iterations
> -----------------------------------------------------
> BM_time_time 63.5 ns 63.4 ns 11037509
>
> AFTER:
> bionic-benchmarks32 --bionic_extra BM_time_time
> -----------------------------------------------------
> Benchmark Time CPU Iterations
> -----------------------------------------------------
> BM_time_time 8.57 ns 8.56 ns 81887312
>
> bionic-benchmarks64 --bionic_extra BM_time_time
> -----------------------------------------------------
> Benchmark Time CPU Iterations
> -----------------------------------------------------
> BM_time_time 7.52 ns 7.51 ns 93253809
>
> Signed-off-by: Chiawei Wang <chiaweiwang@google.com>
> Signed-off-by: Mark Salyzyn <salyzyn@android.com>
> Cc: linux-kernel@vger.kernel.org
> Cc: kernel-team@android.com
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
> Cc: Enrico Weigelt <info@metux.net>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Alexios Zavras <alexios.zavras@intel.com>
> Cc: linux-arm-kernel@lists.infradead.org
I don't understand this: neither arm nor arm64 offer the time() syscall
afaict, so the C library should be implementing it in terms of
clock_gettime() anyway, which _is_ implemented in the vDSO.
What's am I missing?
Will
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2]: arch: arm64: vdso: export the symbols for time()
[not found] ` <CAJ-C09j3ZZOZDPLiS+8-9Ypd1hYtfJY5LUym8z79xAUKS11VUA@mail.gmail.com>
@ 2020-06-23 16:57 ` Will Deacon
0 siblings, 0 replies; 3+ messages in thread
From: Will Deacon @ 2020-06-23 16:57 UTC (permalink / raw)
To: Mark Salyzyn
Cc: LKML, Android Kernel Team, Chiawei Wang, Catalin Marinas,
Thomas Gleixner, Vincenzo Frascino, Enrico Weigelt,
Greg Kroah-Hartman, Alexios Zavras, linux-arm-kernel,
Allison Randal
On Tue, Jun 23, 2020 at 09:47:57AM -0700, Mark Salyzyn wrote:
> time() in bionic libc will go an use vDSO interface to pick up this
> low-resolution timer.
But my point is it should _already_ be using the vDSO implementation of
clock_gettime(), which should be plenty fast enough.
Will
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-23 16:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15 14:38 [PATCH v2]: arch: arm64: vdso: export the symbols for time() Mark Salyzyn
2020-06-23 14:44 ` Will Deacon
[not found] ` <CAJ-C09j3ZZOZDPLiS+8-9Ypd1hYtfJY5LUym8z79xAUKS11VUA@mail.gmail.com>
2020-06-23 16:57 ` Will Deacon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).