Skip to content

Commit ecda255

Browse files
Sam Bobroffdgibson
authored andcommitted
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>
1 parent 5d19be6 commit ecda255

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

hw/ppc/spapr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2480,6 +2480,8 @@ static void spapr_init_cpus(sPAPRMachineState *spapr)
24802480
object_property_set_int(core, core_id, CPU_CORE_PROP_CORE_ID,
24812481
&error_fatal);
24822482
object_property_set_bool(core, true, "realized", &error_fatal);
2483+
2484+
object_unref(core);
24832485
}
24842486
}
24852487
}

0 commit comments

Comments
 (0)