From: Brendan Cully Subject: Re: [PATCH 07 of 10] Add new shutdown mode for checkpoint Date: Fri, 12 Jan 2007 15:58:35 -0800 Message-ID: <20070112235835.GA31491@ventoux.cs.ubc.ca> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="wac7ysb48OaltWcw" Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: Xen Developers List-Id: xen-devel@lists.xenproject.org --wac7ysb48OaltWcw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thursday, 28 December 2006 at 16:51, Keir Fraser wrote: > On 15/12/06 6:38 am, "Brendan Cully" wrote: > > > Add new shutdown mode for checkpoint. > > > > When control/shutdown = checkpoint, invoke an alternate suspend path > > that doesn't disconnect from back ends, and only reconnects when the > > image has been restored into a new domain. > > I don't think a new type of 'checkpoint' handler is required in the guest > OS. We are already most of the way there in terms of doing as little as > possible on the suspend side of save/restore, so we should fix up what > little else there is to be done. Looking at the differences versus your new > checkpointing suspend: > 1. Xenbus_suspend() needs to stay. Actually most drivers do not have a > suspend handler anyway (only tpmfront does). We should provide a > suspend_cancelled() hook callback so that drivers which *do* have a suspend > handler can distinguish between proper resume and checkpoint return. I guess this is what you had in mind? I don't have anything that uses it at the moment though. It's just suspend_dev cut'n'pasted. --wac7ysb48OaltWcw Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="unsuspend.diff" # HG changeset patch # User Brendan Cully # Date 1168646163 28800 # Node ID f6c3f5b0be95efeb0c47318bc6608310cd49c804 # Parent 4fc2fde1b3737554edd795e65701292d8320405d Add unsuspend hook for resuming devices in the checkpoint parent. Nothing uses it at the moment. Signed-off-by: Brendan Cully diff -r 4fc2fde1b373 -r f6c3f5b0be95 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Fri Jan 12 15:02:24 2007 -0800 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Fri Jan 12 15:56:03 2007 -0800 @@ -672,6 +672,26 @@ static int suspend_dev(struct device *de return 0; } +static int unsuspend_dev(struct device *dev, void *data) +{ + int err = 0; + struct xenbus_driver *drv; + struct xenbus_device *xdev; + + DPRINTK(""); + + if (dev->driver == NULL) + return 0; + drv = to_xenbus_driver(dev->driver); + xdev = container_of(dev, struct xenbus_device, dev); + if (drv->unsuspend) + err = drv->unsuspend(xdev); + if (err) + printk(KERN_WARNING + "xenbus: unsuspend %s failed: %i\n", dev->bus_id, err); + return 0; +} + static int resume_dev(struct device *dev, void *data) { int err; @@ -735,6 +755,9 @@ void xenbus_resume(int reconnect) if (reconnect) { bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL, resume_dev); + } else { + bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL, + unsuspend_dev); } xenbus_backend_resume(resume_dev); } diff -r 4fc2fde1b373 -r f6c3f5b0be95 linux-2.6-xen-sparse/include/xen/xenbus.h --- a/linux-2.6-xen-sparse/include/xen/xenbus.h Fri Jan 12 15:02:24 2007 -0800 +++ b/linux-2.6-xen-sparse/include/xen/xenbus.h Fri Jan 12 15:56:03 2007 -0800 @@ -101,6 +101,7 @@ struct xenbus_driver { enum xenbus_state backend_state); int (*remove)(struct xenbus_device *dev); int (*suspend)(struct xenbus_device *dev); + int (*unsuspend)(struct xenbus_device *dev); int (*resume)(struct xenbus_device *dev); int (*uevent)(struct xenbus_device *, char **, int, char *, int); struct device_driver driver; --wac7ysb48OaltWcw Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --wac7ysb48OaltWcw--