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

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



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1255679422 -3600
# Node ID 3eb0e91ae80458b2c80167e40a3022ae2c3f1804
# Parent  1479bbe465993e47ee3f9b390a3f46c120a2aa20
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-unstable changeset:   20274:ff079db21e8d
xen-unstable date:        Wed Oct 07 07:21:31 2009 +0100

x86 hvm: On failed hvm_send_assist_req(), io emulation state should be
reset to HVMIO_none, as no IO is in flight.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
xen-unstable changeset:   20286:440d22c01652
xen-unstable date:        Wed Oct 07 08:07:06 2009 +0100
---
 xen/arch/x86/hvm/emulate.c    |    7 +++++--
 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, 12 insertions(+), 7 deletions(-)

diff -r 1479bbe46599 -r 3eb0e91ae804 xen/arch/x86/hvm/emulate.c
--- a/xen/arch/x86/hvm/emulate.c        Fri Oct 16 08:47:07 2009 +0100
+++ b/xen/arch/x86/hvm/emulate.c        Fri Oct 16 08:50:22 2009 +0100
@@ -163,8 +163,11 @@ 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 = X86EMUL_RETRY;
+        if ( !hvm_send_assist_req(curr) )
+            curr->arch.hvm_vcpu.io_state = HVMIO_none;
+        else if ( p_data == NULL )
+            rc = X86EMUL_OKAY;
         break;
     default:
         BUG();
diff -r 1479bbe46599 -r 3eb0e91ae804 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Fri Oct 16 08:47:07 2009 +0100
+++ b/xen/arch/x86/hvm/hvm.c    Fri Oct 16 08:50:22 2009 +0100
@@ -770,12 +770,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) )
@@ -783,7 +783,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);
@@ -794,6 +794,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 1479bbe46599 -r 3eb0e91ae804 xen/arch/x86/hvm/io.c
--- a/xen/arch/x86/hvm/io.c     Fri Oct 16 08:47:07 2009 +0100
+++ b/xen/arch/x86/hvm/io.c     Fri Oct 16 08:50:22 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 1479bbe46599 -r 3eb0e91ae804 xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h     Fri Oct 16 08:47:07 2009 +0100
+++ b/xen/include/asm-x86/hvm/hvm.h     Fri Oct 16 08:50:22 2009 +0100
@@ -145,7 +145,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®.