Skip to content

Commit 17899ea

Browse files
athira-rajeevmpe
authored andcommitted
powerpc/perf: Fix soft lockups due to missed interrupt accounting
Performance monitor interrupt handler checks if any counter has overflown and calls record_and_restart() in core-book3s which invokes perf_event_overflow() to record the sample information. Apart from creating sample, perf_event_overflow() also does the interrupt and period checks via perf_event_account_interrupt(). Currently we record information only if the SIAR (Sampled Instruction Address Register) valid bit is set (using siar_valid() check) and hence the interrupt check. But it is possible that we do sampling for some events that are not generating valid SIAR, and hence there is no chance to disable the event if interrupts are more than max_samples_per_tick. This leads to soft lockup. Fix this by adding perf_event_account_interrupt() in the invalid SIAR code path for a sampling event. ie if SIAR is invalid, just do interrupt check and don't record the sample information. Reported-by: Alexey Kardashevskiy <[email protected]> Signed-off-by: Athira Rajeev <[email protected]> Tested-by: Alexey Kardashevskiy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent e17a7c0 commit 17899ea

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/powerpc/perf/core-book3s.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2141,6 +2141,10 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
21412141

21422142
if (perf_event_overflow(event, &data, regs))
21432143
power_pmu_stop(event, 0);
2144+
} else if (period) {
2145+
/* Account for interrupt in case of invalid SIAR */
2146+
if (perf_event_account_interrupt(event))
2147+
power_pmu_stop(event, 0);
21442148
}
21452149
}
21462150

0 commit comments

Comments
 (0)