2024-04-12 16:11:10

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 00/30] Add parents to struct pmu -> dev

Robin posted a patch for the cmn and that reminded me that I never
sent a v2.

v2: Drop first patch that added a parent to struct pmu as that has been
upstream for a year.
Drop the arm-cmn change as Robin has dealt with that one.
Gathered tags.

Updated cover letter:

These are the low hanging fruit following GregKH's feedback that
all the devices registered via perf_pmu_register() should have parents.

Note that this causes potential ABI breakage.

It may fall in the category of it isn't breakage if no one notices
but I can't be certain of that. Whilst it is arguable that
no one should be been accessing PMUs except via the event_source
bus, there was documentation suggesting /sys/devices/ for particular
PMUs (because it was a shorter path?)

Addressing all the other instances of struct pmu not covered by this series
is likely to be a more complex discussion but unlikely to have an affect
on what is proposed here.

Documentation updates deliberately 'fixed' in separate patches before
changing the path to highlight that using /sys/bus/event_source/devices
path is unchanged by this series and that is presumed to be the
most common way these files are accessed.

Jonathan Cameron (30):
perf/hisi-pcie: Assign parent for event_source device
Documentation: hisi-pmu: Drop reference to /sys/devices path
perf/hisi-uncore: Assign parents for event_source devices
Documentation: hns-pmu: Use /sys/bus/event_source/devices paths
perf/hisi-hns3: Assign parents for event_source device
perf/amlogic: Assign parents for event_source devices
perf/arm_cspmu: Assign parents for event_source devices
Documentation: xgene-pmu: Use /sys/bus/event_source/devices paths
perf/xgene: Assign parents for event_source devices
Documentation: thunderx2-pmu: Use /sys/bus/event_source/devices paths
perf/thunderx2: Assign parents for event_source devices
perf/riscv: Assign parents for event_source devices
Documentation: qcom-pmu: Use /sys/bus/event_source/devices paths
perf/qcom: Assign parents for event_source devices
perf/imx_ddr: Assign parents for event_source devices
perf/arm_pmu: Assign parents for event_source devices
perf/alibaba_uncore: Assign parents for event_source device
perf/arm-cci: Assign parents for event_source device
perf/arm-ccn: Assign parents for event_source device
perf/arm-dmc620: Assign parents for event_source device
perf/arm-dsu: Assign parents for event_source device
perf/arm-smmuv3: Assign parents for event_source device
perf/arm-spe: Assign parents for event_source device
arc: Assign parents for event_source devices
ARM: imx: Assign parents for mmdc event_source devices
dmaengine: idxd: Assign parent for event_source device
fpga: dfl: Assign parent for event_source device
drivers/nvdimm: Assign parent for event_source device
Documentation: ABI + trace: hisi_ptt: update paths to bus/event_source
hwtracing: hisi_ptt: Assign parent for event_source device

...i_ptt => sysfs-bus-event_source-devices-hisi_ptt} | 12 ++++++------
Documentation/admin-guide/perf/hisi-pmu.rst | 1 -
Documentation/admin-guide/perf/hns3-pmu.rst | 8 ++++----
Documentation/admin-guide/perf/qcom_l2_pmu.rst | 2 +-
Documentation/admin-guide/perf/qcom_l3_pmu.rst | 2 +-
Documentation/admin-guide/perf/thunderx2-pmu.rst | 2 +-
Documentation/admin-guide/perf/xgene-pmu.rst | 2 +-
Documentation/trace/hisi-ptt.rst | 4 ++--
MAINTAINERS | 2 +-
arch/arc/kernel/perf_event.c | 1 +
arch/arm/mach-imx/mmdc.c | 1 +
drivers/dma/idxd/perfmon.c | 1 +
drivers/fpga/dfl-fme-perf.c | 1 +
drivers/hwtracing/ptt/hisi_ptt.c | 1 +
drivers/nvdimm/nd_perf.c | 1 +
drivers/perf/alibaba_uncore_drw_pmu.c | 1 +
drivers/perf/amlogic/meson_ddr_pmu_core.c | 1 +
drivers/perf/arm-cci.c | 1 +
drivers/perf/arm-ccn.c | 1 +
drivers/perf/arm_cspmu/arm_cspmu.c | 1 +
drivers/perf/arm_dmc620_pmu.c | 1 +
drivers/perf/arm_dsu_pmu.c | 1 +
drivers/perf/arm_pmu_platform.c | 1 +
drivers/perf/arm_smmuv3_pmu.c | 1 +
drivers/perf/arm_spe_pmu.c | 1 +
drivers/perf/fsl_imx8_ddr_perf.c | 1 +
drivers/perf/hisilicon/hisi_pcie_pmu.c | 1 +
drivers/perf/hisilicon/hisi_uncore_pmu.c | 1 +
drivers/perf/hisilicon/hns3_pmu.c | 1 +
drivers/perf/qcom_l2_pmu.c | 1 +
drivers/perf/qcom_l3_pmu.c | 1 +
drivers/perf/riscv_pmu_legacy.c | 1 +
drivers/perf/riscv_pmu_sbi.c | 1 +
drivers/perf/thunderx2_pmu.c | 1 +
drivers/perf/xgene_pmu.c | 1 +
35 files changed, 43 insertions(+), 18 deletions(-)
rename Documentation/ABI/testing/{sysfs-devices-hisi_ptt => sysfs-bus-event_source-devices-hisi_ptt} (90%)

--
2.39.2



2024-04-12 16:12:35

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 01/30] perf/hisi-pcie: Assign parent for event_source device

Currently the PMU device appears directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parent to be the PCI device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Reviewed-by: Yicong Yang <[email protected]>
Reviewed-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/perf/hisilicon/hisi_pcie_pmu.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/perf/hisilicon/hisi_pcie_pmu.c b/drivers/perf/hisilicon/hisi_pcie_pmu.c
index 5d1f0e9fdb08..eacbd4e51ba6 100644
--- a/drivers/perf/hisilicon/hisi_pcie_pmu.c
+++ b/drivers/perf/hisilicon/hisi_pcie_pmu.c
@@ -807,6 +807,7 @@ static int hisi_pcie_alloc_pmu(struct pci_dev *pdev, struct hisi_pcie_pmu *pcie_
pcie_pmu->pmu = (struct pmu) {
.name = name,
.module = THIS_MODULE,
+ .parent = &pdev->dev,
.event_init = hisi_pcie_pmu_event_init,
.pmu_enable = hisi_pcie_pmu_enable,
.pmu_disable = hisi_pcie_pmu_disable,
--
2.39.2


2024-04-12 16:12:45

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 02/30] Documentation: hisi-pmu: Drop reference to /sys/devices path

Having assigned a parent to the device, the suggested path is
no longer valid. As /sys/bus/event_sources based path is also
provided, simply drop mention of alternative.

Reviewed-by: Yicong Yang <[email protected]>
Reviewed-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
Documentation/admin-guide/perf/hisi-pmu.rst | 1 -
1 file changed, 1 deletion(-)

diff --git a/Documentation/admin-guide/perf/hisi-pmu.rst b/Documentation/admin-guide/perf/hisi-pmu.rst
index e0174d20809a..5cc248d18c63 100644
--- a/Documentation/admin-guide/perf/hisi-pmu.rst
+++ b/Documentation/admin-guide/perf/hisi-pmu.rst
@@ -20,7 +20,6 @@ interrupt, and the PMU driver shall register perf PMU drivers like L3C,
HHA and DDRC etc. The available events and configuration options shall
be described in the sysfs, see:

-/sys/devices/hisi_sccl{X}_<l3c{Y}/hha{Y}/ddrc{Y}>/, or
/sys/bus/event_source/devices/hisi_sccl{X}_<l3c{Y}/hha{Y}/ddrc{Y}>.
The "perf list" command shall list the available events from sysfs.

--
2.39.2


2024-04-12 16:13:11

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 03/30] perf/hisi-uncore: Assign parents for event_source devices

