From: Brendan Cully Subject: [PATCH] attempt to reset logdirty if enable fails Date: Mon, 30 Apr 2007 16:00:12 -0700 Message-ID: <20070430230012.GC4624@ventoux.cs.ubc.ca> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="UHN/qo2QbUvPLonB" Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Xen Developers List-Id: xen-devel@lists.xenproject.org --UHN/qo2QbUvPLonB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, If the xc_save process ends gracelessly, it may leave logdirty mode enabled. This prevents subsequent attempts to live-migrate the domain from succeeding, because the call to enable logdirty will fail (failure is overloaded to mean both real failure and that the mode is already enabled). I don't know how often this happens to people not fiddling with the live migration code, but it's a theoretical possibility and there's a fairly simple workaround: try turning the mode off and then back on. If both succeed, everything should be fine. Here's a patch that does this. An operation to test the current shadow mode might also be nice. --UHN/qo2QbUvPLonB Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="reset-logdirty.patch" # HG changeset patch # User Brendan Cully # Date 1177973594 25200 # Node ID ab6f47595b9c39fa1b68372daeb0a88c0f1da43c # Parent 0f9b97523450aae06d42852bdac9bbca3d6033d1 If ENABLE_LOGDIRTY fails, it may be because it is already active. To find out, attempt to disable and then reenable the mode. Signed-off-by: Brendan Cully diff -r 0f9b97523450 -r ab6f47595b9c tools/libxc/xc_domain_save.c --- a/tools/libxc/xc_domain_save.c Sat Apr 28 09:44:24 2007 +0100 +++ b/tools/libxc/xc_domain_save.c Mon Apr 30 15:53:14 2007 -0700 @@ -880,8 +880,17 @@ int xc_domain_save(int xc_handle, int io XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY, NULL, 0, NULL, 0, NULL) < 0 ) { - ERROR("Couldn't enable shadow mode"); - goto out; + /* log-dirty already enabled? There's no test op, + so attempt to disable then reenable it */ + if ( !(xc_shadow_control(xc_handle, dom, XEN_DOMCTL_SHADOW_OP_OFF, + NULL, 0, NULL, 0, NULL) >= 0 && + xc_shadow_control(xc_handle, dom, + XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY, + NULL, 0, NULL, 0, NULL) >= 0) ) + { + ERROR("Couldn't enable shadow mode"); + goto out; + } } if ( hvm ) --UHN/qo2QbUvPLonB 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 --UHN/qo2QbUvPLonB--