Skip to contentSkip to conversation

: arch: arm64: vdso: export the symbols for time()

PATCH Superseded Mark Salyzyn 2 participants 2 messages Jun 15, 2020 arm64

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : arch: arm64: vdso: export the symbols for time()

From: Chiawei Wang <[email protected]>

__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

---
 arch/arm64/include/asm/vdso/compat_gettimeofday.h | 2 ++
 arch/arm64/include/asm/vdso/gettimeofday.h        | 2 ++
 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, 16 insertions(+)
arch/arm64/include/asm/vdso/compat_gettimeofday.h +2 -0
index b6907ae78e53..55e841bff432 100644
@@ -14,6 +14,8 @@
 
 #define VDSO_HAS_CLOCK_GETRES		1
 
+#define VDSO_HAS_TIME			1
+
 #define BUILD_VDSO32			1
 
 static __always_inline
arch/arm64/include/asm/vdso/gettimeofday.h +2 -0
index afba6ba332f8..4d2f028284a0 100644
@@ -11,6 +11,8 @@
 
 #define VDSO_HAS_CLOCK_GETRES		1
 
+#define VDSO_HAS_TIME			1
+
 static __always_inline
 int gettimeofday_fallback(struct __kernel_old_timeval *_tv,
 			  struct timezone *_tz)
arch/arm64/kernel/vdso/vdso.lds.S +1 -0
index 7ad2d3a0cd48..61dddb0af1a5 100644
@@ -77,6 +77,7 @@ VERSION
 		__kernel_gettimeofday;
 		__kernel_clock_gettime;
 		__kernel_clock_getres;
+		__kernel_time;
 	local: *;
 	};
 }
arch/arm64/kernel/vdso/vgettimeofday.c +5 -0
index 4236cf34d7d9..09be63204e74 100644
@@ -23,3 +23,8 @@ int __kernel_clock_getres(clockid_t clock_id,
 {
 	return __cvdso_clock_getres(clock_id, res);
 }
+
+time_t __kernel_time(time_t *time)
+{
+	return __cvdso_time(time);
+}
arch/arm64/kernel/vdso32/vdso.lds.S +1 -0
index a3944927eaeb..2222c78451b4 100644
@@ -69,6 +69,7 @@ VERSION
 		__kernel_rt_sigreturn_arm;
 		__kernel_rt_sigreturn_thumb;
 		__vdso_clock_gettime64;
+		__vdso_time;
 	local: *;
 	};
 }
arch/arm64/kernel/vdso32/vgettimeofday.c +5 -0
index 5acff29c5991..9296385e7bb8 100644
@@ -30,6 +30,11 @@ int __vdso_clock_getres(clockid_t clock_id,
 	return __cvdso_clock_getres_time32(clock_id, res);
 }
 
+time_t __vdso_time(time_t *time)
+{
+	return __cvdso_time(time);
+}
+
 /* Avoid unresolved references emitted by GCC */
 
 void __aeabi_unwind_cpp_pr0(void)
Signature · 1 line
2.27.0.290.gba653c62da-goog
#1 lore raw
Thank you for the patch! Yet something to improve:

Hi Mark,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on soc/for-next linus/master v5.8-rc1 next-20200615] [cannot apply to linux/master]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Mark-Salyzyn/arch-arm64-vdso-export-the-symbols-for-time/20200615-192523
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>, old ones prefixed by <<):

arch/arm64/kernel/vdso/vgettimeofday.c:9:5: warning: no previous prototype for '__kernel_clock_gettime' [-Wmissing-prototypes] 9 | int __kernel_clock_gettime(clockid_t clock,
| ^~~~~~~~~~~~~~~~~~~~~~
arch/arm64/kernel/vdso/vgettimeofday.c:15:5: warning: no previous prototype for '__kernel_gettimeofday' [-Wmissing-prototypes] 15 | int __kernel_gettimeofday(struct __kernel_old_timeval *tv,
| ^~~~~~~~~~~~~~~~~~~~~
arch/arm64/kernel/vdso/vgettimeofday.c:21:5: warning: no previous prototype for '__kernel_clock_getres' [-Wmissing-prototypes] 21 | int __kernel_clock_getres(clockid_t clock_id,
| ^~~~~~~~~~~~~~~~~~~~~

>> arch/arm64/kernel/vdso/vgettimeofday.c:27:1: error: unknown type name 'time_t'; did you mean 'timer_t'?

27 | time_t __kernel_time(time_t *time)
| ^~~~~~
| timer_t
arch/arm64/kernel/vdso/vgettimeofday.c:27:22: error: unknown type name 'time_t'; did you mean 'timer_t'? 27 | time_t __kernel_time(time_t *time)

|                      ^~~~~~
|                      timer_t

make[2]: *** [scripts/Makefile.build:267: arch/arm64/kernel/vdso/vgettimeofday.o] Error 1 make[2]: Target 'include/generated/vdso-offsets.h' not remade because of errors. make[1]: *** [arch/arm64/Makefile:183: vdso_prepare] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:180: sub-make] Error 2
make: Target 'prepare' not remade because of errors.

vim +27 arch/arm64/kernel/vdso/vgettimeofday.c

    26	
  > 27	time_t __kernel_time(time_t *time)

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org