From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 00/13] KVM: x86: Allow userspace to disable the emulator
Date: Mon, 2 Mar 2020 19:42:31 +0100 [thread overview]
Message-ID: <3ec358a8-859d-9ef1-7392-372d55b28ee4@redhat.com> (raw)
In-Reply-To: <20200218232953.5724-1-sean.j.christopherson@intel.com>
On 19/02/20 00:29, Sean Christopherson wrote:
> 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 (unless there already is a use case?), which
> is why that part is done in its own tiny patch.
>
> 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".
I agree with Vitaly that, if we want this, it should be a KVM_ENABLE_CAP
instead. The first 10 patches are very nice cleanups though so I plan
to apply them (with Vitaly's suggested nits for review) after you answer
the question on patch 10.
Paolo
>
> v2:
> - Rebase to kvm/queue, 2c2787938512 ("KVM: selftests: Stop ...")
>
> 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 | 13 +-
> 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 | 193 +++++++++++++-------
> arch/x86/kvm/x86.h | 12 +-
> 9 files changed, 183 insertions(+), 99 deletions(-)
> rename arch/x86/{include/asm => kvm}/kvm_emulate.h (99%)
>
next prev parent reply other threads:[~2020-03-02 18:42 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-18 23:29 [PATCH v2 00/13] KVM: x86: Allow userspace to disable the emulator Sean Christopherson
2020-02-18 23:29 ` [PATCH v2 01/13] KVM: x86: Refactor I/O emulation helpers to provide vcpu-only variant Sean Christopherson
2020-02-26 15:16 ` Vitaly Kuznetsov
2020-02-18 23:29 ` [PATCH v2 02/13] KVM: x86: Explicitly pass an exception struct to check_intercept Sean Christopherson
2020-02-18 23:29 ` [PATCH v2 03/13] KVM: x86: Move emulation-only helpers to emulate.c Sean Christopherson
2020-02-26 15:23 ` Vitaly Kuznetsov
2020-02-18 23:29 ` [PATCH v2 04/13] KVM: x86: Refactor R/W page helper to take the emulation context Sean Christopherson
2020-02-26 15:24 ` Vitaly Kuznetsov
2020-02-18 23:29 ` [PATCH v2 05/13] KVM: x86: Refactor emulated exception injection to take the emul context Sean Christopherson
2020-02-26 15:25 ` Vitaly Kuznetsov
2020-02-18 23:29 ` [PATCH v2 06/13] KVM: x86: Refactor emulate tracepoint to explicitly take context Sean Christopherson
2020-02-26 17:11 ` Vitaly Kuznetsov
2020-03-03 16:48 ` Sean Christopherson
2020-03-03 17:29 ` Paolo Bonzini
2020-03-03 17:42 ` Sean Christopherson
2020-03-03 17:44 ` Paolo Bonzini
2020-02-18 23:29 ` [PATCH v2 07/13] KVM: x86: Refactor init_emulate_ctxt() " Sean Christopherson
2020-02-26 17:13 ` Vitaly Kuznetsov
2020-02-18 23:29 ` [PATCH v2 08/13] KVM: x86: Dynamically allocate per-vCPU emulation context Sean Christopherson
2020-02-26 17:29 ` Vitaly Kuznetsov
2020-03-03 10:26 ` Paolo Bonzini
2020-03-03 14:57 ` Sean Christopherson
2020-03-03 16:18 ` Vitaly Kuznetsov
2020-03-03 16:52 ` Sean Christopherson
2020-02-18 23:29 ` [PATCH v2 09/13] KVM: x86: Move kvm_emulate.h into KVM's private directory Sean Christopherson
2020-02-26 17:38 ` Vitaly Kuznetsov
2020-03-03 10:27 ` Paolo Bonzini
2020-02-18 23:29 ` [PATCH v2 10/13] KVM: x86: Shrink the usercopy region of the emulation context Sean Christopherson
2020-02-26 17:51 ` Vitaly Kuznetsov
2020-03-02 18:40 ` Paolo Bonzini
2020-03-02 19:19 ` Sean Christopherson
2020-03-02 19:13 ` Sean Christopherson
2020-02-18 23:29 ` [PATCH v2 11/13] KVM: x86: Add helper to "handle" internal emulation error Sean Christopherson
2020-02-26 17:52 ` Vitaly Kuznetsov
2020-02-18 23:29 ` [PATCH v2 12/13] KVM: x86: Add variable to control existence of emulator Sean Christopherson
2020-02-26 18:01 ` Vitaly Kuznetsov
2020-02-18 23:29 ` [PATCH v2 13/13] KVM: x86: Allow userspace to disable the kernel's emulator Sean Christopherson
2020-03-02 18:42 ` Paolo Bonzini [this message]
2020-03-02 20:02 ` [PATCH v2 00/13] KVM: x86: Allow userspace to disable the emulator Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3ec358a8-859d-9ef1-7392-372d55b28ee4@redhat.com \
--to=pbonzini@redhat.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sean.j.christopherson@intel.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).