RE: [PATCH RFC] KVM: x86: emulate wait-for-SIPI and SIPI-VMExit
From: Qi, Yadong
Date: Thu Sep 17 2020 - 22:02:00 EST
> On Thu, Sep 17, 2020 at 10:56:18AM +0200, Paolo Bonzini wrote:
> > On 17/09/20 04:25, yadong.qi@xxxxxxxxx wrote:
> > > From: Yadong Qi <yadong.qi@xxxxxxxxx>
> > >
> > > Background: We have a lightweight HV, it needs INIT-VMExit and
> > > SIPI-VMExit to wake-up APs for guests since it do not monitoring the
> > > Local APIC. But currently virtual wait-for-SIPI(WFS) state is not
> > > supported in KVM, so when running on top of KVM, the L1 HV cannot
> > > receive the INIT-VMExit and SIPI-VMExit which cause the L2 guest
> > > cannot wake up the APs.
> > >
> > > This patch is incomplete, it emulated wait-for-SIPI state by halt
> > > the vCPU and emulated SIPI-VMExit to L1 when trapped SIPI signal
> > > from L2. I am posting it RFC to gauge whether or not upstream KVM is
> > > interested in emulating wait-for-SIPI state before investing the
> > > time to finish the full support.
> >
> > Yes, the patch makes sense and is a good addition. What exactly is
> > missing? (Apart from test cases in kvm-unit-tests!)
>
> nested_vmx_run() puts the vCPU into KVM_MP_STATE_HALTED instead of
> properly transitioning to INIT_RECEIVED, e.g. events that arrive while the vCPU
> is supposed to be in WFS will be incorrectly recognized. I suspect there are other
> gotchas lurking, but that's the big one.
Thanks, Paolo and Sean.
We will continue to investigate and submit a formal patch later.
Best Regard
Yadong