Re: [PATCH 1/2] iommu/riscv: add RISC-V IOMMU PMU support
From: kernel test robot
Date: Thu Jan 23 2025 - 03:35:44 EST
Hi Zong,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.13 next-20250122]
[cannot apply to joro-iommu/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/Zong-Li/iommu-riscv-add-RISC-V-IOMMU-PMU-support/20250115-110456
base: linus/master
patch link: https://lore.kernel.org/r/20250115030306.29735-2-zong.li%40sifive.com
patch subject: [PATCH 1/2] iommu/riscv: add RISC-V IOMMU PMU support
config: riscv-randconfig-r062-20250123 (https://download.01.org/0day-ci/archive/20250123/202501231613.OiXGj7hO-lkp@xxxxxxxxx/config)
compiler: riscv64-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250123/202501231613.OiXGj7hO-lkp@xxxxxxxxx/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501231613.OiXGj7hO-lkp@xxxxxxxxx/
All warnings (new ones prefixed by >>):
drivers/iommu/riscv/iommu-pmu.c:368:12: error: 'struct hw_perf_event' has no member named 'idx'
368 | hwc->idx = idx;
| ^~
drivers/iommu/riscv/iommu-pmu.c:369:12: error: 'struct hw_perf_event' has no member named 'state'
369 | hwc->state = PERF_HES_STOPPED | PERF_HES_UPTODATE;
| ^~
drivers/iommu/riscv/iommu-pmu.c:369:22: error: 'PERF_HES_STOPPED' undeclared (first use in this function)
369 | hwc->state = PERF_HES_STOPPED | PERF_HES_UPTODATE;
| ^~~~~~~~~~~~~~~~
drivers/iommu/riscv/iommu-pmu.c:369:41: error: 'PERF_HES_UPTODATE' undeclared (first use in this function); did you mean 'PERF_EF_UPDATE'?
369 | hwc->state = PERF_HES_STOPPED | PERF_HES_UPTODATE;
| ^~~~~~~~~~~~~~~~~
| PERF_EF_UPDATE
drivers/iommu/riscv/iommu-pmu.c: In function 'riscv_iommu_pmu_del':
drivers/iommu/riscv/iommu-pmu.c:387:43: error: 'struct perf_event' has no member named 'hw'
387 | struct hw_perf_event *hwc = &event->hw;
| ^~
drivers/iommu/riscv/iommu-pmu.c:388:63: error: 'struct perf_event' has no member named 'pmu'
388 | struct riscv_iommu_pmu *pmu = to_riscv_iommu_pmu(event->pmu);
| ^~
include/linux/container_of.h:19:33: note: in definition of macro 'container_of'
19 | void *__mptr = (void *)(ptr); \
| ^~~
drivers/iommu/riscv/iommu-pmu.c:388:39: note: in expansion of macro 'to_riscv_iommu_pmu'
388 | struct riscv_iommu_pmu *pmu = to_riscv_iommu_pmu(event->pmu);
| ^~~~~~~~~~~~~~~~~~
drivers/iommu/riscv/iommu-pmu.c:388:63: error: 'struct perf_event' has no member named 'pmu'
388 | struct riscv_iommu_pmu *pmu = to_riscv_iommu_pmu(event->pmu);
| ^~
include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~
include/linux/container_of.h:20:9: note: in expansion of macro 'static_assert'
20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \
| ^~~~~~~~~~~~~
include/linux/container_of.h:20:23: note: in expansion of macro '__same_type'
20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \
| ^~~~~~~~~~~
drivers/iommu/riscv/iommu-pmu.c:14:32: note: in expansion of macro 'container_of'
14 | #define to_riscv_iommu_pmu(p) (container_of(p, struct riscv_iommu_pmu, pmu))
| ^~~~~~~~~~~~
drivers/iommu/riscv/iommu-pmu.c:388:39: note: in expansion of macro 'to_riscv_iommu_pmu'
388 | struct riscv_iommu_pmu *pmu = to_riscv_iommu_pmu(event->pmu);
| ^~~~~~~~~~~~~~~~~~
drivers/iommu/riscv/iommu-pmu.c:388:63: error: 'struct perf_event' has no member named 'pmu'
388 | struct riscv_iommu_pmu *pmu = to_riscv_iommu_pmu(event->pmu);
| ^~
include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~
include/linux/container_of.h:20:9: note: in expansion of macro 'static_assert'
20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \
| ^~~~~~~~~~~~~
include/linux/container_of.h:21:23: note: in expansion of macro '__same_type'
21 | __same_type(*(ptr), void), \
| ^~~~~~~~~~~
drivers/iommu/riscv/iommu-pmu.c:14:32: note: in expansion of macro 'container_of'
14 | #define to_riscv_iommu_pmu(p) (container_of(p, struct riscv_iommu_pmu, pmu))
| ^~~~~~~~~~~~
drivers/iommu/riscv/iommu-pmu.c:388:39: note: in expansion of macro 'to_riscv_iommu_pmu'
388 | struct riscv_iommu_pmu *pmu = to_riscv_iommu_pmu(event->pmu);
| ^~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:483:27: error: expression in static assertion is not an integer
483 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~
include/linux/container_of.h:20:9: note: in expansion of macro 'static_assert'
20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \
| ^~~~~~~~~~~~~
include/linux/container_of.h:20:23: note: in expansion of macro '__same_type'
20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \
| ^~~~~~~~~~~
drivers/iommu/riscv/iommu-pmu.c:14:32: note: in expansion of macro 'container_of'
14 | #define to_riscv_iommu_pmu(p) (container_of(p, struct riscv_iommu_pmu, pmu))
| ^~~~~~~~~~~~
drivers/iommu/riscv/iommu-pmu.c:388:39: note: in expansion of macro 'to_riscv_iommu_pmu'
388 | struct riscv_iommu_pmu *pmu = to_riscv_iommu_pmu(event->pmu);
| ^~~~~~~~~~~~~~~~~~
drivers/iommu/riscv/iommu-pmu.c:389:22: error: 'struct hw_perf_event' has no member named 'idx'
389 | int idx = hwc->idx;
| ^~
drivers/iommu/riscv/iommu-pmu.c: In function 'riscv_iommu_pmu_handle_irq':
drivers/iommu/riscv/iommu-pmu.c:399:33: error: storage size of 'data' isn't known
399 | struct perf_sample_data data;
| ^~~~
drivers/iommu/riscv/iommu-pmu.c:418:29: error: 'struct perf_event' has no member named 'hw'
418 | hwc = &event->hw;
| ^~
drivers/iommu/riscv/iommu-pmu.c:421:17: error: implicit declaration of function 'perf_sample_data_init' [-Wimplicit-function-declaration]
421 | perf_sample_data_init(&data, 0, hwc->last_period);
| ^~~~~~~~~~~~~~~~~~~~~
drivers/iommu/riscv/iommu-pmu.c:421:52: error: 'struct hw_perf_event' has no member named 'last_period'
421 | perf_sample_data_init(&data, 0, hwc->last_period);
| ^~
drivers/iommu/riscv/iommu-pmu.c:425:21: error: implicit declaration of function 'perf_event_overflow'; did you mean 'perf_event_period'? [-Wimplicit-function-declaration]
425 | if (perf_event_overflow(event, &data, regs))
| ^~~~~~~~~~~~~~~~~~~
| perf_event_period
>> drivers/iommu/riscv/iommu-pmu.c:399:33: warning: unused variable 'data' [-Wunused-variable]
399 | struct perf_sample_data data;
| ^~~~
drivers/iommu/riscv/iommu-pmu.c: In function 'riscv_iommu_pmu_init':
drivers/iommu/riscv/iommu-pmu.c:459:15: error: implicit declaration of function 'perf_pmu_register' [-Wimplicit-function-declaration]
459 | ret = perf_pmu_register(&pmu->pmu, name, -1);
| ^~~~~~~~~~~~~~~~~
drivers/iommu/riscv/iommu-pmu.c: In function 'riscv_iommu_pmu_uninit':
drivers/iommu/riscv/iommu-pmu.c:485:9: error: implicit declaration of function 'perf_pmu_unregister'; did you mean 'device_unregister'? [-Wimplicit-function-declaration]
485 | perf_pmu_unregister(&pmu->pmu);
| ^~~~~~~~~~~~~~~~~~~
| device_unregister
drivers/iommu/riscv/iommu-pmu.c: In function 'get_event':
>> drivers/iommu/riscv/iommu-pmu.c:20:9: warning: control reaches end of non-void function [-Wreturn-type]
20 | } \
| ^
drivers/iommu/riscv/iommu-pmu.c:22:1: note: in expansion of macro 'RISCV_IOMMU_PMU_ATTR_EXTRACTOR'
22 | RISCV_IOMMU_PMU_ATTR_EXTRACTOR(event, RISCV_IOMMU_IOHPMEVT_EVENTID);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/data +399 drivers/iommu/riscv/iommu-pmu.c
396
397 irqreturn_t riscv_iommu_pmu_handle_irq(struct riscv_iommu_pmu *pmu)
398 {
> 399 struct perf_sample_data data;
400 struct pt_regs *regs;
401 u32 ovf = readl(pmu->reg + RISCV_IOMMU_REG_IOCOUNTOVF);
402 int idx;
403
404 if (!ovf)
405 return IRQ_NONE;
406
407 riscv_iommu_pmu_stop_all(pmu);
408
409 regs = get_irq_regs();
410
411 for_each_set_bit(idx, (unsigned long *)&ovf, pmu->num_counters) {
412 struct perf_event *event = pmu->events[idx];
413 struct hw_perf_event *hwc;
414
415 if (WARN_ON_ONCE(!event) || !is_sampling_event(event))
416 continue;
417
418 hwc = &event->hw;
419
420 riscv_iommu_pmu_update(event);
421 perf_sample_data_init(&data, 0, hwc->last_period);
422 if (!riscv_iommu_pmu_set_period(event))
423 continue;
424
425 if (perf_event_overflow(event, &data, regs))
426 riscv_iommu_pmu_stop(event, 0);
427 }
428
429 riscv_iommu_pmu_start_all(pmu);
430
431 return IRQ_HANDLED;
432 }
433
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki