From: Yang Hongyang Subject: [RFC PATCH COLO v5 17/29] xc_domain_save: flush cache before calling callbacks->postcopy() in colo mode Date: Wed, 1 Apr 2015 14:41:53 +0800 Message-ID: <1427870525-18686-18-git-send-email-yanghy@cn.fujitsu.com> References: <1427870525-18686-1-git-send-email-yanghy@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1427870525-18686-1-git-send-email-yanghy@cn.fujitsu.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: wei.liu2@citrix.com, ian.campbell@citrix.com, wency@cn.fujitsu.com, ian.jackson@eu.citrix.com, yunhong.jiang@intel.com, eddie.dong@intel.com, rshriram@cs.ubc.ca, yanghy@cn.fujitsu.com List-Id: xen-devel@lists.xenproject.org From: Wen Congyang In colo mode, secondary vm is running. We will use the io_fd to ensure that both primary vm and secondary vm are resumed at the same time. So we should call postcopy later. Signed-off-by: Wen Congyang --- tools/libxc/xc_domain_save.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c index cef6995..045a050 100644 --- a/tools/libxc/xc_domain_save.c +++ b/tools/libxc/xc_domain_save.c @@ -2082,10 +2082,15 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter out_rc: completed = 1; - if ( !rc && callbacks->postcopy ) + /* + * COLO: secondary vm is running. We will use the io_fd to + * ensure that both primary vm and secondary vm are resumed + * at the same time. So we should call postcopy later. + */ + if ( !rc && callbacks->postcopy && !callbacks->get_dirty_pfn ) callbacks->postcopy(callbacks->data); - /* guest has been resumed. Now we can compress data + /* Remus: guest has been resumed. Now we can compress data * at our own pace. */ if (!rc && compressing) @@ -2113,6 +2118,13 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter discard_file_cache(xch, io_fd, 1 /* flush */); + /* + * COLO: send qemu device state and resume both + * primary vm and secondary vm now. + */ + if ( !rc && callbacks->postcopy && callbacks->get_dirty_pfn ) + callbacks->postcopy(callbacks->data); + /* Enable compression now, finally */ compressing = (flags & XCFLAGS_CHECKPOINT_COMPRESS); -- 1.9.1