提交 ecda255e 编写于 作者: S Sam Bobroff 提交者: David Gibson

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: NSam Bobroff <sbobroff@linux.ibm.com>
Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
上级 5d19be6c
......@@ -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);
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册