Skip to content

RFC RFCv2: nested AVIC

Maxim Levitsky dri-devel intel-gfx kvm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 RFC Latest10 patches 1 replyIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10KVM: x86: mmu: allow to enable write tracking externallyarch/x86/include/asm/kvm_host.h arch/x86/include/asm/kvm_page_track.h arch/x86/kvm/mmu.h +2 more+25 -130 replies
2/10x86: KVMGT: use kvm_page_track_write_tracking_enablearch/x86/kvm/Kconfig arch/x86/kvm/mmu/mmu.c drivers/gpu/drm/i915/Kconfig +1 more+6 -50 replies
3/10KVM: x86: mmu: add gfn_in_memslot helperinclude/linux/kvm_host.h+9 -10 replies
4/10KVM: x86: mmu: tweak fast path for emulation of access to nested NPT pagesarch/x86/kvm/mmu/mmu.c+2 -21 reply
5/10KVM: x86: lapic: don't allow to change APIC ID when apic acceleration is enabledarch/x86/kvm/lapic.c+23 -50 replies
6/10KVM: x86: SVM: remove avic's broken code that updated APIC IDarch/x86/kvm/svm/avic.c+0 -350 replies
7/10KVM: x86: SVM: move avic state to separate structarch/x86/kvm/svm/avic.c arch/x86/kvm/svm/svm.h+36 -270 replies
8/10KVM: x86: rename .set_apic_access_page_addr to reload_apic_access_pagearch/x86/include/asm/kvm-x86-ops.h arch/x86/include/asm/kvm_host.h arch/x86/kvm/vmx/vmx.c +1 more+9 -100 replies
9/10KVM: nSVM: implement support for nested AVICarch/x86/kvm/svm/avic.c arch/x86/kvm/svm/nested.c arch/x86/kvm/svm/svm.c +3 more+1282 -180 replies
10/10KVM: SVM: allow to avoid not needed updates to is_runningarch/x86/kvm/svm/avic.c arch/x86/kvm/svm/svm.c arch/x86/kvm/svm/svm.h+27 -120 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [RFC PATCH v2 00/10] RFCv2: nested AVIC

This patch series implement everything that is needed to use AMD's AVIC while a nested guest is running including ability of the nested guest to use it, and brings feature parity vs APICv.

Compared to v1 of the series, there are lot of fixes, and refactoring.

This version still use unconditional read-only apic id, which will be addressed in the next version.

For the last patch, which allows to avoid cleaning is_running bit in physid pages as long as it is possible, I measured what would happen in a worst case:

- A malicious guest runs with 2 vCPUs pinned, its first vCPU pounds on ICR sending IPIs to the 2nd vCPU

and 2nd vCPU scheduled out forever and not halted (something that should not happen with Qemu though)

- A normal guest with single vCPU is pinned to run on the same CPU as the 2nd vCPU of the first guest.

The normal guest continued to run, but was observed to run about 40% slower.

Therefore AVIC doorbel is strict by default but if the admin policy is to pin guests and not allow them to share a physical cpu, then strict doorbel can be set to false and that does improves the nested (and not nested as well) AVIC perf futher.

Suggestions, comments are welcome.

Best regards,
Maxim Levitsky

Maxim Levitsky (10):
KVM: x86: mmu: allow to enable write tracking externally
x86: KVMGT: use kvm_page_track_write_tracking_enable
KVM: x86: mmu: add gfn_in_memslot helper
KVM: x86: mmu: tweak fast path for emulation of access to nested NPT
pages
KVM: x86: lapic: don't allow to change APIC ID when apic acceleration
is enabled
KVM: x86: SVM: remove avic's broken code that updated APIC ID
KVM: x86: SVM: move avic state to separate struct
KVM: x86: rename .set_apic_access_page_addr to reload_apic_access_page
KVM: nSVM: implement support for nested AVIC
KVM: SVM: allow to avoid not needed updates to is_running

 arch/x86/include/asm/kvm-x86-ops.h    |   2 +-
 arch/x86/include/asm/kvm_host.h       |   5 +-
 arch/x86/include/asm/kvm_page_track.h |   1 +
 arch/x86/kvm/Kconfig                  |   3 -
 arch/x86/kvm/lapic.c                  |  28 +-
 arch/x86/kvm/mmu.h                    |   8 +-
 arch/x86/kvm/mmu/mmu.c                |  21 +-
 arch/x86/kvm/mmu/page_track.c         |  10 +-
 arch/x86/kvm/svm/avic.c               | 949 ++++++++++++++++++++++++--
 arch/x86/kvm/svm/nested.c             | 131 +++-
 arch/x86/kvm/svm/svm.c                |  31 +-
 arch/x86/kvm/svm/svm.h                | 165 ++++-
 arch/x86/kvm/trace.h                  | 140 +++-
 arch/x86/kvm/vmx/vmx.c                |   8 +-
 arch/x86/kvm/x86.c                    |  17 +-
 drivers/gpu/drm/i915/Kconfig          |   1 -
 drivers/gpu/drm/i915/gvt/kvmgt.c      |   5 +
 include/linux/kvm_host.h              |  10 +-
 18 files changed, 1413 insertions(+), 122 deletions(-)
Signature · 1 line
2.26.3