xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <Ian.Campbell@citrix.com>
To: "rshriram@cs.ubc.ca" <rshriram@cs.ubc.ca>
Cc: "brendan@cs.ubc.ca" <brendan@cs.ubc.ca>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Subject: Re: [PATCH 4 of 6 V3] libxl: support suspend_cancel in domain_resume
Date: Thu, 9 Feb 2012 09:16:02 +0000	[thread overview]
Message-ID: <1328778962.6133.111.camel@zakaz.uk.xensource.com> (raw)
In-Reply-To: <f853c88f0230a2e9d2e1.1328251800@athos.nss.cs.ubc.ca>

On Fri, 2012-02-03 at 06:50 +0000, rshriram@cs.ubc.ca wrote:
> # HG changeset patch
> # User Shriram Rajagopalan <rshriram@cs.ubc.ca>
> # Date 1328251593 28800
> # Node ID f853c88f0230a2e9d2e1006a9cd220c4cd27e74d
> # Parent  329b3c94c618addb1e802cebc7fe23b12b432398
> libxl: support suspend_cancel in domain_resume
> 
> Add an extra parameter to libxl_domain_resume indicating
> if the caller wishes to use the SUSPEND_CANCEL style
> resume instead of the normal resume.
> 
> Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
> 
> diff -r 329b3c94c618 -r f853c88f0230 tools/libxl/libxl.c
> --- a/tools/libxl/libxl.c	Thu Feb 02 22:46:33 2012 -0800
> +++ b/tools/libxl/libxl.c	Thu Feb 02 22:46:33 2012 -0800
> @@ -229,24 +229,29 @@ int libxl_domain_rename(libxl_ctx *ctx, 
>      return rc;
>  }
>  
> -int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid)
> +int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid, int suspend_cancel)
>  {
>      GC_INIT(ctx);
>      int rc = 0;
>  
> -    if (LIBXL__DOMAIN_IS_TYPE(gc,  domid, HVM)) {
> -        LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Called domain_resume on "
> -                "non-cooperative hvm domain %u", domid);
> -        rc = ERROR_NI;
> -        goto out;
> -    }
> -    if (xc_domain_resume(ctx->xch, domid, 0)) {
> +    if (xc_domain_resume(ctx->xch, domid, suspend_cancel)) {
>          LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
>                          "xc_domain_resume failed for domain %u",
>                          domid);
>          rc = ERROR_FAIL;
>          goto out;
>      }
> +
> +    if (LIBXL__DOMAIN_IS_TYPE(gc,  domid, HVM)) {
> +        rc = libxl__domain_resume_device_model(gc, domid);
> +        if (rc) {
> +            LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
> +                       "failed to resume device model for domain %u:%d",
> +                       domid, rc);
> +            goto out;
> +        }
> +    }
> +
>      if (!xs_resume_domain(ctx->xsh, domid)) {
>          LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
>                          "xs_resume_domain failed for domain %u",
> diff -r 329b3c94c618 -r f853c88f0230 tools/libxl/libxl.h
> --- a/tools/libxl/libxl.h	Thu Feb 02 22:46:33 2012 -0800
> +++ b/tools/libxl/libxl.h	Thu Feb 02 22:46:33 2012 -0800
> @@ -268,7 +268,12 @@ int libxl_domain_create_restore(libxl_ct
>  void libxl_domain_config_dispose(libxl_domain_config *d_config);
>  int libxl_domain_suspend(libxl_ctx *ctx, libxl_domain_suspend_info *info,
>                            uint32_t domid, int fd);
> -int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid);
> +
> +/* @param suspend_cancel [from xenctrl.h:xc_domain_resume( @param fast )]
> + *   If this parameter is true, use co-operative resume. The guest
> + *   must support this.
> + */
> +int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid, int suspend_cancel);
>  int libxl_domain_shutdown(libxl_ctx *ctx, uint32_t domid);
>  int libxl_domain_reboot(libxl_ctx *ctx, uint32_t domid);
>  int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid);
> diff -r 329b3c94c618 -r f853c88f0230 tools/libxl/xl_cmdimpl.c
> --- a/tools/libxl/xl_cmdimpl.c	Thu Feb 02 22:46:33 2012 -0800
> +++ b/tools/libxl/xl_cmdimpl.c	Thu Feb 02 22:46:33 2012 -0800
> @@ -2751,7 +2751,7 @@ static void migrate_domain(const char *d
>          if (common_domname) {
>              libxl_domain_rename(ctx, domid, away_domname, common_domname);
>          }
> -        rc = libxl_domain_resume(ctx, domid);
> +        rc = libxl_domain_resume(ctx, domid, 1);

Previously this code would have been equivalent to passing 0 not 1. It
may be ok to change this but it should be separate. However I'm a bit
dubious about changing it without adding some code to detect if the
guest supports it. (I know libxl_domain_resume is currently broken for
the non-cooperative suspend case but we shouldn't paper over that)

Ian.

  reply	other threads:[~2012-02-09  9:16 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-03  6:49 [PATCH 0 of 6 V3] libxl: refactor suspend/resume code rshriram
2012-02-03  6:49 ` [PATCH 1 of 6 V3] libxl: helper function to send commands to traditional qemu rshriram
2012-02-03  6:49 ` [PATCH 2 of 6 V3] libxl: bugfix: create_domain() return to caller if !daemonize rshriram
2012-02-03  6:49 ` [PATCH 3 of 6 V3] libxl: QMP stop/resume & refactor QEMU suspend/resume/save rshriram
2012-02-09  9:13   ` Ian Campbell
2012-02-03  6:50 ` [PATCH 4 of 6 V3] libxl: support suspend_cancel in domain_resume rshriram
2012-02-09  9:16   ` Ian Campbell [this message]
2012-02-09  9:20     ` Ian Campbell
2012-02-09 18:21     ` Shriram Rajagopalan
2012-02-09 19:56       ` Ian Campbell
2012-02-10  1:31         ` [PATCH 4 of 6 V4] " rshriram
2012-02-10  9:00           ` Ian Campbell
2012-02-20 19:00           ` Ian Jackson
2012-02-20 20:02             ` Shriram Rajagopalan
2012-02-20 22:26               ` Shriram Rajagopalan
2012-02-21 10:13                 ` Stefano Stabellini
2012-02-21 10:12               ` Stefano Stabellini
2012-02-21 12:21               ` Ian Jackson
2012-02-03  6:50 ` [PATCH 5 of 6 V3] libxl: refactor migrate_domain and generalize migrate_receive rshriram
2012-02-09  9:17   ` Ian Campbell
2012-02-03  6:50 ` [PATCH 6 of 6 V3] libxl: resume instead of unpause on xl save -c rshriram
2012-02-09  9:18   ` Ian Campbell

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=1328778962.6133.111.camel@zakaz.uk.xensource.com \
    --to=ian.campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=brendan@cs.ubc.ca \
    --cc=rshriram@cs.ubc.ca \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).