diff options
author | Sam Bobroff <sbobroff@linux.ibm.com> | 2018-08-30 15:54:40 +1000 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2018-08-30 15:58:42 +1000 |
commit | ecda255ebab14adc35731fe67f8cfa70624010e2 (patch) | |
tree | f91481833298bc232bc83d9f719465b8b349cce5 /hw/ppc | |
parent | 5d19be6c705ab827313dd76ec09fc6e1d6771bc8 (diff) |
spapr: Correct reference count on spapr-cpu-core
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>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc')
-rw-r--r-- | hw/ppc/spapr.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 505d4c84e5..4a9dd4d9bc 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2480,6 +2480,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); } } } |