* [PATCH] qdev-monitor: Forbid repeated device_del
@ 2020-02-20 16:55 Julia Suvorova
2020-02-21 13:53 ` Stefan Hajnoczi
0 siblings, 1 reply; 3+ messages in thread
From: Julia Suvorova @ 2020-02-20 16:55 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Daniel P. Berrangé,
Eduardo Habkost, Julia Suvorova, Michael S. Tsirkin
Device unplug can be done asynchronously. Thus, sending the second
device_del before the previous unplug is complete may lead to
unexpected results. On PCIe devices, this cancels the hot-unplug
process.
Signed-off-by: Julia Suvorova <jusual@redhat.com>
---
qdev-monitor.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/qdev-monitor.c b/qdev-monitor.c
index 8ce71a206b..8a2a9538cd 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -887,6 +887,12 @@ void qmp_device_del(const char *id, Error **errp)
{
DeviceState *dev = find_device_state(id, errp);
if (dev != NULL) {
+ if (dev->pending_deleted_event) {
+ error_setg(errp, "Device %s is already in the "
+ "process of unplug", id);
+ return;
+ }
+
qdev_unplug(dev, errp);
}
}
--
2.24.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] qdev-monitor: Forbid repeated device_del
2020-02-20 16:55 [PATCH] qdev-monitor: Forbid repeated device_del Julia Suvorova
@ 2020-02-21 13:53 ` Stefan Hajnoczi
2020-02-21 13:58 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Hajnoczi @ 2020-02-21 13:53 UTC (permalink / raw)
To: Julia Suvorova
Cc: Paolo Bonzini, Michael S. Tsirkin, Daniel P. Berrangé,
qemu-devel, Eduardo Habkost
[-- Attachment #1: Type: text/plain, Size: 464 bytes --]
On Thu, Feb 20, 2020 at 05:55:56PM +0100, Julia Suvorova wrote:
> Device unplug can be done asynchronously. Thus, sending the second
> device_del before the previous unplug is complete may lead to
> unexpected results. On PCIe devices, this cancels the hot-unplug
> process.
>
> Signed-off-by: Julia Suvorova <jusual@redhat.com>
> ---
> qdev-monitor.c | 6 ++++++
> 1 file changed, 6 insertions(+)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] qdev-monitor: Forbid repeated device_del
2020-02-21 13:53 ` Stefan Hajnoczi
@ 2020-02-21 13:58 ` Paolo Bonzini
0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2020-02-21 13:58 UTC (permalink / raw)
To: Stefan Hajnoczi, Julia Suvorova
Cc: Michael S. Tsirkin, Daniel P. Berrangé, qemu-devel, Eduardo Habkost
On 21/02/20 14:53, Stefan Hajnoczi wrote:
> On Thu, Feb 20, 2020 at 05:55:56PM +0100, Julia Suvorova wrote:
>> Device unplug can be done asynchronously. Thus, sending the second
>> device_del before the previous unplug is complete may lead to
>> unexpected results. On PCIe devices, this cancels the hot-unplug
>> process.
>>
>> Signed-off-by: Julia Suvorova <jusual@redhat.com>
>> ---
>> qdev-monitor.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-02-21 13:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-20 16:55 [PATCH] qdev-monitor: Forbid repeated device_del Julia Suvorova
2020-02-21 13:53 ` Stefan Hajnoczi
2020-02-21 13:58 ` Paolo Bonzini
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).