Running perf fuzzer testsuite popped up below messages in the dmesg logs: "Can't find PMC that caused IRQ"
This means a PMU exception happened, but none of the PMC's (Performance Monitor Counter) were found to be overflown. Perf interrupt handler checks the PMC's to see which PMC has overflown and if none of the PMCs are overflown ( counter value not >= 0x80000000 ), it throws warning: "Can't find PMC that caused IRQ". Powerpc has capability to mask and replay a performance monitoring interrupt (PMI). In case of replayed PMI, there are some corner cases that clears the PMCs after masking. In such cases, the perf interrupt handler will not find the active PMC values that had caused the overflow and thus leading to this message. This patchset attempts to fix those corner cases. However there is one more case in PowerNV where these messages are emitted during system wide profiling or when a specific CPU is monitored for an event. That is, when a counter overflow just before entering idle and a PMI gets triggered after wakeup from idle. Since PMCs are not saved in the idle path, perf interrupt handler will not find overflown counter value and emits the "Can't find PMC" messages. This patch documents this race condition in powerpc core-book3s. Patch fixes the ppmu callbacks to disable pending interrupt before clearing the overflown PMC and documents the race condition in idle path. Changelog: Changes from v1 -> v2 Addressed review comments from Nicholas Piggin - Moved the PMI pending check and clearing function to arch/powerpc/include/asm/hw_irq.h and renamed function to "get_clear_pmi_irq_pending" - Along with checking for pending PMI bit in Paca, look for PMAO bit in MMCR0 register to decide on pending PMI interrupt. Athira Rajeev (1): powerpc/perf: Fix PMU callbacks to clear pending PMI before resetting an overflown PMC arch/powerpc/include/asm/hw_irq.h | 19 ++++++++ arch/powerpc/perf/core-book3s.c | 77 +++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) -- 2.26.2