All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability
@ 2023-07-24 13:44 James Clark
  2023-07-24 13:44 ` [PATCH v2 1/4] " James Clark
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: James Clark @ 2023-07-24 13:44 UTC (permalink / raw)
  To: linux-perf-users, irogers, anshuman.khandual, will
  Cc: James Clark, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Adrian Hunter, Thomas Gleixner,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Kan Liang,
	linux-kernel, linux-arm-kernel

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

[1]: https://lore.kernel.org/linux-perf-users/CAP-5=fVkRc9=ySJ=fG-SQ8oAKmE_1mhHHzSASmGHUsda5Qy92A@mail.gmail.com/T/#t

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(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v2 1/4] arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability
  2023-07-24 13:44 [PATCH v2 0/4] arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability James Clark
@ 2023-07-24 13:44 ` James Clark
  2023-07-25  4:40   ` Anshuman Khandual
  2023-07-31 10:19   ` [tip: perf/core] " tip-bot2 for James Clark
  2023-07-24 13:44 ` [PATCH v2 2/4] perf/x86: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability James Clark
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 15+ messages in thread
From: James Clark @ 2023-07-24 13:44 UTC (permalink / raw)
  To: linux-perf-users, irogers, anshuman.khandual, will
  Cc: James Clark, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Adrian Hunter, Thomas Gleixner,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Kan Liang,
	linux-kernel, linux-arm-kernel

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%)

Fixes: 55bcf6ef314a ("perf: Extend PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE")
Suggested-by: Ian Rogers <irogers@google.com>
Acked-by: Ian Rogers <irogers@google.com>
Signed-off-by: James Clark <james.clark@arm.com>
---
 drivers/perf/arm_pmu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index f6ccb2cd4dfc..2e79201daa4a 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -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] =
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 2/4] perf/x86: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
  2023-07-24 13:44 [PATCH v2 0/4] arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability James Clark
  2023-07-24 13:44 ` [PATCH v2 1/4] " James Clark
@ 2023-07-24 13:44 ` James Clark
  2023-07-31 10:19   ` [tip: perf/core] " tip-bot2 for James Clark
  2023-07-24 13:44 ` [PATCH v2 3/4] arm_pmu: " James Clark
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: James Clark @ 2023-07-24 13:44 UTC (permalink / raw)
  To: linux-perf-users, irogers, anshuman.khandual, will
  Cc: James Clark, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Adrian Hunter, Thomas Gleixner,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Kan Liang,
	linux-kernel, linux-arm-kernel

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.

Acked-by: Ian Rogers <irogers@google.com>
Signed-off-by: James Clark <james.clark@arm.com>
---
 arch/x86/events/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index 9d248703cbdd..2353aaf0b248 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -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,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 3/4] arm_pmu: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
  2023-07-24 13:44 [PATCH v2 0/4] arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability James Clark
  2023-07-24 13:44 ` [PATCH v2 1/4] " James Clark
  2023-07-24 13:44 ` [PATCH v2 2/4] perf/x86: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability James Clark
@ 2023-07-24 13:44 ` James Clark
  2023-07-25  4:41   ` Anshuman Khandual
  2023-07-31 10:19   ` [tip: perf/core] " tip-bot2 for James Clark
  2023-07-24 13:44 ` [PATCH v2 4/4] perf: " James Clark
  2023-07-25 12:10 ` [PATCH v2 0/4] arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability Peter Zijlstra
  4 siblings, 2 replies; 15+ messages in thread
From: James Clark @ 2023-07-24 13:44 UTC (permalink / raw)
  To: linux-perf-users, irogers, anshuman.khandual, will
  Cc: James Clark, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Adrian Hunter, Thomas Gleixner,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Kan Liang,
	linux-kernel, linux-arm-kernel

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.

