Skip to content

KVM: x86: Halt and APICv overhaul

Sean Christopherson kvm linux-iommu lkml 2 versions – Applied

Status from this message: Queued, thanks; patches 24-26 for 5.16 and the rest for 5.17.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest26 patches 23 repliesApplied
  2. v243 patches 97 repliesSuperseded

Changes in v3 from the cover letter

- Rebase to kvm/queue (and drop non-x86 patches as they've been queued).
- Redo AVIC patches, sadly the vcpu_(un)blocking() hooks need to stay.
- Add a patch to fix a missing (docuentation-only) barrier in nested posted interrupt delivery. [Paolo]
- Collect reviews.

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/26KVM: fix avic_set_running for preemptable kernelsarch/x86/kvm/svm/avic.c+9 -70 replies
2/26KVM: nVMX: Ensure vCPU honors event request if posting nested IRQ failsarch/x86/kvm/vmx/vmx.c+19 -00 replies
3/26KVM: VMX: Clean up PI pre/post-block WARNsarch/x86/kvm/vmx/posted_intr.c+23 -120 replies
4/26KVM: VMX: Handle PI wakeup shenanigans during vcpu_put/loadarch/x86/kvm/vmx/posted_intr.c arch/x86/kvm/vmx/posted_intr.h arch/x86/kvm/vmx/vmx.c+70 -930 replies
5/26KVM: Drop unused kvm_vcpu.pre_pcpu fieldinclude/linux/kvm_host.h virt/kvm/kvm_main.c+0 -20 replies
6/26KVM: Move x86 VMX's posted interrupt list_head to vcpu_vmxarch/x86/kvm/vmx/posted_intr.c arch/x86/kvm/vmx/vmx.c arch/x86/kvm/vmx/vmx.h +2 more+25 -230 replies
7/26KVM: VMX: Move preemption timer <=> hrtimer dance to common x86arch/x86/kvm/vmx/vmx.c arch/x86/kvm/x86.c+22 -54 replies
8/26KVM: x86: Unexport LAPIC's switch_to_{hv,sw}_timer() helpersarch/x86/kvm/lapic.c+0 -20 replies
9/26KVM: x86: Remove defunct pre_block/post_block kvm_x86_ops hooksarch/x86/include/asm/kvm-x86-ops.h arch/x86/include/asm/kvm_host.h arch/x86/kvm/vmx/vmx.c +1 more+1 -320 replies
10/26KVM: SVM: Signal AVIC doorbell iff vCPU is in guest modearch/x86/kvm/svm/avic.c+20 -20 replies
11/26KVM: SVM: Don't bother checking for "running" AVIC when kicking for IPIsarch/x86/kvm/svm/avic.c arch/x86/kvm/svm/svm.h+9 -170 replies
12/26KVM: SVM: Remove unnecessary APICv/AVIC update in vCPU unblocking patharch/x86/kvm/svm/avic.c+0 -20 replies
13/26KVM: SVM: Use kvm_vcpu_is_blocking() in AVIC load to handle preemptionarch/x86/kvm/svm/avic.c arch/x86/kvm/svm/svm.c arch/x86/kvm/svm/svm.h+9 -120 replies
14/26KVM: SVM: Skip AVIC and IRTE updates when loading blocking vCPUarch/x86/kvm/svm/avic.c+19 -140 replies
15/26iommu/amd: KVM: SVM: Use pCPU to infer IsRun state for IRTEarch/x86/kvm/svm/avic.c drivers/iommu/amd/iommu.c include/linux/amd-iommu.h+10 -100 replies
16/26KVM: VMX: Don't do full kick when triggering posted interrupt "fails"arch/x86/kvm/vmx/vmx.c arch/x86/kvm/x86.c+7 -60 replies
17/26KVM: VMX: Wake vCPU when delivering posted IRQ even if vCPU == this vCPUarch/x86/kvm/vmx/vmx.c+1 -20 replies
18/26KVM: VMX: Pass desired vector instead of bool for triggering posted IRQarch/x86/kvm/vmx/vmx.c+3 -50 replies
19/26KVM: VMX: Fold fallback path into triggering posted IRQ helperarch/x86/kvm/vmx/vmx.c+10 -80 replies
20/26KVM: VMX: Don't do full kick when handling posted interrupt wakeuparch/x86/kvm/vmx/posted_intr.c+1 -10 replies
21/26KVM: SVM: Drop AVIC's intermediate avic_set_running() helperarch/x86/kvm/svm/avic.c+30 -203 replies
22/26KVM: SVM: Move svm_hardware_setup() and its helpers below svm_x86_opsarch/x86/kvm/svm/svm.c+233 -2330 replies
23/26KVM: SVM: Nullify vcpu_(un)blocking() hooks if AVIC is disabledarch/x86/kvm/svm/avic.c arch/x86/kvm/svm/svm.c arch/x86/kvm/svm/svm.h+9 -60 replies
24/26KVM: x86: Skip APICv update if APICv is disable at the module levelarch/x86/kvm/hyperv.c arch/x86/kvm/x86.c+6 -00 replies
25/26KVM: x86: Drop NULL check on kvm_x86_ops.check_apicv_inhibit_reasonsarch/x86/kvm/x86.c+1 -20 replies
26/26KVM: x86: Unexport __kvm_request_apicv_update()arch/x86/kvm/x86.c+0 -10 replies

Reviews trailers per patch

12 of 26 patches have a Reviewed-by or Acked-by.

PatchMaxim LevitskySean Christopherson
1/26R-b Not-signed-off-by
2/26
3/26
4/26R-b
5/26R-b
6/26R-b
7/26R-b
8/26R-b
9/26R-b
10/26
11/26R-b
12/26
13/26
14/26
15/26
16/26
17/26R-b
18/26R-b
19/26R-b
20/26R-b
21/26
22/26
23/26
24/26
25/26
26/26

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 00/26] KVM: x86: Halt and APICv overhaul

