[v2,0/8] KVM: x86: Fix the emulation type mess
mbox series

Message ID 20180823205653.3264-1-sean.j.christopherson@intel.com
Headers show
Series
  • KVM: x86: Fix the emulation type mess
Related show

Message

Sean Christopherson Aug. 23, 2018, 8:56 p.m. UTC
v1 of this series was a simple (on the surface) bug fix for an issue
where a nested guest would get stuck in an infinite loop due to L0
restarting the guest over and over after an emulation failure because
L0 incorrectly thought the emulation failure was due to a page fault
in the guest's domain.

While not wrong, v1 was essentially using duct tape to prop up the
house of cards that is emulation type.  v2 demolishes the house and
builds a nice little fortress in its place.

v2:
  - Fix known issues of EMULTYPE_NO_REEXECUTE not being passed
  - Invert re-execute flag and merge it with EMULTYPE_RETRY
  - Fix the original bug by not retrying nested guests' instructions
  - Unexport x86_emulate_instruction() to reduce the probability of
    introducing similar bugs in the future

Sean Christopherson (8):
  KVM: VMX: Do not allow reexecute_instruction() when skipping MMIO
    instr
  KVM: x86: SVM: Set EMULTYPE_NO_REEXECUTE for RSM emulation
  KVM: x86: Invert emulation re-execute behavior to make it opt-in
  KVM: x86: Merge EMULTYPE_RETRY and EMULTYPE_ALLOW_REEXECUTE
  KVM: x86: Default to not allowing emulation retry in
    kvm_mmu_page_fault
  KVM: x86: Do not re-{try,execute} after failed emulation in L2
  KVM: x86: Rename emulate_instruction() to kvm_emulate_instruction()
  KVM: x86: Unexport x86_emulate_instruction()

 arch/x86/include/asm/kvm_host.h | 19 ++++++-------------
 arch/x86/kvm/mmu.c              | 21 +++++++++++++++------
 arch/x86/kvm/svm.c              | 16 ++++++++--------
 arch/x86/kvm/vmx.c              | 18 +++++++++---------
 arch/x86/kvm/x86.c              | 28 +++++++++++++++++++++++-----
 arch/x86/kvm/x86.h              |  2 ++
 6 files changed, 63 insertions(+), 41 deletions(-)

Comments

Paolo Bonzini Aug. 23, 2018, 9:25 p.m. UTC | #1
On 23/08/2018 22:56, Sean Christopherson wrote:
> v1 of this series was a simple (on the surface) bug fix for an issue
> where a nested guest would get stuck in an infinite loop due to L0
> restarting the guest over and over after an emulation failure because
> L0 incorrectly thought the emulation failure was due to a page fault
> in the guest's domain.
> 
> While not wrong, v1 was essentially using duct tape to prop up the
> house of cards that is emulation type.  v2 demolishes the house and
> builds a nice little fortress in its place.
> 
> v2:
>   - Fix known issues of EMULTYPE_NO_REEXECUTE not being passed
>   - Invert re-execute flag and merge it with EMULTYPE_RETRY
>   - Fix the original bug by not retrying nested guests' instructions
>   - Unexport x86_emulate_instruction() to reduce the probability of
>     introducing similar bugs in the future
> 
> Sean Christopherson (8):
>   KVM: VMX: Do not allow reexecute_instruction() when skipping MMIO
>     instr
>   KVM: x86: SVM: Set EMULTYPE_NO_REEXECUTE for RSM emulation
>   KVM: x86: Invert emulation re-execute behavior to make it opt-in
>   KVM: x86: Merge EMULTYPE_RETRY and EMULTYPE_ALLOW_REEXECUTE
>   KVM: x86: Default to not allowing emulation retry in
>     kvm_mmu_page_fault
>   KVM: x86: Do not re-{try,execute} after failed emulation in L2
>   KVM: x86: Rename emulate_instruction() to kvm_emulate_instruction()
>   KVM: x86: Unexport x86_emulate_instruction()
> 
>  arch/x86/include/asm/kvm_host.h | 19 ++++++-------------
>  arch/x86/kvm/mmu.c              | 21 +++++++++++++++------
>  arch/x86/kvm/svm.c              | 16 ++++++++--------
>  arch/x86/kvm/vmx.c              | 18 +++++++++---------
>  arch/x86/kvm/x86.c              | 28 +++++++++++++++++++++++-----
>  arch/x86/kvm/x86.h              |  2 ++
>  6 files changed, 63 insertions(+), 41 deletions(-)
> 

Looks good.  Patches 1-6 should also be

Cc: stable@vger.kernel.org

Thanks,

Paolo