Re: [PATCH v2 03/11] KVM: nSVM: explicitly raise KVM_REQ_EVENT on nested VM exit if L1 doesn't intercept interrupts

From: Sean Christopherson
Date: Mon Jan 30 2023 - 13:41:47 EST


On Sat, Jan 28, 2023, Sean Christopherson wrote:
> > + * If the L2 doesn't intercept interrupts, then
> > + * (even if the L2 does use virtual interrupt masking),
>
> KVM uses "L2" to refer to the thing running at L2. I think what you are referring
> to here is vmcb12? And that's controlled by L1.
>
> > + * KVM will use the vmcb02's V_INTR to detect interrupt window.
>
> s/the vmcb02/vmcb02
>
> Which of the V_INTR fields does this refer to? Oooh, you're saying the KVM injects
> a virtual interrupt into L2 using vmcb02 in order to determine when L2 has IRQs
> enabled.
>
> Why does KVM do that? Why not pend the actual IRQ directly?

Duh, because KVM needs to gain control in if there are multiple pending events.