From: Greg KH <gregkh-l3A5Bk7waGM@public.gmane.org>
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
stable-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Cc: Theodore Ts'o <tytso-3s7WtUTddSA@public.gmane.org>,
Zwane Mwaikambo <zwane-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
Justin Forbes <jmforbes-a5Mqy2EUIFVAfugRpC6u6w@public.gmane.org>,
Domenico Andreoli
<cavokz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Chris Wedgwood <reviews-vFB7bnJMxjixIvdkapsUdQ@public.gmane.org>,
Randy Dunlap <rdunlap-/UHa2rfvQTnk1uMJSBkQmQ@public.gmane.org>,
Michael Krufky <mkrufky-dJidKbW2IEtAfugRpC6u6w@public.gmane.org>,
Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>,
Chuck Ebbert <cebbert-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Dave Jones <davej-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Chuck Wolber <chuckw-lrwSPXAIdEw7YuNMryXyOw@public.gmane.org>,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org,
torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org,
alan-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org
Subject: [patch 24/60] KVM: Skip pio instruction when it is emulated, not executed
Date: Wed, 12 Dec 2007 22:52:09 -0800 [thread overview]
Message-ID: <20071213065209.GY6867@kroah.com> (raw)
In-Reply-To: <20071213065039.GA6867-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
[-- Attachment #1: kvm-skip-pio-instruction-when-it-is-emulated-not-executed.patch --]
[-- Type: text/plain, Size: 1967 bytes --]
2.6.23-stable review patch. If anyone has any objections, please let us
know.
------------------
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
patch 0967b7bf1c22b55777aba46ff616547feed0b141 in mainline.
If we defer updating rip until pio instructions are executed, we have a
problem with reset: a pio reset updates rip, and when the instruction
completes we skip the emulated instruction, pointing rip somewhere completely
unrelated.
Fix by updating rip when we see decode the instruction, not after emulation.
Signed-off-by: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Signed-off-by: Greg Kroah-Hartman <gregkh-l3A5Bk7waGM@public.gmane.org>
---
drivers/kvm/kvm_main.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1757,8 +1757,6 @@ static int complete_pio(struct kvm_vcpu
io->count -= io->cur_count;
io->cur_count = 0;
- if (!io->count)
- kvm_arch_ops->skip_emulated_instruction(vcpu);
return 0;
}
@@ -1804,6 +1802,7 @@ int kvm_setup_pio(struct kvm_vcpu *vcpu,
pio_dev = vcpu_find_pio_dev(vcpu, port);
if (!string) {
+ kvm_arch_ops->skip_emulated_instruction(vcpu);
kvm_arch_ops->cache_regs(vcpu);
memcpy(vcpu->pio_data, &vcpu->regs[VCPU_REGS_RAX], 4);
kvm_arch_ops->decache_regs(vcpu);
@@ -1850,6 +1849,9 @@ int kvm_setup_pio(struct kvm_vcpu *vcpu,
vcpu->run->io.count = now;
vcpu->pio.cur_count = now;
+ if (now == count)
+ kvm_arch_ops->skip_emulated_instruction(vcpu);
+
for (i = 0; i < nr_pages; ++i) {
spin_lock(&vcpu->kvm->lock);
page = gva_to_page(vcpu, address + i * PAGE_SIZE);
--
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
next prev parent reply other threads:[~2007-12-13 6:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20071213064518.328162328@mini.kroah.org>
[not found] ` <20071213065039.GA6867-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2007-12-13 6:51 ` [patch 17/60] KVM: x86 emulator: implement movnti mem, reg Greg KH
2007-12-13 6:51 ` [patch 18/60] KVM: x86 emulator: fix access registers for instructions with ModR/M byte and Mod = 3 Greg KH
2007-12-13 6:51 ` [patch 19/60] KVM: x86 emulator: invd instruction Greg KH
2007-12-13 6:51 ` [patch 20/60] KVM: SVM: Intercept the invd and wbinvd instructions Greg KH
2007-12-13 6:52 ` Greg KH [this message]
2007-12-13 6:52 ` [patch 26/60] KVM: VMX: Reset mmu context when entering real mode Greg KH
[not found] ` <20071213065039.GA6867@kroah.com>
2007-12-13 6:52 ` [patch 21/60] KVM: x86 emulator: Use emulator_write_emulated and not emulator_write_std Greg KH
2007-12-13 6:52 ` [patch 22/60] KVM: Fix hang on uniprocessor Greg KH
2007-12-13 6:52 ` [patch 23/60] KVM: SVM: Fix FPU leak while emulating clts Greg KH
2007-12-13 6:52 ` [patch 25/60] KVM: VMX: Force vm86 mode if setting flags during real mode Greg KH
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=20071213065209.GY6867@kroah.com \
--to=gregkh-l3a5bk7wagm@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=alan-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org \
--cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
--cc=cavokz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=cebbert-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=chuckw-lrwSPXAIdEw7YuNMryXyOw@public.gmane.org \
--cc=davej-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=jmforbes-a5Mqy2EUIFVAfugRpC6u6w@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mkrufky-dJidKbW2IEtAfugRpC6u6w@public.gmane.org \
--cc=rdunlap-/UHa2rfvQTnk1uMJSBkQmQ@public.gmane.org \
--cc=reviews-vFB7bnJMxjixIvdkapsUdQ@public.gmane.org \
--cc=stable-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=tytso-3s7WtUTddSA@public.gmane.org \
--cc=zwane-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.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