Re: [PATCH v3 0/3] powerpc/perf: Fix vpa-pmu driver to report correct numbers
From: Gautam Menghani
Date: Fri Nov 06 2026 - 11:02:48 EST
Forgot to add linuxppc-dev
On Fri, Nov 06, 2026 at 09:01:31PM +0530, Gautam Menghani wrote:
> The vpa-pmu driver can sometimes report incorrect context switch latency
> numbers:
>
> $ perf stat -e vpa_pmu/l1_to_l2_lat/ --tid=2061 -I 1000
> time counts unit events
> 1.001022517 18,446,744,073,708,177,408 vpa_pmu/l1_to_l2_lat/
> 2.002120674 345,092 vpa_pmu/l1_to_l2_lat/
> 3.003171582 406,342 vpa_pmu/l1_to_l2_lat/
> 4.004234838 340,836 vpa_pmu/l1_to_l2_lat/
>
> These invalid numbers are observed because of 2 issues:
>
> 1. The PACA never points to the correct vCPU running on a host vCPU when
> vpa_pmu_add() is called.
>
> 2. When get_counter_data() reads the PACA counter values, it does not
> update the event->hw.prev_count.
>
>
> Changes in V3:
> 1. Drop the usage of the PACA's vCPU pointer.
> 2. Introduce a new patch to fix an issue seen when a tracepoint and vpa-pmu
> driver concurrently enable/disable access to latency counters in VPA.
>
>
> Gautam Menghani (3):
> Revert "powerpc/perf: Add per-task/process monitoring to vpa_pmu
> driver"
> powerpc/perf: Update prev_count of event to get accurate values
> KVM: PPC: Book3s HV: Ensure reliable usage of latency counters
>
> arch/powerpc/include/asm/kvm_book3s_64.h | 3 --
> arch/powerpc/kvm/book3s_hv.c | 54 +++---------------------
> arch/powerpc/perf/vpa-pmu.c | 16 ++-----
> 3 files changed, 11 insertions(+), 62 deletions(-)
>
> --
> 2.56.0
>