Re: [powerpc/merge] PMU: Kernel warning while running pmu/ebb selftests
From: Sachin Sant <hidden>
Date: 2022-01-12 07:09:08
The warning indicates that MSR_EE being set(interrupt enabled) when
there was an overflown PMC detected. This could happen in
power_pmu_disable since it runs under interrupt soft disable
condition ( local_irq_save ) and not with interrupts hard disabled.
commit 2c9ac51b850d ("powerpc/perf: Fix PMU callbacks to clear
pending PMI before resetting an overflown PMC") intended to clear
PMI pending bit in Paca when disabling the PMU. It could happen
that PMC gets overflown while code is in power_pmu_disable
callback function. Hence add a check to see if PMI pending bit
is set in Paca before clearing it via clear_pmi_pending.
Fixes: 2c9ac51b850d ("powerpc/perf: Fix PMU callbacks to clear pending PMI before resetting an overflown PMC")
Signed-off-by: Athira Rajeev <redacted>
Reported-by: Sachin Sant <redacted>
---Thanks for the patch. The test ran to completion without the reported warning. Tested-by: Sachin Sant <redacted>
quoted hunk ↗ jump to hunk
arch/powerpc/perf/core-book3s.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index a684901b6965..dfb0ea0f0df3 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c@@ -1327,9 +1327,10 @@ static void power_pmu_disable(struct pmu *pmu)* Otherwise provide a warning if there is PMI pending, but * no counter is found overflown. */ - if (any_pmc_overflown(cpuhw)) - clear_pmi_irq_pending(); - else + if (any_pmc_overflown(cpuhw)) { + if (pmi_irq_pending()) + clear_pmi_irq_pending(); + } else WARN_ON(pmi_irq_pending()); val = mmcra = cpuhw->mmcr.mmcra; -- 2.33.0