Re: [PATCH 1/2] KVM: nVMX: Always write vmcs02.GUEST_CR3 during nested VM-Enter

From: Sean Christopherson
Date: Fri Sep 27 2019 - 11:02:21 EST


On Fri, Sep 27, 2019 at 05:44:53PM +0300, Liran Alon wrote:
>
> > On 27 Sep 2019, at 17:27, Sean Christopherson <sean.j.christopherson@xxxxxxxxx> wrote:
> >
> > On Fri, Sep 27, 2019 at 03:06:02AM +0300, Liran Alon wrote:
> >>
> >>> On 27 Sep 2019, at 0:43, Sean Christopherson <sean.j.christopherson@xxxxxxxxx> wrote:
> >>>
> >>> + /*
> >>> + * Immediately write vmcs02.GUEST_CR3. It will be propagated to vmcs12
> >>> + * on nested VM-Exit, which can occur without actually running L2, e.g.
> >>> + * if L2 is entering HLT state, and thus without hitting vmx_set_cr3().
> >>> + */
> >>
> >> If I understand correctly, itâs not exactly if L2 is entering HLT state in
> >> general. (E.g. issue doesnât occur if L2 runs HLT directly which is not
> >> configured to be intercepted by vmcs12). Itâs specifically when L1 enters L2
> >> with a HLT guest-activity-state. I suggest rephrasing comment.
> >
> > I deliberately worded the comment so that it remains valid if there are
> > more conditions in the future that cause KVM to skip running L2. What if
> > I split the difference and make the changelog more explicit, but leave the
> > comment as is?
>
> I think what is confusing in comment is that it seems to also refer to the case
> where L2 directly enters HLT state without L1 intercept. Which isnât related.
> So I would explicitly mention itâs when L1 enters L2 but donât physically enter guest
> with vmcs02 because L2 is in HLT state.

Ah, gotcha, I'll tweak the wording.