qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PULL 10/24] exec: adjust rcu_read_lock requirement


From: Paolo Bonzini
Subject: [Qemu-devel] [PULL 10/24] exec: adjust rcu_read_lock requirement
Date: Mon, 23 May 2016 17:09:45 +0200

From: Gonglei <address@hidden>

qemu_ram_unset_idstr() doesn't need rcu lock anymore,
meanwhile make the range of rcu lock in
qemu_ram_set_idstr() as small as possible.

Signed-off-by: Gonglei <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
 exec.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/exec.c b/exec.c
index e2966ce..8cf535d 100644
--- a/exec.c
+++ b/exec.c
@@ -1421,8 +1421,6 @@ void qemu_ram_set_idstr(RAMBlock *new_block, const char 
*name, DeviceState *dev)
 {
     RAMBlock *block;
 
-    rcu_read_lock();
-
     assert(new_block);
     assert(!new_block->idstr[0]);
 
@@ -1435,6 +1433,7 @@ void qemu_ram_set_idstr(RAMBlock *new_block, const char 
*name, DeviceState *dev)
     }
     pstrcat(new_block->idstr, sizeof(new_block->idstr), name);
 
+    rcu_read_lock();
     QLIST_FOREACH_RCU(block, &ram_list.blocks, next) {
         if (block != new_block &&
             !strcmp(block->idstr, new_block->idstr)) {
@@ -1453,12 +1452,9 @@ void qemu_ram_unset_idstr(RAMBlock *block)
      * migration.  Ignore the problem since hot-unplug during migration
      * does not work anyway.
      */
-
-    rcu_read_lock();
     if (block) {
         memset(block->idstr, 0, sizeof(block->idstr));
     }
-    rcu_read_unlock();
 }
 
 static int memory_try_enable_merging(void *addr, size_t len)
-- 
1.8.3.1





reply via email to

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