linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] arm64: perf: Retain PMCR.X of PMCR_EL0 during reset
@ 2022-04-29 11:29 Srinivasarao Pathipati
  2022-05-06 14:12 ` Will Deacon
  0 siblings, 1 reply; 3+ messages in thread
From: Srinivasarao Pathipati @ 2022-04-29 11:29 UTC (permalink / raw)
  To: will, mark.rutland, peterz, mingo, acme, alexander.shishkin,
	jolsa, namhyung, catalin.marinas, linux-arm-kernel,
	linux-perf-users, linux-kernel
  Cc: Srinivasarao Pathipati

Preserve the bit PMCR.X of PMCR_EL0 during PMU reset to export
PMU events. as it could be set before PMU initialization.

Signed-off-by: Srinivasarao Pathipati <quic_c_spathi@quicinc.com>
---
Changes since V1:
	- Preserving only PMCR_X bit as per Robin Murphy's comment
---
 arch/arm64/kernel/perf_event.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
index cb69ff1..532a417 100644
--- a/arch/arm64/kernel/perf_event.c
+++ b/arch/arm64/kernel/perf_event.c
@@ -1047,6 +1047,9 @@ static void armv8pmu_reset(void *info)
 	if (armv8pmu_has_long_event(cpu_pmu))
 		pmcr |= ARMV8_PMU_PMCR_LP;
 
+	/* Preserve PMCR_X to export PMU events */
+	pmcr |= (armv8pmu_pmcr_read() & ARMV8_PMU_PMCR_X);
+
 	armv8pmu_pmcr_write(pmcr);
 }
 
-- 
2.7.4


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

* Re: [PATCH V2] arm64: perf: Retain PMCR.X of PMCR_EL0 during reset
  2022-04-29 11:29 [PATCH V2] arm64: perf: Retain PMCR.X of PMCR_EL0 during reset Srinivasarao Pathipati
@ 2022-05-06 14:12 ` Will Deacon
  2022-05-09 13:21   ` Srinivasarao Pathipati
  0 siblings, 1 reply; 3+ messages in thread
From: Will Deacon @ 2022-05-06 14:12 UTC (permalink / raw)
  To: Srinivasarao Pathipati
  Cc: mark.rutland, peterz, mingo, acme, alexander.shishkin, jolsa,
	namhyung, catalin.marinas, linux-arm-kernel, linux-perf-users,
	linux-kernel

On Fri, Apr 29, 2022 at 04:59:09PM +0530, Srinivasarao Pathipati wrote:
> Preserve the bit PMCR.X of PMCR_EL0 during PMU reset to export
> PMU events. as it could be set before PMU initialization.
> 
> Signed-off-by: Srinivasarao Pathipati <quic_c_spathi@quicinc.com>
> ---
> Changes since V1:
> 	- Preserving only PMCR_X bit as per Robin Murphy's comment
> ---
>  arch/arm64/kernel/perf_event.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
> index cb69ff1..532a417 100644
> --- a/arch/arm64/kernel/perf_event.c
> +++ b/arch/arm64/kernel/perf_event.c
> @@ -1047,6 +1047,9 @@ static void armv8pmu_reset(void *info)
>  	if (armv8pmu_has_long_event(cpu_pmu))
>  		pmcr |= ARMV8_PMU_PMCR_LP;
>  
> +	/* Preserve PMCR_X to export PMU events */
> +	pmcr |= (armv8pmu_pmcr_read() & ARMV8_PMU_PMCR_X);

I don't think this should be unconditional. Exporting events could easily
result in additional power consumption, and potentially even hardware
lockups.

Please stick this behind something like a sysctl toggle or sysfs control,
with documentation about what it does. It should default to disabled.

Will

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

* Re: [PATCH V2] arm64: perf: Retain PMCR.X of PMCR_EL0 during reset
  2022-05-06 14:12 ` Will Deacon
@ 2022-05-09 13:21   ` Srinivasarao Pathipati
  0 siblings, 0 replies; 3+ messages in thread
From: Srinivasarao Pathipati @ 2022-05-09 13:21 UTC (permalink / raw)
  To: Will Deacon
  Cc: mark.rutland, peterz, mingo, acme, alexander.shishkin, jolsa,
	namhyung, catalin.marinas, linux-arm-kernel, linux-perf-users,
	linux-kernel

Thanks Will for reviewing patch

We are seeing issue at early boot up , so we will make this configurable 
with kernel arguments and push

On 5/6/2022 7:42 PM, Will Deacon wrote:
> Changes since V1:
> 	- Preserving only PMCR_X bit as per Robin Murphy's comment

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

end of thread, other threads:[~2022-05-09 13:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-29 11:29 [PATCH V2] arm64: perf: Retain PMCR.X of PMCR_EL0 during reset Srinivasarao Pathipati
2022-05-06 14:12 ` Will Deacon
2022-05-09 13:21   ` Srinivasarao Pathipati

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).