Skip to content

KVM: arm64: Assorted PMU emulation fixes

Marc Zyngier kvm kvmarm linux-arm-kernel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest4 patches 2 repliesIn review
  2. v25 patches 6 repliesSuperseded
  3. v13 patches 5 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4KVM: arm64: pmu: Fix cycle counter truncationvirt/kvm/arm/pmu.c+12 -100 replies
2/4arm64: KVM: Handle PMCR_EL0.LC as RES1 on pure AArch64 systemsarch/arm64/kvm/sys_regs.c+4 -00 replies
3/4KVM: arm64: pmu: Set the CHAINED attribute before creating the in-kernel eventvirt/kvm/arm/pmu.c+3 -31 reply
4/4KVM: arm64: pmu: Reset sample period on overflow handlingvirt/kvm/arm/pmu.c+20 -01 reply

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchAndrew Murray
1/4R-b
2/4R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/4] KVM: arm64: Assorted PMU emulation fixes

I recently came across a number of PMU emulation bugs, all which can result in unexpected behaviours in an unsuspecting guest. The first two patches already have been discussed on the list, but I'm including them here as part of a slightly longer series.

The third patch is new as of v2, and fixes a bug preventing chained events from ever being used.

The last patch fixes an issue that has been here from day one, where we confuse architectural overflow of a counter and perf sampling period, and uses a terrible hack^W^W creative way to interact with the underlying PMU driver so that we can reload the period when handling the overflow.

* From v2 [1]
- Dropped PMUv3 patch and moved the logic into the KVM code
- Properly use UPDATE/RELOAD
- Collected Andrew's RB

[1] https://lore.kernel.org/kvmarm/[email protected]/

Marc Zyngier (4):
KVM: arm64: pmu: Fix cycle counter truncation
arm64: KVM: Handle PMCR_EL0.LC as RES1 on pure AArch64 systems
KVM: arm64: pmu: Set the CHAINED attribute before creating the
in-kernel event
KVM: arm64: pmu: Reset sample period on overflow handling

 arch/arm64/kvm/sys_regs.c |  4 ++++
 virt/kvm/arm/pmu.c        | 48 ++++++++++++++++++++++++++++-----------
 2 files changed, 39 insertions(+), 13 deletions(-)
Signature · 1 line
2.20.1