OpenCloudOS-Kernel/arch/powerpc/perf
Athira Rajeev 8c9f37a78f powerpc/perf: Include caps feature for power10 DD1 version
Commit 6320e693d9 ("powerpc/perf: Add support for caps under sysfs in
powerpc") added support for caps under sysfs in powerpc. This added caps
directory to: /sys/bus/event_source/devices/cpu/ for power8, power9,
power10 and generic compat PMU in respective PMU driver code.

For power10, it is added under "power10_pmu_attr_groups". But
for DD1 version, attr_groups are defined under dd1 array:
"power10_pmu_attr_groups_dd1". Since caps is not added for DD1,
it fails to include "cpu/caps" in DD1 model.

The issue was observed while booting power10 pseries with qemu version
6, but not observed with qemu version 7. This is because qemu version 7
uses a DD 2.0 CPU model.

Below is the trace log:

  Can't update unknown attr grp name: cpu/caps^M
  ------------[ cut here ]------------^M
  Failed to register pmu: cpu, reason -22^M
  WARNING: CPU: 1 PID: 1 at kernel/events/core.c:13427 perf_event_sysfs_init+0xbc/0x108^M
  Modules linked in:^M
  CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.19.0-rc2-00111-g6320e693d98c #148^M
  NIP:  c0000000020391f4 LR: c0000000020391f0 CTR: c0000000008c9c30^M
  REGS: c0000000044c38c0 TRAP: 0700   Not tainted  (5.19.0-rc2-00111-g6320e693d98c)^M
  MSR:  8000000002029033 <SF,VEC,EE,ME,IR,DR,RI,LE>  CR: 48000281  XER: 20040000^M
  CFAR: c00000000013feac IRQMASK: 0 ^M
  GPR00: c0000000020391f0 c0000000044c3b60 c00000000283db00 0000000000000027 ^M
  GPR04: 80000000ffffe0a8 0000000000000000 0000000000000004 00000000fdcd0000 ^M
  GPR08: 0000000000000027 c0000000ffe07e08 0000000000000001 0000000000000000 ^M
  GPR12: c00000000035dd90 c0000000fffff300 c000000000012478 0000000000000000 ^M
  GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ^M
  GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 ^M
  GPR24: c000000002003480 0000000000000007 c0000000012a78d0 c000000001170a80 ^M
  GPR28: c0000000026c4df8 c0000000026c4e68 0000000000000000 c0000000025a8628 ^M
  NIP [c0000000020391f4] perf_event_sysfs_init+0xbc/0x108^M
  LR [c0000000020391f0] perf_event_sysfs_init+0xb8/0x108^M
  Call Trace:^M
  [c0000000044c3b60] [c0000000020391f0] perf_event_sysfs_init+0xb8/0x108 (unreliable)^M
  [c0000000044c3bf0] [c000000000011ec4] do_one_initcall+0x64/0x2d0^M
  [c0000000044c3cd0] [c0000000020049fc] kernel_init_freeable+0x338/0x3e0^M
  [c0000000044c3db0] [c0000000000124a0] kernel_init+0x30/0x1a0^M
  [c0000000044c3e10] [c00000000000cd54] ret_from_kernel_thread+0x5c/0x64^M
  Instruction dump:^M
  813f0038 2c090000 4180002c 7fe3fb78 4a3280c5 2c030000 7c651b78 41820018 ^M
  e89f0030 7f63db78 4a106c59 60000000 <0fe00000> ebff0000 4bffffb4 39200001 ^M
  ---[ end trace 0000000000000000 ]---^M

Fix it by adding caps for dd1 attr_groups in power10 PMU driver.

Fixes: 6320e693d9 ("powerpc/perf: Add support for caps under sysfs in powerpc")
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
[mpe: Update change log to mention qemu 7 DD2.0 CPU model]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220728163746.85062-1-atrajeev@linux.vnet.ibm.com
2022-08-01 22:21:18 +10:00
..
req-gen powerpc: clean the inclusion of stringify.h 2018-07-30 22:48:17 +10:00
8xx-pmu.c powerpc: fix typos in comments 2022-05-05 22:12:44 +10:00
Makefile powerpc/perf: Fix 32bit compile 2022-04-21 23:26:47 +10:00
bhrb.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
callchain.c powerpc: make stack walking KASAN-safe 2021-06-17 00:09:11 +10:00
callchain.h powerpc/64s/hash: Make hash faults work in NMI context 2022-02-24 12:46:54 +11:00
callchain_32.c powerpc/vdso: Retrieve sigtramp offsets at buildtime 2020-12-04 01:01:17 +11:00
callchain_64.c powerpc/64s/hash: Make hash faults work in NMI context 2022-02-24 12:46:54 +11:00
core-book3s.c powerpc/perf: Add support for caps under sysfs in powerpc 2022-07-18 10:39:54 +10:00
core-fsl-emb.c powerpc/perf: move perf irq/nmi handling details into traps.c 2021-02-09 00:02:10 +11:00
e500-pmu.c powerpc/perf: Use PVR rather than oprofile field to determine CPU version 2022-07-27 21:36:05 +10:00
e6500-pmu.c powerpc/perf: Use PVR rather than oprofile field to determine CPU version 2022-07-27 21:36:05 +10:00
generic-compat-pmu.c powerpc/perf: Add support for caps under sysfs in powerpc 2022-07-18 10:39:54 +10:00
hv-24x7-catalog.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hv-24x7-domains.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hv-24x7.c powerpc/perf: Use PVR rather than oprofile field to determine CPU version 2022-07-27 21:36:05 +10:00
hv-24x7.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hv-common.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hv-common.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hv-gpci-requests.h powerpc/perf/hv-gpci: Fix starting index value 2020-10-07 22:34:48 +11:00
hv-gpci.c powerpc: declare unmodified attribute_group usages const 2022-03-08 22:15:32 +11:00
hv-gpci.h powerpc/perf: consolidate GPCI hcall structs into asm/hvcall.h 2020-09-02 11:00:20 +10:00
imc-pmu.c powerpc: Add missing headers 2022-05-08 22:15:40 +10:00
internal.h powerpc/perf: Add __init attribute to eligible functions 2021-12-23 22:33:11 +11:00
isa207-common.c powerpc/perf: Update MMCR2 to support event exclude_idle 2022-06-29 19:42:41 +10:00
isa207-common.h powerpc/perf: Update MMCR2 to support event exclude_idle 2022-06-29 19:42:41 +10:00
mpc7450-pmu.c powerpc/perf: Use PVR rather than oprofile field to determine CPU version 2022-07-27 21:36:05 +10:00
perf_regs.c powerpc: Use the newly added is_tsk_32bit_task() macro 2022-02-12 22:47:42 +11:00
power5+-pmu.c powerpc/perf: Use PVR rather than oprofile field to determine CPU version 2022-07-27 21:36:05 +10:00
power5-pmu.c powerpc/perf: Use PVR rather than oprofile field to determine CPU version 2022-07-27 21:36:05 +10:00
power6-pmu.c powerpc/perf: Use PVR rather than oprofile field to determine CPU version 2022-07-27 21:36:05 +10:00
power7-events-list.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
power7-pmu.c powerpc/perf: Use PVR rather than oprofile field to determine CPU version 2022-07-27 21:36:05 +10:00
power8-events-list.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
power8-pmu.c powerpc/perf: Use PVR rather than oprofile field to determine CPU version 2022-07-27 21:36:05 +10:00
power9-events-list.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
power9-pmu.c powerpc/perf: Use PVR rather than oprofile field to determine CPU version 2022-07-27 21:36:05 +10:00
power10-events-list.h powerpc/perf: Fix cycles/instructions as PM_CYC/PM_INST_CMPL in power10 2021-10-14 21:46:45 +11:00
power10-pmu.c powerpc/perf: Include caps feature for power10 DD1 version 2022-08-01 22:21:18 +10:00
ppc970-pmu.c powerpc/perf: Use PVR rather than oprofile field to determine CPU version 2022-07-27 21:36:05 +10:00