[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [LIBXC] Refactor xc_domain_resume() into its own source file.
# 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
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |