qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 11/11] Restart optimization on stage3 update ver


From: Orit Wasserman
Subject: Re: [Qemu-devel] [PATCH 11/11] Restart optimization on stage3 update version
Date: Thu, 26 Jul 2012 08:03:09 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0

On 07/25/2012 06:41 PM, Vinod, Chegu wrote:
>  
> 
>  
> 
> -----Original Message-----
> From: Orit Wasserman [mailto:address@hidden
> 
>  
> 
> From: Juan Quintela <address@hidden <mailto:address@hidden>>
> 
>  
> 
> Signed-off-by: Juan Quintela <address@hidden <mailto:address@hidden>>
> 
> ---
> 
> arch_init.c |   24 +++++++++++++++---------
> 
> 1 files changed, 15 insertions(+), 9 deletions(-)
> 
>  
> 
> diff --git a/arch_init.c b/arch_init.c
> 
> index f484bd5..f555c27 100644
> 
> --- a/arch_init.c
> 
> +++ b/arch_init.c
> 
> @@ -279,7 +279,7 @@ static void save_block_hdr(QEMUFile *f, RAMBlock *block, 
> ram_addr_t offset,
> 
>  static int save_xbzrle_page(QEMUFile *f, uint8_t *current_data,
> 
>                              ram_addr_t current_addr, RAMBlock *block,
> 
> -                            ram_addr_t offset, int cont)
> 
> +                            ram_addr_t offset, int cont, bool
> 
> + last_stage)
> 
> {
> 
>      int encoded_len = 0, bytes_sent = -1;
> 
>      XBZRLEHeader hdr = {
> 
> @@ -289,8 +289,10 @@ static int save_xbzrle_page(QEMUFile *f, uint8_t 
> *current_data,
> 
>      uint8_t *prev_cached_page;
> 
>      if (!cache_is_cached(XBZRLE.cache, current_addr)) {
> 
> -        cache_insert(XBZRLE.cache, current_addr,
> 
> -                     g_memdup(current_data, TARGET_PAGE_SIZE));
> 
> +        if (!last_stage) {
> 
> +            cache_insert(XBZRLE.cache, current_addr,
> 
> +                         g_memdup(current_data, TARGET_PAGE_SIZE));
> 
> +        }
> 
>          acct_info.xbzrle_cache_miss++;
> 
>          return -1;
> 
>      }
> 
> @@ -317,7 +319,9 @@ static int save_xbzrle_page(QEMUFile *f, uint8_t 
> *current_data,
> 
>      /* we need to update the data in the cache, in order to get the same data
> 
>         we cached we decode the encoded page on the cached data */
> 
>  
> 
> Nit :  Are the above comments still valid…given that there is no decoding 
> happening here ?
I will fix them.
Orit
> 
>  
> 
> -    memcpy(prev_cached_page, XBZRLE.current_buf, TARGET_PAGE_SIZE);
> 
> +    if (!last_stage) {
> 
> +        memcpy(prev_cached_page, XBZRLE.current_buf, TARGET_PAGE_SIZE);
> 
> +    }
> 
>      hdr.xh_len = encoded_len;
> 
>      hdr.xh_flags |= ENCODING_FLAG_XBZRLE; @@ -345,7 +349,7 @@ static 
> ram_addr_t last_offset;
> 
>   *           n: the amount of bytes written in other case
> 
>   */
> 
> -static int ram_save_block(QEMUFile *f)
> 
> +static int ram_save_block(QEMUFile *f, bool last_stage)
> 
> {
> 
>      RAMBlock *block = last_block;
> 
>      ram_addr_t offset = last_offset;
> 
> @@ -376,8 +380,10 @@ static int ram_save_block(QEMUFile *f)
> 
>              } else if (migrate_use_xbzrle()) {
> 
>                  current_addr = block->offset + offset;
> 
>                  bytes_sent = save_xbzrle_page(f, p, current_addr, block,
> 
> -                                              offset, cont);
> 
> -                p = get_cached_data(XBZRLE.cache, current_addr);
> 
> +                                              offset, cont, last_stage);
> 
> +                if (!last_stage) {
> 
> +                    p = get_cached_data(XBZRLE.cache, current_addr);
> 
> +                }
> 
>              }
> 
>              /* either we didn't send yet (we may have had XBZRLE overflow) 
> */ @@ -549,7 +555,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
> 
>      while ((ret = qemu_file_rate_limit(f)) == 0) {
> 
>          int bytes_sent;
> 
> -        bytes_sent = ram_save_block(f);
> 
> +        bytes_sent = ram_save_block(f, false);
> 
>          /* no more blocks to sent */
> 
>          if (bytes_sent < 0) {
> 
>              break;
> 
> @@ -611,7 +617,7 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
> 
>      while (true) {
> 
>          int bytes_sent;
> 
> -        bytes_sent = ram_save_block(f);
> 
> +        bytes_sent = ram_save_block(f, true);
> 
>          /* no more blocks to sent */
> 
>          if (bytes_sent < 0) {
> 
>              break;
> 
> --
> 
> 1.7.7.6
> 
>  
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]