[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/18] spapr_cpu_core: drop reference on ICP object d
From: |
David Gibson |
Subject: |
[Qemu-devel] [PULL 09/18] spapr_cpu_core: drop reference on ICP object during CPU realization |
Date: |
Thu, 25 May 2017 13:51:23 +1000 |
From: Greg Kurz <address@hidden>
When a piece of code allocates an object, it implicitely gets a reference
on it. If it then makes that object a child property of another object, it
should drop its own reference at some point otherwise the child object can
never be finalized. The current code hence leaks one ICP object per CPU
when hot-removing a core.
Failing to add a newly allocated ICP object to the CPU is a bug. While here,
let's ensure QEMU aborts if this ever happens.
Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr_cpu_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 1df1404..ff7058e 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -143,7 +143,8 @@ static void spapr_cpu_core_realize_child(Object *child,
Error **errp)
Object *obj;
obj = object_new(spapr->icp_type);
- object_property_add_child(OBJECT(cpu), "icp", obj, NULL);
+ object_property_add_child(OBJECT(cpu), "icp", obj, &error_abort);
+ object_unref(obj);
object_property_add_const_link(obj, "xics", OBJECT(spapr), &error_abort);
object_property_set_bool(obj, true, "realized", &local_err);
if (local_err) {
--
2.9.4
- [Qemu-devel] [PULL 04/18] spapr-cpu-core: release ICP object when realization fails, (continued)
- [Qemu-devel] [PULL 04/18] spapr-cpu-core: release ICP object when realization fails, David Gibson, 2017/05/24
- [Qemu-devel] [PULL 10/18] spapr: fix error reporting in xics_system_init(), David Gibson, 2017/05/24
- [Qemu-devel] [PULL 06/18] xics_kvm: cache already enabled vCPU ids, David Gibson, 2017/05/24
- [Qemu-devel] [PULL 11/18] pseries: Split CAS PVR negotiation out into a separate function, David Gibson, 2017/05/24
- [Qemu-devel] [PULL 05/18] spapr: Consolidate HPT freeing code into a routine, David Gibson, 2017/05/24
- [Qemu-devel] [PULL 15/18] hw/ppc: removing drc->detach_cb and drc->detach_cb_opaque, David Gibson, 2017/05/24
- [Qemu-devel] [PULL 13/18] spapr: add pre_plug function for memory, David Gibson, 2017/05/24
- [Qemu-devel] [PULL 16/18] hw/ppc: migrating the DRC state of hotplugged devices, David Gibson, 2017/05/24
- [Qemu-devel] [PULL 07/18] spapr: ensure core_slot isn't NULL in spapr_core_unplug(), David Gibson, 2017/05/24
- [Qemu-devel] [PULL 09/18] spapr_cpu_core: drop reference on ICP object during CPU realization,
David Gibson <=
- [Qemu-devel] [PULL 08/18] hw/ppc/spapr_events.c: removing 'exception' from sPAPREventLogEntry, David Gibson, 2017/05/24
- [Qemu-devel] [PULL 17/18] hw/ppc/spapr.c: recover pending LMB unplug info in spapr_lmb_release, David Gibson, 2017/05/24
- [Qemu-devel] [PULL 18/18] xics: add unrealize handler, David Gibson, 2017/05/24
- [Qemu-devel] [PULL 12/18] pseries: Restore support for total vcpus not a multiple of threads-per-core for old machine types, David Gibson, 2017/05/24
- [Qemu-devel] [PULL 14/18] hw/ppc/spapr.c: adding pending_dimm_unplugs to sPAPRMachineState, David Gibson, 2017/05/24
- Re: [Qemu-devel] [PULL 00/18] ppc-for-2.10 queue 20170525, Stefan Hajnoczi, 2017/05/30