Re: [PATCH] KVM: x86: move LAPIC initialization after VMCS creation

From: Paolo Bonzini
Date: Fri Feb 23 2018 - 19:43:10 EST


On 24/02/2018 01:39, Liran Alon wrote:
> I agree with the bug and the fix.
> It makes sense to reset LAPIC in the same place other components are reset
> rather than in it's creation.
>
> However, I failed to understand why you mention it fixes commit:
> 851c1a18c541 ("KVM: nVMX: Fix injection to L2 when L1 don't intercept external-interrupts")
>
> Before and after that commit, vmx_hwapic_irr_update() did exactly the same
> because is_guest_mode(vcpu)==false at this point.
> Therefore, vmx_hwapic_irr_update() has always just called vmx_set_rvi()
> which has not changed in that commit.
>
> It seems to me that the commit which introduced this issue is actually:
> 4191db26b714 ("KVM: x86: Update APICv on APIC reset")
>
> What am I missing?

No, you're right. But then I'm not sure why I'm only seeing the issue
now, and not with 4.15 kernels.

Paolo