All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio-blk: Add blk_drain() to virtio_blk_device_unrealize()
@ 2019-10-18 14:28 Julia Suvorova
  2019-10-21 15:17 ` Stefan Hajnoczi
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Suvorova @ 2019-10-18 14:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Max Reitz, Julia Suvorova, Stefan Hajnoczi,
	Michael S. Tsirkin

QEMU does not wait for completed I/O requests, assuming that the guest
driver will reset the device before calling unrealize(). This does not
happen on Windows, and QEMU crashes in virtio_notify(), getting the
result of a completed I/O request on hot-unplugged device.

Signed-off-by: Julia Suvorova <jusual@redhat.com>
---
 hw/block/virtio-blk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index ed2ddebd2b..14e9f85b8b 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -1207,6 +1207,7 @@ static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp)
     VirtIODevice *vdev = VIRTIO_DEVICE(dev);
     VirtIOBlock *s = VIRTIO_BLK(dev);
 
+    blk_drain(s->blk);
     virtio_blk_data_plane_destroy(s->dataplane);
     s->dataplane = NULL;
     qemu_del_vm_change_state_handler(s->change);
-- 
2.21.0



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

* Re: [PATCH] virtio-blk: Add blk_drain() to virtio_blk_device_unrealize()
  2019-10-18 14:28 [PATCH] virtio-blk: Add blk_drain() to virtio_blk_device_unrealize() Julia Suvorova
@ 2019-10-21 15:17 ` Stefan Hajnoczi
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2019-10-21 15:17 UTC (permalink / raw)
  To: Julia Suvorova; +Cc: Kevin Wolf, Max Reitz, qemu-devel, Michael S. Tsirkin

[-- Attachment #1: Type: text/plain, Size: 572 bytes --]

On Fri, Oct 18, 2019 at 04:28:56PM +0200, Julia Suvorova wrote:
> QEMU does not wait for completed I/O requests, assuming that the guest
> driver will reset the device before calling unrealize(). This does not
> happen on Windows, and QEMU crashes in virtio_notify(), getting the
> result of a completed I/O request on hot-unplugged device.
> 
> Signed-off-by: Julia Suvorova <jusual@redhat.com>
> ---
>  hw/block/virtio-blk.c | 1 +
>  1 file changed, 1 insertion(+)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2019-10-21 15:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-18 14:28 [PATCH] virtio-blk: Add blk_drain() to virtio_blk_device_unrealize() Julia Suvorova
2019-10-21 15:17 ` Stefan Hajnoczi

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.