qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/2] Block patches
@ 2019-10-25 19:18 Stefan Hajnoczi
  2019-10-25 19:18 ` [PULL 1/2] virtio-blk: Add blk_drain() to virtio_blk_device_unrealize() Stefan Hajnoczi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2019-10-25 19:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Peter Maydell, qemu-block, Michael S. Tsirkin,
	Max Reitz, Stefan Hajnoczi, Fam Zheng

The following changes since commit 58560ad254fbda71d4daa6622d71683190070ee2:

  Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.2-20191024' into staging (2019-10-24 16:22:58 +0100)

are available in the Git repository at:

  https://github.com/stefanha/qemu.git tags/block-pull-request

for you to fetch changes up to d154ef37ff885918fa3e512fd7a8e42870291667:

  yield_until_fd_readable: make it work with any AioContect (2019-10-25 14:38:29 +0200)

----------------------------------------------------------------
Pull request

----------------------------------------------------------------

Dietmar Maurer (1):
  yield_until_fd_readable: make it work with any AioContect

Julia Suvorova (1):
  virtio-blk: Add blk_drain() to virtio_blk_device_unrealize()

 hw/block/virtio-blk.c    | 1 +
 util/qemu-coroutine-io.c | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

-- 
2.21.0



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

* [PULL 1/2] virtio-blk: Add blk_drain() to virtio_blk_device_unrealize()
  2019-10-25 19:18 [PULL 0/2] Block patches Stefan Hajnoczi
@ 2019-10-25 19:18 ` Stefan Hajnoczi
  2019-10-25 19:18 ` [PULL 2/2] yield_until_fd_readable: make it work with any AioContect Stefan Hajnoczi
  2019-10-26  9:13 ` [PULL 0/2] Block patches Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2019-10-25 19:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Peter Maydell, qemu-block, Michael S. Tsirkin,
	Julia Suvorova, Max Reitz, Stefan Hajnoczi, Fam Zheng

From: Julia Suvorova <jusual@redhat.com>

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>
Message-Id: <20191018142856.31870-1-jusual@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@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] 4+ messages in thread

* [PULL 2/2] yield_until_fd_readable: make it work with any AioContect
  2019-10-25 19:18 [PULL 0/2] Block patches Stefan Hajnoczi
  2019-10-25 19:18 ` [PULL 1/2] virtio-blk: Add blk_drain() to virtio_blk_device_unrealize() Stefan Hajnoczi
@ 2019-10-25 19:18 ` Stefan Hajnoczi
  2019-10-26  9:13 ` [PULL 0/2] Block patches Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2019-10-25 19:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Peter Maydell, qemu-block, Michael S. Tsirkin,
	Max Reitz, Stefan Hajnoczi, Fam Zheng, Dietmar Maurer

From: Dietmar Maurer <dietmar@proxmox.com>

Simply use qemu_get_current_aio_context().

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
Message-Id: <20191024045610.9071-1-dietmar@proxmox.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 util/qemu-coroutine-io.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/util/qemu-coroutine-io.c b/util/qemu-coroutine-io.c
index 44a8969a69..5b80bb416f 100644
--- a/util/qemu-coroutine-io.c
+++ b/util/qemu-coroutine-io.c
@@ -67,6 +67,7 @@ qemu_co_send_recv(int sockfd, void *buf, size_t bytes, bool do_send)
 }
 
 typedef struct {
+    AioContext *ctx;
     Coroutine *co;
     int fd;
 } FDYieldUntilData;
@@ -74,7 +75,7 @@ typedef struct {
 static void fd_coroutine_enter(void *opaque)
 {
     FDYieldUntilData *data = opaque;
-    qemu_set_fd_handler(data->fd, NULL, NULL, NULL);
+    aio_set_fd_handler(data->ctx, data->fd, false, NULL, NULL, NULL, NULL);
     qemu_coroutine_enter(data->co);
 }
 
@@ -83,8 +84,10 @@ void coroutine_fn yield_until_fd_readable(int fd)
     FDYieldUntilData data;
 
     assert(qemu_in_coroutine());
+    data.ctx = qemu_get_current_aio_context();
     data.co = qemu_coroutine_self();
     data.fd = fd;
-    qemu_set_fd_handler(fd, fd_coroutine_enter, NULL, &data);
+    aio_set_fd_handler(
+        data.ctx, fd, false, fd_coroutine_enter, NULL, NULL, &data);
     qemu_coroutine_yield();
 }
-- 
2.21.0



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

* Re: [PULL 0/2] Block patches
  2019-10-25 19:18 [PULL 0/2] Block patches Stefan Hajnoczi
  2019-10-25 19:18 ` [PULL 1/2] virtio-blk: Add blk_drain() to virtio_blk_device_unrealize() Stefan Hajnoczi
  2019-10-25 19:18 ` [PULL 2/2] yield_until_fd_readable: make it work with any AioContect Stefan Hajnoczi
@ 2019-10-26  9:13 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2019-10-26  9:13 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Kevin Wolf, Fam Zheng, Qemu-block, Michael S. Tsirkin,
	QEMU Developers, Max Reitz

On Fri, 25 Oct 2019 at 20:18, Stefan Hajnoczi <stefanha@redhat.com> wrote:
>
> The following changes since commit 58560ad254fbda71d4daa6622d71683190070ee2:
>
>   Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.2-20191024' into staging (2019-10-24 16:22:58 +0100)
>
> are available in the Git repository at:
>
>   https://github.com/stefanha/qemu.git tags/block-pull-request
>
> for you to fetch changes up to d154ef37ff885918fa3e512fd7a8e42870291667:
>
>   yield_until_fd_readable: make it work with any AioContect (2019-10-25 14:38:29 +0200)
>
> ----------------------------------------------------------------
> Pull request
>
> ----------------------------------------------------------------
>
> Dietmar Maurer (1):
>   yield_until_fd_readable: make it work with any AioContect
>
> Julia Suvorova (1):
>   virtio-blk: Add blk_drain() to virtio_blk_device_unrealize()


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.2
for any user-visible changes.

-- PMM


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

end of thread, other threads:[~2019-10-26  9:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-25 19:18 [PULL 0/2] Block patches Stefan Hajnoczi
2019-10-25 19:18 ` [PULL 1/2] virtio-blk: Add blk_drain() to virtio_blk_device_unrealize() Stefan Hajnoczi
2019-10-25 19:18 ` [PULL 2/2] yield_until_fd_readable: make it work with any AioContect Stefan Hajnoczi
2019-10-26  9:13 ` [PULL 0/2] Block patches Peter Maydell

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).