Currently the PMU device appears directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parent to be the platform device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Reviewed-by: Greg Kroah-Hartman <[email protected]>
Reviewed-by: Yicong Yang <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/perf/hisilicon/hisi_uncore_pmu.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.c b/drivers/perf/hisilicon/hisi_uncore_pmu.c
index 04031450d5fe..5519965600dc 100644
--- a/drivers/perf/hisilicon/hisi_uncore_pmu.c
+++ b/drivers/perf/hisilicon/hisi_uncore_pmu.c
@@ -538,6 +538,7 @@ void hisi_pmu_init(struct hisi_pmu *hisi_pmu, struct module *module)
struct pmu *pmu = &hisi_pmu->pmu;

pmu->module = module;
+ pmu->parent = hisi_pmu->dev;
pmu->task_ctx_nr = perf_invalid_context;
pmu->event_init = hisi_uncore_pmu_event_init;
pmu->pmu_enable = hisi_uncore_pmu_enable;
--
2.39.2


2024-04-12 16:13:21

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 04/30] Documentation: hns-pmu: Use /sys/bus/event_source/devices paths

To allow setting an appropriate parent for the struct pmu device
remove existing references to /sys/devices/ path.

Reviewed-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
Documentation/admin-guide/perf/hns3-pmu.rst | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/admin-guide/perf/hns3-pmu.rst b/Documentation/admin-guide/perf/hns3-pmu.rst
index 75a40846d47f..1195e570f2d6 100644
--- a/Documentation/admin-guide/perf/hns3-pmu.rst
+++ b/Documentation/admin-guide/perf/hns3-pmu.rst
@@ -16,7 +16,7 @@ HNS3 PMU driver

The HNS3 PMU driver registers a perf PMU with the name of its sicl id.::

- /sys/devices/hns3_pmu_sicl_<sicl_id>
+ /sys/bus/event_source/devices/hns3_pmu_sicl_<sicl_id>

PMU driver provides description of available events, filter modes, format,
identifier and cpumask in sysfs.
@@ -40,9 +40,9 @@ device.

Example usage of checking event code and subevent code::

- $# cat /sys/devices/hns3_pmu_sicl_0/events/dly_tx_normal_to_mac_time
+ $# cat /sys/bus/event_source/devices/hns3_pmu_sicl_0/events/dly_tx_normal_to_mac_time
config=0x00204
- $# cat /sys/devices/hns3_pmu_sicl_0/events/dly_tx_normal_to_mac_packet_num
+ $# cat /sys/bus/event_source/devices/hns3_pmu_sicl_0/events/dly_tx_normal_to_mac_packet_num
config=0x10204

Each performance statistic has a pair of events to get two values to
@@ -60,7 +60,7 @@ computation to calculate real performance data is:::

Example usage of checking supported filter mode::

- $# cat /sys/devices/hns3_pmu_sicl_0/filtermode/bw_ssu_rpu_byte_num
+ $# cat /sys/bus/event_source/devices/hns3_pmu_sicl_0/filtermode/bw_ssu_rpu_byte_num
filter mode supported: global/port/port-tc/func/func-queue/

Example usage of perf::
--
2.39.2


2024-04-12 16:14:07

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 05/30] perf/hisi-hns3: Assign parents for event_source device

Currently the PMU device appears directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parent to be the PCI device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/perf/hisilicon/hns3_pmu.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/perf/hisilicon/hns3_pmu.c b/drivers/perf/hisilicon/hns3_pmu.c
index 16869bf5bf4c..5236acdcc2e1 100644
--- a/drivers/perf/hisilicon/hns3_pmu.c
+++ b/drivers/perf/hisilicon/hns3_pmu.c
@@ -1419,6 +1419,7 @@ static int hns3_pmu_alloc_pmu(struct pci_dev *pdev, struct hns3_pmu *hns3_pmu)
hns3_pmu->pmu = (struct pmu) {
.name = name,
.module = THIS_MODULE,
+ .parent = &pdev->dev,
.event_init = hns3_pmu_event_init,
.pmu_enable = hns3_pmu_enable,
.pmu_disable = hns3_pmu_disable,
--
2.39.2


2024-04-12 16:14:15

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 06/30] perf/amlogic: Assign parents for event_source devices

Currently all these devices appear directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parents to be the platform device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Reviewed-by: Jiucheng Xu <[email protected]
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/perf/amlogic/meson_ddr_pmu_core.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/perf/amlogic/meson_ddr_pmu_core.c b/drivers/perf/amlogic/meson_ddr_pmu_core.c
index bbc7285fd934..07446d784a1a 100644
--- a/drivers/perf/amlogic/meson_ddr_pmu_core.c
+++ b/drivers/perf/amlogic/meson_ddr_pmu_core.c
@@ -492,6 +492,7 @@ int meson_ddr_pmu_create(struct platform_device *pdev)
*pmu = (struct ddr_pmu) {
.pmu = {
.module = THIS_MODULE,
+ .parent = &pdev->dev,
.capabilities = PERF_PMU_CAP_NO_EXCLUDE,
.task_ctx_nr = perf_invalid_context,
.attr_groups = attr_groups,
--
2.39.2


2024-04-12 16:14:41

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 07/30] perf/arm_cspmu: Assign parents for event_source devices

Currently all these devices appear directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parents to be the platform device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Reviewed-by: Suzuki K Poulose <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/perf/arm_cspmu/arm_cspmu.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c
index b9a252272f1e..601d7d0d81d4 100644
--- a/drivers/perf/arm_cspmu/arm_cspmu.c
+++ b/drivers/perf/arm_cspmu/arm_cspmu.c
@@ -1206,6 +1206,7 @@ static int arm_cspmu_register_pmu(struct arm_cspmu *cspmu)
cspmu->pmu = (struct pmu){
.task_ctx_nr = perf_invalid_context,
.module = cspmu->impl.module,
+ .parent = cspmu->dev,
.pmu_enable = arm_cspmu_enable,
.pmu_disable = arm_cspmu_disable,
.event_init = arm_cspmu_event_init,
--
2.39.2


2024-04-12 16:15:56

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 09/30] perf/xgene: Assign parents for event_source devices

Currently all these devices appear directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parents to be the hardware related struct device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Cc: Khuong Dinh <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/perf/xgene_pmu.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/perf/xgene_pmu.c b/drivers/perf/xgene_pmu.c
index 0d49343d704b..8823b4c6b556 100644
--- a/drivers/perf/xgene_pmu.c
+++ b/drivers/perf/xgene_pmu.c
@@ -1102,6 +1102,7 @@ static int xgene_init_perf(struct xgene_pmu_dev *pmu_dev, char *name)

/* Perf driver registration */
pmu_dev->pmu = (struct pmu) {
+ .parent = pmu_dev->parent->dev,
.attr_groups = pmu_dev->attr_groups,
.task_ctx_nr = perf_invalid_context,
.pmu_enable = xgene_perf_pmu_enable,
--
2.39.2


2024-04-12 16:17:26

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 11/30] perf/thunderx2: Assign parents for event_source devices

Currently all these devices appear directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parents to be the platform device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Cc: Robert Richter <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/perf/thunderx2_pmu.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/perf/thunderx2_pmu.c b/drivers/perf/thunderx2_pmu.c
index e16d10c763de..4af1510d196d 100644
--- a/drivers/perf/thunderx2_pmu.c
+++ b/drivers/perf/thunderx2_pmu.c
@@ -729,6 +729,7 @@ static int tx2_uncore_pmu_register(
/* Perf event registration */
tx2_pmu->pmu = (struct pmu) {
.module = THIS_MODULE,
+ .parent = tx2_pmu->dev,
.attr_groups = tx2_pmu->attr_groups,
.task_ctx_nr = perf_invalid_context,
.event_init = tx2_uncore_event_init,
--
2.39.2


2024-04-12 16:18:12

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 12/30] perf/riscv: Assign parents for event_source devices

Currently all these devices appear directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parents to be the appropriate platform devices.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Cc: Atish Patra <[email protected]>
CC: Anup Patel <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/perf/riscv_pmu_legacy.c | 1 +
drivers/perf/riscv_pmu_sbi.c | 1 +
2 files changed, 2 insertions(+)

diff --git a/drivers/perf/riscv_pmu_legacy.c b/drivers/perf/riscv_pmu_legacy.c
index fa0bccf4edf2..04487ad7fba0 100644
--- a/drivers/perf/riscv_pmu_legacy.c
+++ b/drivers/perf/riscv_pmu_legacy.c
@@ -136,6 +136,7 @@ static int pmu_legacy_device_probe(struct platform_device *pdev)
pmu = riscv_pmu_alloc();
if (!pmu)
return -ENOMEM;
+ pmu->pmu.parent = &pdev->dev;
pmu_legacy_init(pmu);

return 0;
diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c
index 8cbe6e5f9c39..5c9c98fd796a 100644
--- a/drivers/perf/riscv_pmu_sbi.c
+++ b/drivers/perf/riscv_pmu_sbi.c
@@ -1081,6 +1081,7 @@ static int pmu_sbi_device_probe(struct platform_device *pdev)
}

pmu->pmu.attr_groups = riscv_pmu_attr_groups;
+ pmu->pmu.parent = &pdev->dev;
pmu->cmask = cmask;
pmu->ctr_start = pmu_sbi_ctr_start;
pmu->ctr_stop = pmu_sbi_ctr_stop;
--
2.39.2


2024-04-12 16:18:42

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 13/30] Documentation: qcom-pmu: Use /sys/bus/event_source/devices paths

To allow setting an appropriate parent for the struct pmu device
remove existing references to /sys/devices/ path.

Signed-off-by: Jonathan Cameron <[email protected]>
---
Documentation/admin-guide/perf/qcom_l2_pmu.rst | 2 +-
Documentation/admin-guide/perf/qcom_l3_pmu.rst | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/admin-guide/perf/qcom_l2_pmu.rst b/Documentation/admin-guide/perf/qcom_l2_pmu.rst
index c130178a4a55..c37c6be9b8d8 100644
--- a/Documentation/admin-guide/perf/qcom_l2_pmu.rst
+++ b/Documentation/admin-guide/perf/qcom_l2_pmu.rst
@@ -10,7 +10,7 @@ There is one logical L2 PMU exposed, which aggregates the results from
the physical PMUs.

The driver provides a description of its available events and configuration
-options in sysfs, see /sys/devices/l2cache_0.
+options in sysfs, see /sys/bus/event_source/devices/l2cache_0.

The "format" directory describes the format of the events.

diff --git a/Documentation/admin-guide/perf/qcom_l3_pmu.rst b/Documentation/admin-guide/perf/qcom_l3_pmu.rst
index a3d014a46bfd..a66556b7e985 100644
--- a/Documentation/admin-guide/perf/qcom_l3_pmu.rst
+++ b/Documentation/admin-guide/perf/qcom_l3_pmu.rst
@@ -9,7 +9,7 @@ PMU with device name l3cache_<socket>_<instance>. User space is responsible
for aggregating across slices.

The driver provides a description of its available events and configuration
-options in sysfs, see /sys/devices/l3cache*. Given that these are uncore PMUs
+options in sysfs, see /sys/bus/event_source/devices/l3cache*. Given that these are uncore PMUs
the driver also exposes a "cpumask" sysfs attribute which contains a mask
consisting of one CPU per socket which will be used to handle all the PMU
events on that socket.
--
2.39.2


2024-04-12 16:20:45

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 17/30] perf/alibaba_uncore: Assign parents for event_source device

Currently the PMU device appears directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parent to be the platform device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Reviewed-by: Shuai Xue <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/perf/alibaba_uncore_drw_pmu.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/perf/alibaba_uncore_drw_pmu.c b/drivers/perf/alibaba_uncore_drw_pmu.c
index a9277dcf90ce..aa378c765a74 100644
--- a/drivers/perf/alibaba_uncore_drw_pmu.c
+++ b/drivers/perf/alibaba_uncore_drw_pmu.c
@@ -709,6 +709,7 @@ static int ali_drw_pmu_probe(struct platform_device *pdev)

drw_pmu->pmu = (struct pmu) {
.module = THIS_MODULE,
+ .parent = &pdev->dev,
.task_ctx_nr = perf_invalid_context,
.event_init = ali_drw_pmu_event_init,
.add = ali_drw_pmu_add,
--
2.39.2


2024-04-12 16:22:58

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 19/30] perf/arm-ccn: Assign parents for event_source device

