linux-stable/arch/x86/kvm/vmx
Like Xu 75189d1de1 KVM: x86/pmu: Update AMD PMC sample period to fix guest NMI-watchdog
NMI-watchdog is one of the favorite features of kernel developers,
but it does not work in AMD guest even with vPMU enabled and worse,
the system misrepresents this capability via /proc.

This is a PMC emulation error. KVM does not pass the latest valid
value to perf_event in time when guest NMI-watchdog is running, thus
the perf_event corresponding to the watchdog counter will enter the
old state at some point after the first guest NMI injection, forcing
the hardware register PMC0 to be constantly written to 0x800000000001.

Meanwhile, the running counter should accurately reflect its new value
based on the latest coordinated pmc->counter (from vPMC's point of view)
rather than the value written directly by the guest.

Fixes: 168d918f26 ("KVM: x86: Adjust counter sample period after a wrmsr")
Reported-by: Dongli Cao <caodongli@kingsoft.com>
Signed-off-by: Like Xu <likexu@tencent.com>
Reviewed-by: Yanan Wang <wangyanan55@huawei.com>
Tested-by: Yanan Wang <wangyanan55@huawei.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
Message-Id: <20220409015226.38619-1-likexu@tencent.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-04-21 13:16:14 -04:00
..
capabilities.h KVM: VMX: Remove vmcs_config.order 2022-01-26 12:14:58 -05:00
evmcs.c KVM: nVMX: Implement evmcs_field_offset() suitable for handle_vmread() 2022-01-28 07:38:26 -05:00
evmcs.h KVM: nVMX: Allow VMREAD when Enlightened VMCS is in use 2022-01-28 07:38:26 -05:00
nested.c KVM: nVMX: Defer APICv updates while L2 is active until L1 is active 2022-04-21 13:16:12 -04:00
nested.h KVM: nVMX: Refactor PMU refresh to avoid referencing kvm_x86_ops.pmu_ops 2022-02-10 13:47:19 -05:00
pmu_intel.c KVM: x86/pmu: Update AMD PMC sample period to fix guest NMI-watchdog 2022-04-21 13:16:14 -04:00
posted_intr.c KVM: VMX: Rename VMX functions to conform to kvm_x86_ops names 2022-02-10 13:47:20 -05:00
posted_intr.h KVM: VMX: Rename VMX functions to conform to kvm_x86_ops names 2022-02-10 13:47:20 -05:00
sgx.c KVM: x86: SGX must obey the KVM_INTERNAL_ERROR_EMULATION protocol 2021-10-25 06:48:25 -04:00
sgx.h KVM: VMX: Enable SGX virtualization for SGX1, SGX2 and LC 2021-04-20 04:18:56 -04:00
vmcs.h kvm: x86: Intercept #NM for saving IA32_XFD_ERR 2022-01-14 13:44:18 -05:00
vmcs12.c KVM: nVMX: Rename vmcs_to_field_offset{,_table} 2022-01-28 07:38:26 -05:00
vmcs12.h KVM: nVMX: Rename vmcs_to_field_offset{,_table} 2022-01-28 07:38:26 -05:00
vmcs_shadow_fields.h KVM: Fix some out-dated function names in comment 2020-01-21 13:57:27 +01:00
vmenter.S x86: Prepare asm files for straight-line-speculation 2021-12-08 12:25:37 +01:00
vmx.c KVM: nVMX: Defer APICv updates while L2 is active until L1 is active 2022-04-21 13:16:12 -04:00
vmx.h KVM: nVMX: Defer APICv updates while L2 is active until L1 is active 2022-04-21 13:16:12 -04:00
vmx_ops.h RISCV: 2022-01-16 16:15:14 +02:00