[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/4] spapr_drc.c: send DEVICE_NOT_DELETED event on unplug timeout
From: |
Daniel Henrique Barboza |
Subject: |
[PATCH 2/4] spapr_drc.c: send DEVICE_NOT_DELETED event on unplug timeout |
Date: |
Fri, 12 Mar 2021 17:07:38 -0300 |
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
- [PATCH 0/4] DEVICE_NOT_DELETED/DEVICE_UNPLUG_ERROR QAPI events, Daniel Henrique Barboza, 2021/03/12
- [PATCH 1/4] qapi/qdev.json: add DEVICE_NOT_DELETED event, Daniel Henrique Barboza, 2021/03/12
- [PATCH 2/4] spapr_drc.c: send DEVICE_NOT_DELETED event on unplug timeout,
Daniel Henrique Barboza <=
- [PATCH 3/4] qapi/machine.json: add DEVICE_UNPLUG_ERROR QAPI event, Daniel Henrique Barboza, 2021/03/12
- [PATCH 4/4] spapr.c: use DEVICE_UNPLUG_ERROR event in spapr_memory_unplug_rollback(), Daniel Henrique Barboza, 2021/03/12
- Re: [PATCH 0/4] DEVICE_NOT_DELETED/DEVICE_UNPLUG_ERROR QAPI events, David Gibson, 2021/03/22
- Re: [PATCH 0/4] DEVICE_NOT_DELETED/DEVICE_UNPLUG_ERROR QAPI events, Daniel Henrique Barboza, 2021/03/23
- Re: [PATCH 0/4] DEVICE_NOT_DELETED/DEVICE_UNPLUG_ERROR QAPI events, David Gibson, 2021/03/23
- Re: [PATCH 0/4] DEVICE_NOT_DELETED/DEVICE_UNPLUG_ERROR QAPI events, Daniel Henrique Barboza, 2021/03/24
- Re: [PATCH 0/4] DEVICE_NOT_DELETED/DEVICE_UNPLUG_ERROR QAPI events, David Gibson, 2021/03/24
- Re: [PATCH 0/4] DEVICE_NOT_DELETED/DEVICE_UNPLUG_ERROR QAPI events, Igor Mammedov, 2021/03/29
- Re: [PATCH 0/4] DEVICE_NOT_DELETED/DEVICE_UNPLUG_ERROR QAPI events, David Gibson, 2021/03/30
- Re: [PATCH 0/4] DEVICE_NOT_DELETED/DEVICE_UNPLUG_ERROR QAPI events, Igor Mammedov, 2021/03/31