Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Upton <oupton@kernel.org>
To: Marc Zyngier <maz@kernel.org>, Oliver Upton <oupton@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, Sven Peter <sven@kernel.org>,
	Janne Grunau <j@jannau.net>, Thomas Gleixner <tglx@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>
Cc: Fuad Tabba <fuad.tabba@linux.dev>,
	Joey Gouly <joey.gouly@arm.com>,
	Steffen Eiden <seiden@linux.ibm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Mark Rutland <mark.rutland@arm.com>, Neal Gompa <neal@gompa.dev>,
	Radu Rendec <radu@rendec.net>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	James Clark <james.clark@linaro.org>,
	linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
	linux-kernel@vger.kernel.org, asahi@lists.linux.dev,
	linux-perf-users@vger.kernel.org
Subject: [PATCH 0/4] KVM: arm64: Fixes for guest-only PMU event overflows on Apple Silicon
Date: Tue,  1 Dec 2026 12:44:58 -0800	[thread overview]
Message-ID: <20261201204502.1813335-1-oupton@kernel.org> (raw)

A rather annoying detail of the Apple CPU PMU is that the FIQ appears to
depend on the event filter configuration / value of HCR_EL2.TGE. Events
that filter out the host ELs do not appear to drive the FIQ line when
HCR_EL2.TGE=1.

This manifests when using the vPMU for sampling inside of a KVM guest,
as the overflowed PMU generates a storm of FIQs that are no longer
pending by the time interrupts are unmasked.

This series performs a rather disgusting hack to work around the issue,
forcing a pending FIQ by performing a self-IPI when exiting due to a FIQ
and the PMU is in an interrupt condition. The mitigation works on all
implementations that support PMUv3 traps as the 'fast' IPI feature (IPIs
taken as a FIQ) long predates vPMU support.

Applies to 7.4-rc3, tested with various perf record invocations in an L1
KVM guest.

Oliver Upton (4):
  KVM: arm64: Track IRQ and FIQ exceptions separately
  perf kvm stat: Add new 'ARM_EXCEPTION_FIQ' exception type
  KVM: arm64: Let the irqchip provide a fixup for FIQs taken to EL2
  irqchip/apple-aic: Work around FIQ storms upon vPMU counter overflow

 arch/arm64/include/asm/kvm_asm.h              | 12 ++++---
 arch/arm64/kvm/arm.c                          |  5 ++-
 arch/arm64/kvm/handle_exit.c                  |  1 +
 arch/arm64/kvm/hyp/entry.S                    |  6 ++++
 arch/arm64/kvm/hyp/hyp-entry.S                |  6 +++-
 arch/arm64/kvm/hyp/include/hyp/switch.h       |  4 +--
 arch/arm64/kvm/hyp/nvhe/hyp-main.c            |  2 ++
 arch/arm64/kvm/vgic/vgic-init.c               |  6 ++++
 arch/arm64/kvm/vgic/vgic.h                    |  9 +++++
 drivers/irqchip/irq-apple-aic.c               | 33 +++++++++++++++++--
 include/kvm/arm_vgic.h                        |  4 +++
 include/linux/irqchip/arm-vgic-info.h         |  3 ++
 .../kvm-stat-arch/arm64_exception_types.h     |  2 ++
 13 files changed, 83 insertions(+), 10 deletions(-)


base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
-- 
2.47.3



             reply	other threads:[~2026-12-01 20:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 20:44 Oliver Upton [this message]
2026-12-01 20:44 ` [PATCH 1/4] KVM: arm64: Track IRQ and FIQ exceptions separately Oliver Upton
2026-12-01 20:45 ` [PATCH 2/4] perf kvm stat: Add new 'ARM_EXCEPTION_FIQ' exception type Oliver Upton
2026-12-01 20:45 ` [PATCH 3/4] KVM: arm64: Let the irqchip provide a fixup for FIQs taken to EL2 Oliver Upton
2026-12-01 20:45 ` [PATCH 4/4] irqchip/apple-aic: Work around FIQ storms upon vPMU counter overflow Oliver Upton

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=20261201204502.1813335-1-oupton@kernel.org \
    --to=oupton@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=asahi@lists.linux.dev \
    --cc=catalin.marinas@arm.com \
    --cc=fuad.tabba@linux.dev \
    --cc=irogers@google.com \
    --cc=j@jannau.net \
    --cc=james.clark@linaro.org \
    --cc=joey.gouly@arm.com \
    --cc=jolsa@kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=neal@gompa.dev \
    --cc=peterz@infradead.org \
    --cc=radu@rendec.net \
    --cc=seiden@linux.ibm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=sven@kernel.org \
    --cc=tglx@kernel.org \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox