From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XDECI-0002gj-Mw for qemu-devel@nongnu.org; Fri, 01 Aug 2014 10:52:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XDECC-0002SO-KP for qemu-devel@nongnu.org; Fri, 01 Aug 2014 10:52:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27585) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XDECC-0002S2-BI for qemu-devel@nongnu.org; Fri, 01 Aug 2014 10:52:36 -0400 Date: Fri, 1 Aug 2014 15:52:25 +0100 From: "Dr. David Alan Gilbert" Message-ID: <20140801145225.GC2430@work-vm> References: <1406125538-27992-1-git-send-email-yanghy@cn.fujitsu.com> <1406125538-27992-8-git-send-email-yanghy@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1406125538-27992-8-git-send-email-yanghy@cn.fujitsu.com> Subject: Re: [Qemu-devel] [RFC PATCH 07/17] COLO buffer: implement colo buffer as well as QEMUFileOps based on it List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yang Hongyang Cc: kvm@vger.kernel.org, GuiJianfeng@cn.fujitsu.com, eddie.dong@intel.com, qemu-devel@nongnu.org, mrhines@linux.vnet.ibm.com * Yang Hongyang (yanghy@cn.fujitsu.com) wrote: > We need a buffer to store migration data. > > On save side: > all saved data was write into colo buffer first, so that we can know > the total size of the migration data. this can also separate the data > transmission from colo control data, we use colo control data over > socket fd to synchronous both side's stat. > > On restore side: > all migration data was read into colo buffer first, then load data > from the buffer: If network error happens while data transmission, > the slaver can still functinal because the migration data are not yet > loaded. This is very similar to the QEMUSizedBuffer based QEMUFile's that Stefan Berger wrote and that I use in both my postcopy and BER patchsets: http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg00846.html (and to the similar code from Isaku Yamahata). I think we should be able to use a shared version even if we need some changes. > > Signed-off-by: Yang Hongyang > --- > migration-colo.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 112 insertions(+) > > diff --git a/migration-colo.c b/migration-colo.c > index d566b9d..b90d9b6 100644 > --- a/migration-colo.c > +++ b/migration-colo.c > @@ -11,6 +11,7 @@ > #include "qemu/main-loop.h" > #include "qemu/thread.h" > #include "block/coroutine.h" > +#include "qemu/error-report.h" > #include "migration/migration-colo.h" > > static QEMUBH *colo_bh; > @@ -20,14 +21,122 @@ bool colo_supported(void) > return true; > } > > +/* colo buffer */ > + > +#define COLO_BUFFER_BASE_SIZE (1000*1000*4ULL) > +#define COLO_BUFFER_MAX_SIZE (1000*1000*1000*10ULL) Powers of 2 are nicer! Dave -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK