arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability
Subsystems (3)
v2 cover arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability
Changes since v1:
* Removed "legacy" description of PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE events
* Shift down remaining capability bits instead of inserting
/* Unused */ in the gap (last commit)
Applies to v6.5-rc3
---------------------
This came out of the discussion here [1]. It seems like we can get some extra big.LITTLE stuff working pretty easily. The test issues mentioned in the linked thread are actually fairly unrelated and I've fixed them in a different set on the list.
After adding it in the first commit, the remaining ones tidy up a related capability that doesn't do anything any more.
I've added a fixes tag for the commit where PERF_PMU_CAP_EXTENDED_HW_TYPE was originally added because it probably should have been added to the Arm PMU at the same time. It doesn't apply cleanly that far back because another capability was added between then, but the resolution is trivial.
Thanks
James
James Clark (4):
arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability perf/x86: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
arm_pmu: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
perf: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
arch/x86/events/core.c | 1 - drivers/perf/arm_pmu.c | 10 ++++++---- include/linux/perf_event.h | 7 +++---- 3 files changed, 9 insertions(+), 9 deletions(-)
Signature · 1 line
2.34.1
PATCH v2 1/4 arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability
This capability gives us the ability to open PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE events on a specific PMU for free. All the implementation is contained in the Perf core and tool code so no change to the Arm PMU driver is needed.
The following basic use case now results in Perf opening the event on all PMUs rather than picking only one in an unpredictable way:
$ perf stat -e cycles -- taskset --cpu-list 0,1 stress -c 2
Performance counter stats for 'taskset --cpu-list 0,1 stress -c 2':
963279620 armv8_cortex_a57/cycles/ (99.19%)
752745657 armv8_cortex_a53/cycles/ (94.80%)--- drivers/perf/arm_pmu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/perf/arm_pmu.c +6 -1
@@ -880,8 +880,13 @@ struct arm_pmu *armpmu_alloc(void)* configuration (e.g. big.LITTLE). This is not an uncore PMU, * and we have taken ctx sharing into account (e.g. with our * pmu::filter callback and pmu::event_init group validation). +* +* PERF_PMU_CAP_EXTENDED_HW_TYPE is required to open +* PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE events on a +* specific PMU. */ - .capabilities = PERF_PMU_CAP_HETEROGENEOUS_CPUS | PERF_PMU_CAP_EXTENDED_REGS, + .capabilities = PERF_PMU_CAP_HETEROGENEOUS_CPUS | PERF_PMU_CAP_EXTENDED_REGS | + PERF_PMU_CAP_EXTENDED_HW_TYPE, }; pmu->attr_groups[ARMPMU_ATTR_GROUP_COMMON] =
Signature · 1 line
2.34.1
Quoted 15 lines · James Clark
This capability gives us the ability to open
PERF_TYPE_HARDWAREandPERF_TYPE_HW_CACHEevents on a specific PMU for free. All the implementation is contained in the Perf core and tool code so no change to the Arm PMU driver is needed.The following basic use case now results in Perf opening the event on all PMUs rather than picking only one in an unpredictable way:
$ perf stat -e cycles -- taskset --cpu-list 0,1 stress -c 2Performance counter stats for 'taskset --cpu-list 0,1 stress -c 2': 963279620 armv8_cortex_a57/cycles/ (99.19%) 752745657 armv8_cortex_a53/cycles/ (94.80%)
Quoted 4 lines
Fixes 55bcf6ef314a ("perf: Extend PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE")Suggested-by Ian Rogers <[email protected]>Acked-by Ian Rogers <[email protected]>Signed-off-by James Clark <[email protected]>
Quoted 23 lines
--- drivers/perf/arm_pmu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/perf/arm_pmu.c +6
-1@@ -880,8 +880,13 @@ struct arm_pmu *armpmu_alloc(void)* configuration (e.g. big.LITTLE). This is not an uncore PMU, * and we have taken ctx sharing into account (e.g. with our * pmu::filter callback and pmu::event_init group validation). +* +* PERF_PMU_CAP_EXTENDED_HW_TYPE is required to open +* PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE events on a +* specific PMU. */ - .capabilities = PERF_PMU_CAP_HETEROGENEOUS_CPUS | PERF_PMU_CAP_EXTENDED_REGS, + .capabilities = PERF_PMU_CAP_HETEROGENEOUS_CPUS | PERF_PMU_CAP_EXTENDED_REGS | + PERF_PMU_CAP_EXTENDED_HW_TYPE, }; pmu->attr_groups[ARMPMU_ATTR_GROUP_COMMON] =
The following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 5c816728651ae425954542fed64d21d40cb75a9f Gitweb: https://git.kernel.org/tip/5c816728651ae425954542fed64d21d40cb75a9f Author: James Clark <[email protected]> AuthorDate: Mon, 24 Jul 2023 14:44:56 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Wed, 26 Jul 2023 12:28:46 +02:00
arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability
This capability gives us the ability to open PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE events on a specific PMU for free. All the implementation is contained in the Perf core and tool code so no change to the Arm PMU driver is needed.
The following basic use case now results in Perf opening the event on all PMUs rather than picking only one in an unpredictable way:
$ perf stat -e cycles -- taskset --cpu-list 0,1 stress -c 2
Performance counter stats for 'taskset --cpu-list 0,1 stress -c 2':
963279620 armv8_cortex_a57/cycles/ (99.19%)
752745657 armv8_cortex_a53/cycles/ (94.80%)--- drivers/perf/arm_pmu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/perf/arm_pmu.c +6 -1
@@ -880,8 +880,13 @@ struct arm_pmu *armpmu_alloc(void)* configuration (e.g. big.LITTLE). This is not an uncore PMU, * and we have taken ctx sharing into account (e.g. with our * pmu::filter callback and pmu::event_init group validation). +* +* PERF_PMU_CAP_EXTENDED_HW_TYPE is required to open +* PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE events on a +* specific PMU. */ - .capabilities = PERF_PMU_CAP_HETEROGENEOUS_CPUS | PERF_PMU_CAP_EXTENDED_REGS, + .capabilities = PERF_PMU_CAP_HETEROGENEOUS_CPUS | PERF_PMU_CAP_EXTENDED_REGS | + PERF_PMU_CAP_EXTENDED_HW_TYPE, }; pmu->attr_groups[ARMPMU_ATTR_GROUP_COMMON] =
PATCH v2 2/4 perf/x86: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
In reply to James ClarkSince commit bd2756811766 ("perf: Rewrite core context handling") the relationship between perf_event_context and PMUs has changed so that the error scenario that PERF_PMU_CAP_HETEROGENEOUS_CPUS originally silenced no longer exists.
Remove the capability to avoid confusion that it actually influences any perf core behavior. This change should be a no-op.
--- arch/x86/events/core.c | 1 - 1 file changed, 1 deletion(-)
arch/x86/events/core.c +0 -1
@@ -2168,7 +2168,6 @@ static int __init init_hw_perf_events(void) hybrid_pmu->pmu = pmu; hybrid_pmu->pmu.type =-1 ; hybrid_pmu->pmu.attr_update = x86_pmu.attr_update; - hybrid_pmu->pmu.capabilities |=PERF_PMU_CAP_HETEROGENEOUS_CPUS ; hybrid_pmu->pmu.capabilities |=PERF_PMU_CAP_EXTENDED_HW_TYPE ; err = perf_pmu_register(&hybrid_pmu->pmu, hybrid_pmu->name,
Signature · 1 line
2.34.1
[tip: perf/core] perf/x86: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
The following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 4b36873b4a3455590f686903c354c4716e149c74 Gitweb: https://git.kernel.org/tip/4b36873b4a3455590f686903c354c4716e149c74 Author: James Clark <[email protected]> AuthorDate: Mon, 24 Jul 2023 14:44:57 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Wed, 26 Jul 2023 12:28:46 +02:00
perf/x86: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
Since commit bd2756811766 ("perf: Rewrite core context handling") the relationship between perf_event_context and PMUs has changed so that the error scenario that PERF_PMU_CAP_HETEROGENEOUS_CPUS originally silenced no longer exists.
Remove the capability to avoid confusion that it actually influences any perf core behavior. This change should be a no-op.
--- arch/x86/events/core.c | 1 - 1 file changed, 1 deletion(-)
arch/x86/events/core.c +0 -1
@@ -2166,7 +2166,6 @@ static int __init init_hw_perf_events(void) hybrid_pmu->pmu = pmu; hybrid_pmu->pmu.type =-1 ; hybrid_pmu->pmu.attr_update = x86_pmu.attr_update; - hybrid_pmu->pmu.capabilities |=PERF_PMU_CAP_HETEROGENEOUS_CPUS ; hybrid_pmu->pmu.capabilities |=PERF_PMU_CAP_EXTENDED_HW_TYPE ; err = perf_pmu_register(&hybrid_pmu->pmu, hybrid_pmu->name,
PATCH v2 3/4 arm_pmu: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
In reply to James ClarkSince commit bd2756811766 ("perf: Rewrite core context handling") the relationship between perf_event_context and PMUs has changed so that the error scenario that PERF_PMU_CAP_HETEROGENEOUS_CPUS originally silenced no longer exists.
Remove the capability and associated comment to avoid confusion that it actually influences any perf core behavior. This change should be a no-op.
--- drivers/perf/arm_pmu.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/perf/arm_pmu.c +2 -5
@@ -877,15 +877,12 @@ struct arm_pmu *armpmu_alloc(void) .attr_groups = pmu->attr_groups,/* * This is a CPU PMU potentially in a heterogeneous -* configuration (e.g. big.LITTLE). This is not an uncore PMU, -* and we have taken ctx sharing into account (e.g. with our -* pmu::filter callback and pmu::event_init group validation). -* +* configuration (e.g. big.LITTLE) so * PERF_PMU_CAP_EXTENDED_HW_TYPE is required to open * PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE events on a * specific PMU. */ - .capabilities =PERF_PMU_CAP_HETEROGENEOUS_CPUS |PERF_PMU_CAP_EXTENDED_REGS | + .capabilities =PERF_PMU_CAP_EXTENDED_REGS | PERF_PMU_CAP_EXTENDED_HW_TYPE, };
Signature · 1 line
2.34.1
Re: [PATCH v2 3/4] arm_pmu: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
Quoted 11 lines · James Clark
Since commit
bd2756811766("perf: Rewrite core context handling") the relationship betweenperf_event_contextand PMUs has changed so that the error scenario thatPERF_PMU_CAP_HETEROGENEOUS_CPUSoriginally silenced no longer exists.Remove the capability and associated comment to avoid confusion that it actually influences any perf core behavior. This change should be a no-op.
Acked-by Ian Rogers <[email protected]>Signed-off-by James Clark <[email protected]>
Quoted 26 lines
--- drivers/perf/arm_pmu.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/perf/arm_pmu.c +2
-5@@ -877,15 +877,12 @@ struct arm_pmu *armpmu_alloc(void) .attr_groups = pmu->attr_groups,/* * This is a CPU PMU potentially in a heterogeneous -* configuration (e.g. big.LITTLE). This is not an uncore PMU, -* and we have taken ctx sharing into account (e.g. with our -* pmu::filter callback and pmu::event_init group validation). -* +* configuration (e.g. big.LITTLE) so * PERF_PMU_CAP_EXTENDED_HW_TYPE is required to open * PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE events on a * specific PMU. */ - .capabilities =PERF_PMU_CAP_HETEROGENEOUS_CPUS |PERF_PMU_CAP_EXTENDED_REGS | + .capabilities =PERF_PMU_CAP_EXTENDED_REGS | PERF_PMU_CAP_EXTENDED_HW_TYPE, };
[tip: perf/core] arm_pmu: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
In reply to James ClarkThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 80391d8c387d406e2ec79776ec834666ab9611b0 Gitweb: https://git.kernel.org/tip/80391d8c387d406e2ec79776ec834666ab9611b0 Author: James Clark <[email protected]> AuthorDate: Mon, 24 Jul 2023 14:44:58 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Wed, 26 Jul 2023 12:28:47 +02:00
arm_pmu: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
Since commit bd2756811766 ("perf: Rewrite core context handling") the relationship between perf_event_context and PMUs has changed so that the error scenario that PERF_PMU_CAP_HETEROGENEOUS_CPUS originally silenced no longer exists.
Remove the capability and associated comment to avoid confusion that it actually influences any perf core behavior. This change should be a no-op.
--- drivers/perf/arm_pmu.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/perf/arm_pmu.c +2 -5
@@ -877,15 +877,12 @@ struct arm_pmu *armpmu_alloc(void) .attr_groups = pmu->attr_groups,/* * This is a CPU PMU potentially in a heterogeneous -* configuration (e.g. big.LITTLE). This is not an uncore PMU, -* and we have taken ctx sharing into account (e.g. with our -* pmu::filter callback and pmu::event_init group validation). -* +* configuration (e.g. big.LITTLE) so * PERF_PMU_CAP_EXTENDED_HW_TYPE is required to open * PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE events on a * specific PMU. */ - .capabilities =PERF_PMU_CAP_HETEROGENEOUS_CPUS |PERF_PMU_CAP_EXTENDED_REGS | + .capabilities =PERF_PMU_CAP_EXTENDED_REGS | PERF_PMU_CAP_EXTENDED_HW_TYPE, };
PATCH v2 4/4 perf: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
In reply to James ClarkSince commit bd2756811766 ("perf: Rewrite core context handling") the relationship between perf_event_context and PMUs has changed so that the error scenario that PERF_PMU_CAP_HETEROGENEOUS_CPUS originally silenced no longer exists.
Remove the capability to avoid confusion that it actually influences any perf core behavior and shift down the following capability bits to fill in the unused space. This change should be a no-op.
--- include/linux/perf_event.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
include/linux/perf_event.h +3 -4
@@ -288,10 +288,9 @@ struct perf_event_pmu_context;#define PERF_PMU_CAP_EXTENDED_REGS 0x0008#define PERF_PMU_CAP_EXCLUSIVE 0x0010#define PERF_PMU_CAP_ITRACE 0x0020 -#define PERF_PMU_CAP_HETEROGENEOUS_CPUS 0x0040 -#define PERF_PMU_CAP_NO_EXCLUDE 0x0080 -#define PERF_PMU_CAP_AUX_OUTPUT 0x0100 -#define PERF_PMU_CAP_EXTENDED_HW_TYPE 0x0200 +#define PERF_PMU_CAP_NO_EXCLUDE 0x0040 +#define PERF_PMU_CAP_AUX_OUTPUT 0x0080 +#define PERF_PMU_CAP_EXTENDED_HW_TYPE 0x0100struct perf_output_handle ;
Signature · 1 line
2.34.1
Re: [PATCH v2 4/4] perf: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
Quoted 11 lines · James Clark
Since commit
bd2756811766("perf: Rewrite core context handling") the relationship betweenperf_event_contextand PMUs has changed so that the error scenario thatPERF_PMU_CAP_HETEROGENEOUS_CPUSoriginally silenced no longer exists.Remove the capability to avoid confusion that it actually influences any perf core behavior and shift down the following capability bits to fill in the unused space. This change should be a no-op.
Acked-by Ian Rogers <[email protected]>Signed-off-by James Clark <[email protected]>
Quoted 22 lines
--- include/linux/perf_event.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)include/linux/perf_event.h +3
-4@@ -288,10 +288,9 @@ struct perf_event_pmu_context;#define PERF_PMU_CAP_EXTENDED_REGS 0x0008#define PERF_PMU_CAP_EXCLUSIVE 0x0010#define PERF_PMU_CAP_ITRACE 0x0020 -#define PERF_PMU_CAP_HETEROGENEOUS_CPUS 0x0040 -#define PERF_PMU_CAP_NO_EXCLUDE 0x0080 -#define PERF_PMU_CAP_AUX_OUTPUT 0x0100 -#define PERF_PMU_CAP_EXTENDED_HW_TYPE 0x0200 +#define PERF_PMU_CAP_NO_EXCLUDE 0x0040 +#define PERF_PMU_CAP_AUX_OUTPUT 0x0080 +#define PERF_PMU_CAP_EXTENDED_HW_TYPE 0x0100struct perf_output_handle ;
[tip: perf/core] perf: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
In reply to James ClarkThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 0cb52ad7bbb27bc6700412b055c743d5ae501b29 Gitweb: https://git.kernel.org/tip/0cb52ad7bbb27bc6700412b055c743d5ae501b29 Author: James Clark <[email protected]> AuthorDate: Mon, 24 Jul 2023 14:44:59 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Wed, 26 Jul 2023 12:28:47 +02:00
perf: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
Since commit bd2756811766 ("perf: Rewrite core context handling") the relationship between perf_event_context and PMUs has changed so that the error scenario that PERF_PMU_CAP_HETEROGENEOUS_CPUS originally silenced no longer exists.
Remove the capability to avoid confusion that it actually influences any perf core behavior and shift down the following capability bits to fill in the unused space. This change should be a no-op.
--- include/linux/perf_event.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
include/linux/perf_event.h +3 -4
@@ -288,10 +288,9 @@ struct perf_event_pmu_context;#define PERF_PMU_CAP_EXTENDED_REGS 0x0008#define PERF_PMU_CAP_EXCLUSIVE 0x0010#define PERF_PMU_CAP_ITRACE 0x0020 -#define PERF_PMU_CAP_HETEROGENEOUS_CPUS 0x0040 -#define PERF_PMU_CAP_NO_EXCLUDE 0x0080 -#define PERF_PMU_CAP_AUX_OUTPUT 0x0100 -#define PERF_PMU_CAP_EXTENDED_HW_TYPE 0x0200 +#define PERF_PMU_CAP_NO_EXCLUDE 0x0040 +#define PERF_PMU_CAP_AUX_OUTPUT 0x0080 +#define PERF_PMU_CAP_EXTENDED_HW_TYPE 0x0100struct perf_output_handle ;
Peter Zijlstra
maintainerQuoted 10 lines · James Clark
James Clark (4):
arm_pmu: AddPERF_PMU_CAP_EXTENDED_HW_TYPEcapability perf/x86: Remove unusedPERF_PMU_CAP_HETEROGENEOUS_CPUScapability
arm_pmu: Remove unusedPERF_PMU_CAP_HETEROGENEOUS_CPUScapability
perf: Remove unusedPERF_PMU_CAP_HETEROGENEOUS_CPUScapabilityarch/x86/events/core.c | 1 - drivers/perf/arm_pmu.c | 10 ++++++---- include/linux/perf_event.h | 7 +++---- 3 files changed, 9 insertions(+), 9 deletions(-)
Thanks!
Quoted 8 lines · Peter Zijlstra
Quoted 6 lines · James Clark
James Clark (4):
arm_pmu: AddPERF_PMU_CAP_EXTENDED_HW_TYPEcapability perf/x86: Remove unusedPERF_PMU_CAP_HETEROGENEOUS_CPUScapability
arm_pmu: Remove unusedPERF_PMU_CAP_HETEROGENEOUS_CPUScapability
perf: Remove unusedPERF_PMU_CAP_HETEROGENEOUS_CPUScapability
Quoted 6 lines
Quoted 4 lines
arch/x86/events/core.c | 1 - drivers/perf/arm_pmu.c | 10 ++++++---- include/linux/perf_event.h | 7 +++---- 3 files changed, 9 insertions(+), 9 deletions(-)Thanks!
Ah, I see that you've queued that in your perf/core branch in your queue tree.
Given that, I assume you don't need anything from me or from Will, but just in case, for the series:
Mark.