]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
spapr: Correct reference count on spapr-cpu-core
authorSam Bobroff <sbobroff@linux.ibm.com>
Thu, 30 Aug 2018 05:54:40 +0000 (15:54 +1000)
committerDavid Gibson <david@gibson.dropbear.id.au>
Thu, 30 Aug 2018 05:58:42 +0000 (15:58 +1000)
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>
hw/ppc/spapr.c

index 505d4c84e5e039fdc6f63f6d15cde8bc055a564e..4a9dd4d9bc14876958af633aee2835fdce02facc 100644 (file)
@@ -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);
         }
     }
 }