RE: [PATCH v2 1/2] perf: coresight_pmu: Add support for ARM CoreSight PMU driver

From: Besar Wicaksono
Date: Wed May 18 2022 - 16:11:42 EST


The errors on the APMT* identifiers are due to the missing ACPI patch, which was
submitted on different series: https://lkml.org/lkml/fancy/2022/4/19/1395.
Sudeep, could you please suggest if I need to combine ACPI and driver patches
into a single patch series ?

I will fix the warning on 'level' usage on the next version.

Regards,
Besar

> -----Original Message-----
> From: kernel test robot <lkp@xxxxxxxxx>
> Sent: Wednesday, May 18, 2022 2:16 AM
> To: Besar Wicaksono <bwicaksono@xxxxxxxxxx>; robin.murphy@xxxxxxx;
> catalin.marinas@xxxxxxx; will@xxxxxxxxxx; mark.rutland@xxxxxxx
> Cc: llvm@xxxxxxxxxxxxxxx; kbuild-all@xxxxxxxxxxxx; linux-arm-
> kernel@xxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-
> tegra@xxxxxxxxxxxxxxx; sudeep.holla@xxxxxxx;
> thanu.rangarajan@xxxxxxx; Michael.Williams@xxxxxxx;
> suzuki.poulose@xxxxxxx; Thierry Reding <treding@xxxxxxxxxx>; Jonathan
> Hunter <jonathanh@xxxxxxxxxx>; Vikram Sethi <vsethi@xxxxxxxxxx>; Besar
> Wicaksono <bwicaksono@xxxxxxxxxx>
> Subject: Re: [PATCH v2 1/2] perf: coresight_pmu: Add support for ARM
> CoreSight PMU driver
>
> External email: Use caution opening links or attachments
>
>
> Hi Besar,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on arm64/for-next/core]
> [also build test WARNING on soc/for-next linus/master v5.18-rc7 next-
> 20220517]
> [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]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Besar-Wicaksono/perf-
> coresight_pmu-Add-support-for-ARM-CoreSight-PMU-driver/20220516-
> 013131
> base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-
> next/core
> config: arm64-allyesconfig (https://download.01.org/0day-
> ci/archive/20220518/202205181534.wuyBFt9d-lkp@xxxxxxxxx/config)
> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project
> 853fa8ee225edf2d0de94b0dcbd31bea916e825e)
> 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
> # https://github.com/intel-lab-
> lkp/linux/commit/79f30980a7a91e6bbe7430206e4e46fa8134cfa9
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review Besar-Wicaksono/perf-coresight_pmu-
> Add-support-for-ARM-CoreSight-PMU-driver/20220516-013131
> git checkout 79f30980a7a91e6bbe7430206e4e46fa8134cfa9
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross
> W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash
> drivers/media/platform/qcom/venus/ drivers/perf/coresight_pmu/
> drivers/rtc/
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All warnings (new ones prefixed by >>):
>
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:165:49: error:
> incomplete definition of type 'struct acpi_apmt_node'
> return CHECK_APMT_FLAG(coresight_pmu->apmt_node->flags,
> ATOMIC, SUPP);
> ~~~~~~~~~~~~~~~~~~~~~~~~^
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:129:4: note: expanded
> from macro 'CHECK_APMT_FLAG'
> ((flags & (ACPI_APMT_FLAGS_ ## f)) == (ACPI_APMT_FLAGS_ ## f ##
> _ ## v))
> ^~~~~
> drivers/perf/coresight_pmu/arm_coresight_pmu.h:116:9: note: forward
> declaration of 'struct acpi_apmt_node'
> struct acpi_apmt_node *apmt_node;
> ^
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:165:9: error: use of
> undeclared identifier 'ACPI_APMT_FLAGS_ATOMIC'
> return CHECK_APMT_FLAG(coresight_pmu->apmt_node->flags,
> ATOMIC, SUPP);
> ^
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:129:13: note: expanded
> from macro 'CHECK_APMT_FLAG'
> ((flags & (ACPI_APMT_FLAGS_ ## f)) == (ACPI_APMT_FLAGS_ ## f ##
> _ ## v))
> ^
> <scratch space>:61:1: note: expanded from here
> ACPI_APMT_FLAGS_ATOMIC
> ^
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:165:9: error: use of
> undeclared identifier 'ACPI_APMT_FLAGS_ATOMIC_SUPP'
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:129:41: note: expanded
> from macro 'CHECK_APMT_FLAG'
> ((flags & (ACPI_APMT_FLAGS_ ## f)) == (ACPI_APMT_FLAGS_ ## f ##
> _ ## v))
> ^
> <scratch space>:64:1: note: expanded from here
> ACPI_APMT_FLAGS_ATOMIC_SUPP
> ^
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:369:13: error:
> incomplete definition of type 'struct acpi_apmt_node'
> (apmt_node->impl_id) ? apmt_node->impl_id :
> ~~~~~~~~~^
> drivers/perf/coresight_pmu/arm_coresight_pmu.h:116:9: note: forward
> declaration of 'struct acpi_apmt_node'
> struct acpi_apmt_node *apmt_node;
> ^
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:369:35: error:
> incomplete definition of type 'struct acpi_apmt_node'
> (apmt_node->impl_id) ? apmt_node->impl_id :
> ~~~~~~~~~^
> drivers/perf/coresight_pmu/arm_coresight_pmu.h:116:9: note: forward
> declaration of 'struct acpi_apmt_node'
> struct acpi_apmt_node *apmt_node;
> ^
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:894:58: error:
> incomplete definition of type 'struct acpi_apmt_node'
> devm_kasprintf(dev, GFP_KERNEL, PMUNAME "%u", apmt_node-
> >id);
> ~~~~~~~~~^
> drivers/perf/coresight_pmu/arm_coresight_pmu.h:116:9: note: forward
> declaration of 'struct acpi_apmt_node'
> struct acpi_apmt_node *apmt_node;
> ^
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:920:31: error:
> incomplete definition of type 'struct acpi_apmt_node'
> if (CHECK_APMT_FLAG(apmt_node->flags, DUAL_PAGE, SUPP)) {
> ~~~~~~~~~^
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:129:4: note: expanded
> from macro 'CHECK_APMT_FLAG'
> ((flags & (ACPI_APMT_FLAGS_ ## f)) == (ACPI_APMT_FLAGS_ ## f ##
> _ ## v))
> ^~~~~
> drivers/perf/coresight_pmu/arm_coresight_pmu.h:116:9: note: forward
> declaration of 'struct acpi_apmt_node'
> struct acpi_apmt_node *apmt_node;
> ^
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:920:6: error: use of
> undeclared identifier 'ACPI_APMT_FLAGS_DUAL_PAGE'
> if (CHECK_APMT_FLAG(apmt_node->flags, DUAL_PAGE, SUPP)) {
> ^
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:129:13: note: expanded
> from macro 'CHECK_APMT_FLAG'
> ((flags & (ACPI_APMT_FLAGS_ ## f)) == (ACPI_APMT_FLAGS_ ## f ##
> _ ## v))
> ^
> <scratch space>:60:1: note: expanded from here
> ACPI_APMT_FLAGS_DUAL_PAGE
> ^
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:920:6: error: use of
> undeclared identifier 'ACPI_APMT_FLAGS_DUAL_PAGE_SUPP'
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:129:41: note: expanded
> from macro 'CHECK_APMT_FLAG'
> ((flags & (ACPI_APMT_FLAGS_ ## f)) == (ACPI_APMT_FLAGS_ ## f ##
> _ ## v))
> ^
> <scratch space>:63:1: note: expanded from here
> ACPI_APMT_FLAGS_DUAL_PAGE_SUPP
> ^
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:1028:15: error:
> incomplete definition of type 'struct acpi_apmt_node'
> if (apmt_node->ovflw_irq == 0)
> ~~~~~~~~~^
> drivers/perf/coresight_pmu/arm_coresight_pmu.h:116:9: note: forward
> declaration of 'struct acpi_apmt_node'
> struct acpi_apmt_node *apmt_node;
> ^
> >> drivers/perf/coresight_pmu/arm_coresight_pmu.c:1053:6: warning:
> variable 'level' set but not used [-Wunused-but-set-variable]
> int level = 0;
> ^
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:1079:27: error:
> incomplete definition of type 'struct acpi_apmt_node'
> affinity_flag = apmt_node->flags & ACPI_APMT_FLAGS_AFFINITY;
> ~~~~~~~~~^
> drivers/perf/coresight_pmu/arm_coresight_pmu.h:116:9: note: forward
> declaration of 'struct acpi_apmt_node'
> struct acpi_apmt_node *apmt_node;
> ^
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:1079:37: error: use of
> undeclared identifier 'ACPI_APMT_FLAGS_AFFINITY'
> affinity_flag = apmt_node->flags & ACPI_APMT_FLAGS_AFFINITY;
> ^
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:1081:23: error: use of
> undeclared identifier 'ACPI_APMT_FLAGS_AFFINITY_PROC'
> if (affinity_flag == ACPI_APMT_FLAGS_AFFINITY_PROC) {
> ^
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:1083:17: error:
> incomplete definition of type 'struct acpi_apmt_node'
> if (apmt_node->proc_affinity ==
> ~~~~~~~~~^
> drivers/perf/coresight_pmu/arm_coresight_pmu.h:116:9: note: forward
> declaration of 'struct acpi_apmt_node'
> struct acpi_apmt_node *apmt_node;
> ^
> drivers/perf/coresight_pmu/arm_coresight_pmu.c:1093:23: error:
> incomplete definition of type 'struct acpi_apmt_node'
> cpu, apmt_node->proc_affinity))
> ~~~~~~~~~^
> drivers/perf/coresight_pmu/arm_coresight_pmu.h:116:9: note: forward
> declaration of 'struct acpi_apmt_node'
> struct acpi_apmt_node *apmt_node;
> ^
> 1 warning and 15 errors generated.
>
>
> vim +/level +1053 drivers/perf/coresight_pmu/arm_coresight_pmu.c
>
> 1047
> 1048 static inline int coresight_pmu_find_cpu_container(int cpu, u32
> container_uid)
> 1049 {
> 1050 u32 acpi_uid;
> 1051 struct device *cpu_dev = get_cpu_device(cpu);
> 1052 struct acpi_device *acpi_dev = ACPI_COMPANION(cpu_dev);
> > 1053 int level = 0;
> 1054
> 1055 if (!cpu_dev)
> 1056 return -ENODEV;
> 1057
> 1058 while (acpi_dev) {
> 1059 if (!strcmp(acpi_device_hid(acpi_dev),
> 1060 ACPI_PROCESSOR_CONTAINER_HID) &&
> 1061 !kstrtouint(acpi_device_uid(acpi_dev), 0, &acpi_uid) &&
> 1062 acpi_uid == container_uid)
> 1063 return 0;
> 1064
> 1065 acpi_dev = acpi_dev->parent;
> 1066 level++;
> 1067 }
> 1068
> 1069 return -ENODEV;
> 1070 }
> 1071
>
> --
> 0-DAY CI Kernel Test Service
> https://01.org/lkp