arch/arm64/kernel/perf_event.c | 3 +++ 1 file changed, 3 insertions(+)
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
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
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
© 2016 - 2026 Red Hat, Inc.