diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2015-10-12 11:07:38 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2015-10-12 11:07:38 +0100 |
| commit | 768492239014cb5e6161f1be80a9c8043c4530c2 (patch) | |
| tree | 9299859ad4f734950d353473cf229d0da3250cf2 /memory.c | |
| parent | c9003eb4662f44c61be9c8d7d5c9d4a02d58b560 (diff) | |
| parent | 33fe96833015cf15f4c0aa5bf8d34f60526e0732 (diff) | |
| download | focaccia-qemu-768492239014cb5e6161f1be80a9c8043c4530c2.tar.gz focaccia-qemu-768492239014cb5e6161f1be80a9c8043c4530c2.zip | |
Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2015-10-09' into staging
Fix device introspection regressions # gpg: Signature made Fri 09 Oct 2015 14:43:41 BST using RSA key ID EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" * remotes/armbru/tags/pull-monitor-2015-10-09: Revert "qdev: Use qdev_get_device_class() for -device <type>,help" qdev: Protect device-list-properties against broken devices qmp: Fix device-list-properties not to crash for abstract device device-introspect-test: New, covering device introspection libqtest: New hmp() & friends libqtest: Clean up unused QTestState member sigact_old tests: Fix how qom-test is run macio: move DBDMA_init from instance_init to realize hw: do not pass NULL to memory_region_init from instance_init memory: allow destroying a non-empty MemoryRegion virtio-input: Fix device introspection on non-Linux hosts update-linux-headers: Rename SW_MAX to SW_MAX_ Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'memory.c')
| -rw-r--r-- | memory.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/memory.c b/memory.c index 1b03d2251c..2eb1597518 100644 --- a/memory.c +++ b/memory.c @@ -1304,7 +1304,22 @@ static void memory_region_finalize(Object *obj) { MemoryRegion *mr = MEMORY_REGION(obj); - assert(QTAILQ_EMPTY(&mr->subregions)); + assert(!mr->container); + + /* We know the region is not visible in any address space (it + * does not have a container and cannot be a root either because + * it has no references, so we can blindly clear mr->enabled. + * memory_region_set_enabled instead could trigger a transaction + * and cause an infinite loop. + */ + mr->enabled = false; + memory_region_transaction_begin(); + while (!QTAILQ_EMPTY(&mr->subregions)) { + MemoryRegion *subregion = QTAILQ_FIRST(&mr->subregions); + memory_region_del_subregion(mr, subregion); + } + memory_region_transaction_commit(); + mr->destructor(mr); memory_region_clear_coalescing(mr); g_free((char *)mr->name); |