kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joerg Roedel <joerg.roedel@amd.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Avi Kivity <avi@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 03/10] KVM: SVM: Move nested INTR #vmexit into preemtible code
Date: Thu, 8 Oct 2009 11:12:02 +0200	[thread overview]
Message-ID: <20091008091202.GB14073@amd.com> (raw)
In-Reply-To: <20091007205852.GA7692@amt.cnet>

On Wed, Oct 07, 2009 at 05:58:52PM -0300, Marcelo Tosatti wrote:
> On Wed, Oct 07, 2009 at 04:31:21PM +0200, Joerg Roedel wrote:
> > This patch makes use of the KVM_REQ_VMEXIT to move the
> > emulation of #vmexit(INTR) out of non-preemptible code.
> > 
> > Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
> > ---
> >  arch/x86/kvm/svm.c |   18 ++++++++++++++++--
> >  1 files changed, 16 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> > index b6ce1a9..7015680 100644
> > --- a/arch/x86/kvm/svm.c
> > +++ b/arch/x86/kvm/svm.c
> > @@ -1379,8 +1379,14 @@ static inline int nested_svm_intr(struct vcpu_svm *svm)
> >  
> >  	svm->vmcb->control.exit_code = SVM_EXIT_INTR;
> >  
> > -	if (nested_svm_exit_handled(svm)) {
> > -		nsvm_printk("VMexit -> INTR\n");
> > +	if (svm->nested.intercept & 1ULL) {
> > +		/*
> > +		 * The #vmexit can't be emulated here directly because this
> > +		 * code path runs with irqs and preemtion disabled and a
> > +		 * #vmexit emulation might sleep. Only set the request bit for
> > +		 * the #vmexit here.
> > +		 */
> > +		set_bit(KVM_REQ_VMEXIT, &svm->vcpu.requests);
> >  		return 1;
> >  	}
> 
> What if you keep this internal to SVM? Proceed to svm_vcpu_run and
> return, do the emulation on the exit handler.
> 
> Then there's no need for the request bit (VMX does that, see
> vmx_vcpu_run).

Yeah, right. This would be cleaner code. I will change it.

	Joerg

  reply	other threads:[~2009-10-08  9:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-07 14:31 [PATCH 0/10] KVM: Nested SVM fixes and tracepoint conversion Joerg Roedel
2009-10-07 14:31 ` [PATCH 01/10] KVM: SVM: Notify nested hypervisor of lost event injections Joerg Roedel
2009-10-07 14:31 ` [PATCH 02/10] KVM: X86: Add KVM_REQ_VMEXIT to trigger a nested #vmexit Joerg Roedel
2009-10-07 14:31 ` [PATCH 03/10] KVM: SVM: Move nested INTR #vmexit into preemtible code Joerg Roedel
2009-10-07 20:58   ` Marcelo Tosatti
2009-10-08  9:12     ` Joerg Roedel [this message]
2009-10-07 14:31 ` [PATCH 04/10] KVM: SVM: Add tracepoint for nested vmrun Joerg Roedel
2009-10-07 14:31 ` [PATCH 05/10] KVM: SVM: Add tracepoint for nested #vmexit Joerg Roedel
2009-10-07 14:31 ` [PATCH 06/10] KVM: SVM: Add tracepoint for injected #vmexit Joerg Roedel
2009-10-07 14:31 ` [PATCH 07/10] KVM: SVM: Add tracepoint for #vmexit because intr pending Joerg Roedel
2009-10-07 14:31 ` [PATCH 08/10] KVM: SVM: Add tracepoint for invlpga instruction Joerg Roedel
2009-10-07 14:31 ` [PATCH 09/10] KVM: SVM: Add tracepoint for skinit instruction Joerg Roedel
2009-10-07 14:31 ` [PATCH 10/10] KVM: SVM: Remove nsvm_printk debugging code Joerg Roedel

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=20091008091202.GB14073@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.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).