All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH-trivial] arch_init.c: Always be sure that 'encoded_buf' and 'current_buf' are lock protected
@ 2014-06-02 12:35 ` Chen Gang
  0 siblings, 0 replies; 14+ messages in thread
From: Chen Gang @ 2014-06-02 12:35 UTC (permalink / raw)
  To: Michael Tokarev, quintela, arei.gonglei, Eric Blake, dgilbert,
	owasserm
  Cc: QEMU Trivial, QEMU Developers

'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 <gang.chen.5i5j@gmail.com>
---
 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();
     }
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-06-04 10:50 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-02 12:35 [Qemu-trivial] [PATCH-trivial] arch_init.c: Always be sure that 'encoded_buf' and 'current_buf' are lock protected Chen Gang
2014-06-02 12:35 ` [Qemu-devel] " Chen Gang
2014-06-03  7:31 ` [Qemu-trivial] " ChenLiang
2014-06-03  7:31   ` ChenLiang
2014-06-03 13:45   ` [Qemu-trivial] " Chen Gang
2014-06-03 13:45     ` Chen Gang
2014-06-04 10:01     ` [Qemu-trivial] " Dr. David Alan Gilbert
2014-06-04 10:01       ` Dr. David Alan Gilbert
2014-06-04 10:49       ` [Qemu-trivial] " Chen Gang
2014-06-04 10:49         ` Chen Gang
2014-06-04  8:20 ` [Qemu-trivial] " Markus Armbruster
2014-06-04  8:20   ` Markus Armbruster
2014-06-04 10:32   ` [Qemu-trivial] " Chen Gang
2014-06-04 10:32     ` Chen Gang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.