[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86 hvm: Do not incorrectly retire an instruction emulation when a



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1254896491 -3600
# Node ID ff079db21e8d49e9e15083d72a8ac6f6e37bc62d
# Parent  10cfcbef68ee8ff7747e0150d93220c2b832cd08
x86 hvm: Do not incorrectly retire an instruction emulation when a
read/write cycle to qemu is dropped due to guest suspend.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/hvm/emulate.c    |    4 ++--
 xen/arch/x86/hvm/hvm.c        |    8 +++++---
 xen/arch/x86/hvm/io.c         |    2 +-
 xen/include/asm-x86/hvm/hvm.h |    2 +-
 4 files changed, 9 insertions(+), 7 deletions(-)

diff -r 10cfcbef68ee -r ff079db21e8d xen/arch/x86/hvm/emulate.c
--- a/xen/arch/x86/hvm/emulate.c        Tue Oct 06 10:11:53 2009 +0100
+++ b/xen/arch/x86/hvm/emulate.c        Wed Oct 07 07:21:31 2009 +0100
@@ -163,8 +163,8 @@ static int hvmemul_do_io(
         curr->arch.hvm_vcpu.io_state = HVMIO_none;
         break;
     case X86EMUL_UNHANDLEABLE:
-        hvm_send_assist_req(curr);
-        rc = (p_data != NULL) ? X86EMUL_RETRY : X86EMUL_OKAY;
+        rc = (!hvm_send_assist_req(curr) || (p_data != NULL)
+              ? X86EMUL_RETRY : X86EMUL_OKAY);
         break;
     default:
         BUG();
diff -r 10cfcbef68ee -r ff079db21e8d xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Tue Oct 06 10:11:53 2009 +0100
+++ b/xen/arch/x86/hvm/hvm.c    Wed Oct 07 07:21:31 2009 +0100
@@ -858,12 +858,12 @@ void hvm_vcpu_down(struct vcpu *v)
     }
 }
 
-void hvm_send_assist_req(struct vcpu *v)
+bool_t hvm_send_assist_req(struct vcpu *v)
 {
     ioreq_t *p;
 
     if ( unlikely(!vcpu_start_shutdown_deferral(v)) )
-        return; /* implicitly bins the i/o operation */
+        return 0; /* implicitly bins the i/o operation */
 
     p = &get_ioreq(v)->vp_ioreq;
     if ( unlikely(p->state != STATE_IOREQ_NONE) )
@@ -871,7 +871,7 @@ void hvm_send_assist_req(struct vcpu *v)
         /* This indicates a bug in the device model. Crash the domain. */
         gdprintk(XENLOG_ERR, "Device model set bad IO state %d.\n", p->state);
         domain_crash(v->domain);
-        return;
+        return 0;
     }
 
     prepare_wait_on_xen_event_channel(v->arch.hvm_vcpu.xen_port);
@@ -882,6 +882,8 @@ void hvm_send_assist_req(struct vcpu *v)
      */
     p->state = STATE_IOREQ_READY;
     notify_via_xen_event_channel(v->arch.hvm_vcpu.xen_port);
+
+    return 1;
 }
 
 void hvm_hlt(unsigned long rflags)
diff -r 10cfcbef68ee -r ff079db21e8d xen/arch/x86/hvm/io.c
--- a/xen/arch/x86/hvm/io.c     Tue Oct 06 10:11:53 2009 +0100
+++ b/xen/arch/x86/hvm/io.c     Wed Oct 07 07:21:31 2009 +0100
@@ -168,7 +168,7 @@ void send_invalidate_req(void)
     p->data = ~0UL; /* flush all */
     p->io_count++;
 
-    hvm_send_assist_req(v);
+    (void)hvm_send_assist_req(v);
 }
 
 int handle_mmio(void)
diff -r 10cfcbef68ee -r ff079db21e8d xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h     Tue Oct 06 10:11:53 2009 +0100
+++ b/xen/include/asm-x86/hvm/hvm.h     Wed Oct 07 07:21:31 2009 +0100
@@ -148,7 +148,7 @@ void hvm_vcpu_cacheattr_destroy(struct v
 void hvm_vcpu_cacheattr_destroy(struct vcpu *v);
 void hvm_vcpu_reset_state(struct vcpu *v, uint16_t cs, uint16_t ip);
 
-void hvm_send_assist_req(struct vcpu *v);
+bool_t hvm_send_assist_req(struct vcpu *v);
 
 void hvm_set_guest_tsc(struct vcpu *v, u64 guest_tsc);
 u64 hvm_get_guest_tsc(struct vcpu *v);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.