Skip to content

Commit a488848

Browse files
schnhrrbonzini
authored andcommitted
KVM: VMX: Do not fully reset PI descriptor on vCPU reset
Parts of the posted interrupt descriptor configure host behavior, such as the notification vector and destination. Overwriting them with zero as done during vCPU reset breaks posted interrupts. KVM (re-)writes these fields on certain occasions and belatedly fixes the situation in many cases. However, if you have a guest configured with "idle=poll", for example, the fields might stay zero forever. Do not reset the full descriptor in vmx_vcpu_reset(). Instead, reset only the outstanding notifications and leave everything else untouched. Signed-off-by: Jan H. Schönherr <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 0087552 commit a488848

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arch/x86/kvm/vmx.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5619,8 +5619,10 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
56195619

56205620
kvm_make_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu);
56215621

5622-
if (kvm_vcpu_apicv_active(vcpu))
5623-
memset(&vmx->pi_desc, 0, sizeof(struct pi_desc));
5622+
if (kvm_vcpu_apicv_active(vcpu)) {
5623+
pi_clear_on(&vmx->pi_desc);
5624+
memset(vmx->pi_desc.pir, 0, sizeof(vmx->pi_desc.pir));
5625+
}
56245626

56255627
if (vmx->vpid != 0)
56265628
vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);

0 commit comments

Comments
 (0)