Message ID | 20200605131131.16491-5-broonie@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | arm64: vdso: getcpu() support | expand |
Hi Mark, I love your patch! Perhaps something to improve: [auto build test WARNING on next-20200605] [cannot apply to arm64/for-next/core arm-perf/for-next/perf kselftest/next v5.7 v5.7-rc7 v5.7-rc6 v5.7] [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-Brown/arm64-vdso-getcpu-support/20200605-212237 base: af30725c132e2e5c5369b60369ff0771fde7d4ff 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 Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>, old ones prefixed by <<): >> arch/arm64/kernel/vdso/vgetcpu.c:33:5: warning: no previous prototype for '__kernel_getcpu' [-Wmissing-prototypes] 33 | int __kernel_getcpu(unsigned int *cpu, unsigned int *node, | ^~~~~~~~~~~~~~~ -- >> arch/arm64/kernel/vdso/vgetcpu.c:33:5: warning: no previous prototype for '__kernel_getcpu' [-Wmissing-prototypes] 33 | int __kernel_getcpu(unsigned int *cpu, unsigned int *node, | ^~~~~~~~~~~~~~~ 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, | ^~~~~~~~~~~~~~~~~~~~~ vim +/__kernel_getcpu +33 arch/arm64/kernel/vdso/vgetcpu.c 32 > 33 int __kernel_getcpu(unsigned int *cpu, unsigned int *node, --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
On Sat, Jun 06, 2020 at 12:11:08AM +0800, kernel test robot wrote: > >> arch/arm64/kernel/vdso/vgetcpu.c:33:5: warning: no previous prototype for '__kernel_getcpu' [-Wmissing-prototypes] > 33 | int __kernel_getcpu(unsigned int *cpu, unsigned int *node, > | ^~~~~~~~~~~~~~~ > -- > >> arch/arm64/kernel/vdso/vgetcpu.c:33:5: warning: no previous prototype for '__kernel_getcpu' [-Wmissing-prototypes] > 33 | int __kernel_getcpu(unsigned int *cpu, unsigned int *node, > | ^~~~~~~~~~~~~~~ > 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, > | ^~~~~~~~~~~~~~~~~~~~~~ I'm not seeing this here and what we're doing is in line with the existing idiom as can be seen from the __kernel_clock_gettime() code flagging the same thing. Possibly an old/outdated toolchain?
Hi Mark, I love your patch! Perhaps something to improve: [auto build test WARNING on next-20200605] [cannot apply to arm64/for-next/core arm-perf/for-next/perf kselftest/next v5.7 v5.7-rc7 v5.7-rc6 v5.7] [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-Brown/arm64-vdso-getcpu-support/20200605-212237 base: af30725c132e2e5c5369b60369ff0771fde7d4ff config: arm64-randconfig-r016-20200607 (attached as .config) compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project e429cffd4f228f70c1d9df0e5d77c08590dd9766) 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 # install arm64 cross compiling tool for clang build # apt-get install binutils-aarch64-linux-gnu # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>, old ones prefixed by <<): >> arch/arm64/kernel/vdso/vgetcpu.c:33:5: warning: no previous prototype for function '__kernel_getcpu' [-Wmissing-prototypes] int __kernel_getcpu(unsigned int *cpu, unsigned int *node, ^ arch/arm64/kernel/vdso/vgetcpu.c:33:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int __kernel_getcpu(unsigned int *cpu, unsigned int *node, ^ static 1 warning generated. -- >> arch/arm64/kernel/vdso/vgetcpu.c:33:5: warning: no previous prototype for function '__kernel_getcpu' [-Wmissing-prototypes] int __kernel_getcpu(unsigned int *cpu, unsigned int *node, ^ arch/arm64/kernel/vdso/vgetcpu.c:33:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int __kernel_getcpu(unsigned int *cpu, unsigned int *node, ^ static 1 warning generated. arch/arm64/kernel/vdso/vgettimeofday.c:9:5: warning: no previous prototype for function '__kernel_clock_gettime' [-Wmissing-prototypes] int __kernel_clock_gettime(clockid_t clock, ^ arch/arm64/kernel/vdso/vgettimeofday.c:9:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int __kernel_clock_gettime(clockid_t clock, ^ static arch/arm64/kernel/vdso/vgettimeofday.c:15:5: warning: no previous prototype for function '__kernel_gettimeofday' [-Wmissing-prototypes] int __kernel_gettimeofday(struct __kernel_old_timeval *tv, ^ arch/arm64/kernel/vdso/vgettimeofday.c:15:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int __kernel_gettimeofday(struct __kernel_old_timeval *tv, ^ static arch/arm64/kernel/vdso/vgettimeofday.c:21:5: warning: no previous prototype for function '__kernel_clock_getres' [-Wmissing-prototypes] int __kernel_clock_getres(clockid_t clock_id, ^ arch/arm64/kernel/vdso/vgettimeofday.c:21:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int __kernel_clock_getres(clockid_t clock_id, ^ static 3 warnings generated. vim +/__kernel_getcpu +33 arch/arm64/kernel/vdso/vgetcpu.c 32 > 33 int __kernel_getcpu(unsigned int *cpu, unsigned int *node, --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Mark On 6/6/20 12:35 AM, Mark Brown wrote: > On Sat, Jun 06, 2020 at 12:11:08AM +0800, kernel test robot wrote: > >>>> arch/arm64/kernel/vdso/vgetcpu.c:33:5: warning: no previous prototype for '__kernel_getcpu' [-Wmissing-prototypes] >> 33 | int __kernel_getcpu(unsigned int *cpu, unsigned int *node, >> | ^~~~~~~~~~~~~~~ >> -- >>>> arch/arm64/kernel/vdso/vgetcpu.c:33:5: warning: no previous prototype for '__kernel_getcpu' [-Wmissing-prototypes] >> 33 | int __kernel_getcpu(unsigned int *cpu, unsigned int *node, >> | ^~~~~~~~~~~~~~~ >> 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, >> | ^~~~~~~~~~~~~~~~~~~~~~ > I'm not seeing this here and what we're doing is in line with the > existing idiom as can be seen from the __kernel_clock_gettime() code > flagging the same thing. Possibly an old/outdated toolchain? thanks for your input. Actually, the origin mail contained 4 warnings, and only one is *new*, as the mail mentioned that > All warnings (new ones prefixed by >>, old ones prefixed by <<): 0Day/LKP had marked the *new* ones prefixed by '>>' > >>> arch/arm64/kernel/vdso/vgetcpu.c:33:5: warning: no previous prototype for '__kernel_getcpu' [-Wmissing-prototypes] > 33 | int __kernel_getcpu(unsigned int *cpu, unsigned int *node, > | ^~~~~~~~~~~~~~~ the rest 3 warnings, indeed they are not introduced by this patch, 0Day/LKP listed them here because they appeared near the *new* warning(s). 0Day/LKP hope the extra info/warnings could be also helpful for diagnosis. Thanks
On Mon, Jun 08, 2020 at 03:46:57PM +0800, Li Zhijian wrote: > On 6/6/20 12:35 AM, Mark Brown wrote: > > > 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, > > > | ^~~~~~~~~~~~~~~~~~~~~~ > > I'm not seeing this here and what we're doing is in line with the > > existing idiom as can be seen from the __kernel_clock_gettime() code > > flagging the same thing. Possibly an old/outdated toolchain? > Actually, the origin mail contained 4 warnings, and only one is *new*, as > the mail mentioned that > > All warnings (new ones prefixed by >>, old ones prefixed by <<): > 0Day/LKP had marked the *new* ones prefixed by '>>' My point here is that all the warnings, both old and new, look spurious and the new warning comes from following the pattern that generates the existing warnings. I'm not seeing any of those warnings locally or in other build services like KernelCI.
On Mon, Jun 08, 2020 at 12:09:01PM +0100, Mark Brown wrote: > On Mon, Jun 08, 2020 at 03:46:57PM +0800, Li Zhijian wrote: > > On 6/6/20 12:35 AM, Mark Brown wrote: > > > > > 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, > > > > | ^~~~~~~~~~~~~~~~~~~~~~ > > > > I'm not seeing this here and what we're doing is in line with the > > > existing idiom as can be seen from the __kernel_clock_gettime() code > > > flagging the same thing. Possibly an old/outdated toolchain? > > > Actually, the origin mail contained 4 warnings, and only one is *new*, as > > the mail mentioned that > > > > All warnings (new ones prefixed by >>, old ones prefixed by <<): > > > 0Day/LKP had marked the *new* ones prefixed by '>>' > > My point here is that all the warnings, both old and new, look spurious > and the new warning comes from following the pattern that generates the > existing warnings. I'm not seeing any of those warnings locally or in > other build services like KernelCI. Thanks Mark for the input. Here the 0-day kernel bot uses W=1 to build which is mentioned as part of reproduce step. > reproduce (this is a W=1 build): And we just add FAQ at https://github.com/intel/lkp-tests/wiki/LKP-FAQ#how-is-one-meant-to-act-on-w1-reports-like--wmissing-prototypes to explain the the missing-prototypes warning, hope this can provide extra information. Thanks > _______________________________________________ > kbuild-all mailing list -- kbuild-all@lists.01.org > To unsubscribe send an email to kbuild-all-leave@lists.01.org
diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile index 279b1b9fb956..4ba2a159dd7c 100644 --- a/arch/arm64/kernel/vdso/Makefile +++ b/arch/arm64/kernel/vdso/Makefile @@ -11,7 +11,7 @@ ARCH_REL_TYPE_ABS := R_AARCH64_JUMP_SLOT|R_AARCH64_GLOB_DAT|R_AARCH64_ABS64 include $(srctree)/lib/vdso/Makefile -obj-vdso := vgettimeofday.o note.o sigreturn.o +obj-vdso := vgettimeofday.o note.o sigreturn.o vgetcpu.o # Build rules targets := $(obj-vdso) vdso.so vdso.so.dbg diff --git a/arch/arm64/kernel/vdso/vdso.lds.S b/arch/arm64/kernel/vdso/vdso.lds.S index 7ad2d3a0cd48..c2fd94f14b94 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_getcpu; local: *; }; } diff --git a/arch/arm64/kernel/vdso/vgetcpu.c b/arch/arm64/kernel/vdso/vgetcpu.c new file mode 100644 index 000000000000..e8972e561e08 --- /dev/null +++ b/arch/arm64/kernel/vdso/vgetcpu.c @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * ARM64 userspace implementations of getcpu() + * + * Copyright (C) 2020 ARM Limited + * + */ + +#include <asm/unistd.h> +#include <asm/vdso/datapage.h> + +struct getcpucache; + +static __always_inline +int getcpu_fallback(unsigned int *_cpu, unsigned int *_node, + struct getcpucache *_c) +{ + register unsigned int *cpu asm("x0") = _cpu; + register unsigned int *node asm("x1") = _node; + register struct getcpucache *c asm("x2") = _c; + register long ret asm ("x0"); + register long nr asm("x8") = __NR_getcpu; + + asm volatile( + " svc #0\n" + : "=r" (ret) + : "r" (cpu), "r" (node), "r" (c), "r" (nr) + : "memory"); + + return ret; +} + +int __kernel_getcpu(unsigned int *cpu, unsigned int *node, + struct getcpucache *c) +{ + struct vdso_cpu_data *cpu_data = __vdso_cpu_data(); + + if (cpu_data) { + if (cpu) + *cpu = cpu_data->cpu; + if (node) + *node = cpu_data->node; + + return 0; + } + + return getcpu_fallback(cpu, node, c); +}
Some applications, especially trace ones, benefit from avoiding the syscall overhead on getcpu() calls so provide a vDSO implementation of it. Signed-off-by: Mark Brown <broonie@kernel.org> --- arch/arm64/kernel/vdso/Makefile | 2 +- arch/arm64/kernel/vdso/vdso.lds.S | 1 + arch/arm64/kernel/vdso/vgetcpu.c | 48 +++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/kernel/vdso/vgetcpu.c