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