[PATCH v5] arm64: pmuv3: dynamically map PERF_COUNT_HW_BRANCH_INSTRUCTIONS

Will Deacon will at kernel.org
Thu Apr 6 08:10:23 PDT 2023


Hi Peter,

On Mon, Apr 03, 2023 at 11:15:47AM +0200, Peter Newman wrote:
> From: Stephane Eranian <eranian at google.com>
> 
> The mapping of perf_events generic hardware events to actual PMU events on
> ARM PMUv3 may not always be correct. This is in particular true for the
> PERF_COUNT_HW_BRANCH_INSTRUCTIONS event. Although the mapping points to an
> architected event, it may not always be available. This can be seen with a
> simple:
> 
> $ perf stat -e branches sleep 0
>  Performance counter stats for 'sleep 0':
> 
>    <not supported>      branches
> 
>        0.001401081 seconds time elapsed
> 
> Yet the hardware does have an event that could be used for branches.
> 
> Dynamically check for a supported hardware event which can be used for
> PERF_COUNT_HW_BRANCH_INSTRUCTIONS at mapping time.
> 
> And with that:
> 
> $ perf stat -e branches sleep 0
> 
>  Performance counter stats for 'sleep 0':
> 
>            166,739      branches
> 
>        0.000832163 seconds time elapsed
> 
> Co-Developed-by: Stephane Eranian <eranian at google.com>
> Signed-off-by: Stephane Eranian <eranian at google.com>
> Co-Developed-by: Mark Rutland <mark.rutland at arm.com>
> Signed-off-by: Mark Rutland <mark.rutland at arm.com>
> Co-Developed-by: Peter Newman <peternewman at google.com>
> Signed-off-by: Peter Newman <peternewman at google.com>
> Link: https://lore.kernel.org/all/YvunKCJHSXKz%2FkZB@FVFF77S0Q05N
> ---
> v4->v5:
>  - update changelog tags

Thanks, this looks good to me.

Please can you rebase it on my for-next/perf branch so that I can queue it
up? More of the PMU code has moved out into drivers/perf/.

Cheers,

Will

[1] https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git/log/?h=for-next/perf



More information about the linux-arm-kernel mailing list