acrn-kernel/arch/powerpc/perf
Kajol Jain ab0cc6bbf0 powerpc/perf: Fix the threshold compare group constraint for power9
Thresh compare bits for a event is used to program thresh compare
field in Monitor Mode Control Register A (MMCRA: 9-18 bits for power9).
When scheduling events as a group, all events in that group should
match value in threshold bits (like thresh compare, thresh control,
thresh select). Otherwise event open for the sibling events should fail.
But in the current code, incase thresh compare bits are not valid,
we are not failing in group_constraint function which can result
in invalid group schduling.

Fix the issue by returning -1 incase event is threshold and threshold
compare value is not valid.

Thresh control bits in the event code is used to program thresh_ctl
field in Monitor Mode Control Register A (MMCRA: 48-55). In below example,
the scheduling of group events PM_MRK_INST_CMPL (873534401e0) and
PM_THRESH_MET (8734340101ec) is expected to fail as both event
request different thresh control bits and invalid thresh compare value.

Result before the patch changes:

[command]# perf stat -e "{r8735340401e0,r8734340101ec}" sleep 1

 Performance counter stats for 'sleep 1':

            11,048      r8735340401e0
             1,967      r8734340101ec

       1.001354036 seconds time elapsed

       0.001421000 seconds user
       0.000000000 seconds sys

Result after the patch changes:

[command]# perf stat -e "{r8735340401e0,r8734340101ec}" sleep 1
Error:
The sys_perf_event_open() syscall returned with 22 (Invalid argument)
for event (r8735340401e0).
/bin/dmesg | grep -i perf may provide additional information.

Fixes: 78a16d9fc1 ("powerpc/perf: Avoid FAB_*_MATCH checks for power9")
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
Reviewed-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220506061015.43916-2-kjain@linux.ibm.com
2022-05-22 15:58:30 +10:00
..
req-gen
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
callchain.c
callchain.h powerpc/64s/hash: Make hash faults work in NMI context 2022-02-24 12:46:54 +11:00
callchain_32.c
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: fix typos in comments 2022-05-05 22:12:44 +10:00
core-fsl-emb.c
e500-pmu.c
e6500-pmu.c
generic-compat-pmu.c powerpc: declare unmodified attribute_group usages const 2022-03-08 22:15:32 +11:00
hv-24x7-catalog.h
hv-24x7-domains.h
hv-24x7.c powerpc/perf/24x7: use 'unsigned int' instead of 'unsigned' 2022-05-04 19:37:44 +10:00
hv-24x7.h
hv-common.c
hv-common.h
hv-gpci-requests.h
hv-gpci.c powerpc: declare unmodified attribute_group usages const 2022-03-08 22:15:32 +11:00
hv-gpci.h
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: Fix the threshold compare group constraint for power9 2022-05-22 15:58:30 +10:00
isa207-common.h
mpc7450-pmu.c
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: Add __init attribute to eligible functions 2021-12-23 22:33:11 +11:00
power5-pmu.c powerpc/perf: Add __init attribute to eligible functions 2021-12-23 22:33:11 +11:00
power6-pmu.c powerpc/perf: Add __init attribute to eligible functions 2021-12-23 22:33:11 +11:00
power7-events-list.h
power7-pmu.c powerpc: declare unmodified attribute_group usages const 2022-03-08 22:15:32 +11:00
power8-events-list.h
power8-pmu.c powerpc: declare unmodified attribute_group usages const 2022-03-08 22:15:32 +11:00
power9-events-list.h
power9-pmu.c Linux 5.18-rc4 2022-05-05 22:09:35 +10:00
power10-events-list.h
power10-pmu.c powerpc/perf: Fix power10 event alternatives 2022-04-21 23:25:33 +10:00
ppc970-pmu.c powerpc/perf: Add __init attribute to eligible functions 2021-12-23 22:33:11 +11:00