From: Gleb Natapov <gleb@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm-devel <kvm@vger.kernel.org>
Subject: Re: KVM: x86: stop IO emulation cycle if instruction pointer is modified
Date: Sat, 6 Jul 2013 10:41:12 +0300 [thread overview]
Message-ID: <20130706074112.GA26728@redhat.com> (raw)
In-Reply-To: <20130705191654.GA18788@amt.cnet>
On Fri, Jul 05, 2013 at 04:16:55PM -0300, Marcelo Tosatti wrote:
>
> 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.
>
Userspace has to return to the kernel to complete pending IO operation.
This is documented in Documentation/virtual/kvm/api.txt. If this is not
what program does it is a bug. What userspace you see the problem with?
> 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);
>
--
Gleb.
next prev parent reply other threads:[~2013-07-06 7:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-05 19:16 KVM: x86: stop IO emulation cycle if instruction pointer is modified Marcelo Tosatti
2013-07-06 7:41 ` Gleb Natapov [this message]
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=20130706074112.GA26728@redhat.com \
--to=gleb@redhat.com \
--cc=kvm@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 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.