Skip to content

KVM: SVM: Fix IRQ window inhibit handling

Sean Christopherson kvm lkml 1 version Applied

Status from this message: Applied to kvm-x86 svm, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest4 patches 1 replyApplied

Changes in v2 from the cover letter

- Formalize the SoB chains (thanks Naveen!)
- Explicitly isolate the write-mostly fields with ____cacheline_aligned.
- Add Naveen's Tested-by tags.

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/4KVM: SVM: Fix clearing IRQ window inhibit with nested guestsarch/x86/kvm/svm/svm.c+14 -140 replies
2/4KVM: SVM: Fix IRQ window inhibit handling across multiple vCPUsarch/x86/include/asm/kvm_host.h arch/x86/kvm/svm/svm.c arch/x86/kvm/svm/svm.h +1 more+63 -120 replies
3/4KVM: SVM: Optimize IRQ window inhibit handlingarch/x86/kvm/x86.c+25 -10 replies
4/4KVM: Isolate apicv_update_lock and apicv_nr_irq_window_req in a cachelinearch/x86/include/asm/kvm_host.h+11 -10 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by.

PatchNaveen N Rao (AMD)
1/4T-b
2/4T-b
3/4T-b
4/4T-b

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

Read the v2 thread

Cover letter [PATCH v2 0/4] KVM: SVM: Fix IRQ window inhibit handling

Patch 1 fixes a bugs where KVM will keep AVIC inhibit for too long when running a nested guest and AVIC is inhibited to open an IRQ window.

Patch 2 refcounts IRQ window inhibits so that "closing" an IRQ window on one vCPU doesn't clobber other vCPUs' windows when AVIC is enabled.

Patch 3 optimizes IRQ window inhibits by avoiding contention on apicv_update_lock when KVM wants to inhibit AVIC to open an IRQ windows because AVIC is _already_ inhibited.

Patch 4 further optimizes IRQ window inhibits by isolating the refcount and the lock in their own cacheline, e.g. to avoid false sharing and cache line contention with things like apicv_inhibit_reasons, which is read on every VM-Enter.

v2:
- Formalize the SoB chains (thanks Naveen!)
- Explicitly isolate the write-mostly fields with ____cacheline_aligned.
- Add Naveen's Tested-by tags.

v1 / RFC: https://lore.kernel.org/all/[email protected]

Original: https://lore.kernel.org/all/[email protected]

Sean Christopherson (4):
KVM: SVM: Fix clearing IRQ window inhibit with nested guests
KVM: SVM: Fix IRQ window inhibit handling across multiple vCPUs
KVM: SVM: Optimize IRQ window inhibit handling
KVM: Isolate apicv_update_lock and apicv_nr_irq_window_req in a
cacheline

 arch/x86/include/asm/kvm_host.h | 29 +++++++++++++++-
 arch/x86/kvm/svm/svm.c          | 60 ++++++++++++++++++++-------------
 arch/x86/kvm/svm/svm.h          |  1 +
 arch/x86/kvm/x86.c              | 45 ++++++++++++++++++++++++-
 4 files changed, 110 insertions(+), 25 deletions(-)

base-commit: e81f7c908e1664233974b9f20beead78cde6343a

Signature · 1 line
2.52.0.457.g6b5491de43-goog