From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wen Congyang Subject: [RFC Patch v3 09/22] xc_domain_save: flush cache before calling callbacks->postcopy() in colo mode Date: Fri, 5 Sep 2014 17:25:44 +0800 Message-ID: <1409909158-19243-10-git-send-email-wency@cn.fujitsu.com> References: <1409909158-19243-1-git-send-email-wency@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1409909158-19243-1-git-send-email-wency@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 Cc: Ian Campbell , Wen Congyang , Ian Jackson , Jiang Yunhong , Dong Eddie , Yang Hongyang , Lai Jiangshan List-Id: xen-devel@lists.xenproject.org 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 254fdb3..61caa47 100644 --- a/tools/libxc/xc_domain_save.c +++ b/tools/libxc/xc_domain_save.c @@ -2078,10 +2078,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) @@ -2109,6 +2114,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.3