From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:47344) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SuGE2-0003Ef-Rk for qemu-devel@nongnu.org; Thu, 26 Jul 2012 01:03:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SuGE1-0001jK-OB for qemu-devel@nongnu.org; Thu, 26 Jul 2012 01:03:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5405) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SuGE1-0001jD-Fu for qemu-devel@nongnu.org; Thu, 26 Jul 2012 01:03:01 -0400 Message-ID: <5010CF8D.5000004@redhat.com> Date: Thu, 26 Jul 2012 08:03:09 +0300 From: Orit Wasserman MIME-Version: 1.0 References: <1343227834-5400-1-git-send-email-owasserm@redhat.com> <1343227834-5400-13-git-send-email-owasserm@redhat.com> <4168C988EBDF2141B4E0B6475B6A73D115952A@G6W2493.americas.hpqcorp.net> In-Reply-To: <4168C988EBDF2141B4E0B6475B6A73D115952A@G6W2493.americas.hpqcorp.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 11/11] Restart optimization on stage3 update version List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Vinod, Chegu" Cc: "peter.maydell@linaro.org" , "aliguori@us.ibm.com" , "quintela@redhat.com" , "stefanha@gmail.com" , "qemu-devel@nongnu.org" , "mdroth@linux.vnet.ibm.com" , "blauwirbel@gmail.com" , "avi@redhat.com" , "pbonzini@redhat.com" , "lcapitulino@redhat.com" , "eblake@redhat.com" On 07/25/2012 06:41 PM, Vinod, Chegu wrote: > =20 >=20 > =20 >=20 > -----Original Message----- > From: Orit Wasserman [mailto:owasserm@redhat.com] >=20 > =20 >=20 > From: Juan Quintela > >=20 > =20 >=20 > Signed-off-by: Juan Quintela > >=20 > --- >=20 > arch_init.c | 24 +++++++++++++++--------- >=20 > 1 files changed, 15 insertions(+), 9 deletions(-) >=20 > =20 >=20 > diff --git a/arch_init.c b/arch_init.c >=20 > index f484bd5..f555c27 100644 >=20 > --- a/arch_init.c >=20 > +++ b/arch_init.c >=20 > @@ -279,7 +279,7 @@ static void save_block_hdr(QEMUFile *f, RAMBlock *b= lock, ram_addr_t offset, >=20 > static int save_xbzrle_page(QEMUFile *f, uint8_t *current_data, >=20 > ram_addr_t current_addr, RAMBlock *block, >=20 > - ram_addr_t offset, int cont) >=20 > + ram_addr_t offset, int cont, bool >=20 > + last_stage) >=20 > { >=20 > int encoded_len =3D 0, bytes_sent =3D -1; >=20 > XBZRLEHeader hdr =3D { >=20 > @@ -289,8 +289,10 @@ static int save_xbzrle_page(QEMUFile *f, uint8_t *= current_data, >=20 > uint8_t *prev_cached_page; >=20 > if (!cache_is_cached(XBZRLE.cache, current_addr)) { >=20 > - cache_insert(XBZRLE.cache, current_addr, >=20 > - g_memdup(current_data, TARGET_PAGE_SIZE)); >=20 > + if (!last_stage) { >=20 > + cache_insert(XBZRLE.cache, current_addr, >=20 > + g_memdup(current_data, TARGET_PAGE_SIZE)); >=20 > + } >=20 > acct_info.xbzrle_cache_miss++; >=20 > return -1; >=20 > } >=20 > @@ -317,7 +319,9 @@ static int save_xbzrle_page(QEMUFile *f, uint8_t *c= urrent_data, >=20 > /* we need to update the data in the cache, in order to get the sa= me data >=20 > we cached we decode the encoded page on the cached data */ >=20 > =20 >=20 > Nit : Are the above comments still valid=85given that there is no deco= ding happening here ? I will fix them. Orit >=20 > =20 >=20 > - memcpy(prev_cached_page, XBZRLE.current_buf, TARGET_PAGE_SIZE); >=20 > + if (!last_stage) { >=20 > + memcpy(prev_cached_page, XBZRLE.current_buf, TARGET_PAGE_SIZE)= ; >=20 > + } >=20 > hdr.xh_len =3D encoded_len; >=20 > hdr.xh_flags |=3D ENCODING_FLAG_XBZRLE; @@ -345,7 +349,7 @@ static= ram_addr_t last_offset; >=20 > * n: the amount of bytes written in other case >=20 > */ >=20 > -static int ram_save_block(QEMUFile *f) >=20 > +static int ram_save_block(QEMUFile *f, bool last_stage) >=20 > { >=20 > RAMBlock *block =3D last_block; >=20 > ram_addr_t offset =3D last_offset; >=20 > @@ -376,8 +380,10 @@ static int ram_save_block(QEMUFile *f) >=20 > } else if (migrate_use_xbzrle()) { >=20 > current_addr =3D block->offset + offset; >=20 > bytes_sent =3D save_xbzrle_page(f, p, current_addr, bl= ock, >=20 > - offset, cont); >=20 > - p =3D get_cached_data(XBZRLE.cache, current_addr); >=20 > + offset, cont, last_stage= ); >=20 > + if (!last_stage) { >=20 > + p =3D get_cached_data(XBZRLE.cache, current_addr); >=20 > + } >=20 > } >=20 > /* either we didn't send yet (we may have had XBZRLE overf= low) */ @@ -549,7 +555,7 @@ static int ram_save_iterate(QEMUFile *f, void= *opaque) >=20 > while ((ret =3D qemu_file_rate_limit(f)) =3D=3D 0) { >=20 > int bytes_sent; >=20 > - bytes_sent =3D ram_save_block(f); >=20 > + bytes_sent =3D ram_save_block(f, false); >=20 > /* no more blocks to sent */ >=20 > if (bytes_sent < 0) { >=20 > break; >=20 > @@ -611,7 +617,7 @@ static int ram_save_complete(QEMUFile *f, void *opa= que) >=20 > while (true) { >=20 > int bytes_sent; >=20 > - bytes_sent =3D ram_save_block(f); >=20 > + bytes_sent =3D ram_save_block(f, true); >=20 > /* no more blocks to sent */ >=20 > if (bytes_sent < 0) { >=20 > break; >=20 > -- >=20 > 1.7.7.6 >=20 > =20 >=20