Commit 47c8c915 authored by Greg Kurz's avatar Greg Kurz Committed by David Gibson
Browse files

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: default avatarGreg Kurz <groug@kaod.org>
Message-Id: <157185826035.3073024.1664101000438499392.stgit@bahia.lan>
Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
parent cb97526a
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -3741,10 +3741,11 @@ void spapr_core_unplug_request(HotplugHandler *hotplug_dev, DeviceState *dev,
                          spapr_vcpu_id(spapr, cc->core_id));
    g_assert(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,
                           void *fdt, int *fdt_start_offset, Error **errp)