linux-stable/arch/powerpc
Kajol Jain 48feaf23f3 powerpc/hv-gpci: Fix the H_GET_PERF_COUNTER_INFO hcall return value checks
[ Upstream commit ad86d7ee43 ]

Running event hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/
in one of the system throws below error:

 ---Logs---
 # perf list | grep hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles
  hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=?/[Kernel PMU event]

 # perf stat -v -e hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/ sleep 2
Using CPUID 00800200
Control descriptor is not initialized
Warning:
hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/ event is not supported by the kernel.
failed to read counter hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/

 Performance counter stats for 'system wide':

   <not supported>      hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/

       2.000700771 seconds time elapsed

The above error is because of the hcall failure as required
permission "Enable Performance Information Collection" is not set.
Based on current code, single_gpci_request function did not check the
error type incase hcall fails and by default returns EINVAL. But we can
have other reasons for hcall failures like H_AUTHORITY/H_PARAMETER with
detail_rc as GEN_BUF_TOO_SMALL, for which we need to act accordingly.

Fix this issue by adding new checks in the single_gpci_request and
h_gpci_event_init functions.

Result after fix patch changes:

 # perf stat -e hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/ sleep 2
Error:
No permission to enable hv_gpci/dispatch_timebase_by_processor_processor_time_in_timebase_cycles,phys_processor_idx=0/ event.

Fixes: 220a0c609a ("powerpc/perf: Add support for the hv gpci (get performance counter info) interface")
Reported-by: Akanksha J N <akanksha@linux.ibm.com>
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240229122847.101162-1-kjain@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-03-26 18:20:52 -04:00
..
boot powerpc/boot: Disable power10 features after BOOTAFLAGS assignment 2023-09-13 09:42:20 +02:00
configs - Yu Zhao's Multi-Gen LRU patches are here. They've been under test in 2022-10-10 17:53:04 -07:00
crypto treewide: use get_random_bytes() when possible 2022-10-11 17:42:58 -06:00
include powerpc: Force inlining of arch_vmap_p{u/m}d_supported() 2024-03-26 18:20:48 -04:00
kernel powerpc/cputable: Add missing PPC_FEATURE_BOOKE on PPC64 Book-E 2024-02-23 09:12:43 +01:00
kexec powerpc/64/kdump: Limit kdump base to 512MB 2022-09-28 19:22:09 +10:00
kvm powerpc: Don't include lppaca.h in paca.h 2023-09-13 09:42:48 +02:00
lib powerpc/lib: Validate size for vector operations 2024-02-05 20:12:47 +00:00
math-emu powerpc/math-emu: Inhibit W=1 warnings 2022-09-08 11:11:18 +10:00
mm powerpc/kasan: Fix addr error caused by page alignment 2024-02-23 09:12:35 +01:00
net powerpc/bpf/32: Only set a stack frame when necessary 2023-03-17 08:50:30 +01:00
perf powerpc/hv-gpci: Fix the H_GET_PERF_COUNTER_INFO hcall return value checks 2024-03-26 18:20:52 -04:00
platforms powerpc/pseries: Fix potential memleak in papr_get_attr() 2024-03-26 18:20:52 -04:00
purgatory powerpc/purgatory: remove PGO flags 2023-06-21 16:00:55 +02:00
sysdev powerpc/xive: Fix endian conversion size 2023-11-20 11:52:12 +01:00
tools powerpc/64: Add UADDR64 relocation support 2022-03-09 21:47:53 +11:00
xmon powerpc: Don't include lppaca.h in paca.h 2023-09-13 09:42:48 +02:00
Kbuild
Kconfig Revert "powerpc/64s: Increase default stack size to 32KB" 2024-01-31 16:17:10 -08:00
Kconfig.debug powerpc: allow PPC_EARLY_DEBUG_CPM only when SERIAL_CPM=y 2023-07-19 16:22:04 +02:00
Makefile powerpc: remove checks for binutils older than 2.25 2024-01-25 15:27:18 -08:00
Makefile.postlink