From: Ian Campbell Subject: Re: [PATCH 4 of 6 V4] libxl: support suspend_cancel in domain_resume Date: Fri, 10 Feb 2012 09:00:32 +0000 Message-ID: <1328864432.6133.241.camel@zakaz.uk.xensource.com> References: <1328817372.13189.93.camel@dagon.hellion.org.uk> <47366457a52076b78c52.1328837508@athos.nss.cs.ubc.ca> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <47366457a52076b78c52.1328837508@athos.nss.cs.ubc.ca> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "rshriram@cs.ubc.ca" Cc: "brendan@cs.ubc.ca" , "xen-devel@lists.xensource.com" , Ian Jackson , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Fri, 2012-02-10 at 01:31 +0000, rshriram@cs.ubc.ca wrote: > # HG changeset patch > # User Shriram Rajagopalan > # Date 1328835221 28800 > # Node ID 47366457a52076b78c5218c95b87c4ba7c9a723a > # Parent 2fadbad1577ed4222dd2cf8931b79f514619eb0d > 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 Thanks Acked-by: Ian Campbell (although doesn't the libxl__domain_resume_device_model need to be in another patch to avoid bisection issues? i.e. in with the changes to the suspend/resume ordering to balance things there?) > > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > --- a/tools/libxl/libxl.c > +++ b/tools/libxl/libxl.c > @@ -298,24 +298,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 --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h > --- a/tools/libxl/libxl.h > +++ b/tools/libxl/libxl.h > @@ -325,7 +325,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 --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c > --- a/tools/libxl/xl_cmdimpl.c > +++ b/tools/libxl/xl_cmdimpl.c > @@ -2802,7 +2802,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, 0); > if (!rc) fprintf(stderr, "migration sender: Resumed OK.\n"); > > fprintf(stderr, "Migration failed due to problems at target.\n"); > @@ -2824,7 +2824,7 @@ static void migrate_domain(const char *d > close(send_fd); > migration_child_report(child, recv_fd); > fprintf(stderr, "Migration failed, resuming at sender.\n"); > - libxl_domain_resume(ctx, domid); > + libxl_domain_resume(ctx, domid, 0); > exit(-ERROR_FAIL); > > failed_badly: