All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gautam Menghani <gautam@linux.ibm.com>
To: maddy@linux.ibm.com, npiggin@gmail.com, mpe@ellerman.id.au,
	chleroy@kernel.org, ritesh.list@gmail.com, sshegde@linux.ibm.com,
	atrajeev@linux.ibm.com, tshah@linux.ibm.com
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 0/3] powerpc/perf: Fix vpa-pmu driver to report correct numbers
Date: Fri,  6 Nov 2026 21:01:31 +0530	[thread overview]
Message-ID: <20261106153136.330165-1-gautam@linux.ibm.com> (raw)

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


             reply	other threads:[~2026-11-06 15:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 15:31 Gautam Menghani [this message]
2026-11-06 15:31 ` [PATCH v3 1/3] Revert "powerpc/perf: Add per-task/process monitoring to vpa_pmu driver" Gautam Menghani
2026-11-06 15:31 ` [PATCH v3 2/3] powerpc/perf: Update prev_count of event to get accurate values Gautam Menghani
2026-11-06 15:40   ` sashiko-bot
2026-11-06 15:31 ` [PATCH v3 3/3] KVM: PPC: Book3s HV: Ensure reliable usage of latency counters Gautam Menghani
2026-11-06 15:50   ` sashiko-bot
2026-11-06 16:02 ` [PATCH v3 0/3] powerpc/perf: Fix vpa-pmu driver to report correct numbers Gautam Menghani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261106153136.330165-1-gautam@linux.ibm.com \
    --to=gautam@linux.ibm.com \
    --cc=atrajeev@linux.ibm.com \
    --cc=chleroy@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=ritesh.list@gmail.com \
    --cc=sshegde@linux.ibm.com \
    --cc=tshah@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.