qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: qemu-devel@nongnu.org
Cc: armbru@redhat.com,
	Daniel Henrique Barboza <danielhb413@gmail.com>,
	qemu-ppc@nongnu.org, groug@kaod.org, david@gibson.dropbear.id.au
Subject: [PATCH 2/4] spapr_drc.c: send DEVICE_NOT_DELETED event on unplug timeout
Date: Fri, 12 Mar 2021 17:07:38 -0300	[thread overview]
Message-ID: <20210312200740.815014-3-danielhb413@gmail.com> (raw)
In-Reply-To: <20210312200740.815014-1-danielhb413@gmail.com>

The newly added DEVICE_NOT_DELETED QAPI event is adequate to be
sent when the hotunplug timeout expires, letting users know that
something happened inside the guest and the pseries machine didn't
delete the device from QOM.

After this patch, if an user try to hotunplug the last online CPU of
the guest, the "DEIVCE_NOT_DELETED" event will be issued when the
hotunplug timeout for 'core1' is expired:

{"execute": "device_del", "arguments": {"id": "core1"} }
{"return": {}}

{"execute": "device_del", "arguments": {"id": "core1"} }
{"error": {"class": "GenericError",
           "desc": "core-id 1 unplug is still pending, 12 seconds timeout remaining"}}

{"execute": "device_del", "arguments": {"id": "core1"} }
{"error": {"class": "GenericError",
           "desc": "core-id 1 unplug is still pending, 5 seconds timeout remaining"}}

{"timestamp": {"seconds": 1615570254, "microseconds": 573986},
  "event": "DEVICE_NOT_DELETED",
  "data": {"device": "core1", "path": "/machine/peripheral/core1"}}

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
 hw/ppc/spapr_drc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
index 8a71b03800..14f39cec71 100644
--- a/hw/ppc/spapr_drc.c
+++ b/hw/ppc/spapr_drc.c
@@ -13,6 +13,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qnull.h"
+#include "qapi/qapi-events-qdev.h"
 #include "cpu.h"
 #include "qemu/cutils.h"
 #include "hw/ppc/spapr_drc.h"
@@ -529,9 +530,16 @@ static const VMStateDescription vmstate_spapr_drc = {
 static void drc_unplug_timeout_cb(void *opaque)
 {
     SpaprDrc *drc = opaque;
+    DeviceState *dev = drc->dev;
 
     if (drc->unplug_requested) {
         drc->unplug_requested = false;
+
+        if (dev) {
+            qapi_event_send_device_not_deleted(!!dev->id,
+                                               dev->id,
+                                               dev->canonical_path);
+        }
     }
 }
 
-- 
2.29.2



  parent reply	other threads:[~2021-03-12 20:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12 20:07 [PATCH 0/4] DEVICE_NOT_DELETED/DEVICE_UNPLUG_ERROR QAPI events Daniel Henrique Barboza
2021-03-12 20:07 ` [PATCH 1/4] qapi/qdev.json: add DEVICE_NOT_DELETED event Daniel Henrique Barboza
2021-03-23 18:00   ` Eric Blake
2021-03-23 18:12     ` Daniel Henrique Barboza
2021-03-12 20:07 ` Daniel Henrique Barboza [this message]
2021-03-12 20:07 ` [PATCH 3/4] qapi/machine.json: add DEVICE_UNPLUG_ERROR QAPI event Daniel Henrique Barboza
2021-03-12 20:07 ` [PATCH 4/4] spapr.c: use DEVICE_UNPLUG_ERROR event in spapr_memory_unplug_rollback() Daniel Henrique Barboza
2021-03-23  1:12 ` [PATCH 0/4] DEVICE_NOT_DELETED/DEVICE_UNPLUG_ERROR QAPI events David Gibson
2021-03-23 17:10   ` Daniel Henrique Barboza
2021-03-24  1:40     ` David Gibson
2021-03-24 19:09       ` Daniel Henrique Barboza
2021-03-25  1:32         ` David Gibson
2021-03-29 23:28         ` Igor Mammedov
2021-03-30 23:46           ` David Gibson
2021-03-31  9:49             ` Igor Mammedov
2021-04-01  1:31               ` David Gibson
2021-03-31 19:47             ` Daniel Henrique Barboza
2021-04-01  1:36               ` David Gibson
2021-03-31 19:40           ` Daniel Henrique Barboza
2021-04-20 17:11 ` Daniel Henrique Barboza

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210312200740.815014-3-danielhb413@gmail.com \
    --to=danielhb413@gmail.com \
    --cc=armbru@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=groug@kaod.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).