1
The following changes since commit 33f18cf7dca7741d3647d514040904ce83edd73d:
1
The following changes since commit 3521ade3510eb5cefb2e27a101667f25dad89935:
2
2
3
Merge remote-tracking branch 'remotes/kraxel/tags/audio-20190821-pull-request' into staging (2019-08-21 15:18:50 +0100)
3
Merge remote-tracking branch 'remotes/thuth-gitlab/tags/pull-request-2021-07-29' into staging (2021-07-29 13:17:20 +0100)
4
4
5
are available in the Git repository at:
5
are available in the Git repository at:
6
6
7
https://github.com/stefanha/qemu.git tags/block-pull-request
7
https://gitlab.com/stefanha/qemu.git tags/block-pull-request
8
8
9
for you to fetch changes up to 5d4c1ed3d46d7e2010b389fe5f3376f605182ab0:
9
for you to fetch changes up to cc8eecd7f105a1dff5876adeb238a14696061a4a:
10
10
11
vhost-user-scsi: prevent using uninitialized vqs (2019-08-22 16:52:23 +0100)
11
MAINTAINERS: Added myself as a reviewer for the NVMe Block Driver (2021-07-29 17:17:34 +0100)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Pull request
14
Pull request
15
15
16
The main fix here is for io_uring. Spurious -EAGAIN errors can happen and the
17
request needs to be resubmitted.
18
19
The MAINTAINERS changes carry no risk and we might as well include them in QEMU
20
6.1.
21
16
----------------------------------------------------------------
22
----------------------------------------------------------------
17
23
18
Raphael Norwitz (1):
24
Fabian Ebner (1):
19
vhost-user-scsi: prevent using uninitialized vqs
25
block/io_uring: resubmit when result is -EAGAIN
20
26
21
Stefan Hajnoczi (1):
27
Philippe Mathieu-Daudé (1):
22
util/async: hold AioContext ref to prevent use-after-free
28
MAINTAINERS: Added myself as a reviewer for the NVMe Block Driver
23
29
24
hw/scsi/vhost-user-scsi.c | 2 +-
30
Stefano Garzarella (1):
25
util/async.c | 8 ++++++++
31
MAINTAINERS: add Stefano Garzarella as io_uring reviewer
26
2 files changed, 9 insertions(+), 1 deletion(-)
32
33
MAINTAINERS | 2 ++
34
block/io_uring.c | 16 +++++++++++++++-
35
2 files changed, 17 insertions(+), 1 deletion(-)
27
36
28
--
37
--
29
2.21.0
38
2.31.1
30
39
31
diff view generated by jsdifflib
New patch
1
From: Stefano Garzarella <sgarzare@redhat.com>
1
2
3
I've been working with io_uring for a while so I'd like to help
4
with reviews.
5
6
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
7
Message-Id: <20210728131515.131045-1-sgarzare@redhat.com>
8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9
---
10
MAINTAINERS | 1 +
11
1 file changed, 1 insertion(+)
12
13
diff --git a/MAINTAINERS b/MAINTAINERS
14
index XXXXXXX..XXXXXXX 100644
15
--- a/MAINTAINERS
16
+++ b/MAINTAINERS
17
@@ -XXX,XX +XXX,XX @@ Linux io_uring
18
M: Aarushi Mehta <mehta.aaru20@gmail.com>
19
M: Julia Suvorova <jusual@redhat.com>
20
M: Stefan Hajnoczi <stefanha@redhat.com>
21
+R: Stefano Garzarella <sgarzare@redhat.com>
22
L: qemu-block@nongnu.org
23
S: Maintained
24
F: block/io_uring.c
25
--
26
2.31.1
27
diff view generated by jsdifflib
1
From: Raphael Norwitz <raphael.norwitz@nutanix.com>
1
From: Fabian Ebner <f.ebner@proxmox.com>
2
2
3
Of the 3 virtqueues, seabios only sets cmd, leaving ctrl
3
Linux SCSI can throw spurious -EAGAIN in some corner cases in its
4
and event without a physical address. This can cause
4
completion path, which will end up being the result in the completed
5
vhost_verify_ring_part_mapping to return ENOMEM, causing
5
io_uring request.
6
the following logs:
7
6
8
qemu-system-x86_64: Unable to map available ring for ring 0
7
Resubmitting such requests should allow block jobs to complete, even
9
qemu-system-x86_64: Verify ring failure on region 0
8
if such spurious errors are encountered.
10
9
11
The qemu commit e6cc11d64fc998c11a4dfcde8fda3fc33a74d844
10
Co-authored-by: Stefan Hajnoczi <stefanha@gmail.com>
12
has already resolved the issue for vhost scsi devices but
11
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
13
the fix was never applied to vhost-user scsi devices.
12
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
14
13
Message-id: 20210729091029.65369-1-f.ebner@proxmox.com
15
Signed-off-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
16
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
17
Message-id: 1560299717-177734-1-git-send-email-raphael.norwitz@nutanix.com
18
Message-Id: <1560299717-177734-1-git-send-email-raphael.norwitz@nutanix.com>
19
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
14
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
20
---
15
---
21
hw/scsi/vhost-user-scsi.c | 2 +-
16
block/io_uring.c | 16 +++++++++++++++-
22
1 file changed, 1 insertion(+), 1 deletion(-)
17
1 file changed, 15 insertions(+), 1 deletion(-)
23
18
24
diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c
19
diff --git a/block/io_uring.c b/block/io_uring.c
25
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
26
--- a/hw/scsi/vhost-user-scsi.c
21
--- a/block/io_uring.c
27
+++ b/hw/scsi/vhost-user-scsi.c
22
+++ b/block/io_uring.c
28
@@ -XXX,XX +XXX,XX @@ static void vhost_user_scsi_realize(DeviceState *dev, Error **errp)
23
@@ -XXX,XX +XXX,XX @@ static void luring_process_completions(LuringState *s)
29
}
24
total_bytes = ret + luringcb->total_read;
30
25
31
vsc->dev.nvqs = 2 + vs->conf.num_queues;
26
if (ret < 0) {
32
- vsc->dev.vqs = g_new(struct vhost_virtqueue, vsc->dev.nvqs);
27
- if (ret == -EINTR) {
33
+ vsc->dev.vqs = g_new0(struct vhost_virtqueue, vsc->dev.nvqs);
28
+ /*
34
vsc->dev.vq_index = 0;
29
+ * Only writev/readv/fsync requests on regular files or host block
35
vsc->dev.backend_features = 0;
30
+ * devices are submitted. Therefore -EAGAIN is not expected but it's
36
vqs = vsc->dev.vqs;
31
+ * known to happen sometimes with Linux SCSI. Submit again and hope
32
+ * the request completes successfully.
33
+ *
34
+ * For more information, see:
35
+ * https://lore.kernel.org/io-uring/20210727165811.284510-3-axboe@kernel.dk/T/#u
36
+ *
37
+ * If the code is changed to submit other types of requests in the
38
+ * future, then this workaround may need to be extended to deal with
39
+ * genuine -EAGAIN results that should not be resubmitted
40
+ * immediately.
41
+ */
42
+ if (ret == -EINTR || ret == -EAGAIN) {
43
luring_resubmit(s, luringcb);
44
continue;
45
}
37
--
46
--
38
2.21.0
47
2.31.1
39
48
40
diff view generated by jsdifflib
1
The tests/test-bdrv-drain /bdrv-drain/iothread/drain test case does the
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
following:
3
2
4
1. The preadv coroutine calls aio_bh_schedule_oneshot() and then yields.
3
I'm interested in following the activity around the NVMe bdrv.
5
2. The one-shot BH executes in another AioContext. All it does is call
6
aio_co_wakeup(preadv_co).
7
3. The preadv coroutine is re-entered and returns.
8
4
9
There is a race condition in aio_co_wake() where the preadv coroutine
5
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
10
returns and the test case destroys the preadv IOThread. aio_co_wake()
6
Message-id: 20210728183340.2018313-1-philmd@redhat.com
11
can still be running in the other AioContext and it performs an access
12
to the freed IOThread AioContext.
13
14
Here is the race in aio_co_schedule():
15
16
QSLIST_INSERT_HEAD_ATOMIC(&ctx->scheduled_coroutines,
17
co, co_scheduled_next);
18
<-- race: co may execute before we invoke qemu_bh_schedule()!
19
qemu_bh_schedule(ctx->co_schedule_bh);
20
21
So if co causes ctx to be freed then we're in trouble. Fix this problem
22
by holding a reference to ctx.
23
24
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
25
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
26
Message-id: 20190723190623.21537-1-stefanha@redhat.com
27
Message-Id: <20190723190623.21537-1-stefanha@redhat.com>
28
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
29
---
8
---
30
util/async.c | 8 ++++++++
9
MAINTAINERS | 1 +
31
1 file changed, 8 insertions(+)
10
1 file changed, 1 insertion(+)
32
11
33
diff --git a/util/async.c b/util/async.c
12
diff --git a/MAINTAINERS b/MAINTAINERS
34
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
35
--- a/util/async.c
14
--- a/MAINTAINERS
36
+++ b/util/async.c
15
+++ b/MAINTAINERS
37
@@ -XXX,XX +XXX,XX @@ void aio_co_schedule(AioContext *ctx, Coroutine *co)
16
@@ -XXX,XX +XXX,XX @@ F: block/null.c
38
abort();
17
NVMe Block Driver
39
}
18
M: Stefan Hajnoczi <stefanha@redhat.com>
40
19
R: Fam Zheng <fam@euphon.net>
41
+ /* The coroutine might run and release the last ctx reference before we
20
+R: Philippe Mathieu-Daudé <philmd@redhat.com>
42
+ * invoke qemu_bh_schedule(). Take a reference to keep ctx alive until
21
L: qemu-block@nongnu.org
43
+ * we're done.
22
S: Supported
44
+ */
23
F: block/nvme*
45
+ aio_context_ref(ctx);
46
+
47
QSLIST_INSERT_HEAD_ATOMIC(&ctx->scheduled_coroutines,
48
co, co_scheduled_next);
49
qemu_bh_schedule(ctx->co_schedule_bh);
50
+
51
+ aio_context_unref(ctx);
52
}
53
54
void aio_co_wake(struct Coroutine *co)
55
--
24
--
56
2.21.0
25
2.31.1
57
26
58
diff view generated by jsdifflib