Currently the PMU device appears directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parent to be the platform device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Acked-by: Suzuki K Poulose <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/perf/arm-ccn.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/perf/arm-ccn.c b/drivers/perf/arm-ccn.c
index 641471bd5eff..f4495ff6525f 100644
--- a/drivers/perf/arm-ccn.c
+++ b/drivers/perf/arm-ccn.c
@@ -1265,6 +1265,7 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn)
/* Perf driver registration */
ccn->dt.pmu = (struct pmu) {
.module = THIS_MODULE,
+ .parent = ccn->dev,
.attr_groups = arm_ccn_pmu_attr_groups,
.task_ctx_nr = perf_invalid_context,
.event_init = arm_ccn_pmu_event_init,
--
2.39.2


2024-04-12 16:23:52

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 20/30] perf/arm-dmc620: Assign parents for event_source device

Currently the PMU device appears directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parent to be the platform device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/perf/arm_dmc620_pmu.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/perf/arm_dmc620_pmu.c b/drivers/perf/arm_dmc620_pmu.c
index 8a81be2dd5ec..2ec96e204c40 100644
--- a/drivers/perf/arm_dmc620_pmu.c
+++ b/drivers/perf/arm_dmc620_pmu.c
@@ -673,6 +673,7 @@ static int dmc620_pmu_device_probe(struct platform_device *pdev)

dmc620_pmu->pmu = (struct pmu) {
.module = THIS_MODULE,
+ .parent = &pdev->dev,
.capabilities = PERF_PMU_CAP_NO_EXCLUDE,
.task_ctx_nr = perf_invalid_context,
.event_init = dmc620_pmu_event_init,
--
2.39.2


2024-04-12 16:24:25

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 21/30] perf/arm-dsu: Assign parents for event_source device

Currently the PMU device appears directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parent to be the platform device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Reviewed-by: Suzuki K Poulose <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/perf/arm_dsu_pmu.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/perf/arm_dsu_pmu.c b/drivers/perf/arm_dsu_pmu.c
index bae3ca37f846..ce98bf169574 100644
--- a/drivers/perf/arm_dsu_pmu.c
+++ b/drivers/perf/arm_dsu_pmu.c
@@ -751,6 +751,7 @@ static int dsu_pmu_device_probe(struct platform_device *pdev)

dsu_pmu->pmu = (struct pmu) {
.task_ctx_nr = perf_invalid_context,
+ .parent = &pdev->dev,
.module = THIS_MODULE,
.pmu_enable = dsu_pmu_enable,
.pmu_disable = dsu_pmu_disable,
--
2.39.2


2024-04-12 16:24:40

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 22/30] perf/arm-smmuv3: Assign parents for event_source device

Currently the PMU device appears directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parent to be the platform device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/perf/arm_smmuv3_pmu.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c
index 719aa953a1c4..d5fa92ba8373 100644
--- a/drivers/perf/arm_smmuv3_pmu.c
+++ b/drivers/perf/arm_smmuv3_pmu.c
@@ -860,6 +860,7 @@ static int smmu_pmu_probe(struct platform_device *pdev)

smmu_pmu->pmu = (struct pmu) {
.module = THIS_MODULE,
+ .parent = &pdev->dev,
.task_ctx_nr = perf_invalid_context,
.pmu_enable = smmu_pmu_enable,
.pmu_disable = smmu_pmu_disable,
--
2.39.2


2024-04-12 16:25:08

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 23/30] perf/arm-spe: Assign parents for event_source device

Currently the PMU device appears directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parent to be the platform device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Acked-by: Suzuki K Poulose <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/perf/arm_spe_pmu.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c
index 35f0de03416f..9100d82bfabc 100644
--- a/drivers/perf/arm_spe_pmu.c
+++ b/drivers/perf/arm_spe_pmu.c
@@ -932,6 +932,7 @@ static int arm_spe_pmu_perf_init(struct arm_spe_pmu *spe_pmu)

