Re: [PATCH v2] KVM: x86: Clear hardware HLT state when userspace makes a vCPU not-halted
From: Sean Christopherson
Date: Fri Oct 02 2026 - 17:14:41 EST
On Thu, 20 Aug 2026 20:35:12 +0800, Keqiang Duan wrote:
> Force a vCPU out of its hardware-tracked halted state when userspace puts
> the vCPU into any state other than HALTED via KVM_SET_MP_STATE, i.e. clear
> VMCS.GUEST_ACTIVITY_STATE if it says the vCPU is halted. Add an optional
> kvm_x86_ops hook to do the clearing, as SVM has no equivalent VMCB field.
>
> When HLT-exiting is disabled for a VM (KVM_CAP_X86_DISABLE_EXITS with
> KVM_X86_DISABLE_EXITS_HLT, e.g. QEMU's "-overcommit cpu-pm=on"), a guest
> HLT halts the physical CPU instead of exiting to KVM, and hardware saves
> GUEST_ACTIVITY_STATE=HLT into the VMCS on the next VM-Exit. That field is
> sticky: it survives VM-Exit/VM-Enter and is only cleared by vmx_clear_hlt()
> on event injection, or by vmx_vcpu_reset() on INIT / vCPU creation.
>
> [...]
Applied to kvm-x86 vmx, thanks!
[1/1] KVM: x86: Clear hardware HLT state when userspace makes a vCPU not-halted
https://github.com/kvm-x86/linux/commit/883719f57f5d
--
https://github.com/kvm-x86/linux/tree/next