Re: [PATCH V3] arm64: perf: Retain PMCR.X of PMCR_EL0 during reset

From: Will Deacon
Date: Tue May 10 2022 - 05:29:03 EST


On Mon, May 09, 2022 at 10:58:50PM +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.
>
> Exporting events could result in additional power consumption
> so making it configurable.
>
> Signed-off-by: Srinivasarao Pathipati <quic_c_spathi@xxxxxxxxxxx>
> ---
> Changes since V2:
> Done below changes as per Will's comments
> - enabling pmcr_x now configurable with kernel parameters and
> by default it is disabled.
>
> Changes since V1:
> - Preserving only PMCR_X bit as per Robin Murphy's comment.
> ---
> Documentation/admin-guide/kernel-parameters.txt | 4 ++++
> arch/arm64/kernel/perf_event.c | 13 +++++++++++++
> 2 files changed, 17 insertions(+)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index de3da15..cf3410e 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -5150,6 +5150,10 @@
> Useful for devices that are detected asynchronously
> (e.g. USB and MMC devices).
>
> + retain_pmcr_x
> + [KNL] Retain export bit of PMCR_EL0 that is getting reset
> + during pmu reset.

I think it would be better to build this as a sysctl so that it can be
toggled at runtime as well.

Will