spe_pmu->pmu = (struct pmu) {
.module = THIS_MODULE,
+ .parent = &spe_pmu->pdev->dev,
.capabilities = PERF_PMU_CAP_EXCLUSIVE | PERF_PMU_CAP_ITRACE,
.attr_groups = arm_spe_pmu_attr_groups,
/*
--
2.39.2


2024-04-12 16:25:27

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 24/30] arc: Assign parents for event_source devices

Currently the PMU device appears directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parent to be the platform device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Cc: Vineet Gupta <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
arch/arc/kernel/perf_event.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c
index adff957962da..bd4c2c110afe 100644
--- a/arch/arc/kernel/perf_event.c
+++ b/arch/arc/kernel/perf_event.c
@@ -788,6 +788,7 @@ static int arc_pmu_device_probe(struct platform_device *pdev)
arc_pmu->attr_groups[ARCPMU_ATTR_GR_FORMATS] = &arc_pmu_format_attr_gr;

arc_pmu->pmu = (struct pmu) {
+ .parent = &pdev->dev,
.pmu_enable = arc_pmu_enable,
.pmu_disable = arc_pmu_disable,
.event_init = arc_pmu_event_init,
--
2.39.2


2024-04-12 16:25:55

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 25/30] ARM: imx: Assign parents for mmdc event_source devices

Currently the PMU device appears directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parent to be the platform device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Cc: Shawn Guo <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
arch/arm/mach-imx/mmdc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-imx/mmdc.c b/arch/arm/mach-imx/mmdc.c
index 25893d109190..b68cb86dbe4c 100644
--- a/arch/arm/mach-imx/mmdc.c
+++ b/arch/arm/mach-imx/mmdc.c
@@ -437,6 +437,7 @@ static int mmdc_pmu_init(struct mmdc_pmu *pmu_mmdc,
{
*pmu_mmdc = (struct mmdc_pmu) {
.pmu = (struct pmu) {
+ .parent = dev,
.task_ctx_nr = perf_invalid_context,
.attr_groups = attr_groups,
.event_init = mmdc_pmu_event_init,
--
2.39.2


2024-04-12 16:26:20

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 26/30] dmaengine: idxd: Assign parent for event_source device

Currently the PMU device appears directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parent to be the iDXD PCI Device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Cc: Fenghua Yu <[email protected]>
Cc: Dave Jiang <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/dma/idxd/perfmon.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/dma/idxd/perfmon.c b/drivers/dma/idxd/perfmon.c
index fdda6d604262..fbb586eed0b3 100644
--- a/drivers/dma/idxd/perfmon.c
+++ b/drivers/dma/idxd/perfmon.c
@@ -477,6 +477,7 @@ static void idxd_pmu_init(struct idxd_pmu *idxd_pmu)
}

idxd_pmu->pmu.name = idxd_pmu->name;
+ idxd_pmu->pmu.parent = &idxd_pmu->idxd->pdev->dev;
idxd_pmu->pmu.attr_groups = perfmon_attr_groups;
idxd_pmu->pmu.task_ctx_nr = perf_invalid_context;
idxd_pmu->pmu.event_init = perfmon_pmu_event_init;
--
2.39.2


2024-04-12 16:27:12

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 08/30] Documentation: xgene-pmu: Use /sys/bus/event_source/devices paths

To allow setting an appropriate parent for the struct pmu device
remove existing references to /sys/devices/ path.

Signed-off-by: Jonathan Cameron <[email protected]>
---
Documentation/admin-guide/perf/xgene-pmu.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/perf/xgene-pmu.rst b/Documentation/admin-guide/perf/xgene-pmu.rst
index 644f8ed89152..98ccb8e777c4 100644
--- a/Documentation/admin-guide/perf/xgene-pmu.rst
+++ b/Documentation/admin-guide/perf/xgene-pmu.rst
@@ -13,7 +13,7 @@ PMU (perf) driver

The xgene-pmu driver registers several perf PMU drivers. Each of the perf
driver provides description of its available events and configuration options
-in sysfs, see /sys/devices/<l3cX/iobX/mcbX/mcX>/.
+in sysfs, see /sys/bus/event_source/devices/<l3cX/iobX/mcbX/mcX>/.

The "format" directory describes format of the config (event ID),
config1 (agent ID) fields of the perf_event_attr structure. The "events"
--
2.39.2


2024-04-12 16:31:06

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 10/30] Documentation: thunderx2-pmu: Use /sys/bus/event_source/devices paths

To allow setting an appropriate parent for the struct pmu device
remove existing references to /sys/devices/ path.

Signed-off-by: Jonathan Cameron <[email protected]>
---
Documentation/admin-guide/perf/thunderx2-pmu.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/perf/thunderx2-pmu.rst b/Documentation/admin-guide/perf/thunderx2-pmu.rst
index 01f158238ae1..9255f7bf9452 100644
--- a/Documentation/admin-guide/perf/thunderx2-pmu.rst
+++ b/Documentation/admin-guide/perf/thunderx2-pmu.rst
@@ -22,7 +22,7 @@ The thunderx2_pmu driver registers per-socket perf PMUs for the DMC and
L3C devices. Each PMU can be used to count up to 4 (DMC/L3C) or up to 8
(CCPI2) events simultaneously. The PMUs provide a description of their
available events and configuration options under sysfs, see
-/sys/devices/uncore_<l3c_S/dmc_S/ccpi2_S/>; S is the socket id.
+/sys/bus/event_source/devices/uncore_<l3c_S/dmc_S/ccpi2_S/>; S is the socket id.

The driver does not support sampling, therefore "perf record" will not
work. Per-task perf sessions are also not supported.
--
2.39.2


2024-04-12 16:35:04

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 14/30] perf/qcom: Assign parents for event_source devices

Currently all these devices appear directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parents to be the platform devices.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Cc: Andy Gross <[email protected]>
Cc: Bjorn Andersson <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/perf/qcom_l2_pmu.c | 1 +
drivers/perf/qcom_l3_pmu.c | 1 +
2 files changed, 2 insertions(+)

diff --git a/drivers/perf/qcom_l2_pmu.c b/drivers/perf/qcom_l2_pmu.c
index 148df5ae8ef8..9d6a8ae1c47a 100644
--- a/drivers/perf/qcom_l2_pmu.c
+++ b/drivers/perf/qcom_l2_pmu.c
@@ -904,6 +904,7 @@ static int l2_cache_pmu_probe(struct platform_device *pdev)
l2cache_pmu->pmu = (struct pmu) {
/* suffix is instance id for future use with multiple sockets */
.name = "l2cache_0",
+ .parent = &pdev->dev,
.task_ctx_nr = perf_invalid_context,
.pmu_enable = l2_cache_pmu_enable,
.pmu_disable = l2_cache_pmu_disable,
diff --git a/drivers/perf/qcom_l3_pmu.c b/drivers/perf/qcom_l3_pmu.c
index f16783d03db7..37786e88514e 100644
--- a/drivers/perf/qcom_l3_pmu.c
+++ b/drivers/perf/qcom_l3_pmu.c
@@ -748,6 +748,7 @@ static int qcom_l3_cache_pmu_probe(struct platform_device *pdev)
return -ENOMEM;

l3pmu->pmu = (struct pmu) {
+ .parent = &pdev->dev,
.task_ctx_nr = perf_invalid_context,

.pmu_enable = qcom_l3_cache__pmu_enable,
--
2.39.2


2024-04-12 16:35:40

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 15/30] perf/imx_ddr: Assign parents for event_source devices

Currently all this device appear directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parent to be the platform device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Cc: Frank Li <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/perf/fsl_imx8_ddr_perf.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/perf/fsl_imx8_ddr_perf.c b/drivers/perf/fsl_imx8_ddr_perf.c
index 4e8fa5a48fcf..1bbdb29743c4 100644
--- a/drivers/perf/fsl_imx8_ddr_perf.c
+++ b/drivers/perf/fsl_imx8_ddr_perf.c
@@ -651,6 +651,7 @@ static int ddr_perf_init(struct ddr_pmu *pmu, void __iomem *base,
*pmu = (struct ddr_pmu) {
.pmu = (struct pmu) {
.module = THIS_MODULE,
+ .parent = dev,
.capabilities = PERF_PMU_CAP_NO_EXCLUDE,
.task_ctx_nr = perf_invalid_context,
.attr_groups = attr_groups,
--
2.39.2


2024-04-12 16:36:02

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 16/30] perf/arm_pmu: Assign parents for event_source devices

Currently the PMU device appears directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parent to be the platform device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/perf/arm_pmu_platform.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/perf/arm_pmu_platform.c b/drivers/perf/arm_pmu_platform.c
index 3596db36cbff..4b1a9a92ea11 100644
--- a/drivers/perf/arm_pmu_platform.c
+++ b/drivers/perf/arm_pmu_platform.c
@@ -196,6 +196,7 @@ int arm_pmu_device_probe(struct platform_device *pdev,
if (!pmu)
return -ENOMEM;

+ pmu->pmu.parent = &pdev->dev;
pmu->plat_device = pdev;

ret = pmu_parse_irqs(pmu);
--
2.39.2


2024-04-12 16:38:01

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 28/30] drivers/nvdimm: Assign parent for event_source device

Currently the PMU device appears directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parent to be the platform device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Reviewed-by: Dan Williams <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/nvdimm/nd_perf.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/nvdimm/nd_perf.c b/drivers/nvdimm/nd_perf.c
index 2b6dc80d8fb5..dfc2028b9add 100644
--- a/drivers/nvdimm/nd_perf.c
+++ b/drivers/nvdimm/nd_perf.c
@@ -292,6 +292,7 @@ int register_nvdimm_pmu(struct nvdimm_pmu *nd_pmu, struct platform_device *pdev)
* device data in events functions.
*/
nd_pmu->dev = &pdev->dev;
+ nd_pmu->pmu.parent = &pdev->dev;

/* Fill attribute groups for the nvdimm pmu device */
nd_pmu->pmu.attr_groups[NVDIMM_PMU_FORMAT_ATTR] = &nvdimm_pmu_format_group;
--
2.39.2


2024-04-12 16:38:23

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 29/30] Documentation: ABI + trace: hisi_ptt: update paths to bus/event_source

To allow for assigning a suitable parent to the struct pmu device
update the documentation to describe the device via the event_source
bus where it will remain accessible.

For the ABI documention file also rename the file as it is named
after the path.

Reviewed-by: Yicong Yang <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
...i_ptt => sysfs-bus-event_source-devices-hisi_ptt} | 12 ++++++------
Documentation/trace/hisi-ptt.rst | 4 ++--
MAINTAINERS | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-devices-hisi_ptt b/Documentation/ABI/testing/sysfs-bus-event_source-devices-hisi_ptt
similarity index 90%
rename from Documentation/ABI/testing/sysfs-devices-hisi_ptt
rename to Documentation/ABI/testing/sysfs-bus-event_source-devices-hisi_ptt
index d7e206b4901c..1119766564d7 100644
--- a/Documentation/ABI/testing/sysfs-devices-hisi_ptt
+++ b/Documentation/ABI/testing/sysfs-bus-event_source-devices-hisi_ptt
@@ -1,4 +1,4 @@
-What: /sys/devices/hisi_ptt<sicl_id>_<core_id>/tune
+What: /sys/bus/event_source/devices/hisi_ptt<sicl_id>_<core_id>/tune
Date: October 2022
KernelVersion: 6.1
Contact: Yicong Yang <[email protected]>
@@ -8,7 +8,7 @@ Description: This directory contains files for tuning the PCIe link

See Documentation/trace/hisi-ptt.rst for more information.

-What: /sys/devices/hisi_ptt<sicl_id>_<core_id>/tune/qos_tx_cpl
+What: /sys/bus/event_source/devices/hisi_ptt<sicl_id>_<core_id>/tune/qos_tx_cpl
Date: October 2022
KernelVersion: 6.1
Contact: Yicong Yang <[email protected]>
@@ -18,7 +18,7 @@ Description: (RW) Controls the weight of Tx completion TLPs, which influence
will return an error, and out of range values will be converted
to 2. The value indicates a probable level of the event.

-What: /sys/devices/hisi_ptt<sicl_id>_<core_id>/tune/qos_tx_np
+What: /sys/bus/event_source/devices/hisi_ptt<sicl_id>_<core_id>/tune/qos_tx_np
Date: October 2022
KernelVersion: 6.1
Contact: Yicong Yang <[email protected]>
@@ -28,7 +28,7 @@ Description: (RW) Controls the weight of Tx non-posted TLPs, which influence
will return an error, and out of range values will be converted
to 2. The value indicates a probable level of the event.

-What: /sys/devices/hisi_ptt<sicl_id>_<core_id>/tune/qos_tx_p
+What: /sys/bus/event_source/devices/hisi_ptt<sicl_id>_<core_id>/tune/qos_tx_p
Date: October 2022
KernelVersion: 6.1
Contact: Yicong Yang <[email protected]>
@@ -38,7 +38,7 @@ Description: (RW) Controls the weight of Tx posted TLPs, which influence the
will return an error, and out of range values will be converted
to 2. The value indicates a probable level of the event.

-What: /sys/devices/hisi_ptt<sicl_id>_<core_id>/tune/rx_alloc_buf_level
+What: /sys/bus/event_source/devices/hisi_ptt<sicl_id>_<core_id>/tune/rx_alloc_buf_level
Date: October 2022
KernelVersion: 6.1
Contact: Yicong Yang <[email protected]>
@@ -49,7 +49,7 @@ Description: (RW) Control the allocated buffer watermark for inbound packets.
will return an error, and out of range values will be converted
to 2. The value indicates a probable level of the event.

-What: /sys/devices/hisi_ptt<sicl_id>_<core_id>/tune/tx_alloc_buf_level
+What: /sys/bus/event_source/devices/hisi_ptt<sicl_id>_<core_id>/tune/tx_alloc_buf_level
Date: October 2022
KernelVersion: 6.1
Contact: Yicong Yang <[email protected]>
diff --git a/Documentation/trace/hisi-ptt.rst b/Documentation/trace/hisi-ptt.rst
index 989255eb5622..6eef28ebb0c7 100644
--- a/Documentation/trace/hisi-ptt.rst
+++ b/Documentation/trace/hisi-ptt.rst
@@ -40,7 +40,7 @@ IO dies (SICL, Super I/O Cluster), where there's one PCIe Root
Complex for each SICL.
::

- /sys/devices/hisi_ptt<sicl_id>_<core_id>
+ /sys/bus/event_source/devices/hisi_ptt<sicl_id>_<core_id>

Tune
====
@@ -53,7 +53,7 @@ Each event is presented as a file under $(PTT PMU dir)/tune, and
a simple open/read/write/close cycle will be used to tune the event.
::

- $ cd /sys/devices/hisi_ptt<sicl_id>_<core_id>/tune
+ $ cd /sys/bus/event_source/devices/hisi_ptt<sicl_id>_<core_id>/tune
$ ls
qos_tx_cpl qos_tx_np qos_tx_p
tx_path_rx_req_alloc_buf_level
diff --git a/MAINTAINERS b/MAINTAINERS
index aea47e04c3a5..2f0a97aa1e60 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9796,7 +9796,7 @@ M: Yicong Yang <[email protected]>
M: Jonathan Cameron <[email protected]>
L: [email protected]
S: Maintained
-F: Documentation/ABI/testing/sysfs-devices-hisi_ptt
+F: Documentation/ABI/testing/sysfs-bus-event_source-devices-hisi_ptt
F: Documentation/trace/hisi-ptt.rst
F: drivers/hwtracing/ptt/
F: tools/perf/arch/arm64/util/hisi-ptt.c
--
2.39.2


2024-04-12 16:38:39

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 18/30] perf/arm-cci: Assign parents for event_source device