Acked-by: Ian Rogers <irogers@google.com>
Signed-off-by: James Clark <james.clark@arm.com>
---
 drivers/perf/arm_pmu.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index 2e79201daa4a..d712a19e47ac 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -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,
 	};
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 4/4] perf: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
  2023-07-24 13:44 [PATCH v2 0/4] arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability James Clark
                   ` (2 preceding siblings ...)
  2023-07-24 13:44 ` [PATCH v2 3/4] arm_pmu: " James Clark
@ 2023-07-24 13:44 ` James Clark
  2023-07-25  4:43   ` Anshuman Khandual
  2023-07-31 10:19   ` [tip: perf/core] " tip-bot2 for James Clark
  2023-07-25 12:10 ` [PATCH v2 0/4] arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability Peter Zijlstra
  4 siblings, 2 replies; 15+ messages in thread
From: James Clark @ 2023-07-24 13:44 UTC (permalink / raw)
  To: linux-perf-users, irogers, anshuman.khandual, will
  Cc: James Clark, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Adrian Hunter, Thomas Gleixner,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Kan Liang,
	linux-kernel, linux-arm-kernel

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.

Acked-by: Ian Rogers <irogers@google.com>
Signed-off-by: James Clark <james.clark@arm.com>
---
 include/linux/perf_event.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 2166a69e3bf2..c617badd1e76 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -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		0x0100
 
 struct perf_output_handle;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 1/4] arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability
  2023-07-24 13:44 ` [PATCH v2 1/4] " James Clark
@ 2023-07-25  4:40   ` Anshuman Khandual
  2023-07-31 10:19   ` [tip: perf/core] " tip-bot2 for James Clark
  1 sibling, 0 replies; 15+ messages in thread
From: Anshuman Khandual @ 2023-07-25  4:40 UTC (permalink / raw)
  To: James Clark, linux-perf-users, irogers, will
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Adrian Hunter, Thomas Gleixner, Borislav Petkov, Dave Hansen,
	x86, H. Peter Anvin, Kan Liang, linux-kernel, linux-arm-kernel



On 7/24/23 19:14, James Clark wrote:
> 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%)
> 
> Fixes: 55bcf6ef314a ("perf: Extend PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE")
> Suggested-by: Ian Rogers <irogers@google.com>
> Acked-by: Ian Rogers <irogers@google.com>
> Signed-off-by: James Clark <james.clark@arm.com>

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>

> ---
>  drivers/perf/arm_pmu.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
> index f6ccb2cd4dfc..2e79201daa4a 100644
> --- a/drivers/perf/arm_pmu.c
> +++ b/drivers/perf/arm_pmu.c
> @@ -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] =

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 3/4] arm_pmu: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
  2023-07-24 13:44 ` [PATCH v2 3/4] arm_pmu: " James Clark
@ 2023-07-25  4:41   ` Anshuman Khandual
  2023-07-31 10:19   ` [tip: perf/core] " tip-bot2 for James Clark
  1 sibling, 0 replies; 15+ messages in thread
From: Anshuman Khandual @ 2023-07-25  4:41 UTC (permalink / raw)
  To: James Clark, linux-perf-users, irogers, will
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Adrian Hunter, Thomas Gleixner, Borislav Petkov, Dave Hansen,
	x86, H. Peter Anvin, Kan Liang, linux-kernel, linux-arm-kernel



On 7/24/23 19:14, James Clark wrote:
> 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.
> 
> Acked-by: Ian Rogers <irogers@google.com>
> Signed-off-by: James Clark <james.clark@arm.com>

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>

