[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/14] virtio-blk: tolerate failure to set BlockBackend AioContext
|
From: |
Kevin Wolf |
|
Subject: |
[PULL 12/14] virtio-blk: tolerate failure to set BlockBackend AioContext |
|
Date: |
Fri, 19 Jan 2024 19:13:25 +0100 |
From: Stefan Hajnoczi <stefanha@redhat.com>
We no longer rely on setting the AioContext since the block layer
IO_CODE APIs can be called from any thread. Now it's just a hint to help
block jobs and other operations co-locate themselves in a thread with
the guest I/O requests. Keep going if setting the AioContext fails.
Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20240119135748.270944-6-stefanha@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
hw/block/virtio-blk.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 4525988d92..73248d15c8 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -1786,11 +1786,14 @@ static int virtio_blk_start_ioeventfd(VirtIODevice
*vdev)
memory_region_transaction_commit();
+ /*
+ * Try to change the AioContext so that block jobs and other operations can
+ * co-locate their activity in the same AioContext. If it fails, nevermind.
+ */
r = blk_set_aio_context(s->conf.conf.blk, s->vq_aio_context[0],
&local_err);
if (r < 0) {
- error_report_err(local_err);
- goto fail_aio_context;
+ warn_report_err(local_err);
}
/*
@@ -1819,18 +1822,6 @@ static int virtio_blk_start_ioeventfd(VirtIODevice *vdev)
}
return 0;
- fail_aio_context:
- memory_region_transaction_begin();
-
- for (i = 0; i < nvqs; i++) {
- virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false);
- }
-
- memory_region_transaction_commit();
-
- for (i = 0; i < nvqs; i++) {
- virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i);
- }
fail_host_notifiers:
k->set_guest_notifiers(qbus->parent, nvqs, false);
fail_guest_notifiers:
--
2.43.0
- [PULL 01/14] block/blklogwrites: Fix a bug when logging "write zeroes" operations., (continued)
- [PULL 01/14] block/blklogwrites: Fix a bug when logging "write zeroes" operations., Kevin Wolf, 2024/01/19
- [PULL 08/14] virtio-blk: move dataplane code into virtio-blk.c, Kevin Wolf, 2024/01/19
- [PULL 10/14] virtio-blk: rename dataplane to ioeventfd, Kevin Wolf, 2024/01/19
- [PULL 05/14] iotests: add filter_qmp_generated_node_ids(), Kevin Wolf, 2024/01/19
- [PULL 02/14] string-output-visitor: Fix (pseudo) struct handling, Kevin Wolf, 2024/01/19
- [PULL 06/14] iotests: port 141 to Python for reliable QMP testing, Kevin Wolf, 2024/01/19
- [PULL 09/14] virtio-blk: rename dataplane create/destroy functions, Kevin Wolf, 2024/01/19
- [PULL 07/14] monitor: only run coroutine commands in qemu_aio_context, Kevin Wolf, 2024/01/19
- [PULL 04/14] stream: Allow users to request only format driver names in backing file format, Kevin Wolf, 2024/01/19
- [PULL 14/14] block/blklogwrites: Protect mutable driver state with a mutex., Kevin Wolf, 2024/01/19
- [PULL 12/14] virtio-blk: tolerate failure to set BlockBackend AioContext,
Kevin Wolf <=
- [PULL 13/14] virtio-blk: always set ioeventfd during startup, Kevin Wolf, 2024/01/19
- [PULL 11/14] virtio-blk: restart s->rq reqs in vq AioContexts, Kevin Wolf, 2024/01/19
- Re: [PULL 00/14] Block layer patches, Peter Maydell, 2024/01/20