[RHEL7,COMMIT] ms/KVM: x86: Add module parameter for supporting VMware backdoor

Submitted by Konstantin Khorenko on May 8, 2018, 9:26 a.m.

Details

Message ID 201805080926.w489QMai001296@finist_ce7.work
State New
Series "ms/KVM: x86: Add module parameter for supporting VMware backdoor"
Headers show

Commit Message

Konstantin Khorenko May 8, 2018, 9:26 a.m.
The commit is pushed to "branch-rh7-3.10.0-693.21.1.vz7.47.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.21.1.vz7.47.5
------>
commit 9c519da8307a09639073284cab9dfb42e017323a
Author: Liran Alon <liran.alon@oracle.com>
Date:   Tue May 8 12:26:22 2018 +0300

    ms/KVM: x86: Add module parameter for supporting VMware backdoor
    
    Support access to VMware backdoor requires KVM to intercept #GP
    exceptions from guest which introduce slight performance hit.
    Therefore, control this support by module parameter.
    
    Note that module parameter is exported as it should be consumed by
    kvm_intel & kvm_amd to determine if they should intercept #GP or not.
    
    This commit doesn't change semantics.
    It is done as a preparation for future commits.
    
    Signed-off-by: Liran Alon <liran.alon@oracle.com>
    Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
    Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    
    (cherry picked from commit c4ae60e4bbf8f5fd4929d2c98543d9c163cb336b)
    Signed-off-by: Jan Dakinevich <jan.dakinevich@virtuozzo.com>
    
    ==============================================================
    Patchset description:
    KVM: x86: Add support for VMware backdoor I/O ports & Pseduo-PMCs
    
    Original discussion is here:
    
    https://www.spinics.net/lists/kvm/msg165799.html
    
    This backport was done mostly for satisfying of some KVM tests (PSBM-84046).
    Please, make your own decision if these changes should be applied, or not.
    
    Arbel Moshe (1):
      KVM: x86: Add support for VMware backdoor Pseudo-PMCs
    
    Liran Alon (6):
      KVM: x86: Add module parameter for supporting VMware backdoor
      KVM: x86: Always allow access to VMware backdoor I/O ports
      KVM: x86: Add emulation_type to not raise #UD on emulation failure
      KVM: x86: Emulate only IN/OUT instructions when accessing VMware
        backdoor
      KVM: x86: VMX: Intercept #GP to support access to VMware backdoor
        ports
      KVM: x86: SVM: Intercept #GP to support access to VMware backdoor
        ports
    
    https://jira.sw.ru/browse/PSBM-84046
---
 Documentation/kernel-parameters.txt | 3 +++
 arch/x86/kvm/x86.c                  | 4 ++++
 arch/x86/kvm/x86.h                  | 2 ++
 3 files changed, 9 insertions(+)

Patch hide | download patch | download mbox

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index a221c1b21e90..356914298b00 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1484,6 +1484,9 @@  bytes respectively. Such letter suffixes can also be entirely omitted.
 	kvm.ignore_msrs=[KVM] Ignore guest accesses to unhandled MSRs.
 			Default is 0 (don't ignore, but inject #GP)
 
+	kvm.enable_vmware_backdoor=[KVM] Support VMware backdoor PV interface.
+				   Default is false (don't support).
+
 	kvm.mmu_audit=	[KVM] This is a R/W parameter which allows audit
 			KVM MMU at runtime.
 			Default is 0 (off)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 24e84a4809af..d59f8a872a58 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -134,6 +134,10 @@  module_param(vector_hashing, bool, S_IRUGO);
 
 static bool __read_mostly backwards_tsc_observed = false;
 
+bool __read_mostly enable_vmware_backdoor = false;
+module_param(enable_vmware_backdoor, bool, S_IRUGO);
+EXPORT_SYMBOL_GPL(enable_vmware_backdoor);
+
 #define KVM_NR_SHARED_MSRS 16
 
 struct kvm_shared_msrs_global {
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index 079a9b170ae4..2de3695ee1a0 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -189,6 +189,8 @@  extern unsigned int min_timer_period_us;
 
 extern unsigned int lapic_timer_advance_ns;
 
+extern bool enable_vmware_backdoor;
+
 extern struct static_key kvm_no_apic_vcpu;
 
 static inline u64 nsec_to_cycles(struct kvm_vcpu *vcpu, u64 nsec)