[PATCH] powerpc/perf: Account for interrupts during PMC overflow for an invalid SIAR check

Alexey Kardashevskiy aik at ozlabs.ru
Fri Aug 7 09:51:59 AEST 2020



On 06/08/2020 22:46, Athira Rajeev wrote:
> 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 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 is 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.
> 
> Signed-off-by: Athira Rajeev <atrajeev at linux.vnet.ibm.com>
> Reported-by: Alexey Kardashevskiy <aik at ozlabs.ru>



Tested-by: Alexey Kardashevskiy <aik at ozlabs.ru>


> ---
>  arch/powerpc/perf/core-book3s.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
> index 01d7028..626e587 100644
> --- a/arch/powerpc/perf/core-book3s.c
> +++ b/arch/powerpc/perf/core-book3s.c
> @@ -2101,6 +2101,10 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
>  
>  		if (perf_event_overflow(event, &data, regs))
>  			power_pmu_stop(event, 0);
> +	} else if (period) {
> +		/* Account for interrupt incase of invalid siar */
> +		if (perf_event_account_interrupt(event))
> +			power_pmu_stop(event, 0);
>  	}
>  }
>  
> 

-- 
Alexey


More information about the Linuxppc-dev mailing list