Re: [PATCH] LoongArch: Add perf events support
From: kernel test robot
Date: Tue Aug 16 2022 - 06:36:48 EST
Hi Huacai,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.0-rc1 next-20220816]
[cannot apply to soc/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Huacai-Chen/LoongArch-Add-perf-events-support/20220815-204852
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 568035b01cfb107af8d2e4bd2fb9aea22cf5b868
config: loongarch-randconfig-s051-20220815 (https://download.01.org/0day-ci/archive/20220816/202208161648.zq48ilEV-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 12.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://github.com/intel-lab-lkp/linux/commit/0e6d9490ff3f6129799675b9288135022a0908e2
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Huacai-Chen/LoongArch-Add-perf-events-support/20220815-204852
git checkout 0e6d9490ff3f6129799675b9288135022a0908e2
# save the config file
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=loongarch
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
sparse warnings: (new ones prefixed by >>)
>> arch/loongarch/kernel/perf_event.c:30:50: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned long [noderef] __user *user_frame_tail @@ got unsigned long * @@
arch/loongarch/kernel/perf_event.c:30:50: sparse: expected unsigned long [noderef] __user *user_frame_tail
arch/loongarch/kernel/perf_event.c:30:50: sparse: got unsigned long *
arch/loongarch/kernel/perf_event.c: note: in included file (through arch/loongarch/include/asm/cpu-info.h, arch/loongarch/include/asm/processor.h, ...):
arch/loongarch/include/asm/loongarch.h:237:16: sparse: sparse: undefined identifier '__builtin_loongarch_csrrd_d'
arch/loongarch/include/asm/loongarch.h:237:16: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:237:16: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:237:16: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:237:16: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:247:9: sparse: sparse: undefined identifier '__builtin_loongarch_csrwr_d'
arch/loongarch/include/asm/loongarch.h:247:9: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:247:9: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:247:9: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:247:9: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:237:16: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:237:16: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:237:16: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:237:16: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:247:9: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:247:9: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:247:9: sparse: sparse: cast from unknown type
arch/loongarch/include/asm/loongarch.h:247:9: sparse: sparse: cast from unknown type
vim +30 arch/loongarch/kernel/perf_event.c
20
21 /*
22 * Get the return address for a single stackframe and return a pointer to the
23 * next frame tail.
24 */
25 static unsigned long
26 user_backtrace(struct perf_callchain_entry_ctx *entry, unsigned long fp)
27 {
28 struct stack_frame buftail;
29 unsigned long err;
> 30 unsigned long __user *user_frame_tail = (unsigned long *)(fp - sizeof(struct stack_frame));
31
32 /* Also check accessibility of one struct frame_tail beyond */
33 if (!access_ok(user_frame_tail, sizeof(buftail)))
34 return 0;
35
36 pagefault_disable();
37 err = __copy_from_user_inatomic(&buftail, user_frame_tail, sizeof(buftail));
38 pagefault_enable();
39
40 if (err || (unsigned long)user_frame_tail >= buftail.fp)
41 return 0;
42
43 perf_callchain_store(entry, buftail.ra);
44
45 return buftail.fp;
46 }
47
--
0-DAY CI Kernel Test Service
https://01.org/lkp