[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 09/18] spapr_cpu_core: drop reference on ICP object dur
From: |
David Gibson |
Subject: |
[Qemu-ppc] [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-ppc] [PULL 00/18] ppc-for-2.10 queue 20170525, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 01/18] target/ppc: reset reservation in do_rfi(), David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 02/18] ppc/xics: simplify prototype of xics_spapr_init(), David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 04/18] spapr-cpu-core: release ICP object when realization fails, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 10/18] spapr: fix error reporting in xics_system_init(), David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 08/18] hw/ppc/spapr_events.c: removing 'exception' from sPAPREventLogEntry, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 07/18] spapr: ensure core_slot isn't NULL in spapr_core_unplug(), David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 09/18] spapr_cpu_core: drop reference on ICP object during CPU realization,
David Gibson <=
- [Qemu-ppc] [PULL 06/18] xics_kvm: cache already enabled vCPU ids, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 13/18] spapr: add pre_plug function for memory, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 11/18] pseries: Split CAS PVR negotiation out into a separate function, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 14/18] hw/ppc/spapr.c: adding pending_dimm_unplugs to sPAPRMachineState, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 03/18] spapr: sanitize error handling in spapr_ics_create(), David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 05/18] spapr: Consolidate HPT freeing code into a routine, David Gibson, 2017/05/24
- [Qemu-ppc] [PULL 18/18] xics: add unrealize handler, David Gibson, 2017/05/24