> ---
>  drivers/perf/arm_pmu.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
> index 2e79201daa4a..d712a19e47ac 100644
> --- a/drivers/perf/arm_pmu.c
> +++ b/drivers/perf/arm_pmu.c
> @@ -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,
>  	};
>  

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 4/4] perf: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
  2023-07-24 13:44 ` [PATCH v2 4/4] perf: " James Clark
@ 2023-07-25  4:43   ` Anshuman Khandual
  2023-07-31 10:19   ` [tip: perf/core] " tip-bot2 for James Clark
  1 sibling, 0 replies; 15+ messages in thread
From: Anshuman Khandual @ 2023-07-25  4:43 UTC (permalink / raw)
  To: James Clark, linux-perf-users, irogers, will
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Adrian Hunter, Thomas Gleixner, Borislav Petkov, Dave Hansen,
	x86, H. Peter Anvin, Kan Liang, linux-kernel, linux-arm-kernel



On 7/24/23 19:14, James Clark wrote:
> 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.
> 
> Acked-by: Ian Rogers <irogers@google.com>
> Signed-off-by: James Clark <james.clark@arm.com>

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>

> ---
>  include/linux/perf_event.h | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index 2166a69e3bf2..c617badd1e76 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -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		0x0100
>  
>  struct perf_output_handle;
>  

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 0/4] arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability
  2023-07-24 13:44 [PATCH v2 0/4] arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability James Clark
                   ` (3 preceding siblings ...)
  2023-07-24 13:44 ` [PATCH v2 4/4] perf: " James Clark
@ 2023-07-25 12:10 ` Peter Zijlstra
  2023-07-28 14:02     ` Mark Rutland
  4 siblings, 1 reply; 15+ messages in thread
From: Peter Zijlstra @ 2023-07-25 12:10 UTC (permalink / raw)
  To: James Clark
  Cc: linux-perf-users, irogers, anshuman.khandual, will, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Adrian Hunter, Thomas Gleixner,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Kan Liang,
	linux-kernel, linux-arm-kernel

On Mon, Jul 24, 2023 at 02:44:55PM +0100, James Clark wrote:

> 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(-)

Thanks!

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 0/4] arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability
  2023-07-25 12:10 ` [PATCH v2 0/4] arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability Peter Zijlstra
@ 2023-07-28 14:02     ` Mark Rutland
  0 siblings, 0 replies; 15+ messages in thread
From: Mark Rutland @ 2023-07-28 14:02 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: James Clark, linux-perf-users, irogers, anshuman.khandual, will,
	Ingo Molnar, Arnaldo Carvalho de Melo, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Adrian Hunter, Thomas Gleixner,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Kan Liang,
	linux-kernel, linux-arm-kernel

On Tue, Jul 25, 2023 at 02:10:23PM +0200, Peter Zijlstra wrote:
> On Mon, Jul 24, 2023 at 02:44:55PM +0100, James Clark wrote:
> 
> > 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(-)
> 
> 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:

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 0/4] arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability
@ 2023-07-28 14:02     ` Mark Rutland
  0 siblings, 0 replies; 15+ messages in thread
From: Mark Rutland @ 2023-07-28 14:02 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: James Clark, linux-perf-users, irogers, anshuman.khandual, will,
	Ingo Molnar, Arnaldo Carvalho de Melo, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Adrian Hunter, Thomas Gleixner,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Kan Liang,
	linux-kernel, linux-arm-kernel

On Tue, Jul 25, 2023 at 02:10:23PM +0200, Peter Zijlstra wrote:
> On Mon, Jul 24, 2023 at 02:44:55PM +0100, James Clark wrote:
> 
> > 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(-)
> 
> 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:

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [tip: perf/core] perf: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
  2023-07-24 13:44 ` [PATCH v2 4/4] perf: " James Clark
  2023-07-25  4:43   ` Anshuman Khandual
@ 2023-07-31 10:19   ` tip-bot2 for James Clark
  1 sibling, 0 replies; 15+ messages in thread
From: tip-bot2 for James Clark @ 2023-07-31 10:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: James Clark, Peter Zijlstra (Intel),
	Anshuman Khandual, Ian Rogers, x86, linux-kernel

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 <james.clark@arm.com>
AuthorDate:    Mon, 24 Jul 2023 14:44:59 +01:00
Committer:     Peter Zijlstra <peterz@infradead.org>
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.

Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Acked-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20230724134500.970496-5-james.clark@arm.com
---
 include/linux/perf_event.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index dd92b4f..9b1cf3c 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -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		0x0100
 
 struct perf_output_handle;
 

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [tip: perf/core] arm_pmu: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
  2023-07-24 13:44 ` [PATCH v2 3/4] arm_pmu: " James Clark
  2023-07-25  4:41   ` Anshuman Khandual
@ 2023-07-31 10:19   ` tip-bot2 for James Clark
  1 sibling, 0 replies; 15+ messages in thread
