public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: kvm-devel <kvm@vger.kernel.org>
Cc: Gleb Natapov <gleb@redhat.com>
Subject: KVM: x86: stop IO emulation cycle if instruction pointer is modified
Date: Fri, 5 Jul 2013 16:16:55 -0300	[thread overview]
Message-ID: <20130705191654.GA18788@amt.cnet> (raw)


MMIO/PIO emulation should be interrupted if the system is restarted.
Otherwise in progress IO emulation continues at the instruction pointer,
even after vcpus' IP has been modified by KVM_SET_REGS.

Use IP change as an indicator to reset MMIO/PIO emulation state.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index e8ba99c..9f7ce41 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6144,6 +6144,10 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
 	kvm_register_write(vcpu, VCPU_REGS_R15, regs->r15);
 #endif
 
+	/* stop IO emulation cycle if RIP changes */
+	if (kvm_rip_read(vcpu) != regs->rip)
+		vcpu->arch.complete_userspace_io = NULL;
+
 	kvm_rip_write(vcpu, regs->rip);
 	kvm_set_rflags(vcpu, regs->rflags);
 

             reply	other threads:[~2013-07-05 19:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-05 19:16 Marcelo Tosatti [this message]
2013-07-06  7:41 ` KVM: x86: stop IO emulation cycle if instruction pointer is modified Gleb Natapov
2013-07-08 21:16   ` Marcelo Tosatti

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=20130705191654.GA18788@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.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