All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spapr: Don't request to unplug the same core twice
@ 2019-10-23 19:17 Greg Kurz
  2019-10-23 22:38 ` David Gibson
  0 siblings, 1 reply; 4+ messages in thread
From: Greg Kurz @ 2019-10-23 19:17 UTC (permalink / raw)
  To: David Gibson; +Cc: qemu-ppc, qemu-devel

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>
---
 hw/ppc/spapr.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index f9410d390a07..94f9d27096af 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,



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-29  8:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-23 19:17 [PATCH] spapr: Don't request to unplug the same core twice Greg Kurz
2019-10-23 22:38 ` David Gibson
2019-10-24  6:28   ` Greg Kurz
2019-10-28 22:20     ` David Gibson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.