public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Ladi Prosek <lprosek@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] KVM: SVM: handle singlestep exception when skipping emulated instructions
Date: Wed, 21 Jun 2017 19:03:03 +0200	[thread overview]
Message-ID: <20170621170302.GB27032@potion> (raw)
In-Reply-To: <20170621165501.GA27032@potion>

2017-06-21 18:55+0200, Radim Krčmář:
> 2017-06-21 15:37+0200, Ladi Prosek:
> > kvm_skip_emulated_instruction handles the singlestep debug exception
> > which is something we almost always want. This commit (specifically
> > the change in rdmsr_interception) makes the debug.flat KVM unit test
> > pass on AMD.
> 
> kvm_skip_emulated_instruction() also has a return value, which says
> whether the debug exception was requested by the userspace or by the
> guest (userspace has priority).
> 
> This patch fixes the guest debugging, but userspace still won't receive
> its events.  I think it would be better to fix both at once,
> 
> > Signed-off-by: Ladi Prosek <lprosek@redhat.com>
> > ---
> > diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> > @@ -2278,7 +2278,7 @@ static int io_interception(struct vcpu_svm *svm)
> >  	port = io_info >> 16;
> >  	size = (io_info & SVM_IOIO_SIZE_MASK) >> SVM_IOIO_SIZE_SHIFT;
> >  	svm->next_rip = svm->vmcb->control.exit_info_2;
> > -	skip_emulated_instruction(&svm->vcpu);
> > +	kvm_skip_emulated_instruction(&svm->vcpu);
> >  
> >  	return in ? kvm_fast_pio_in(vcpu, size, port)
> >  		  : kvm_fast_pio_out(vcpu, size, port);
> 
> i.e.
> 	ret = kvm_skip_emulated_instruction(&svm->vcpu);
> 
> 	return ret && (...);

Nope, the ret has to be checked afterwards ... better look at
handle_io() in vmx.c. :)

  reply	other threads:[~2017-06-21 17:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21 13:37 [PATCH] KVM: SVM: handle singlestep exception when skipping emulated instructions Ladi Prosek
2017-06-21 16:55 ` Radim Krčmář
2017-06-21 17:03   ` Radim Krčmář [this message]
2017-06-21 20:17   ` Ladi Prosek

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=20170621170302.GB27032@potion \
    --to=rkrcmar@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=lprosek@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