[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [PATCH v2 1/4] spapr_cpu_core: drop reference on ICP obje
From: |
David Gibson |
Subject: |
Re: [Qemu-ppc] [PATCH v2 1/4] spapr_cpu_core: drop reference on ICP object during CPU realization |
Date: |
Sat, 20 May 2017 16:40:36 +1000 |
User-agent: |
Mutt/1.8.0 (2017-02-23) |
On Fri, May 19, 2017 at 12:32:04PM +0200, Greg Kurz wrote:
> 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>
Applied to ppc-for-2.10.
> ---
> 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 1df1404ea52d..ff7058ecc00e 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) {
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature
[Qemu-ppc] [PATCH v2 3/4] target/ppc: consolidate CPU device-tree id computation in helper, Greg Kurz, 2017/05/19