Re: [RFC 1/2] KVM/nVMX: Cleanly exit from L2 to L1 on user-space exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16/02/2018 15:23, KarimAllah Ahmed wrote:
> On exit to L0 user-space, always exit from L2 to L1 and synchronize the
> state properly for L1. This ensures that user-space only ever sees L1
> state. It also allows L1 to be saved and resumed properly. Obviously
> horrible things will still happen to the L2 guest. This will be handled in
> a seperate patch.
> 
> There is only a single case which requires a bit of extra care. When the
> decision to switch to user space happens while handling an L1
> VMRESUME/VMLAUNCH (i.e. pending_nested_run). In order to handle this
> as cleanly as possible without major restructuring, we simply do not exit
> to user-space in this case and give L2 another chance to actually run. We
> also request an immediate exit to ensure that an exit to user space will
> still happen for the L2.
> 
> The only reason I can see where an exit to user space will occur while L2
> is running is because of a pending signal. The is how user space preempts
> the KVM_RUN in order to save the state. L2 exits are either handled in L0
> kernel or reflected to L1 and not handled in L0 user-space.
> 
> Signed-off-by: KarimAllah Ahmed <karahmed@xxxxxxxxx>

We discussed this with Jim about one year ago and then again last
January.  While I (in 2017) and David H. (in 2018) also thought about
doing an L2->L1 exit like this, Jim quickly got me to change my
mind---it doesn't really seem like a good idea compared to doing full
checkpointing of VMX state.  You can find the discussion at
https://patchwork.kernel.org/patch/9454799/.

Of course, Jim's series (first posted Nov 2016) is way more complex than
yours, but the good news is that most of his changes have already been
merged; the only ones missing are:

https://patchwork.kernel.org/patch/9454799/
 [7/8] kvm: nVMX: Introduce KVM_CAP_VMX_STATE

https://patchwork.kernel.org/patch/9454797/
 [8/8] kvm: nVMX: Defer gpa->hpa lookups for set_vmx_state

The main request was to make [7/8] a bit more generic so that it can be
applied to SVM as well.  That's pretty simple though.

Thanks,

Paolo



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux