All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brendan Cully <brendan@cs.ubc.ca>
To: Keir Fraser <keir@xensource.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH 3 of 7] Make suspend return 1 when a domain is resumed
Date: Fri, 19 Jan 2007 16:22:33 -0800	[thread overview]
Message-ID: <20070120002233.GC3732@ventoux.cs.ubc.ca> (raw)
In-Reply-To: <C1D6951C.7E5B%keir@xensource.com>

[-- Attachment #1: Type: text/plain, Size: 443 bytes --]

On Friday, 19 January 2007 at 15:32, Keir Fraser wrote:
> xc_set_vcpucontext() is a nice thing to have, but it belongs in xc_domain.c
> and it would be great if all direct users of the domctl could be ported to
> use it. I'd gladly take that patch. :-)

Here's the cleanup patch. lock_pages happens later now (just before
the domctl). If that matters, I think it's harmless to leave the
original call in, so that mlock would get called twice.

[-- Attachment #2: xc-use-vcpu_setcontext.patch --]
[-- Type: text/plain, Size: 3877 bytes --]

# HG changeset patch
# User Brendan Cully <brendan@cs.ubc.ca>
# Date 1169252138 28800
# Node ID 2048d2698d461070786a655e7d0d24f015b6cb8b
# Parent  f89126a590738ad804463772230dde0b4a6640ba
Use xc_vcpu_setcontext instead of the lowlevel domctl.

Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>

diff -r f89126a59073 -r 2048d2698d46 tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c	Fri Jan 19 16:11:31 2007 +0000
+++ b/tools/libxc/xc_hvm_build.c	Fri Jan 19 16:15:38 2007 -0800
@@ -270,7 +270,6 @@ static int xc_hvm_build_internal(int xc_
                                  char *image,
                                  unsigned long image_size)
 {
-    struct xen_domctl launch_domctl;
     vcpu_guest_context_t ctxt;
     int rc;
 
@@ -287,20 +286,7 @@ static int xc_hvm_build_internal(int xc_
         goto error_out;
     }
 
-    if ( lock_pages(&ctxt, sizeof(ctxt) ) )
-    {
-        PERROR("%s: ctxt mlock failed", __func__);
-        goto error_out;
-    }
-
-    memset(&launch_domctl, 0, sizeof(launch_domctl));
-    launch_domctl.domain = (domid_t)domid;
-    launch_domctl.u.vcpucontext.vcpu   = 0;
-    set_xen_guest_handle(launch_domctl.u.vcpucontext.ctxt, &ctxt);
-    launch_domctl.cmd = XEN_DOMCTL_setvcpucontext;
-    rc = xc_domctl(xc_handle, &launch_domctl);
-
-    unlock_pages(&ctxt, sizeof(ctxt));
+    rc = xc_vcpu_setcontext(xc_handle, domid, 0, &ctxt);
 
     return rc;
 
diff -r f89126a59073 -r 2048d2698d46 tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c	Fri Jan 19 16:11:31 2007 +0000
+++ b/tools/libxc/xc_linux_build.c	Fri Jan 19 16:15:38 2007 -0800
@@ -1092,7 +1092,6 @@ static int xc_linux_build_internal(int x
                                    unsigned int console_evtchn,
                                    unsigned long *console_mfn)
 {
-    struct xen_domctl launch_domctl;
     DECLARE_DOMCTL;
     int rc;
     struct vcpu_guest_context st_ctxt, *ctxt = &st_ctxt;
@@ -1109,12 +1108,6 @@ static int xc_linux_build_internal(int x
     }
 
     memset(ctxt, 0, sizeof(*ctxt));
-
-    if ( lock_pages(ctxt, sizeof(*ctxt) ) )
-    {
-        PERROR("%s: ctxt lock failed", __func__);
-        return 1;
-    }
 
     domctl.cmd = XEN_DOMCTL_getdomaininfo;
     domctl.domain = (domid_t)domid;
@@ -1170,14 +1163,7 @@ static int xc_linux_build_internal(int x
     ctxt->kernel_sp = ctxt->user_regs.esp;
 #endif /* x86 */
 
-    memset(&launch_domctl, 0, sizeof(launch_domctl));
-
-    launch_domctl.domain = (domid_t)domid;
-    launch_domctl.u.vcpucontext.vcpu   = 0;
-    set_xen_guest_handle(launch_domctl.u.vcpucontext.ctxt, ctxt);
-
-    launch_domctl.cmd = XEN_DOMCTL_setvcpucontext;
-    rc = xc_domctl(xc_handle, &launch_domctl);
+    rc = xc_vcpu_setcontext(xc_handle, domid, 0, ctxt);
 
     return rc;
 
diff -r f89126a59073 -r 2048d2698d46 tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c	Fri Jan 19 16:11:31 2007 +0000
+++ b/tools/libxc/xc_linux_restore.c	Fri Jan 19 16:15:38 2007 -0800
@@ -195,12 +195,6 @@ int xc_linux_restore(int xc_handle, int 
     if(!get_platform_info(xc_handle, dom,
                           &max_mfn, &hvirt_start, &pt_levels)) {
         ERROR("Unable to get platform info.");
-        return 1;
-    }
-
-    if (lock_pages(&ctxt, sizeof(ctxt))) {
-        /* needed for build domctl, but might as well do early */
-        ERROR("Unable to lock ctxt");
         return 1;
     }
 
@@ -845,12 +839,7 @@ int xc_linux_restore(int xc_handle, int 
 
     DPRINTF("Domain ready to be built.\n");
 
-    domctl.cmd = XEN_DOMCTL_setvcpucontext;
-    domctl.domain = (domid_t)dom;
-    domctl.u.vcpucontext.vcpu   = 0;
-    set_xen_guest_handle(domctl.u.vcpucontext.ctxt, &ctxt);
-    rc = xc_domctl(xc_handle, &domctl);
-
+    rc = xc_vcpu_setcontext(xc_handle, dom, 0, &ctxt);
     if (rc != 0) {
         ERROR("Couldn't build the domain");
         goto out;

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

  parent reply	other threads:[~2007-01-20  0:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-15 19:05 [PATCH 0 of 7] guest checkpointing patches take 3 Brendan Cully
2007-01-15 19:05 ` [PATCH 1 of 7] Add resumedomain domctl to resume a domain after checkpoint Brendan Cully
2007-01-15 19:05 ` [PATCH 2 of 7] Add XS_RESUME command; export it to xend Brendan Cully
2007-01-15 19:05 ` [PATCH 3 of 7] Make suspend return 1 when a domain is resumed Brendan Cully
2007-01-19 15:32   ` Keir Fraser
2007-01-19 16:36     ` Brendan Cully
2007-01-19 17:09       ` Keir Fraser
2007-01-20  0:04     ` Brendan Cully
2007-01-20  0:22     ` Brendan Cully [this message]
2007-01-15 19:05 ` [PATCH 4 of 7] Make xen_suspend handle resume Brendan Cully
2007-01-15 19:05 ` [PATCH 5 of 7] Add xm save -c/--checkpoint option Brendan Cully
2007-01-15 19:05 ` [PATCH 6 of 7] Advertise resumability feature in guest kernel Brendan Cully
2007-01-15 19:05 ` [PATCH 7 of 7] Add unsuspend hook for resuming devices in the checkpoint parent Brendan Cully

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070120002233.GC3732@ventoux.cs.ubc.ca \
    --to=brendan@cs.ubc.ca \
    --cc=keir@xensource.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.