[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/3] exec: adjuest rcu_read_lock requiement
From: |
Gonglei |
Subject: |
[Qemu-devel] [PATCH 2/3] exec: adjuest rcu_read_lock requiement |
Date: |
Wed, 20 Apr 2016 11:34:20 +0800 |
qemu_ram_unset_idstr() don't need rcu lock anymore,
meanwhile adjuest the range of rcu lock in
qemu_ram_set_idstr() as small as possible.
Signed-off-by: Gonglei <address@hidden>
---
exec.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/exec.c b/exec.c
index 101f0f4..b0ecbcd 100644
--- a/exec.c
+++ b/exec.c
@@ -1418,8 +1418,6 @@ void qemu_ram_set_idstr(RAMBlock *block, const char
*name, DeviceState *dev)
RAMBlock *new_block = block;
RAMBlock *old_block;
- rcu_read_lock();
-
assert(new_block);
assert(!new_block->idstr[0]);
@@ -1432,6 +1430,7 @@ void qemu_ram_set_idstr(RAMBlock *block, const char
*name, DeviceState *dev)
}
pstrcat(new_block->idstr, sizeof(new_block->idstr), name);
+ rcu_read_lock();
QLIST_FOREACH_RCU(old_block, &ram_list.blocks, next) {
if (old_block != new_block &&
!strcmp(old_block->idstr, new_block->idstr)) {
@@ -1443,7 +1442,6 @@ void qemu_ram_set_idstr(RAMBlock *block, const char
*name, DeviceState *dev)
rcu_read_unlock();
}
-/* Called with iothread lock held. */
void qemu_ram_unset_idstr(RAMBlock *block)
{
/* FIXME: arch_init.c assumes that this is not called throughout
@@ -1451,11 +1449,9 @@ void qemu_ram_unset_idstr(RAMBlock *block)
* 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.7.12.4