Currently the PMU device appears directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parent to be the platform device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Reviewed-by: Suzuki K Poulose <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/perf/arm-cci.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/perf/arm-cci.c b/drivers/perf/arm-cci.c
index 6be03f81ae5d..a7fd80677919 100644
--- a/drivers/perf/arm-cci.c
+++ b/drivers/perf/arm-cci.c
@@ -1409,6 +1409,7 @@ static int cci_pmu_init(struct cci_pmu *cci_pmu, struct platform_device *pdev)

cci_pmu->pmu = (struct pmu) {
.module = THIS_MODULE,
+ .parent = &pdev->dev,
.name = cci_pmu->model->name,
.task_ctx_nr = perf_invalid_context,
.pmu_enable = cci_pmu_enable,
--
2.39.2


2024-04-12 16:46:25

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 27/30] fpga: dfl: Assign parent for event_source device

Currently the PMU device appears directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parent to be the Platform device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Cc: [email protected]
Reviewed-by: Xu Yilun <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/fpga/dfl-fme-perf.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/fpga/dfl-fme-perf.c b/drivers/fpga/dfl-fme-perf.c
index 7422d2bc6f37..2d59f1c620b1 100644
--- a/drivers/fpga/dfl-fme-perf.c
+++ b/drivers/fpga/dfl-fme-perf.c
@@ -912,6 +912,7 @@ static int fme_perf_pmu_register(struct platform_device *pdev,

fme_perf_setup_hardware(priv);

+ pmu->parent = &pdev->dev;
pmu->task_ctx_nr = perf_invalid_context;
pmu->attr_groups = fme_perf_groups;
pmu->attr_update = fme_perf_events_groups;
--
2.39.2


2024-04-12 16:47:41

by Jonathan Cameron

[permalink] [raw]
Subject: [PATCH v2 30/30] hwtracing: hisi_ptt: Assign parent for event_source device

Currently the PMU device appears directly under /sys/devices/
Only root busses should appear there, so instead assign the pmu->dev
parent to be the PCI device.

Link: https://lore.kernel.org/linux-cxl/[email protected]/
Cc: Suzuki K Poulose <[email protected]>
Reviewed-by: Yicong Yang <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
---
drivers/hwtracing/ptt/hisi_ptt.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c
index 4bf04a977840..3090479a2979 100644
--- a/drivers/hwtracing/ptt/hisi_ptt.c
+++ b/drivers/hwtracing/ptt/hisi_ptt.c
@@ -1221,6 +1221,7 @@ static int hisi_ptt_register_pmu(struct hisi_ptt *hisi_ptt)

hisi_ptt->hisi_ptt_pmu = (struct pmu) {
.module = THIS_MODULE,
+ .parent = &hisi_ptt->pdev->dev,
.capabilities = PERF_PMU_CAP_EXCLUSIVE | PERF_PMU_CAP_NO_EXCLUDE,
.task_ctx_nr = perf_sw_context,
.attr_groups = hisi_ptt_pmu_groups,
--
2.39.2


2024-04-12 16:48:12

by Dave Jiang

[permalink] [raw]
Subject: Re: [PATCH v2 26/30] dmaengine: idxd: Assign parent for event_source device



On 4/12/24 9:10 AM, Jonathan Cameron wrote:
> Currently the PMU device appears directly under /sys/devices/
> Only root busses should appear there, so instead assign the pmu->dev
> parent to be the iDXD PCI Device.
>
> Link: https://lore.kernel.org/linux-cxl/[email protected]/
> Cc: Fenghua Yu <[email protected]>
> Cc: Dave Jiang <[email protected]>
> Signed-off-by: Jonathan Cameron <[email protected]>

Reviewed-by: Dave Jiang <[email protected]>
> ---
> drivers/dma/idxd/perfmon.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/dma/idxd/perfmon.c b/drivers/dma/idxd/perfmon.c
> index fdda6d604262..fbb586eed0b3 100644
> --- a/drivers/dma/idxd/perfmon.c
> +++ b/drivers/dma/idxd/perfmon.c
> @@ -477,6 +477,7 @@ static void idxd_pmu_init(struct idxd_pmu *idxd_pmu)
> }
>
> idxd_pmu->pmu.name = idxd_pmu->name;
> + idxd_pmu->pmu.parent = &idxd_pmu->idxd->pdev->dev;
> idxd_pmu->pmu.attr_groups = perfmon_attr_groups;
> idxd_pmu->pmu.task_ctx_nr = perf_invalid_context;
> idxd_pmu->pmu.event_init = perfmon_pmu_event_init;

2024-04-15 19:05:23

by Fenghua Yu

[permalink] [raw]
Subject: Re: [PATCH v2 26/30] dmaengine: idxd: Assign parent for event_source device

Hi, Jonathan,


On 4/12/24 09:10, Jonathan Cameron wrote:
> Currently the PMU device appears directly under /sys/devices/
> Only root busses should appear there, so instead assign the pmu->dev
s/busses/buses/

> parent to be the iDXD PCI Device.
s/iDXD/IDXD/
>
> Link: https://lore.kernel.org/linux-cxl/[email protected]/
> Cc: Fenghua Yu <[email protected]>
> Cc: Dave Jiang <[email protected]>
> Signed-off-by: Jonathan Cameron <[email protected]>

Other than the typos,

Reviewed-by: Fenghua Yu <[email protected]>

> ---
> drivers/dma/idxd/perfmon.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/dma/idxd/perfmon.c b/drivers/dma/idxd/perfmon.c
> index fdda6d604262..fbb586eed0b3 100644
> --- a/drivers/dma/idxd/perfmon.c
> +++ b/drivers/dma/idxd/perfmon.c
> @@ -477,6 +477,7 @@ static void idxd_pmu_init(struct idxd_pmu *idxd_pmu)
> }
>
> idxd_pmu->pmu.name = idxd_pmu->name;
> + idxd_pmu->pmu.parent = &idxd_pmu->idxd->pdev->dev;
> idxd_pmu->pmu.attr_groups = perfmon_attr_groups;
> idxd_pmu->pmu.task_ctx_nr = perf_invalid_context;
> idxd_pmu->pmu.event_init = perfmon_pmu_event_init;

