linux_dsm_epyc7002/arch/x86/kvm/vmx
Sean Christopherson f93f7ede08 Revert "KVM: nVMX: Expose RDPMC-exiting only when guest supports PMU"
The RDPMC-exiting control is dependent on the existence of the RDPMC
instruction itself, i.e. is not tied to the "Architectural Performance
Monitoring" feature.  For all intents and purposes, the control exists
on all CPUs with VMX support since RDPMC also exists on all VCPUs with
VMX supported.  Per Intel's SDM:

  The RDPMC instruction was introduced into the IA-32 Architecture in
  the Pentium Pro processor and the Pentium processor with MMX technology.
  The earlier Pentium processors have performance-monitoring counters, but
  they must be read with the RDMSR instruction.

Because RDPMC-exiting always exists, KVM requires the control and refuses
to load if it's not available.  As a result, hiding the PMU from a guest
breaks nested virtualization if the guest attemts to use KVM.

While it's not explicitly stated in the RDPMC pseudocode, the VM-Exit
check for RDPMC-exiting follows standard fault vs. VM-Exit prioritization
for privileged instructions, e.g. occurs after the CPL/CR0.PE/CR4.PCE
checks, but before the counter referenced in ECX is checked for validity.

In other words, the original KVM behavior of injecting a #GP was correct,
and the KVM unit test needs to be adjusted accordingly, e.g. eat the #GP
when the unit test guest (L3 in this case) executes RDPMC without
RDPMC-exiting set in the unit test host (L2).

This reverts commit e51bfdb687.

Fixes: e51bfdb687 ("KVM: nVMX: Expose RDPMC-exiting only when guest supports PMU")
Reported-by: David Hill <hilld@binarystorm.net>
Cc: Saar Amar <saaramar@microsoft.com>
Cc: Mihai Carabas <mihai.carabas@oracle.com>
Cc: Jim Mattson <jmattson@google.com>
Cc: Liran Alon <liran.alon@oracle.com>
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-05-15 23:19:19 +02:00
..
capabilities.h KVM: VMX: Include architectural defs header in capabilities.h 2019-04-30 21:32:21 +02:00
evmcs.c x86/kvm/hyper-v: nested_enable_evmcs() sets vmcs_version incorrectly 2019-01-25 19:11:37 +01:00
evmcs.h x86/kvm/hyper-v: Introduce nested_get_evmcs_version() helper 2018-12-14 17:59:54 +01:00
nested.c KVM: nVMX: Disable intercept for FS/GS base MSRs in vmcs02 when possible 2019-05-15 22:53:44 +02:00
nested.h KVM: nVMX: Move nested code to dedicated files 2018-12-14 17:59:46 +01:00
ops.h KVM: VMX: Move VMX instruction wrappers to a dedicated header file 2018-12-14 17:17:27 +01:00
pmu_intel.c KVM: x86: Add support of clear Trace_ToPA_PMI status 2019-04-30 21:32:14 +02:00
vmcs12.c KVM: nVMX: Move vmcs12 code to dedicated files 2018-12-14 12:34:30 +01:00
vmcs12.h KVM: nVMX: Move vmcs12 code to dedicated files 2018-12-14 12:34:30 +01:00
vmcs_shadow_fields.h
vmcs.h KVM: nVMX: Cache host_rsp on a per-VMCS basis 2019-02-12 13:12:22 +01:00
vmenter.S KVM: VMX: Reorder clearing of registers in the vCPU-run assembly flow 2019-02-20 22:48:18 +01:00
vmx.c Revert "KVM: nVMX: Expose RDPMC-exiting only when guest supports PMU" 2019-05-15 23:19:19 +02:00
vmx.h KVM/nVMX: Use kvm_vcpu_map for accessing the enlightened VMCS 2019-04-30 21:49:40 +02:00