]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/perf: Add support for caps under sysfs in powerpc
authorAthira Rajeev <atrajeev@linux.vnet.ibm.com>
Fri, 20 May 2022 08:46:29 +0000 (14:16 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 18 Jul 2022 00:39:54 +0000 (10:39 +1000)
commitd1587f82640e6ca3e104ff58caf0f91648177fd8
tree9702c439c50411724c23a731eee6fa7692fb2b3d
parent09d466d285cebb5f6264a2042f371d9ed12b795f
powerpc/perf: Add support for caps under sysfs in powerpc

Add caps support under "/sys/bus/event_source/devices/<pmu>/"
for powerpc. This directory can be used to expose some of the
specific features that powerpc PMU supports to the user.
Example: pmu_name. The name of PMU registered will depend on
platform, say power9 or power10 or it could be Generic Compat
PMU.

Currently the only way to know which is the registered
PMU is from the dmesg logs. But clearing the dmesg will make it
difficult to know exact PMU backend used. And even extracting
from dmesg will be complicated, as we need  to parse the dmesg
logs and add filters for pmu name. Whereas by exposing it via
caps will make it easy as we just need to directly read it from
the sysfs.

Add a caps directory to /sys/bus/event_source/devices/cpu/
for power8, power9, power10 and generic compat PMU in respective
PMU driver code. Update the pmu_name file under caps folder
in core-book3s using "attr_update".

The information exposed currently:
 - pmu_name : Underlying PMU name from the driver

Example result with power9 pmu:

 # ls /sys/bus/event_source/devices/cpu/caps
pmu_name

 # cat /sys/bus/event_source/devices/cpu/caps/pmu_name
POWER9

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220520084630.15181-1-atrajeev@linux.vnet.ibm.com
arch/powerpc/perf/core-book3s.c
arch/powerpc/perf/generic-compat-pmu.c
arch/powerpc/perf/power10-pmu.c
arch/powerpc/perf/power8-pmu.c
arch/powerpc/perf/power9-pmu.c