qemu-trivial
[Top][All Lists]
Advanced

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

Re: [Qemu-trivial] [Qemu-devel] [PATCH-trivial] arch_init.c: Always be s


From: ChenLiang
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH-trivial] arch_init.c: Always be sure that 'encoded_buf' and 'current_buf' are lock protected
Date: Tue, 3 Jun 2014 15:31:32 +0800
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20120327 Thunderbird/11.0.1

On 2014/6/2 20:35, Chen Gang wrote:

> 'encoded_buf' and 'current_buf' are lock protected during using in
> save_xbzrle_page() in ram_save_page(), and during freeing in
> migration_end().
> 
> So recommend to let them lock protected during starting, just like we
> have done to 'cache'.
> 
> 
> Signed-off-by: Chen Gang <address@hidden>
> ---
>  arch_init.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch_init.c b/arch_init.c
> index 23044c1..784922c 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -783,12 +783,12 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
>              error_report("Error creating cache");
>              return -1;
>          }
> -        XBZRLE_cache_unlock();
> 
>          /* We prefer not to abort if there is no memory */
>          XBZRLE.encoded_buf = g_try_malloc0(TARGET_PAGE_SIZE);
>          if (!XBZRLE.encoded_buf) {
>              error_report("Error allocating encoded_buf");
> +            XBZRLE_cache_unlock();
>              return -1;
>          }
> 
> @@ -797,8 +797,10 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
>              error_report("Error allocating current_buf");
>              g_free(XBZRLE.encoded_buf);
>              XBZRLE.encoded_buf = NULL;
> +            XBZRLE_cache_unlock();
>              return -1;
>          }
> +        XBZRLE_cache_unlock();
> 
>          acct_clear();
>      }


It isn't necessary.

Best regards.
ChenLiang




reply via email to

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