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

[Xen-changelog] [xen-unstable] x86, hvm: MMIO emulations should defer domain shutdown requests until



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1206617997 0
# Node ID b667e220e55615957f98e54a44c2f638d270e225
# Parent  a294519d97d2fc59ec286b9c4e9988776166053e
x86, hvm: MMIO emulations should defer domain shutdown requests until
the relevant instruction has been fully emulated (which may require
multiple round trips to qemu-dm).
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/hvm/io.c |   19 +++++++++----------
 xen/common/domain.c   |    6 ++++++
 2 files changed, 15 insertions(+), 10 deletions(-)

diff -r a294519d97d2 -r b667e220e556 xen/arch/x86/hvm/io.c
--- a/xen/arch/x86/hvm/io.c     Thu Mar 27 11:03:45 2008 +0000
+++ b/xen/arch/x86/hvm/io.c     Thu Mar 27 11:39:57 2008 +0000
@@ -221,35 +221,34 @@ int handle_mmio_with_translation(unsigne
 
 void hvm_io_assist(void)
 {
-    struct vcpu *v = current;
-    ioreq_t *p = &get_ioreq(v)->vp_ioreq;
+    struct vcpu *curr = current;
+    ioreq_t *p = &get_ioreq(curr)->vp_ioreq;
     enum hvm_io_state io_state;
 
     if ( p->state != STATE_IORESP_READY )
     {
         gdprintk(XENLOG_ERR, "Unexpected HVM iorequest state %d.\n", p->state);
-        domain_crash(v->domain);
-        goto out;
+        domain_crash_synchronous();
     }
 
     rmb(); /* see IORESP_READY /then/ read contents of ioreq */
 
     p->state = STATE_IOREQ_NONE;
 
-    io_state = v->arch.hvm_vcpu.io_state;
-    v->arch.hvm_vcpu.io_state = HVMIO_none;
+    io_state = curr->arch.hvm_vcpu.io_state;
+    curr->arch.hvm_vcpu.io_state = HVMIO_none;
 
     if ( (io_state == HVMIO_awaiting_completion) ||
          (io_state == HVMIO_handle_mmio_awaiting_completion) )
     {
-        v->arch.hvm_vcpu.io_state = HVMIO_completed;
-        v->arch.hvm_vcpu.io_data = p->data;
+        curr->arch.hvm_vcpu.io_state = HVMIO_completed;
+        curr->arch.hvm_vcpu.io_data = p->data;
         if ( io_state == HVMIO_handle_mmio_awaiting_completion )
             (void)handle_mmio();
     }
 
- out:
-    vcpu_end_shutdown_deferral(v);
+    if ( p->state == STATE_IOREQ_NONE )
+        vcpu_end_shutdown_deferral(curr);
 }
 
 void dpci_ioport_read(uint32_t mport, ioreq_t *p)
diff -r a294519d97d2 -r b667e220e556 xen/common/domain.c
--- a/xen/common/domain.c       Thu Mar 27 11:03:45 2008 +0000
+++ b/xen/common/domain.c       Thu Mar 27 11:39:57 2008 +0000
@@ -393,6 +393,8 @@ void __domain_crash_synchronous(void)
         this_cpu(mc_state).flags = 0;
     }
 
+    vcpu_end_shutdown_deferral(current);
+
     for ( ; ; )
         do_softirq();
 }
@@ -459,10 +461,14 @@ void domain_resume(struct domain *d)
 
 int vcpu_start_shutdown_deferral(struct vcpu *v)
 {
+    if ( v->defer_shutdown )
+        return 1;
+
     v->defer_shutdown = 1;
     smp_mb(); /* set deferral status /then/ check for shutdown */
     if ( unlikely(v->domain->is_shutting_down) )
         vcpu_check_shutdown(v);
+
     return v->defer_shutdown;
 }
 

_______________________________________________
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®.