All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] powerpc/perf: Fix vpa-pmu driver to report correct numbers
@ 2026-08-13  9:45 Gautam Menghani
  2026-08-13  9:45 ` [PATCH v2 1/3] KVM: PPC: Book3S HV: Maintain aggregate context switch values for vCPUs Gautam Menghani
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Gautam Menghani @ 2026-08-13  9:45 UTC (permalink / raw)
  To: maddy, atrajeev, npiggin, mpe, chleroy
  Cc: Gautam Menghani, linuxppc-dev, kvm, linux-kernel

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 the vpa-pmu driver does not
handle the following scenarios:

1. The vCPU process gets rescheduled to a different host cpu.

2. The vCPU process is not running, and vpa_pmu_read() is called to read
counter values.

Fix the above cases by maintaining aggregate counter values inside the
vcpu->arch struct and using them to report data.


changes in v2:
1. Fix the output for "perf stat --cpu ..."
2. Add stable and fixes tags

Gautam Menghani (3):
  KVM: PPC: Book3S HV: Maintain aggregate context switch values for
    vCPUs
  powerpc/perf: Use the aggregate context switch values from vcpu struct
  powerpc/perf: Update prev_count of event to get accurate values

 arch/powerpc/include/asm/kvm_book3s_64.h |  3 --
 arch/powerpc/kvm/book3s_hv.c             | 51 ++----------------------
 arch/powerpc/perf/vpa-pmu.c              | 25 +++++++++---
 3 files changed, 22 insertions(+), 57 deletions(-)

-- 
2.54.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-08-13 10:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-13  9:45 [PATCH v2 0/3] powerpc/perf: Fix vpa-pmu driver to report correct numbers Gautam Menghani
2026-08-13  9:45 ` [PATCH v2 1/3] KVM: PPC: Book3S HV: Maintain aggregate context switch values for vCPUs Gautam Menghani
2026-08-13 10:03   ` sashiko-bot
2026-08-13  9:45 ` [PATCH v2 2/3] powerpc/perf: Use the aggregate context switch values from vcpu struct Gautam Menghani
2026-08-13  9:58   ` sashiko-bot
2026-08-13  9:45 ` [PATCH v2 3/3] powerpc/perf: Update prev_count of event to get accurate values Gautam Menghani
2026-08-13 10:01   ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.