|
|
4ec855 |
From 2f11a1952881d9e2dcc8acb3549441dbd9ade1e3 Mon Sep 17 00:00:00 2001
|
|
|
4ec855 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
4ec855 |
Date: Wed, 14 Aug 2019 08:42:26 +0100
|
|
|
4ec855 |
Subject: [PATCH 03/10] virtio-blk: Increase in_flight for request restart BH
|
|
|
4ec855 |
|
|
|
4ec855 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
4ec855 |
Message-id: <20190814084229.6458-3-kwolf@redhat.com>
|
|
|
4ec855 |
Patchwork-id: 89967
|
|
|
4ec855 |
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH 2/5] virtio-blk: Increase in_flight for request restart BH
|
|
|
4ec855 |
Bugzilla: 1716349
|
|
|
4ec855 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
4ec855 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
4ec855 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
4ec855 |
|
|
|
4ec855 |
virtio_blk_dma_restart_bh() submits new requests, so in order to make
|
|
|
4ec855 |
sure that these requests are not started inside a drained section of the
|
|
|
4ec855 |
attached BlockBackend, we need to make sure that draining the
|
|
|
4ec855 |
BlockBackend waits for the BH to be executed.
|
|
|
4ec855 |
|
|
|
4ec855 |
This BH is still questionable because its scheduled in the main thread
|
|
|
4ec855 |
instead of the configured iothread. Leave a FIXME comment for this.
|
|
|
4ec855 |
|
|
|
4ec855 |
But with this fix, enabling the data plane at least waits for these
|
|
|
4ec855 |
requests (in bdrv_set_aio_context()) instead of changing the AioContext
|
|
|
4ec855 |
under their feet and making them run in the wrong thread, causing
|
|
|
4ec855 |
crashes and failures (e.g. due to missing locking).
|
|
|
4ec855 |
|
|
|
4ec855 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
4ec855 |
(cherry picked from commit 680f200217748e0920b79ec1d524717c2f50935b)
|
|
|
4ec855 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
4ec855 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
4ec855 |
---
|
|
|
4ec855 |
hw/block/virtio-blk.c | 4 ++++
|
|
|
4ec855 |
1 file changed, 4 insertions(+)
|
|
|
4ec855 |
|
|
|
4ec855 |
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
|
|
|
4ec855 |
index b1532e4..691ade4 100644
|
|
|
4ec855 |
--- a/hw/block/virtio-blk.c
|
|
|
4ec855 |
+++ b/hw/block/virtio-blk.c
|
|
|
4ec855 |
@@ -678,6 +678,7 @@ static void virtio_blk_dma_restart_bh(void *opaque)
|
|
|
4ec855 |
if (mrb.num_reqs) {
|
|
|
4ec855 |
virtio_blk_submit_multireq(s->blk, &mrb);
|
|
|
4ec855 |
}
|
|
|
4ec855 |
+ blk_dec_in_flight(s->conf.conf.blk);
|
|
|
4ec855 |
aio_context_release(blk_get_aio_context(s->conf.conf.blk));
|
|
|
4ec855 |
}
|
|
|
4ec855 |
|
|
|
4ec855 |
@@ -691,8 +692,11 @@ static void virtio_blk_dma_restart_cb(void *opaque, int running,
|
|
|
4ec855 |
}
|
|
|
4ec855 |
|
|
|
4ec855 |
if (!s->bh) {
|
|
|
4ec855 |
+ /* FIXME The data plane is not started yet, so these requests are
|
|
|
4ec855 |
+ * processed in the main thread. */
|
|
|
4ec855 |
s->bh = aio_bh_new(blk_get_aio_context(s->conf.conf.blk),
|
|
|
4ec855 |
virtio_blk_dma_restart_bh, s);
|
|
|
4ec855 |
+ blk_inc_in_flight(s->conf.conf.blk);
|
|
|
4ec855 |
qemu_bh_schedule(s->bh);
|
|
|
4ec855 |
}
|
|
|
4ec855 |
}
|
|
|
4ec855 |
--
|
|
|
4ec855 |
1.8.3.1
|
|
|
4ec855 |
|