Skip to content

KVM: arm64: Fix cross-CPU vcpu pausing

Marc Zyngier kvm kvmarm linux-arm-kernel stable 1 version Applied

Status from this message: Applied to fixes, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 9 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/7KVM: arm64: nv: Move L2->L1 switch on interrupt earlyarch/arm64/kvm/arm.c arch/arm64/kvm/nested.c arch/arm64/kvm/vgic/vgic.c+11 -90 replies
2/7KVM: arm64: Move OUTSIDE_GUEST_MODE publication past context being savedarch/arm64/kvm/arm.c+7 -23 replies
3/7KVM: arm64: Move IN_GUEST_MODE ahead of state being loadedarch/arm64/kvm/arm.c+10 -80 replies
4/7KVM: arm64: Turn vcpu->arch.pause into a counterarch/arm64/include/asm/kvm_host.h arch/arm64/kvm/arm.c+15 -130 replies
5/7KVM: arm64: Add helpers to halt a vCPUarch/arm64/include/asm/kvm_host.h arch/arm64/kvm/arm.c+19 -43 replies
6/7KVM: arm64: vgic: Stop the target vcpu when disabling LPIsarch/arm64/kvm/vgic/vgic-mmio-v3.c+10 -00 replies
7/7KVM: arm64: vgic-its: Stop the VM when handling MOVALLarch/arm64/kvm/vgic/vgic-its.c+11 -00 replies

Reviews trailers per patch

1 of 7 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchFuad Tabba
SeriesR-b T-b
1/7
2/7
3/7
4/7R-b T-b
5/7
6/7
7/7

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

Read the v1 thread

Cover letter [PATCH 0/7] KVM: arm64: Fix cross-CPU vcpu pausing

This series is a follow-up on what I previously posted at [1], and has now grown a few more fixes, and inherited an improvement from Oliver. Some of the fixes have already been merged, so what we have here serves a slightly different goal.

As we are simplifying (and fixing) a bunch of vgic behaviours, it becomes necessary to pause one (or all) vcpu(s) and *reliably* introspect the state of interrupts.

It appears that the current KVM behaviour is remarkably broken:

- OUTSIDE_GUEST_MODE is published too early, before we have resynced the state, making it unreliable

- IN_GUEST_MODE is published too late, once we have already placed volatile state on the CPU (interrupts, for example), and making the in-memory state stale (edge pending bits are a particular sore spot)

- self-generated requests are sometimes posted too late, after we have committed to entering the guest, and are therefore delayed

- the pausing mechanism itself is unreliable, as it has no requirement to be called whilst holding a global lock, and therefore is able to nest, while it is backed by a simple boolean

This series addresses these defects, and builds on top of it to:

- add pausing to a single vcpu in addition to the full VM pausing

- convert LPI disabling and the MOVALL command to vcpu pausing

Patches on top of -rc6, most of them being Cc stable without any qualification (this has been broken for as long as I can remember).

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

Marc Zyngier (6):
KVM: arm64: nv: Move L2->L1 switch on interrupt early
KVM: arm64: Move OUTSIDE_GUEST_MODE publication past context being
saved
KVM: arm64: Move IN_GUEST_MODE ahead of state being loaded
KVM: arm64: Turn vcpu->arch.pause into a counter
KVM: arm64: vgic: Stop the target vcpu when disabling LPIs
KVM: arm64: vgic-its: Stop the VM when handling MOVALL

Oliver Upton (1):
KVM: arm64: Add helpers to halt a vCPU

 arch/arm64/include/asm/kvm_host.h  |  9 ++--
 arch/arm64/kvm/arm.c               | 69 ++++++++++++++++++++----------
 arch/arm64/kvm/nested.c            |  8 ++++
 arch/arm64/kvm/vgic/vgic-its.c     | 11 +++++
 arch/arm64/kvm/vgic/vgic-mmio-v3.c | 10 +++++
 arch/arm64/kvm/vgic/vgic.c         |  8 +---
 6 files changed, 81 insertions(+), 34 deletions(-)
Signature · 1 line
2.47.3