[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/6] virtio-blk: tolerate failure to set BlockBackend AioContext
From: |
Stefan Hajnoczi |
Subject: |
[PATCH 5/6] virtio-blk: tolerate failure to set BlockBackend AioContext |
Date: |
Fri, 19 Jan 2024 08:57:47 -0500 |
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>
---
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
- [PATCH 0/6] virtio-blk: iothread-vq-mapping cleanups, Stefan Hajnoczi, 2024/01/19
- [PATCH 2/6] virtio-blk: rename dataplane create/destroy functions, Stefan Hajnoczi, 2024/01/19
- [PATCH 3/6] virtio-blk: rename dataplane to ioeventfd, Stefan Hajnoczi, 2024/01/19
- [PATCH 4/6] virtio-blk: restart s->rq reqs in vq AioContexts, Stefan Hajnoczi, 2024/01/19
- [PATCH 1/6] virtio-blk: move dataplane code into virtio-blk.c, Stefan Hajnoczi, 2024/01/19
- [PATCH 5/6] virtio-blk: tolerate failure to set BlockBackend AioContext,
Stefan Hajnoczi <=
- [PATCH 6/6] virtio-blk: always set ioeventfd during startup, Stefan Hajnoczi, 2024/01/19
- Re: [PATCH 0/6] virtio-blk: iothread-vq-mapping cleanups, Kevin Wolf, 2024/01/19