[atishp04:sbi_pmu_v3 8/11] drivers/perf/riscv_pmu_sbi.c:59:8: error: use of undeclared identifier 'SBI_PMU_HW_CPU_CYCLES'

From: kernel test robot
Date: Thu Sep 09 2021 - 11:45:48 EST


tree: https://github.com/atishp04/linux sbi_pmu_v3
head: 47b211137ae63bf642990d3f48fc3d2f4f386848
commit: 0ea60aa37fc8087a2b5e2b3c9215c873b2a22bec [8/11] RISC-V: Add perf platform driver based on SBI PMU extension
config: riscv-randconfig-r012-20210908 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 261cbe98c38f8c1ee1a482fe76511110e790f58a)
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 riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/atishp04/linux/commit/0ea60aa37fc8087a2b5e2b3c9215c873b2a22bec
git remote add atishp04 https://github.com/atishp04/linux
git fetch --no-tags atishp04 sbi_pmu_v3
git checkout 0ea60aa37fc8087a2b5e2b3c9215c873b2a22bec
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=riscv SHELL=/bin/bash drivers/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

In file included from drivers/perf/riscv_pmu_sbi.c:12:
In file included from include/linux/perf/riscv_pmu.h:12:
In file included from include/linux/perf_event.h:49:
In file included from include/linux/ftrace.h:10:
In file included from include/linux/trace_recursion.h:5:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:136:
include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:36:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/perf/riscv_pmu_sbi.c:12:
In file included from include/linux/perf/riscv_pmu.h:12:
In file included from include/linux/perf_event.h:49:
In file included from include/linux/ftrace.h:10:
In file included from include/linux/trace_recursion.h:5:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:136:
include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:34:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/perf/riscv_pmu_sbi.c:12:
In file included from include/linux/perf/riscv_pmu.h:12:
In file included from include/linux/perf_event.h:49:
In file included from include/linux/ftrace.h:10:
In file included from include/linux/trace_recursion.h:5:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:136:
include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:1024:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
~~~~~~~~~~ ^
>> drivers/perf/riscv_pmu_sbi.c:59:8: error: use of undeclared identifier 'SBI_PMU_HW_CPU_CYCLES'
SBI_PMU_HW_CPU_CYCLES,
^
>> drivers/perf/riscv_pmu_sbi.c:60:8: error: use of undeclared identifier 'SBI_PMU_EVENT_TYPE_HW'
SBI_PMU_EVENT_TYPE_HW, 0}},
^
>> drivers/perf/riscv_pmu_sbi.c:62:8: error: use of undeclared identifier 'SBI_PMU_HW_INSTRUCTIONS'; did you mean 'PERF_COUNT_HW_INSTRUCTIONS'?
SBI_PMU_HW_INSTRUCTIONS,
^~~~~~~~~~~~~~~~~~~~~~~
PERF_COUNT_HW_INSTRUCTIONS
include/uapi/linux/perf_event.h:65:2: note: 'PERF_COUNT_HW_INSTRUCTIONS' declared here
PERF_COUNT_HW_INSTRUCTIONS = 1,
^
drivers/perf/riscv_pmu_sbi.c:63:8: error: use of undeclared identifier 'SBI_PMU_EVENT_TYPE_HW'
SBI_PMU_EVENT_TYPE_HW, 0}},
^
>> drivers/perf/riscv_pmu_sbi.c:65:8: error: use of undeclared identifier 'SBI_PMU_HW_CACHE_REFERENCES'; did you mean 'PERF_COUNT_HW_CACHE_REFERENCES'?
SBI_PMU_HW_CACHE_REFERENCES,
^~~~~~~~~~~~~~~~~~~~~~~~~~~
PERF_COUNT_HW_CACHE_REFERENCES
include/uapi/linux/perf_event.h:66:2: note: 'PERF_COUNT_HW_CACHE_REFERENCES' declared here
PERF_COUNT_HW_CACHE_REFERENCES = 2,
^
drivers/perf/riscv_pmu_sbi.c:66:8: error: use of undeclared identifier 'SBI_PMU_EVENT_TYPE_HW'
SBI_PMU_EVENT_TYPE_HW, 0}},
^
>> drivers/perf/riscv_pmu_sbi.c:68:8: error: use of undeclared identifier 'SBI_PMU_HW_CACHE_MISSES'; did you mean 'PERF_COUNT_HW_CACHE_MISSES'?
SBI_PMU_HW_CACHE_MISSES,
^~~~~~~~~~~~~~~~~~~~~~~
PERF_COUNT_HW_CACHE_MISSES
include/uapi/linux/perf_event.h:67:2: note: 'PERF_COUNT_HW_CACHE_MISSES' declared here
PERF_COUNT_HW_CACHE_MISSES = 3,
^
drivers/perf/riscv_pmu_sbi.c:69:8: error: use of undeclared identifier 'SBI_PMU_EVENT_TYPE_HW'
SBI_PMU_EVENT_TYPE_HW, 0}},
^
>> drivers/perf/riscv_pmu_sbi.c:71:8: error: use of undeclared identifier 'SBI_PMU_HW_BRANCH_INSTRUCTIONS'; did you mean 'PERF_COUNT_HW_BRANCH_INSTRUCTIONS'?
SBI_PMU_HW_BRANCH_INSTRUCTIONS,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PERF_COUNT_HW_BRANCH_INSTRUCTIONS
include/uapi/linux/perf_event.h:68:2: note: 'PERF_COUNT_HW_BRANCH_INSTRUCTIONS' declared here
PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4,
^
drivers/perf/riscv_pmu_sbi.c:72:8: error: use of undeclared identifier 'SBI_PMU_EVENT_TYPE_HW'
SBI_PMU_EVENT_TYPE_HW, 0}},
^
>> drivers/perf/riscv_pmu_sbi.c:74:8: error: use of undeclared identifier 'SBI_PMU_HW_BRANCH_MISSES'; did you mean 'PERF_COUNT_HW_BRANCH_MISSES'?
SBI_PMU_HW_BRANCH_MISSES,
^~~~~~~~~~~~~~~~~~~~~~~~
PERF_COUNT_HW_BRANCH_MISSES
include/uapi/linux/perf_event.h:69:2: note: 'PERF_COUNT_HW_BRANCH_MISSES' declared here
PERF_COUNT_HW_BRANCH_MISSES = 5,
^
drivers/perf/riscv_pmu_sbi.c:75:8: error: use of undeclared identifier 'SBI_PMU_EVENT_TYPE_HW'
SBI_PMU_EVENT_TYPE_HW, 0}},
^
>> drivers/perf/riscv_pmu_sbi.c:77:8: error: use of undeclared identifier 'SBI_PMU_HW_BUS_CYCLES'
SBI_PMU_HW_BUS_CYCLES,
^
drivers/perf/riscv_pmu_sbi.c:78:8: error: use of undeclared identifier 'SBI_PMU_EVENT_TYPE_HW'
SBI_PMU_EVENT_TYPE_HW, 0}},
^
>> drivers/perf/riscv_pmu_sbi.c:80:8: error: use of undeclared identifier 'SBI_PMU_HW_STALLED_CYCLES_FRONTEND'; did you mean 'PERF_COUNT_HW_STALLED_CYCLES_FRONTEND'?
SBI_PMU_HW_STALLED_CYCLES_FRONTEND,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PERF_COUNT_HW_STALLED_CYCLES_FRONTEND
include/uapi/linux/perf_event.h:71:2: note: 'PERF_COUNT_HW_STALLED_CYCLES_FRONTEND' declared here
PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7,
^
drivers/perf/riscv_pmu_sbi.c:81:8: error: use of undeclared identifier 'SBI_PMU_EVENT_TYPE_HW'
SBI_PMU_EVENT_TYPE_HW, 0}},
^
>> drivers/perf/riscv_pmu_sbi.c:83:8: error: use of undeclared identifier 'SBI_PMU_HW_STALLED_CYCLES_BACKEND'; did you mean 'PERF_COUNT_HW_STALLED_CYCLES_BACKEND'?
SBI_PMU_HW_STALLED_CYCLES_BACKEND,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PERF_COUNT_HW_STALLED_CYCLES_BACKEND
include/uapi/linux/perf_event.h:72:2: note: 'PERF_COUNT_HW_STALLED_CYCLES_BACKEND' declared here
PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8,
^
drivers/perf/riscv_pmu_sbi.c:84:8: error: use of undeclared identifier 'SBI_PMU_EVENT_TYPE_HW'
SBI_PMU_EVENT_TYPE_HW, 0}},
^
>> drivers/perf/riscv_pmu_sbi.c:86:8: error: use of undeclared identifier 'SBI_PMU_HW_REF_CPU_CYCLES'; did you mean 'PERF_COUNT_HW_REF_CPU_CYCLES'?
SBI_PMU_HW_REF_CPU_CYCLES,
^~~~~~~~~~~~~~~~~~~~~~~~~
PERF_COUNT_HW_REF_CPU_CYCLES
include/uapi/linux/perf_event.h:73:2: note: 'PERF_COUNT_HW_REF_CPU_CYCLES' declared here
PERF_COUNT_HW_REF_CPU_CYCLES = 9,
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
7 warnings and 20 errors generated.


