aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc/spapr.c
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2019-10-23 21:17:40 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2019-10-24 09:37:54 +1100
commit47c8c915b1628360d4d7d483e421e49b6bcfc371 (patch)
tree136d99d00f8e8149f1728cd4b002847eb93529a7 /hw/ppc/spapr.c
parentcb97526aa47e0590a04bf90579b76584fbc0d79f (diff)
downloadqemu-47c8c915b1628360d4d7d483e421e49b6bcfc371.zip
qemu-47c8c915b1628360d4d7d483e421e49b6bcfc371.tar.gz
qemu-47c8c915b1628360d4d7d483e421e49b6bcfc371.tar.bz2
spapr: Don't request to unplug the same core twice
We must not call spapr_drc_detach() on a detached DRC otherwise bad things can happen, ie. QEMU hangs or crashes. This is easily demonstrated with a CPU hotplug/unplug loop using QMP. Signed-off-by: Greg Kurz <groug@kaod.org> Message-Id: <157185826035.3073024.1664101000438499392.stgit@bahia.lan> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc/spapr.c')
-rw-r--r--hw/ppc/spapr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index f9410d3..94f9d27 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3741,9 +3741,10 @@ void spapr_core_unplug_request(HotplugHandler *hotplug_dev, DeviceState *dev,
spapr_vcpu_id(spapr, cc->core_id));
g_assert(drc);
- spapr_drc_detach(drc);
-
- spapr_hotplug_req_remove_by_index(drc);
+ if (!spapr_drc_unplug_requested(drc)) {
+ spapr_drc_detach(drc);
+ spapr_hotplug_req_remove_by_index(drc);
+ }
}
int spapr_core_dt_populate(SpaprDrc *drc, SpaprMachineState *spapr,