From: tip-bot2 for James Clark @ 2023-07-31 10:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: James Clark, Peter Zijlstra (Intel),
	Anshuman Khandual, Ian Rogers, x86, linux-kernel

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 <james.clark@arm.com>
AuthorDate:    Mon, 24 Jul 2023 14:44:58 +01:00
Committer:     Peter Zijlstra <peterz@infradead.org>
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.

Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Acked-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20230724134500.970496-4-james.clark@arm.com
---
 drivers/perf/arm_pmu.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index 2e79201..d712a19 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -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,
 	};
 

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [tip: perf/core] perf/x86: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability
  2023-07-24 13:44 ` [PATCH v2 2/4] perf/x86: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability James Clark
@ 2023-07-31 10:19   ` tip-bot2 for James Clark
  0 siblings, 0 replies; 15+ messages in thread
From: tip-bot2 for James Clark @ 2023-07-31 10:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: James Clark, Peter Zijlstra (Intel), Ian Rogers, x86, linux-kernel

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 <james.clark@arm.com>
AuthorDate:    Mon, 24 Jul 2023 14:44:57 +01:00
Committer:     Peter Zijlstra <peterz@infradead.org>
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.

Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20230724134500.970496-3-james.clark@arm.com
---
 arch/x86/events/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index 23c9642..185f902 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -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,

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [tip: perf/core] arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability
  2023-07-24 13:44 ` [PATCH v2 1/4] " James Clark
  2023-07-25  4:40   ` Anshuman Khandual
@ 2023-07-31 10:19   ` tip-bot2 for James Clark
  1 sibling, 0 replies; 15+ messages in thread
From: tip-bot2 for James Clark @ 2023-07-31 10:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Ian Rogers, James Clark, Peter Zijlstra (Intel),
	Anshuman Khandual, x86, linux-kernel

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 <james.clark@arm.com>
AuthorDate:    Mon, 24 Jul 2023 14:44:56 +01:00
Committer:     Peter Zijlstra <peterz@infradead.org>
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%)

Fixes: 55bcf6ef314a ("perf: Extend PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE")
Suggested-by: Ian Rogers <irogers@google.com>
Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Acked-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20230724134500.970496-2-james.clark@arm.com
---
 drivers/perf/arm_pmu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index f6ccb2c..2e79201 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -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] =

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-07-31 10:19 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-24 13:44 [PATCH v2 0/4] arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability James Clark
2023-07-24 13:44 ` [PATCH v2 1/4] " James Clark
2023-07-25  4:40   ` Anshuman Khandual
2023-07-31 10:19   ` [tip: perf/core] " tip-bot2 for James Clark
2023-07-24 13:44 ` [PATCH v2 2/4] perf/x86: Remove unused PERF_PMU_CAP_HETEROGENEOUS_CPUS capability James Clark
2023-07-31 10:19   ` [tip: perf/core] " tip-bot2 for James Clark
2023-07-24 13:44 ` [PATCH v2 3/4] arm_pmu: " James Clark
2023-07-25  4:41   ` Anshuman Khandual
2023-07-31 10:19   ` [tip: perf/core] " tip-bot2 for James Clark
2023-07-24 13:44 ` [PATCH v2 4/4] perf: " James Clark
2023-07-25  4:43   ` Anshuman Khandual
2023-07-31 10:19   ` [tip: perf/core] " tip-bot2 for James Clark
2023-07-25 12:10 ` [PATCH v2 0/4] arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability Peter Zijlstra
2023-07-28 14:02   ` Mark Rutland
2023-07-28 14:02     ` Mark Rutland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.