1 | The following changes since commit 240ab11fb72049d6373cbbec8d788f8e411a00bc: | 1 | The following changes since commit 3521ade3510eb5cefb2e27a101667f25dad89935: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/aperard/tags/pull-xen-20190924' into staging (2019-09-24 15:36:31 +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 f9a7e3698a737ee75a7b0af34203303df982550f: | 9 | for you to fetch changes up to cc8eecd7f105a1dff5876adeb238a14696061a4a: |
10 | 10 | ||
11 | virtio-blk: schedule virtio_notify_config to run on main context (2019-09-25 18:06:36 +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 | Sergio Lopez (1): | 24 | Fabian Ebner (1): |
19 | virtio-blk: schedule virtio_notify_config to run on main context | 25 | block/io_uring: resubmit when result is -EAGAIN |
20 | 26 | ||
21 | Vladimir Sementsov-Ogievskiy (1): | 27 | Philippe Mathieu-Daudé (1): |
22 | util/ioc.c: try to reassure Coverity about qemu_iovec_init_extended | 28 | MAINTAINERS: Added myself as a reviewer for the NVMe Block Driver |
23 | 29 | ||
24 | hw/block/virtio-blk.c | 16 +++++++++++++++- | 30 | Stefano Garzarella (1): |
25 | util/iov.c | 3 ++- | 31 | MAINTAINERS: add Stefano Garzarella as io_uring reviewer |
26 | 2 files changed, 17 insertions(+), 2 deletions(-) | 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: Sergio Lopez <slp@redhat.com> | 1 | From: Fabian Ebner <f.ebner@proxmox.com> |
---|---|---|---|
2 | 2 | ||
3 | virtio_notify_config() needs to acquire the global mutex, which isn't | 3 | Linux SCSI can throw spurious -EAGAIN in some corner cases in its |
4 | allowed from an iothread, and may lead to a deadlock like this: | 4 | completion path, which will end up being the result in the completed |
5 | io_uring request. | ||
5 | 6 | ||
6 | - main thead | 7 | Resubmitting such requests should allow block jobs to complete, even |
7 | * Has acquired: qemu_global_mutex. | 8 | if such spurious errors are encountered. |
8 | * Is trying the acquire: iothread AioContext lock via | ||
9 | AIO_WAIT_WHILE (after aio_poll). | ||
10 | 9 | ||
11 | - iothread | 10 | Co-authored-by: Stefan Hajnoczi <stefanha@gmail.com> |
12 | * Has acquired: AioContext lock. | 11 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> |
13 | * Is trying to acquire: qemu_global_mutex (via | 12 | Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> |
14 | virtio_notify_config->prepare_mmio_access). | 13 | Message-id: 20210729091029.65369-1-f.ebner@proxmox.com |
15 | |||
16 | If virtio_blk_resize() is called from an iothread, schedule | ||
17 | virtio_notify_config() to be run in the main context BH. | ||
18 | |||
19 | [Removed unnecessary newline as suggested by Kevin Wolf | ||
20 | <kwolf@redhat.com>. | ||
21 | --Stefan] | ||
22 | |||
23 | Signed-off-by: Sergio Lopez <slp@redhat.com> | ||
24 | Reviewed-by: Kevin Wolf <kwolf@redhat.com> | ||
25 | Message-id: 20190916112411.21636-1-slp@redhat.com | ||
26 | Message-Id: <20190916112411.21636-1-slp@redhat.com> | ||
27 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 14 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
28 | --- | 15 | --- |
29 | hw/block/virtio-blk.c | 16 +++++++++++++++- | 16 | block/io_uring.c | 16 +++++++++++++++- |
30 | 1 file changed, 15 insertions(+), 1 deletion(-) | 17 | 1 file changed, 15 insertions(+), 1 deletion(-) |
31 | 18 | ||
32 | diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c | 19 | diff --git a/block/io_uring.c b/block/io_uring.c |
33 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/hw/block/virtio-blk.c | 21 | --- a/block/io_uring.c |
35 | +++ b/hw/block/virtio-blk.c | 22 | +++ b/block/io_uring.c |
36 | @@ -XXX,XX +XXX,XX @@ | 23 | @@ -XXX,XX +XXX,XX @@ static void luring_process_completions(LuringState *s) |
37 | #include "qemu/iov.h" | 24 | total_bytes = ret + luringcb->total_read; |
38 | #include "qemu/module.h" | 25 | |
39 | #include "qemu/error-report.h" | 26 | if (ret < 0) { |
40 | +#include "qemu/main-loop.h" | 27 | - if (ret == -EINTR) { |
41 | #include "trace.h" | 28 | + /* |
42 | #include "hw/block/block.h" | 29 | + * Only writev/readv/fsync requests on regular files or host block |
43 | #include "hw/qdev-properties.h" | 30 | + * devices are submitted. Therefore -EAGAIN is not expected but it's |
44 | @@ -XXX,XX +XXX,XX @@ static int virtio_blk_load_device(VirtIODevice *vdev, QEMUFile *f, | 31 | + * known to happen sometimes with Linux SCSI. Submit again and hope |
45 | return 0; | 32 | + * the request completes successfully. |
46 | } | 33 | + * |
47 | 34 | + * For more information, see: | |
48 | +static void virtio_resize_cb(void *opaque) | 35 | + * https://lore.kernel.org/io-uring/20210727165811.284510-3-axboe@kernel.dk/T/#u |
49 | +{ | 36 | + * |
50 | + VirtIODevice *vdev = opaque; | 37 | + * If the code is changed to submit other types of requests in the |
51 | + | 38 | + * future, then this workaround may need to be extended to deal with |
52 | + assert(qemu_get_current_aio_context() == qemu_get_aio_context()); | 39 | + * genuine -EAGAIN results that should not be resubmitted |
53 | + virtio_notify_config(vdev); | 40 | + * immediately. |
54 | +} | 41 | + */ |
55 | + | 42 | + if (ret == -EINTR || ret == -EAGAIN) { |
56 | static void virtio_blk_resize(void *opaque) | 43 | luring_resubmit(s, luringcb); |
57 | { | 44 | continue; |
58 | VirtIODevice *vdev = VIRTIO_DEVICE(opaque); | 45 | } |
59 | |||
60 | - virtio_notify_config(vdev); | ||
61 | + /* | ||
62 | + * virtio_notify_config() needs to acquire the global mutex, | ||
63 | + * so it can't be called from an iothread. Instead, schedule | ||
64 | + * it to be run in the main context BH. | ||
65 | + */ | ||
66 | + aio_bh_schedule_oneshot(qemu_get_aio_context(), virtio_resize_cb, vdev); | ||
67 | } | ||
68 | |||
69 | static const BlockDevOps virtio_block_ops = { | ||
70 | -- | 46 | -- |
71 | 2.21.0 | 47 | 2.31.1 |
72 | 48 | ||
73 | diff view generated by jsdifflib |
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Make it more obvious, that filling qiov corresponds to qiov allocation, | 3 | I'm interested in following the activity around the NVMe bdrv. |
4 | which in turn corresponds to total_niov calculation, based on mid_niov | ||
5 | (not mid_len). Still add an assertion to show that there should be no | ||
6 | difference. | ||
7 | 4 | ||
8 | Reported-by: Coverity (CID 1405302) | 5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
9 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 6 | Message-id: 20210728183340.2018313-1-philmd@redhat.com |
10 | Message-id: 20190910090310.14032-1-vsementsov@virtuozzo.com | ||
11 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
13 | Message-Id: <20190910090310.14032-1-vsementsov@virtuozzo.com> | ||
14 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 7 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
15 | --- | 8 | --- |
16 | util/iov.c | 3 ++- | 9 | MAINTAINERS | 1 + |
17 | 1 file changed, 2 insertions(+), 1 deletion(-) | 10 | 1 file changed, 1 insertion(+) |
18 | 11 | ||
19 | diff --git a/util/iov.c b/util/iov.c | 12 | diff --git a/MAINTAINERS b/MAINTAINERS |
20 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/util/iov.c | 14 | --- a/MAINTAINERS |
22 | +++ b/util/iov.c | 15 | +++ b/MAINTAINERS |
23 | @@ -XXX,XX +XXX,XX @@ void qemu_iovec_init_extended( | 16 | @@ -XXX,XX +XXX,XX @@ F: block/null.c |
24 | p++; | 17 | NVMe Block Driver |
25 | } | 18 | M: Stefan Hajnoczi <stefanha@redhat.com> |
26 | 19 | R: Fam Zheng <fam@euphon.net> | |
27 | - if (mid_len) { | 20 | +R: Philippe Mathieu-Daudé <philmd@redhat.com> |
28 | + assert(!mid_niov == !mid_len); | 21 | L: qemu-block@nongnu.org |
29 | + if (mid_niov) { | 22 | S: Supported |
30 | memcpy(p, mid_iov, mid_niov * sizeof(*p)); | 23 | F: block/nvme* |
31 | p[0].iov_base = (uint8_t *)p[0].iov_base + mid_head; | ||
32 | p[0].iov_len -= mid_head; | ||
33 | -- | 24 | -- |
34 | 2.21.0 | 25 | 2.31.1 |
35 | 26 | ||
36 | diff view generated by jsdifflib |