[PATCH 4/5] perf/powerpc: Count dropped samples in core-book3s PMU

Madhavan Srinivasan maddy at linux.ibm.com
Fri Sep 13 14:46:01 AEST 2024


On 9/5/24 8:40 AM, Namhyung Kim wrote:
> Due to the hardware limitation, sometimes it could sample kernel address
> while attr.exclude_kernel is set.  In that case it silently drops the
> sample.  Let's count that case in the new dropped_samples counter.

Nice catch. Thanks for the fix.
Reviewed-by: Madhavan Srinivasan <maddy at linux.ibm.com>

> Cc: Michael Ellerman <mpe at ellerman.id.au>
> Cc: Nicholas Piggin <npiggin at gmail.com>
> Cc: Christophe Leroy <christophe.leroy at csgroup.eu>
> Cc: Naveen N Rao <naveen at kernel.org>
> Cc: Kajol Jain <kjain at linux.ibm.com>
> Cc: Athira Rajeev <atrajeev at linux.vnet.ibm.com>
> Cc: linuxppc-dev at lists.ozlabs.org
> Signed-off-by: Namhyung Kim <namhyung at kernel.org>
> ---
>   arch/powerpc/perf/core-book3s.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
> index 42867469752d73cf..553e288b9f113836 100644
> --- a/arch/powerpc/perf/core-book3s.c
> +++ b/arch/powerpc/perf/core-book3s.c
> @@ -2287,8 +2287,10 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
>   	 */
>   	if (event->attr.exclude_kernel &&
>   	    (event->attr.sample_type & PERF_SAMPLE_IP) &&
> -	    is_kernel_addr(mfspr(SPRN_SIAR)))
> +	    is_kernel_addr(mfspr(SPRN_SIAR))) {
> +		atomic64_inc(&event->dropped_samples);
>   		record = 0;
> +	}
>   
>   	/*
>   	 * Finally record data if requested.


More information about the Linuxppc-dev mailing list