mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxim Levitsky <mlevitsk@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, kvm@vger.kernel.org
Cc: Sean Christopherson <sean.j.christopherson@intel.com>,
	"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" 
	<linux-kernel@vger.kernel.org>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<x86@kernel.org>, Jim Mattson <jmattson@google.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Joerg Roedel <joro@8bytes.org>,
	Wanpeng Li <wanpengli@tencent.com>
Subject: Re: [PATCH v3 8/8] KVM: nSVM: implement ondemand allocation of the nested state
Date: Sun, 13 Sep 2020 22:57:38 +0300	[thread overview]
Message-ID: <ce09f2e9dd8c7315d847b92064cc4ff0dfae12ac.camel@redhat.com> (raw)
In-Reply-To: <58f9d2c1-0739-5b72-ee21-285474666c58@redhat.com>

On Sat, 2020-09-12 at 18:32 +0200, Paolo Bonzini wrote:
> On 27/08/20 19:11, Maxim Levitsky wrote:
> > +	hsave_page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO);
> > +	if (!hsave_page)
> > +		goto error;
> > +
> 
> I think an error here should be just an internal error userspace exit,
> or a -ENOMEM from KVM_RUN; not a #GP in the guest[1].  However, that's
> difficult to plug into KVM.  Can you instead allocate nested state if
> KVM_SET_CPUID2 sets the SVM bit?  Returning -ENOMEM from KVM_SET_CPUID2
> is more likely to be something that userspace copes with.

This would be a bit sad thing to do, as it would allocate nested state for each
guest where it is enabled in CPUID, which is IMHO already the default or soon to be.

Currently nested KVM is nice to only enable EFER.SVME when a vm is created (in svm_hardware_enable)
which means that with this on demand nested state allocation, we only use nested state
for guests that actually use nested as opposed to be merely enabled.

About injecting the #GP,
I probably can make the guest triple fault instead if we consider this to be better solution.
in terms of not allowing to continue guest execution.
I somehow thought that guest will already be killed on emulation failure,
but now I do see that kvm_emulate_wrmsr and that it injects a #GP

What do you think?

> 
> I queued patches 1-5, and 7 for 5.9-rc.

Thanks!

Best regards,
	Maxim Levitsky

> 
> Paolo
> 
> [1] Though in practice an order 0 allocation will never fail
> 



      reply	other threads:[~2020-09-13 19:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-27 17:11 [PATCH v3 0/8] KVM: nSVM: ondemand nested state allocation + smm fixes Maxim Levitsky
2020-08-27 17:11 ` [PATCH v3 1/8] KVM: SVM: rename a variable in the svm_create_vcpu Maxim Levitsky
2020-08-27 17:11 ` [PATCH v3 2/8] KVM: nSVM: rename nested vmcb to vmcb12 Maxim Levitsky
2020-08-27 17:11 ` [PATCH v3 3/8] KVM: SVM: refactor msr permission bitmap allocation Maxim Levitsky
2020-08-27 17:11 ` [PATCH v3 4/8] KVM: SVM: use __GFP_ZERO instead of clear_page Maxim Levitsky
2020-08-27 17:11 ` [PATCH v3 5/8] KVM: SVM: refactor exit labels in svm_create_vcpu Maxim Levitsky
2020-08-27 17:11 ` [PATCH v3 6/8] KVM: x86: allow kvm_x86_ops.set_efer to return a value Maxim Levitsky
2020-08-27 17:11 ` [PATCH v3 7/8] KVM: emulator: more strict rsm checks Maxim Levitsky
2020-08-27 17:11 ` [PATCH v3 8/8] KVM: nSVM: implement ondemand allocation of the nested state Maxim Levitsky
2020-09-12 16:32   ` Paolo Bonzini
2020-09-13 19:57     ` Maxim Levitsky [this message]

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=ce09f2e9dd8c7315d847b92064cc4ff0dfae12ac.camel@redhat.com \
    --to=mlevitsk@redhat.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=pbonzini@redhat.com \
    --cc=sean.j.christopherson@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®