Skip to content

KVM: x86: hyper-v: Conditionally allow SynIC with APICv/AVIC

Vitaly Kuznetsov kvm lkml 3 versions – Applied

Status from this message: Queued, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest4 patches 6 repliesApplied
  2. v25 patches 25 repliesSuperseded
  3. v12 patches 4 repliesSuperseded

Changes in v3 from the cover letter

- First two patches got merged, rebase.
- Use 'enable_apicv = avic = ...' in PATCH1 [Paolo]
- Collect R-b tags for PATCH2 [Sean, Max]
- Use hv_apicv_update_work() to get out of SRCU lock [Max]
- "KVM: x86: Check for pending interrupts when APICv is getting disabled" added.

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/4KVM: x86: Use common 'enable_apicv' variable for both APICv and AVICarch/x86/include/asm/kvm_host.h arch/x86/kvm/svm/avic.c arch/x86/kvm/svm/svm.c +4 more+23 -220 replies
2/4KVM: x86: Drop vendor specific functions for APICv/AVIC enablementarch/x86/include/asm/kvm_host.h arch/x86/kvm/svm/svm.c arch/x86/kvm/vmx/vmx.c +1 more+3 -60 replies
3/4KVM: x86: Check for pending interrupts when APICv is getting disabledarch/x86/kvm/x86.c+9 -00 replies
4/4KVM: x86: hyper-v: Deactivate APICv only when AutoEOI feature is in usearch/x86/include/asm/kvm_host.h arch/x86/kvm/hyperv.c+52 -60 replies

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchSean ChristophersonMaxim Levitsky
1/4
2/4R-b R-b
3/4
4/4

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: x86: hyper-v: Conditionally allow SynIC with APICv/AVIC

Changes since v2:
- First two patches got merged, rebase.
- Use 'enable_apicv = avic = ...' in PATCH1 [Paolo]
- Collect R-b tags for PATCH2 [Sean, Max]
- Use hv_apicv_update_work() to get out of SRCU lock [Max]
- "KVM: x86: Check for pending interrupts when APICv is getting disabled" added.

Original description:

APICV_INHIBIT_REASON_HYPERV is currently unconditionally forced upon SynIC activation as SynIC's AutoEOI is incompatible with APICv/AVIC. It is, however, possible to track whether the feature was actually used by the guest and only inhibit APICv/AVIC when needed.

The series can be tested with the followin hack:

arch/x86/kvm/cpuid.c +7 -0
index 9a48f138832d..65a9974f80d9 100644
@@ -147,6 +147,13 @@ void kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu)
                                           vcpu->arch.ia32_misc_enable_msr &
                                           MSR_IA32_MISC_ENABLE_MWAIT);
        }
+
+       /* Dirty hack: force HV_DEPRECATING_AEOI_RECOMMENDED. Not to be merged! */
+       best = kvm_find_cpuid_entry(vcpu, HYPERV_CPUID_ENLIGHTMENT_INFO, 0);
+       if (best) {
+               best->eax &= ~HV_X64_APIC_ACCESS_RECOMMENDED;
+               best->eax |= HV_DEPRECATING_AEOI_RECOMMENDED;
+       }
 }
 EXPORT_SYMBOL_GPL(kvm_update_cpuid_runtime);
 

Vitaly Kuznetsov (4):
KVM: x86: Use common 'enable_apicv' variable for both APICv and AVIC
KVM: x86: Drop vendor specific functions for APICv/AVIC enablement
KVM: x86: Check for pending interrupts when APICv is getting disabled
KVM: x86: hyper-v: Deactivate APICv only when AutoEOI feature is in
use

 arch/x86/include/asm/kvm_host.h |  9 +++++-
 arch/x86/kvm/hyperv.c           | 51 +++++++++++++++++++++++++++++----
 arch/x86/kvm/svm/avic.c         | 14 ++++-----
 arch/x86/kvm/svm/svm.c          | 22 ++++++++------
 arch/x86/kvm/svm/svm.h          |  2 --
 arch/x86/kvm/vmx/capabilities.h |  1 -
 arch/x86/kvm/vmx/vmx.c          |  2 --
 arch/x86/kvm/x86.c              | 18 ++++++++++--
 8 files changed, 86 insertions(+), 33 deletions(-)
Signature · 1 line
2.31.1