qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Greg Kurz <groug@kaod.org>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	Laurent Vivier <lvivier@redhat.com>,
	Bharata B Rao <bharata@linux.vnet.ibm.com>,
	Cedric Le Goater <clg@kaod.org>
Subject: Re: [Qemu-devel] [PATCH v2 1/4] spapr_cpu_core: drop reference on ICP object during CPU realization
Date: Sat, 20 May 2017 16:40:36 +1000	[thread overview]
Message-ID: <20170520064036.GC30246@umbus.fritz.box> (raw)
In-Reply-To: <149518992406.24289.10624548011389715164.stgit@bahia.lan>

[-- Attachment #1: Type: text/plain, Size: 1591 bytes --]

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 <groug@kaod.org>

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2017-05-21 10:14 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-19 10:31 [Qemu-devel] [PATCH v2 0/4] spapr/xics: fix migration of older machine types Greg Kurz
2017-05-19 10:32 ` [Qemu-devel] [PATCH v2 1/4] spapr_cpu_core: drop reference on ICP object during CPU realization Greg Kurz
2017-05-20  6:40   ` David Gibson [this message]
2017-05-19 10:32 ` [Qemu-devel] [PATCH v2 2/4] spapr: fix error reporting in xics_system_init() Greg Kurz
2017-05-20  6:45   ` David Gibson
2017-05-21 17:03     ` Greg Kurz
2017-05-22  1:26       ` David Gibson
2017-05-22  7:41       ` Markus Armbruster
2017-05-22  9:00         ` David Gibson
2017-05-19 10:32 ` [Qemu-devel] [PATCH v2 3/4] target/ppc: consolidate CPU device-tree id computation in helper Greg Kurz
2017-05-22  2:04   ` David Gibson
2017-05-22  2:12     ` David Gibson
2017-05-22  9:09       ` Greg Kurz
2017-05-22 14:33       ` Greg Kurz
2017-05-23  2:37         ` David Gibson
2017-05-22  8:59     ` Greg Kurz
2017-05-22 13:13       ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2017-05-23  6:37         ` David Gibson
2017-05-23  2:35       ` [Qemu-devel] " David Gibson
2017-05-23  6:57         ` Greg Kurz
2017-05-19 10:32 ` [Qemu-devel] [PATCH v2 4/4] spapr: fix migration of ICP objects from/to older QEMU Greg Kurz
2017-05-22  2:30   ` David Gibson
2017-05-22  7:20     ` Cédric Le Goater
2017-05-22  9:15       ` David Gibson
2017-05-22 15:04         ` Greg Kurz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170520064036.GC30246@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=clg@kaod.org \
    --cc=groug@kaod.org \
    --cc=lvivier@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).