diff options
author | Gonglei <arei.gonglei@huawei.com> | 2016-05-10 10:05:00 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-05-23 16:53:44 +0200 |
commit | ab0a99560857302b60053c245d1231acbd976cd4 (patch) | |
tree | 2642774165b03e8ac1efb2a5f9c903c899698204 /exec.c | |
parent | fa53a0e53efdc7002497ea4a76aacf6cceb170ef (diff) |
exec: adjust rcu_read_lock requirement
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 <arei.gonglei@huawei.com>
Message-Id: <1462845901-89716-3-git-send-email-arei.gonglei@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'exec.c')
-rw-r--r-- | exec.c | 6 |
1 files changed, 1 insertions, 5 deletions
@@ -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) |