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

[Xen-changelog] [xen-3.0.4-testing] [IOEMU] Process reset requests before returning control to the guest.



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
# Date 1167832553 0
# Node ID 07b38e9f1d5759237107689246060905205a9e02
# Parent  b5f32f507ad1228cfdf07580840938c2a493bbcb
[IOEMU] Process reset requests before returning control to the guest.

Since 12899:4ae4bdee00e Xen only pays attention the first shutdown or
reboot request for a domain.

When a reset if requested we need to make the SCHEDOP_remote_shutdown
hypercall before we return control to the guest so that it wins the
"race" with the heuristic in xen/arch/x86/hvm/hvm.c:hvm_vcpu_down()
which causes a powerdown.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxxxxx>

Based on xen-unstable changeset 13212:55be48549bb11b38377f3f6c0fc0c37ea7b0d9c2
---
 tools/ioemu/target-i386-dm/helper2.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+)

diff -r b5f32f507ad1 -r 07b38e9f1d57 tools/ioemu/target-i386-dm/helper2.c
--- a/tools/ioemu/target-i386-dm/helper2.c      Tue Jan 02 14:19:47 2007 +0000
+++ b/tools/ioemu/target-i386-dm/helper2.c      Wed Jan 03 13:55:53 2007 +0000
@@ -498,6 +498,8 @@ void handle_buffered_io(void *opaque)
 
 void cpu_handle_ioreq(void *opaque)
 {
+    extern int vm_running;
+    extern int shutdown_requested;
     CPUState *env = opaque;
     ioreq_t *req = cpu_get_ioreq();
 
@@ -516,6 +518,25 @@ void cpu_handle_ioreq(void *opaque)
         }
 
         wmb(); /* Update ioreq contents /then/ update state. */
+
+       /*
+         * We do this before we send the response so that the tools
+         * have the opportunity to pick up on the reset before the
+         * guest resumes and does a hlt with interrupts disabled which
+         * causes Xen to powerdown the domain.
+         */
+        if (vm_running) {
+            if (shutdown_requested) {
+               fprintf(logfile, "shutdown requested in cpu_handle_ioreq\n");
+               destroy_hvm_domain();
+           }
+           if (reset_requested) {
+               fprintf(logfile, "reset requested in cpu_handle_ioreq.\n");
+               qemu_system_reset();
+               reset_requested = 0;
+           }
+       }
+
         req->state = STATE_IORESP_READY;
         xc_evtchn_notify(xce_handle, ioreq_local_port[send_vcpu]);
     }

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