vim +/SBI_PMU_HW_CPU_CYCLES +59 drivers/perf/riscv_pmu_sbi.c

56
57 static const struct pmu_event_data pmu_hw_event_map[] = {
58 [PERF_COUNT_HW_CPU_CYCLES] = {.hw_gen_event = {
> 59 SBI_PMU_HW_CPU_CYCLES,
> 60 SBI_PMU_EVENT_TYPE_HW, 0}},
61 [PERF_COUNT_HW_INSTRUCTIONS] = {.hw_gen_event = {
> 62 SBI_PMU_HW_INSTRUCTIONS,
63 SBI_PMU_EVENT_TYPE_HW, 0}},
64 [PERF_COUNT_HW_CACHE_REFERENCES] = {.hw_gen_event = {
> 65 SBI_PMU_HW_CACHE_REFERENCES,
66 SBI_PMU_EVENT_TYPE_HW, 0}},
67 [PERF_COUNT_HW_CACHE_MISSES] = {.hw_gen_event = {
> 68 SBI_PMU_HW_CACHE_MISSES,
69 SBI_PMU_EVENT_TYPE_HW, 0}},
70 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = {.hw_gen_event = {
> 71 SBI_PMU_HW_BRANCH_INSTRUCTIONS,
72 SBI_PMU_EVENT_TYPE_HW, 0}},
73 [PERF_COUNT_HW_BRANCH_MISSES] = {.hw_gen_event = {
> 74 SBI_PMU_HW_BRANCH_MISSES,
75 SBI_PMU_EVENT_TYPE_HW, 0}},
76 [PERF_COUNT_HW_BUS_CYCLES] = {.hw_gen_event = {
> 77 SBI_PMU_HW_BUS_CYCLES,
78 SBI_PMU_EVENT_TYPE_HW, 0}},
79 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = {.hw_gen_event = {
> 80 SBI_PMU_HW_STALLED_CYCLES_FRONTEND,
81 SBI_PMU_EVENT_TYPE_HW, 0}},
82 [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = {.hw_gen_event = {
> 83 SBI_PMU_HW_STALLED_CYCLES_BACKEND,
84 SBI_PMU_EVENT_TYPE_HW, 0}},
85 [PERF_COUNT_HW_REF_CPU_CYCLES] = {.hw_gen_event = {
> 86 SBI_PMU_HW_REF_CPU_CYCLES,
87 SBI_PMU_EVENT_TYPE_HW, 0}},
88 };
89

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

Attachment: .config.gz
Description: application/gzip