[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/15] qom: object_unref call reclaimer
From: |
Liu Ping Fan |
Subject: |
[Qemu-devel] [PATCH 14/15] qom: object_unref call reclaimer |
Date: |
Wed, 8 Aug 2012 14:25:55 +0800 |
From: Liu Ping Fan <address@hidden>
iohandler/bh/timer may use DeviceState when its refcnt=0,
postpone the reclaimer till they have done with it.
Signed-off-by: Liu Ping Fan <address@hidden>
---
qom/object.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/qom/object.c b/qom/object.c
index 822bdb7..1452b1b 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -23,6 +23,8 @@
#include "qbool.h"
#include "qint.h"
#include "qstring.h"
+#include "hw/qdev.h"
+#include "qemu/reclaimer.h"
#define MAX_INTERFACES 32
@@ -646,7 +648,12 @@ void object_unref(Object *obj)
{
g_assert(atomic_read(&obj->ref) > 0);
if (atomic_dec_and_test(&obj->ref)) {
- object_finalize(obj);
+ /* fixme, maybe introduce obj->finalze to make this more elegant */
+ if (object_dynamic_cast(obj, TYPE_DEVICE) != NULL) {
+ qemu_reclaimer_enqueue(obj, object_finalize);
+ } else {
+ object_finalize(obj);
+ }
}
}
--
1.7.4.4
- [Qemu-devel] [PATCH 11/15] lock: introduce global lock for device tree, (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, 2012/08/08
[Qemu-devel] [PATCH 14/15] qom: object_unref call reclaimer,
Liu Ping Fan <=
[Qemu-devel] [PATCH 08/15] memory: introduce PhysMap to present snapshot of toploygy, Liu Ping Fan, 2012/08/08