[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 07/15] memory: inc/dec mr's ref when adding/removing
From: |
Liu Ping Fan |
Subject: |
[Qemu-devel] [PATCH 07/15] memory: inc/dec mr's ref when adding/removing from mem view |
Date: |
Wed, 8 Aug 2012 14:25:48 +0800 |
From: Liu Ping Fan <address@hidden>
memory_region_{add,del}_subregion will inc/dec mr's refcnt.
Signed-off-by: Liu Ping Fan <address@hidden>
---
memory.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/memory.c b/memory.c
index 5dc8b59..2eaa2fc 100644
--- a/memory.c
+++ b/memory.c
@@ -1356,7 +1356,7 @@ static void
memory_region_add_subregion_common(MemoryRegion *mr,
assert(!subregion->parent);
subregion->parent = mr;
subregion->addr = offset;
-
+ memory_region_get(subregion);
qemu_mutex_lock(&mem_map_lock);
QTAILQ_FOREACH(other, &mr->subregions, subregions_link) {
if (subregion->may_overlap || other->may_overlap) {
@@ -1420,6 +1420,8 @@ void memory_region_del_subregion(MemoryRegion *mr,
qemu_mutex_lock(&mem_map_lock);
QTAILQ_REMOVE(&mr->subregions, subregion, subregions_link);
memory_region_update_topology(mr);
+ /* mr may be still in use by reader of radix, must delay to release */
+ memory_region_put(subregion);
qemu_mutex_unlock(&mem_map_lock);
}
--
1.7.4.4
- Re: [Qemu-devel] [PATCH 15/15] e1000: using new interface--unmap to unplug, (continued)
[Qemu-devel] [PATCH 12/15] qdev: using devtree lock to protect device's accessing, Liu Ping Fan, 2012/08/08
[Qemu-devel] [PATCH 07/15] memory: inc/dec mr's ref when adding/removing from mem view,
Liu Ping Fan <=
[Qemu-devel] [PATCH 14/15] qom: object_unref call reclaimer, Liu Ping Fan, 2012/08/08
[Qemu-devel] [PATCH 08/15] memory: introduce PhysMap to present snapshot of toploygy, Liu Ping Fan, 2012/08/08