linux/drivers/perf
Yicong Yang b6693ad68e drivers/perf: hisi_pcie: Fix incorrect counting under metric mode
The metric counting shows incorrect results if the events in the
metric group using the same event but different filter options.
This is because we only judge the event code to decide whether
the event in the metric group should share the same hardware
counter, but ignore the settings of the filter.

For example, on a platform of 2 ports 0x1 and 0x2 but only port
0x1 has a downstream PCIe NVME device. The metric counting
shows both ports have the same counts because we misassign these
two events to one same hardware counter:
[root@localhost perf-iostat]# ./perf stat -e '{hisi_pcie0_core1/event=0x0104,port=0x2/,hisi_pcie0_core1/event=0x0104,port=0x1/}'

 Performance counter stats for 'system wide':

        7907484924      hisi_pcie0_core1/event=0x0104,port=0x2/
        7907484924      hisi_pcie0_core1/event=0x0104,port=0x1/

      10.153863691 seconds time elapsed

Fix this by using the whole config rather than the event only
to judge whether two events are the same and should share the
same hardware counter. With this patch, the metric counting in
the above case tends to be corrected:

[root@localhost perf-iostat]# ./perf stat -e '{hisi_pcie0_core1/event=0x0104,port=0x2/,hisi_pcie0_core1/event=0x0104,port=0x1/}'

 Performance counter stats for 'system wide':

                 0      hisi_pcie0_core1/event=0x0104,port=0x2/
        8123122077      hisi_pcie0_core1/event=0x0104,port=0x1/

      10.152875631 seconds time elapsed

Fixes: 8404b0fbc7 ("drivers/perf: hisi: Add driver for HiSilicon PCIe PMU")
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20240223103359.18669-4-yangyicong@huawei.com
Signed-off-by: Will Deacon <will@kernel.org>
2024-03-04 14:18:28 +00:00
..
amlogic perf: amlogic: Convert to platform remove callback returning void 2024-02-09 15:59:28 +00:00
arm_cspmu perf/arm_cspmu: Add devicetree support 2024-02-09 17:34:35 +00:00
hisilicon drivers/perf: hisi_pcie: Fix incorrect counting under metric mode 2024-03-04 14:18:28 +00:00
alibaba_uncore_drw_pmu.c perf: alibaba_uncore_drw: Convert to platform remove callback returning void 2024-02-09 15:59:28 +00:00
apple_m1_cpu_pmu.c arm: pmu: Move error message and -EOPNOTSUPP to individual PMUs 2023-12-12 09:46:22 +00:00
arm_dmc620_pmu.c perf: arm_dmc620: Convert to platform remove callback returning void 2024-02-09 15:59:29 +00:00
arm_dsu_pmu.c perf: arm_dsu: Convert to platform remove callback returning void 2024-02-09 15:59:29 +00:00
arm_pmu_acpi.c arm_pmu: acpi: Add a representative platform device for TRBE 2023-08-18 18:07:10 +01:00
arm_pmu_platform.c drivers/perf: Explicitly include correct DT includes 2023-07-27 13:02:23 +01:00
arm_pmu.c arm: pmu: Move error message and -EOPNOTSUPP to individual PMUs 2023-12-12 09:46:22 +00:00
arm_pmuv3.c arm64: perf: Add support for event counting threshold 2023-12-12 09:46:22 +00:00
arm_smmuv3_pmu.c perf: arm_smmuv3: Convert to platform remove callback returning void 2024-02-09 15:59:29 +00:00
arm_spe_pmu.c perf: arm_spe: Convert to platform remove callback returning void 2024-02-09 15:59:29 +00:00
arm-cci.c perf: arm-cci: Convert to platform remove callback returning void 2024-02-09 15:59:28 +00:00
arm-ccn.c perf: arm-ccn: Convert to platform remove callback returning void 2024-02-09 15:59:29 +00:00
arm-cmn.c perf/arm-cmn: Improve debugfs pretty-printing for large configs 2024-02-09 16:00:08 +00:00
cxl_pmu.c perf: CXL: fix mismatched number of counters mask 2023-09-05 15:51:18 +01:00
dwc_pcie_pmu.c drivers/perf: add DesignWare PCIe PMU driver 2023-12-13 15:35:28 +00:00
fsl_imx8_ddr_perf.c perf: fsl_imx8_ddr: Convert to platform remove callback returning void 2024-02-09 15:59:29 +00:00
fsl_imx9_ddr_perf.c perf: fsl_imx9_ddr: Convert to platform remove callback returning void 2024-02-09 15:59:30 +00:00
Kconfig drivers/perf: add DesignWare PCIe PMU driver 2023-12-13 15:35:28 +00:00
Makefile drivers/perf: add DesignWare PCIe PMU driver 2023-12-13 15:35:28 +00:00
marvell_cn10k_ddr_pmu.c perf: marvell_cn10k_ddr: Convert to platform remove callback returning void 2024-02-09 15:59:30 +00:00
marvell_cn10k_tad_pmu.c perf: marvell_cn10k_tad: Convert to platform remove callback returning void 2024-02-09 15:59:30 +00:00
qcom_l2_pmu.c perf: qcom_l2: Convert to platform remove callback returning void 2024-02-09 15:59:30 +00:00
qcom_l3_pmu.c perf: qcom: use acpi_device_uid() for fetching _UID 2023-10-20 19:21:14 +02:00
riscv_pmu_legacy.c drivers: perf: Implement perf event mmap support in the legacy backend 2023-08-16 07:28:19 -07:00
riscv_pmu_sbi.c riscv: Rearrange hwcap.h and cpufeature.h 2023-11-09 10:15:51 -08:00
riscv_pmu.c drivers: perf: Fix panic in riscv SBI mmap support 2023-10-12 11:46:35 -07:00
thunderx2_pmu.c perf: thunderx2: Convert to platform remove callback returning void 2024-02-09 15:59:30 +00:00
xgene_pmu.c perf: xgene: Convert to platform remove callback returning void 2024-02-09 15:59:30 +00:00