linux/arch/powerpc
Kajol Jain 505d31650b powerpc/perf: Fix the threshold compare group constraint for power10
Thresh compare bits for a event is used to program thresh compare
field in Monitor Mode Control Register A (MMCRA: 8-18 bits for power10).
When scheduling events as a group, all events in that group should
match value in threshold bits. 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 in group_constraint function.

Patch also fixes the p10_thresh_cmp_val function to return -1,
incase threshold bits are not valid and changes corresponding check in
is_thresh_cmp_valid function to return false only when the thresh_cmp
value is less then 0.

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 (3534401e0) and
PM_THRESH_MET (34340101ec) is expected to fail as both event
request different thresh control bits.

Result before the patch changes:

[command]# perf stat -e "{r35340401e0,r34340101ec}" sleep 1

 Performance counter stats for 'sleep 1':

             8,482      r35340401e0
                 0      r34340101ec

       1.001474838 seconds time elapsed

       0.001145000 seconds user
       0.000000000 seconds sys

Result after the patch changes:

[command]# perf stat -e "{r35340401e0,r34340101ec}" sleep 1

 Performance counter stats for 'sleep 1':

     <not counted>      r35340401e0
   <not supported>      r34340101ec

       1.001499607 seconds time elapsed

       0.000204000 seconds user
       0.000760000 seconds sys

Fixes: 82d2c16b35 ("powerpc/perf: Adds support for programming of Thresholding in P10")
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-1-kjain@linux.ibm.com
2022-05-22 15:58:29 +10:00
..
boot powerpc/85xx/p2020: Add fsl,mpc8548-pmc node 2022-05-22 15:58:28 +10:00
configs arch: Remove references to CONFIG_NFSD_V3 in the default configs 2022-03-11 10:25:16 -05:00
crypto powerpc: fix typos in comments 2022-05-05 22:12:44 +10:00
include powerpc: Book3S 64-bit outline-only KASAN support 2022-05-22 15:58:29 +10:00
kernel powerpc: Book3S 64-bit outline-only KASAN support 2022-05-22 15:58:29 +10:00
kexec powerpc/kasan: Disable address sanitization in kexec paths 2022-05-22 15:58:29 +10:00
kvm powerpc: Book3S 64-bit outline-only KASAN support 2022-05-22 15:58:29 +10:00
lib powerpc/kasan: Don't instrument non-maskable or raw interrupts 2022-05-22 15:58:29 +10:00
math-emu
mm powerpc/kaslr_booke: Fix build error 2022-05-22 15:58:29 +10:00
net powerpc/inst: Remove PPC_INST_BL 2022-05-22 15:58:27 +10:00
perf powerpc/perf: Fix the threshold compare group constraint for power10 2022-05-22 15:58:29 +10:00
platforms powerpc: Book3S 64-bit outline-only KASAN support 2022-05-22 15:58:29 +10:00
purgatory
sysdev powerpc/kasan: Disable address sanitization in kexec paths 2022-05-22 15:58:29 +10:00
tools powerpc/64: Add UADDR64 relocation support 2022-03-09 21:47:53 +11:00
xmon powerpc: Remove asm/prom.h from all files that don't need it 2022-05-08 22:15:04 +10:00
Kbuild
Kconfig powerpc: Book3S 64-bit outline-only KASAN support 2022-05-22 15:58:29 +10:00
Kconfig.debug powerpc: Book3S 64-bit outline-only KASAN support 2022-05-22 15:58:29 +10:00
Makefile powerpc: Finalise cleanup around ABI use 2022-05-19 23:11:29 +10:00
Makefile.postlink