From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Maxim Levitsky <mlevitsk@redhat.com>
Cc: kvm@vger.kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Joerg Roedel <joro@8bytes.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org, Jim Mattson <jmattson@google.com>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<x86@kernel.org>
Subject: Re: [PATCH v6 4/4] KVM: nSVM: implement on demand allocation of the nested state
Date: Mon, 28 Sep 2020 22:15:26 -0700 [thread overview]
Message-ID: <20200929051526.GD353@linux.intel.com> (raw)
In-Reply-To: <20200922211025.175547-5-mlevitsk@redhat.com>
On Wed, Sep 23, 2020 at 12:10:25AM +0300, Maxim Levitsky wrote:
> This way we don't waste memory on VMs which don't use nesting
> virtualization even when the host enabled it for them.
>
> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> ---
> arch/x86/kvm/svm/nested.c | 42 ++++++++++++++++++++++++++++++
> arch/x86/kvm/svm/svm.c | 55 ++++++++++++++++++++++-----------------
> arch/x86/kvm/svm/svm.h | 6 +++++
> 3 files changed, 79 insertions(+), 24 deletions(-)
>
> diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
> index 09417f5197410..dd13856818a03 100644
> --- a/arch/x86/kvm/svm/nested.c
> +++ b/arch/x86/kvm/svm/nested.c
> @@ -467,6 +467,9 @@ int nested_svm_vmrun(struct vcpu_svm *svm)
>
> vmcb12 = map.hva;
>
> + if (WARN_ON(!svm->nested.initialized))
Probably should use WARN_ON_ONCE, if this is somehow it, userspace could
easily spam the kernel.
Side topic, do we actually need 'initialized'? Wouldn't checking for a
valid nested.msrpm or nested.hsave suffice?
> + return 1;
> +
> if (!nested_vmcb_checks(svm, vmcb12)) {
> vmcb12->control.exit_code = SVM_EXIT_ERR;
> vmcb12->control.exit_code_hi = 0;
> @@ -684,6 +687,45 @@ int nested_svm_vmexit(struct vcpu_svm *svm)
> return 0;
> }
next prev parent reply other threads:[~2020-09-29 5:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-22 21:10 [PATCH v6 0/4] KVM: nSVM: ondemand nested state allocation Maxim Levitsky
2020-09-22 21:10 ` [PATCH v6 1/4] KVM: x86: xen_hvm_config: cleanup return values Maxim Levitsky
2020-09-22 21:10 ` [PATCH v6 2/4] KVM: x86: report negative values from wrmsr emulation to userspace Maxim Levitsky
2020-10-26 19:40 ` Qian Cai
2020-10-27 20:31 ` Qian Cai
2020-10-28 8:51 ` Maxim Levitsky
2020-09-22 21:10 ` [PATCH v6 3/4] KVM: x86: allow kvm_x86_ops.set_efer to return an error value Maxim Levitsky
2020-09-29 5:12 ` Sean Christopherson
2020-09-22 21:10 ` [PATCH v6 4/4] KVM: nSVM: implement on demand allocation of the nested state Maxim Levitsky
2020-09-29 5:15 ` Sean Christopherson [this message]
2020-09-30 15:35 ` Maxim Levitsky
2020-10-01 0:26 ` Sean Christopherson
2020-09-30 15:36 ` [PATCH v6 0/4] KVM: nSVM: ondemand nested state allocation Maxim Levitsky
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=20200929051526.GD353@linux.intel.com \
--to=sean.j.christopherson@intel.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mlevitsk@redhat.com \
--cc=pbonzini@redhat.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=x86@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.