linux/arch/x86/kvm/vmx
Like Xu 6a08083f29 KVM: x86/pmu: Disable vPMU if the minimum num of counters isn't met
Disable PMU support when running on AMD and perf reports fewer than four
general purpose counters. All AMD PMUs must define at least four counters
due to AMD's legacy architecture hardcoding the number of counters
without providing a way to enumerate the number of counters to software,
e.g. from AMD's APM:

 The legacy architecture defines four performance counters (PerfCtrn)
 and corresponding event-select registers (PerfEvtSeln).

Virtualizing fewer than four counters can lead to guest instability as
software expects four counters to be available. Rather than bleed AMD
details into the common code, just define a const unsigned int and
provide a convenient location to document why Intel and AMD have different
mins (in particular, AMD's lack of any way to enumerate less than four
counters to the guest).

Keep the minimum number of counters at Intel at one, even though old P6
and Core Solo/Duo processor effectively require a minimum of two counters.
KVM can, and more importantly has up until this point, supported a vPMU so
long as the CPU has at least one counter.  Perf's support for P6/Core CPUs
does require two counters, but perf will happily chug along with a single
counter when running on a modern CPU.

Cc: Jim Mattson <jmattson@google.com>
Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Like Xu <likexu@tencent.com>
[sean: set Intel min to '1', not '2']
Link: https://lore.kernel.org/r/20230603011058.1038821-8-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
2023-06-06 17:31:44 -07:00
..
capabilities.h KVM: VMX: Make VMCS configuration/capabilities structs read-only after init 2022-12-29 15:41:25 -05:00
hyperv.c KVM: VMX: Rename "KVM is using eVMCS" static key to match its wrapper 2023-03-14 10:28:58 -04:00
hyperv.h KVM: VMX: Rename "KVM is using eVMCS" static key to match its wrapper 2023-03-14 10:28:58 -04:00
nested.c KVM: x86/pmu: Move handling PERF_GLOBAL_CTRL and friends to common x86 2023-06-06 17:31:44 -07:00
nested.h KVM: nVMX: Reword comments about generating nested CR0/4 read shadows 2022-11-30 16:27:17 -08:00
pmu_intel.c KVM: x86/pmu: Disable vPMU if the minimum num of counters isn't met 2023-06-06 17:31:44 -07:00
posted_intr.c KVM: x86: Unify pr_fmt to use module name for all KVM modules 2022-12-29 15:47:35 -05:00
posted_intr.h KVM: VMX: enable IPI virtualization 2022-06-08 04:47:37 -04:00
run_flags.h KVM: VMX: Prevent guest RSB poisoning attacks with eIBRS 2022-06-27 10:34:00 +02:00
sgx.c KVM: VMX: Don't rely _only_ on CPUID to enforce XCR0 restrictions for ECREATE 2023-05-21 04:05:51 -04:00
sgx.h KVM: VMX: Enable SGX virtualization for SGX1, SGX2 and LC 2021-04-20 04:18:56 -04:00
vmcs12.c KVM: x86: Unify pr_fmt to use module name for all KVM modules 2022-12-29 15:47:35 -05:00
vmcs12.h bug: introduce ASSERT_STRUCT_OFFSET 2022-11-09 12:31:16 -05:00
vmcs_shadow_fields.h
vmcs.h KVM: VMX: Handle NMI VM-Exits in noinstr region 2023-01-24 10:36:41 -08:00
vmenter.S KVM: VMX: Use tabs instead of spaces for indentation 2023-03-14 09:40:55 -04:00
vmx_ops.h KVM: VMX: Stub out enable_evmcs static key for CONFIG_HYPERV=n 2023-03-14 10:28:57 -04:00
vmx.c KVM VMX changes for 6.4: 2023-04-26 15:56:51 -04:00
vmx.h KVM: x86/pmu: Move handling PERF_GLOBAL_CTRL and friends to common x86 2023-06-06 17:31:44 -07:00