linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/13] KVM: x86: Allow userspace to disable the emulator
@ 2019-11-22 22:39 Sean Christopherson
  2019-11-22 22:39 ` [PATCH 01/13] KVM: x86: Refactor I/O emulation helpers to provide vcpu-only variant Sean Christopherson
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: Sean Christopherson @ 2019-11-22 22:39 UTC (permalink / raw)
  To: Paolo Bonzini, Radim Krčmář
  Cc: Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, kvm, linux-kernel

The primary intent of this series is to dynamically allocate the emulator
and get KVM to a state where the emulator *could* be disabled at some
point in the future.  Actually allowing userspace to disable the emulator
was a minor change at that point, so I threw it in.

Dynamically allocating the emulator shrinks the size of x86 vcpus by
~2.5k bytes, which is important because 'struct vcpu_vmx' has once again
fattened up and squeaked past the PAGE_ALLOC_COSTLY_ORDER threshold.
Moving the emulator to its own allocation gives us some breathing room
for the near future, and has some other nice side effects.

As for disabling the emulator... in the not-too-distant future, I expect
there will be use cases that can truly disable KVM's emulator, e.g. for
security (KVM's and/or the guests).  I don't have a strong opinion on
whether or not KVM should actually allow userspace to disable the emulator
without a concrete use case, which is why that part is done in its own
tiny patch.  I also expect that any real use case would want "no emulator"
to be a per-VM toggle, but since this is basically an experimental feature
I added it as a module param.

Running without an emulator has been "tested" in the sense that the
selftests that don't require emulation continue to pass, and everything
else fails with the expected "emulation error".

Sean Christopherson (13):
  KVM: x86: Refactor I/O emulation helpers to provide vcpu-only variant
  KVM: x86: Explicitly pass an exception struct to check_intercept
  KVM: x86: Move emulation-only helpers to emulate.c
  KVM: x86: Refactor R/W page helper to take the emulation context
  KVM: x86: Refactor emulated exception injection to take the emul
    context
  KVM: x86: Refactor emulate tracepoint to explicitly take context
  KVM: x86: Refactor init_emulate_ctxt() to explicitly take context
  KVM: x86: Dynamically allocate per-vCPU emulation context
  KVM: x86: Move kvm_emulate.h into KVM's private directory
  KVM: x86: Shrink the usercopy region of the emulation context
  KVM: x86: Add helper to "handle" internal emulation error
  KVM: x86: Add variable to control existence of emulator
  KVM: x86: Allow userspace to disable the kernel's emulator

 arch/x86/include/asm/kvm_host.h             |  12 +-
 arch/x86/kvm/emulate.c                      |  17 +-
 arch/x86/{include/asm => kvm}/kvm_emulate.h |   9 +-
 arch/x86/kvm/mmu/mmu.c                      |   1 +
 arch/x86/kvm/svm.c                          |   5 +-
 arch/x86/kvm/trace.h                        |  22 +--
 arch/x86/kvm/vmx/vmx.c                      |  15 +-
 arch/x86/kvm/x86.c                          | 194 ++++++++++++++------
 arch/x86/kvm/x86.h                          |  16 +-
 9 files changed, 189 insertions(+), 102 deletions(-)
 rename arch/x86/{include/asm => kvm}/kvm_emulate.h (99%)

-- 
2.24.0


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-11-22 22:41 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-22 22:39 [PATCH 00/13] KVM: x86: Allow userspace to disable the emulator Sean Christopherson
2019-11-22 22:39 ` [PATCH 01/13] KVM: x86: Refactor I/O emulation helpers to provide vcpu-only variant Sean Christopherson
2019-11-22 22:39 ` [PATCH 02/13] KVM: x86: Explicitly pass an exception struct to check_intercept Sean Christopherson
2019-11-22 22:39 ` [PATCH 03/13] KVM: x86: Move emulation-only helpers to emulate.c Sean Christopherson
2019-11-22 22:39 ` [PATCH 04/13] KVM: x86: Refactor R/W page helper to take the emulation context Sean Christopherson
2019-11-22 22:39 ` [PATCH 05/13] KVM: x86: Refactor emulated exception injection to take the emul context Sean Christopherson
2019-11-22 22:39 ` [PATCH 06/13] KVM: x86: Refactor emulate tracepoint to explicitly take context Sean Christopherson
2019-11-22 22:39 ` [PATCH 07/13] KVM: x86: Refactor init_emulate_ctxt() " Sean Christopherson
2019-11-22 22:39 ` [PATCH 08/13] KVM: x86: Dynamically allocate per-vCPU emulation context Sean Christopherson
2019-11-22 22:39 ` [PATCH 09/13] KVM: x86: Move kvm_emulate.h into KVM's private directory Sean Christopherson
2019-11-22 22:39 ` [PATCH 10/13] KVM: x86: Shrink the usercopy region of the emulation context Sean Christopherson
2019-11-22 22:39 ` [PATCH 11/13] KVM: x86: Add helper to "handle" internal emulation error Sean Christopherson
2019-11-22 22:39 ` [PATCH 12/13] KVM: x86: Add variable to control existence of emulator Sean Christopherson
2019-11-22 22:39 ` [PATCH 13/13] KVM: x86: Allow userspace to disable the kernel's emulator Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).