kernel_samsung_a53x/arch/powerpc/perf
Kajol Jain 7be600d655 powerpc/hv-gpci: Fix the H_GET_PERF_COUNTER_INFO hcall return value checks
[ Upstream commit ad86d7ee43b22aa2ed60fb982ae94b285c1be671 ]

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: 220a0c609ad1 ("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-11-19 08:44:55 +01:00
..
req-gen Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8xx-pmu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bhrb.S Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
callchain.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
callchain.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
callchain_32.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
callchain_64.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
core-book3s.c powerpc/perf: Fix disabling BHRB and instruction sampling 2024-11-18 11:43:20 +01:00
core-fsl-emb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
e500-pmu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
e6500-pmu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
generic-compat-pmu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hv-24x7-catalog.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hv-24x7-domains.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hv-24x7.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hv-24x7.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hv-common.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hv-common.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hv-gpci-requests.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hv-gpci.c powerpc/hv-gpci: Fix the H_GET_PERF_COUNTER_INFO hcall return value checks 2024-11-19 08:44:55 +01:00
hv-gpci.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
imc-pmu.c powerpc/imc-pmu: Add a null pointer check in update_events_in_group() 2024-11-18 12:12:20 +01:00
internal.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
isa207-common.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
isa207-common.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mpc7450-pmu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
perf_regs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
power5+-pmu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
power5-pmu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
power6-pmu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
power7-events-list.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
power7-pmu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
power8-events-list.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
power8-pmu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
power9-events-list.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
power9-pmu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
power10-events-list.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
power10-pmu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ppc970-pmu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00