Thanks.

-Fenghua

2024-04-16 09:37:19

by Suzuki K Poulose

[permalink] [raw]
Subject: Re: [PATCH v2 16/30] perf/arm_pmu: Assign parents for event_source devices

On 12/04/2024 17:10, Jonathan Cameron wrote:
> Currently the PMU device appears directly under /sys/devices/
> Only root busses should appear there, so instead assign the pmu->dev
> parent to be the platform device.
>
> Link: https://lore.kernel.org/linux-cxl/[email protected]/
> Signed-off-by: Jonathan Cameron <[email protected]>
> ---
> drivers/perf/arm_pmu_platform.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/perf/arm_pmu_platform.c b/drivers/perf/arm_pmu_platform.c
> index 3596db36cbff..4b1a9a92ea11 100644
> --- a/drivers/perf/arm_pmu_platform.c
> +++ b/drivers/perf/arm_pmu_platform.c
> @@ -196,6 +196,7 @@ int arm_pmu_device_probe(struct platform_device *pdev,
> if (!pmu)
> return -ENOMEM;
>
> + pmu->pmu.parent = &pdev->dev;
> pmu->plat_device = pdev;
>
> ret = pmu_parse_irqs(pmu);


Reviewed-by: Suzuki K Poulose <[email protected]>


2024-04-16 09:38:18

by Suzuki K Poulose

[permalink] [raw]
Subject: Re: [PATCH v2 30/30] hwtracing: hisi_ptt: Assign parent for event_source device

On 12/04/2024 17:10, Jonathan Cameron wrote:
> Currently the PMU device appears directly under /sys/devices/
> Only root busses should appear there, so instead assign the pmu->dev
> parent to be the PCI device.
>
> Link: https://lore.kernel.org/linux-cxl/[email protected]/
> Cc: Suzuki K Poulose <[email protected]>
> Reviewed-by: Yicong Yang <[email protected]>
> Signed-off-by: Jonathan Cameron <[email protected]>
> ---
> drivers/hwtracing/ptt/hisi_ptt.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c
> index 4bf04a977840..3090479a2979 100644
> --- a/drivers/hwtracing/ptt/hisi_ptt.c
> +++ b/drivers/hwtracing/ptt/hisi_ptt.c
> @@ -1221,6 +1221,7 @@ static int hisi_ptt_register_pmu(struct hisi_ptt *hisi_ptt)
>
> hisi_ptt->hisi_ptt_pmu = (struct pmu) {
> .module = THIS_MODULE,
> + .parent = &hisi_ptt->pdev->dev,
> .capabilities = PERF_PMU_CAP_EXCLUSIVE | PERF_PMU_CAP_NO_EXCLUDE,
> .task_ctx_nr = perf_sw_context,
> .attr_groups = hisi_ptt_pmu_groups,


Acked-by: Suzuki K Poulose <[email protected]>



2024-04-19 15:34:02

by Will Deacon

[permalink] [raw]
Subject: Re: [PATCH v2 00/30] Add parents to struct pmu -> dev

On Fri, 12 Apr 2024 17:10:27 +0100, Jonathan Cameron wrote:
> Robin posted a patch for the cmn and that reminded me that I never
> sent a v2.
>
> v2: Drop first patch that added a parent to struct pmu as that has been
> upstream for a year.
> Drop the arm-cmn change as Robin has dealt with that one.
> Gathered tags.
>
> [...]

Applied drivers/perf parts to will (for-next/perf), thanks!

[01/30] perf/hisi-pcie: Assign parent for event_source device
https://git.kernel.org/will/c/1fb8950417a4
[02/30] Documentation: hisi-pmu: Drop reference to /sys/devices path
https://git.kernel.org/will/c/d0412b6ecb4e
[03/30] perf/hisi-uncore: Assign parents for event_source devices
https://git.kernel.org/will/c/16d417f6c45b
[04/30] Documentation: hns-pmu: Use /sys/bus/event_source/devices paths
https://git.kernel.org/will/c/eff6af531335
[05/30] perf/hisi-hns3: Assign parents for event_source device
https://git.kernel.org/will/c/3d957de12c65
[06/30] perf/amlogic: Assign parents for event_source devices
https://git.kernel.org/will/c/1b7718fcc3f2
[07/30] perf/arm_cspmu: Assign parents for event_source devices
https://git.kernel.org/will/c/3a1bb75ebc1b
[08/30] Documentation: xgene-pmu: Use /sys/bus/event_source/devices paths
https://git.kernel.org/will/c/867ba6d204f1
[09/30] perf/xgene: Assign parents for event_source devices
https://git.kernel.org/will/c/89e34f8bee6c
[10/30] Documentation: thunderx2-pmu: Use /sys/bus/event_source/devices paths
https://git.kernel.org/will/c/90b4a1a927ee
[11/30] perf/thunderx2: Assign parents for event_source devices
https://git.kernel.org/will/c/ecb79c21c189
[12/30] perf/riscv: Assign parents for event_source devices
https://git.kernel.org/will/c/50650e5f3186
[13/30] Documentation: qcom-pmu: Use /sys/bus/event_source/devices paths
https://git.kernel.org/will/c/556da1343452
[14/30] perf/qcom: Assign parents for event_source devices
https://git.kernel.org/will/c/6148865dd57c
[15/30] perf/imx_ddr: Assign parents for event_source devices
https://git.kernel.org/will/c/1d194ab8571b
[16/30] perf/arm_pmu: Assign parents for event_source devices
https://git.kernel.org/will/c/7bf75431a9ba
[17/30] perf/alibaba_uncore: Assign parents for event_source device
https://git.kernel.org/will/c/1919bd8e0be0
[18/30] perf/arm-cci: Assign parents for event_source device
https://git.kernel.org/will/c/e7ec4791f903
[19/30] perf/arm-ccn: Assign parents for event_source device
https://git.kernel.org/will/c/f4144be05a60
[20/30] perf/arm-dmc620: Assign parents for event_source device
https://git.kernel.org/will/c/46bed4c740d5
[21/30] perf/arm-dsu: Assign parents for event_source device
https://git.kernel.org/will/c/bc81ae2efbb3
[22/30] perf/arm-smmuv3: Assign parents for event_source device
https://git.kernel.org/will/c/a8889fbf16bc
[23/30] perf/arm-spe: Assign parents for event_source device
https://git.kernel.org/will/c/4052ce07d5d7

Cheers,
--
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

2024-04-22 05:44:38

by Shawn Guo

[permalink] [raw]
Subject: Re: [PATCH v2 25/30] ARM: imx: Assign parents for mmdc event_source devices

On Fri, Apr 12, 2024 at 05:10:52PM +0100, Jonathan Cameron wrote:
> Currently the PMU device appears directly under /sys/devices/
> Only root busses should appear there, so instead assign the pmu->dev
> parent to be the platform device.
>
> Link: https://lore.kernel.org/linux-cxl/[email protected]/
> Cc: Shawn Guo <[email protected]>
> Signed-off-by: Jonathan Cameron <[email protected]>

Applied, thanks!


2024-05-02 11:14:10

by Suzuki K Poulose

[permalink] [raw]
Subject: Re: [PATCH v2 00/30] (subset) Add parents to struct pmu -> dev

On Fri, 12 Apr 2024 17:10:27 +0100, Jonathan Cameron wrote:
> Robin posted a patch for the cmn and that reminded me that I never
> sent a v2.
>
> v2: Drop first patch that added a parent to struct pmu as that has been
> upstream for a year.
> Drop the arm-cmn change as Robin has dealt with that one.
> Gathered tags.
>
> [...]

Applied, subset of patches to coresight/next. thanks!

[29/30] Documentation: ABI + trace: hisi_ptt: update paths to bus/event_source
https://git.kernel.org/coresight/c/1f82d58ddbe21ed75c04d04403d8268a95e0190a
[30/30] hwtracing: hisi_ptt: Assign parent for event_source device
https://git.kernel.org/coresight/c/9b47d9982d1de5adf0abcb8f1a400e51d68cca1f

Best regards,
--
Suzuki K Poulose <[email protected]>