>@@ -6873,6 +6873,23 @@ void vmx_hwapic_isr_update(struct kvm_vcpu *vcpu, int max_isr) > u16 status; > u8 old; > >+ /* >+ * If L2 is active, defer the SVI update until vmcs01 is loaded, as SVI >+ * is only relevant for if and only if Virtual Interrupt Delivery is >+ * enabled in vmcs12, and if VID is enabled then L2 EOIs affect L2's >+ * vAPIC, not L1's vAPIC. KVM must update vmcs01 on the next nested >+ * VM-Exit, otherwise L1 with run with a stale SVI. >+ */ >+ if (is_guest_mode(vcpu)) { >+ /* >+ * KVM is supposed to forward intercepted L2 EOIs to L1 if VID >+ * is enabled in vmcs12; as above, the EOIs affect L2's vAPIC. >+ */ >+ WARN_ON_ONCE(nested_cpu_has_vid(get_vmcs12(vcpu))); This function can be called in other scenarios, e.g., from kvm_apic_set_state(). Is it possible for the userspace VMM to set the APIC state while L2 is running and VID is enabled for L2? If so, this warning could be triggered by the userspace VMM. Anyway, I verified this patch can fix the reported issue. So, Tested-by: Chao Gao <chao.gao@xxxxxxxxx> >+ to_vmx(vcpu)->nested.update_vmcs01_hwapic_isr = true; >+ return; >+ } >+ > if (max_isr == -1) > max_isr = 0;