WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [LIBXC] Refactor xc_domain_resume() into

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [LIBXC] Refactor xc_domain_resume() into its own source file.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 20 Jan 2007 09:10:11 -0800
Delivery-date: Sat, 20 Jan 2007 09:10:23 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1169231548 0
# Node ID 9f27746eff43ba379e0cfabeb11331439268b7d4
# Parent  701afa77106ae331714db968090bc1b0370c7714
[LIBXC] Refactor xc_domain_resume() into its own source file.

The idea is that this file is where we will have two implementations
of 'suspend cancellation': one which the guest is aware of (and is
faster) and the other which does more work to avoid requiring guest
modifications.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/libxc/Makefile    |    1 +
 tools/libxc/xc_domain.c |   17 +++--------------
 tools/libxc/xc_resume.c |   35 +++++++++++++++++++++++++++++++++++
 tools/libxc/xenctrl.h   |    6 +++---
 4 files changed, 42 insertions(+), 17 deletions(-)

diff -r 701afa77106a -r 9f27746eff43 tools/libxc/Makefile
--- a/tools/libxc/Makefile      Fri Jan 19 18:04:00 2007 +0000
+++ b/tools/libxc/Makefile      Fri Jan 19 18:32:28 2007 +0000
@@ -15,6 +15,7 @@ CTRL_SRCS-y       += xc_sedf.c
 CTRL_SRCS-y       += xc_sedf.c
 CTRL_SRCS-y       += xc_csched.c
 CTRL_SRCS-y       += xc_tbuf.c
+CTRL_SRCS-y       += xc_resume.c
 CTRL_SRCS-$(CONFIG_X86) += xc_pagetab.c
 CTRL_SRCS-$(CONFIG_Linux) += xc_linux.c
 CTRL_SRCS-$(CONFIG_SunOS) += xc_solaris.c
diff -r 701afa77106a -r 9f27746eff43 tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c   Fri Jan 19 18:04:00 2007 +0000
+++ b/tools/libxc/xc_domain.c   Fri Jan 19 18:32:28 2007 +0000
@@ -89,16 +89,6 @@ int xc_domain_shutdown(int xc_handle,
 }
 
 
-int xc_domain_resume(int xc_handle,
-                      uint32_t domid)
-{
-    DECLARE_DOMCTL;
-    domctl.cmd = XEN_DOMCTL_resumedomain;
-    domctl.domain = (domid_t)domid;
-    return do_domctl(xc_handle, &domctl);
-}
-
-
 int xc_vcpu_setaffinity(int xc_handle,
                         uint32_t domid,
                         int vcpu,
@@ -293,9 +283,9 @@ int xc_domain_hvm_setcontext(int xc_hand
 }
 
 int xc_vcpu_getcontext(int xc_handle,
-                               uint32_t domid,
-                               uint32_t vcpu,
-                               vcpu_guest_context_t *ctxt)
+                       uint32_t domid,
+                       uint32_t vcpu,
+                       vcpu_guest_context_t *ctxt)
 {
     int rc;
     DECLARE_DOMCTL;
@@ -611,7 +601,6 @@ int xc_vcpu_setcontext(int xc_handle,
         unlock_pages(ctxt, sizeof(*ctxt));
 
     return rc;
-
 }
 
 int xc_domain_irq_permission(int xc_handle,
diff -r 701afa77106a -r 9f27746eff43 tools/libxc/xc_resume.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxc/xc_resume.c   Fri Jan 19 18:32:28 2007 +0000
@@ -0,0 +1,35 @@
+#include "xc_private.h"
+
+/*
+ * Resume execution of a domain after suspend shutdown.
+ * This can happen in one of two ways:
+ *  1. Resume with special return code.
+ *  2. Reset guest environment so it believes it is resumed in a new
+ *     domain context.
+ * (2) should be used only for guests which cannot handle the special
+ * new return code. (1) is always safe (but slower).
+ * 
+ * XXX Only (2) is implemented below. We need to use (1) by default!
+ */
+int xc_domain_resume(int xc_handle, uint32_t domid)
+{
+    vcpu_guest_context_t ctxt;
+    DECLARE_DOMCTL;
+    int rc;
+
+    /*
+     * Set hypercall return code to indicate that suspend is cancelled
+     * (rather than resuming in a new domain context).
+     */
+#if defined(__i386__) || defined(__x86_64__)
+    if ( (rc = xc_vcpu_getcontext(xc_handle, domid, 0, &ctxt)) != 0 )
+        return rc;
+    ctxt.user_regs.eax = 1;
+    if ( (rc = xc_vcpu_setcontext(xc_handle, domid, 0, &ctxt)) != 0 )
+        return rc;
+#endif
+
+    domctl.cmd = XEN_DOMCTL_resumedomain;
+    domctl.domain = domid;
+    return do_domctl(xc_handle, &domctl);
+}
diff -r 701afa77106a -r 9f27746eff43 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Fri Jan 19 18:04:00 2007 +0000
+++ b/tools/libxc/xenctrl.h     Fri Jan 19 18:32:28 2007 +0000
@@ -360,9 +360,9 @@ int xc_domain_hvm_setcontext(int xc_hand
  * @return 0 on success, -1 on failure
  */
 int xc_vcpu_getcontext(int xc_handle,
-                               uint32_t domid,
-                               uint32_t vcpu,
-                               vcpu_guest_context_t *ctxt);
+                       uint32_t domid,
+                       uint32_t vcpu,
+                       vcpu_guest_context_t *ctxt);
 
 typedef xen_domctl_getvcpuinfo_t xc_vcpuinfo_t;
 int xc_vcpu_getinfo(int xc_handle,

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [LIBXC] Refactor xc_domain_resume() into its own source file., Xen patchbot-unstable <=