qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Sam Bobroff <sbobroff@linux.ibm.com>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, lvivier@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/1] spapr: Correct reference count on spapr-cpu-core
Date: Thu, 30 Aug 2018 16:07:37 +1000	[thread overview]
Message-ID: <20180830060737.GK2222@umbus.fritz.box> (raw)
In-Reply-To: <d14d97226c3b432fa70513dcd7bacf59c6881cbd.1535608432.git.sbobroff@linux.ibm.com>

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

On Thu, Aug 30, 2018 at 03:54:40PM +1000, Sam Bobroff wrote:
11;rgb:ffff/ffff/ffff> spapr_init_cpus() currently creates spapr-cpu-core objects via
> object_new() and setting their realized property to true. This leaves
> their reference count at two, because object_new() adds an initial
> reference and the realization attaches them to a default parent object
> which also increments the reference count.
> 
> This causes a problem if one of these cores is hot unplugged: no
> delete event is generated for it because it's reference count doesn't
> reach zero when it is detached from it's parent.
> 
> Correct this by adding a call to object_unref() in spapr_init_cpus().
> 
> Signed-off-by: Sam Bobroff <sbobroff@linux.ibm.com>

Applied to ppc-for-3.1.

> ---
>  hw/ppc/spapr.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 0d032a1ad0..fbb00f0c56 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -2502,6 +2502,8 @@ static void spapr_init_cpus(sPAPRMachineState *spapr)
>              object_property_set_int(core, core_id, CPU_CORE_PROP_CORE_ID,
>                                      &error_fatal);
>              object_property_set_bool(core, true, "realized", &error_fatal);
> +
> +            object_unref(core);
>          }
>      }
>  }

-- 
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: 833 bytes --]

      reply	other threads:[~2018-08-30  6:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-30  5:54 [Qemu-devel] [PATCH 1/1] spapr: Correct reference count on spapr-cpu-core Sam Bobroff
2018-08-30  6:07 ` David Gibson [this message]

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=20180830060737.GK2222@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=lvivier@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=sbobroff@linux.ibm.com \
    /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).