Overhaul and cleanup APIC virtualization (Posted Interrupts on Intel VMX, AVIC on AMD SVM) to streamline things as much as possible, remove a bunch of cruft, and document the lurking gotchas along the way.

Patch 01 is a fix from Paolo that's already been merged but hasn't made its way to kvm/queue. It's included here to avoid a number of conflicts.

Based on kvm/queue, commit 1cf84614b04a ("KVM: x86: Exit to ...")

v3:
- Rebase to kvm/queue (and drop non-x86 patches as they've been queued).
- Redo AVIC patches, sadly the vcpu_(un)blocking() hooks need to stay.
- Add a patch to fix a missing (docuentation-only) barrier in nested posted interrupt delivery. [Paolo]
- Collect reviews.

v2:
- https://lore.kernel.org/all/[email protected]/
- Collect reviews. [Christian, David]
- Add patch to move arm64 WFI functionality out of hooks. [Marc]
- Add RISC-V to the fun.
- Add all the APICv fun.

v1: https://lkml.kernel.org/r/[email protected]

Paolo Bonzini (1):
KVM: fix avic_set_running for preemptable kernels

Sean Christopherson (25):
KVM: nVMX: Ensure vCPU honors event request if posting nested IRQ
fails
KVM: VMX: Clean up PI pre/post-block WARNs
KVM: VMX: Handle PI wakeup shenanigans during vcpu_put/load
KVM: Drop unused kvm_vcpu.pre_pcpu field
KVM: Move x86 VMX's posted interrupt list_head to vcpu_vmx
KVM: VMX: Move preemption timer <=> hrtimer dance to common x86
KVM: x86: Unexport LAPIC's switch_to_{hv,sw}_timer() helpers
KVM: x86: Remove defunct pre_block/post_block kvm_x86_ops hooks
KVM: SVM: Signal AVIC doorbell iff vCPU is in guest mode
KVM: SVM: Don't bother checking for "running" AVIC when kicking for
IPIs
KVM: SVM: Remove unnecessary APICv/AVIC update in vCPU unblocking path
KVM: SVM: Use kvm_vcpu_is_blocking() in AVIC load to handle preemption
KVM: SVM: Skip AVIC and IRTE updates when loading blocking vCPU iommu/amd: KVM: SVM: Use pCPU to infer IsRun state for IRTE
KVM: VMX: Don't do full kick when triggering posted interrupt "fails"
KVM: VMX: Wake vCPU when delivering posted IRQ even if vCPU == this
vCPU
KVM: VMX: Pass desired vector instead of bool for triggering posted
IRQ
KVM: VMX: Fold fallback path into triggering posted IRQ helper
KVM: VMX: Don't do full kick when handling posted interrupt wakeup
KVM: SVM: Drop AVIC's intermediate avic_set_running() helper
KVM: SVM: Move svm_hardware_setup() and its helpers below svm_x86_ops
KVM: SVM: Nullify vcpu_(un)blocking() hooks if AVIC is disabled
KVM: x86: Skip APICv update if APICv is disable at the module level
KVM: x86: Drop NULL check on kvm_x86_ops.check_apicv_inhibit_reasons
KVM: x86: Unexport __kvm_request_apicv_update()

 arch/x86/include/asm/kvm-x86-ops.h |   2 -
 arch/x86/include/asm/kvm_host.h    |  12 -
 arch/x86/kvm/hyperv.c              |   3 +
 arch/x86/kvm/lapic.c               |   2 -
 arch/x86/kvm/svm/avic.c            | 116 ++++---
 arch/x86/kvm/svm/svm.c             | 479 ++++++++++++++---------------
 arch/x86/kvm/svm/svm.h             |  16 +-
 arch/x86/kvm/vmx/posted_intr.c     | 234 +++++++-------
 arch/x86/kvm/vmx/posted_intr.h     |   8 +-
 arch/x86/kvm/vmx/vmx.c             |  66 ++--
 arch/x86/kvm/vmx/vmx.h             |   3 +
 arch/x86/kvm/x86.c                 |  41 ++-
 drivers/iommu/amd/iommu.c          |   6 +-
 include/linux/amd-iommu.h          |   6 +-
 include/linux/kvm_host.h           |   3 -
 virt/kvm/kvm_main.c                |   3 -
 16 files changed, 510 insertions(+), 490 deletions(-)
Signature · 1 line
2.34.1.400.ga245620fadb-goog