1 | The following changes since commit 3521ade3510eb5cefb2e27a101667f25dad89935: | 1 | The following changes since commit b0fbe46ad82982b289a44ee2495b59b0bad8a842: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/thuth-gitlab/tags/pull-request-2021-07-29' into staging (2021-07-29 13:17:20 +0100) | 3 | Update version for v2.11.0-rc0 release (2017-11-07 16:05:28 +0000) |
4 | 4 | ||
5 | are available in the Git repository at: | 5 | are available in the git repository at: |
6 | 6 | ||
7 | https://gitlab.com/stefanha/qemu.git tags/block-pull-request | 7 | git://github.com/stefanha/qemu.git tags/block-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to cc8eecd7f105a1dff5876adeb238a14696061a4a: | 9 | for you to fetch changes up to ef6dada8b44e1e7c4bec5c1115903af9af415b50: |
10 | 10 | ||
11 | MAINTAINERS: Added myself as a reviewer for the NVMe Block Driver (2021-07-29 17:17:34 +0100) | 11 | util/async: use atomic_mb_set in qemu_bh_cancel (2017-11-08 19:09:15 +0000) |
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 | 16 | v2: |
17 | request needs to be resubmitted. | 17 | * v1 emails 2/3 and 3/3 weren't sent due to an email failure |
18 | 18 | * Included Sergio's updated wording in the commit description | |
19 | The MAINTAINERS changes carry no risk and we might as well include them in QEMU | ||
20 | 6.1. | ||
21 | 19 | ||
22 | ---------------------------------------------------------------- | 20 | ---------------------------------------------------------------- |
23 | 21 | ||
24 | Fabian Ebner (1): | 22 | Sergio Lopez (1): |
25 | block/io_uring: resubmit when result is -EAGAIN | 23 | util/async: use atomic_mb_set in qemu_bh_cancel |
26 | 24 | ||
27 | Philippe Mathieu-Daudé (1): | 25 | Stefan Hajnoczi (1): |
28 | MAINTAINERS: Added myself as a reviewer for the NVMe Block Driver | 26 | tests-aio-multithread: fix /aio/multi/schedule race condition |
29 | 27 | ||
30 | Stefano Garzarella (1): | 28 | tests/test-aio-multithread.c | 5 ++--- |
31 | MAINTAINERS: add Stefano Garzarella as io_uring reviewer | 29 | util/async.c | 2 +- |
32 | 30 | 2 files changed, 3 insertions(+), 4 deletions(-) | |
33 | MAINTAINERS | 2 ++ | ||
34 | block/io_uring.c | 16 +++++++++++++++- | ||
35 | 2 files changed, 17 insertions(+), 1 deletion(-) | ||
36 | 31 | ||
37 | -- | 32 | -- |
38 | 2.31.1 | 33 | 2.13.6 |
39 | 34 | ||
35 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Stefano Garzarella <sgarzare@redhat.com> | ||
2 | 1 | ||
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: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | test_multi_co_schedule_entry() set to_schedule[id] in the final loop |
---|---|---|---|
2 | iteration before terminating the coroutine. There is a race condition | ||
3 | where the main thread attempts to enter the terminating or terminated | ||
4 | coroutine when signalling coroutines to stop: | ||
2 | 5 | ||
3 | I'm interested in following the activity around the NVMe bdrv. | 6 | atomic_mb_set(&now_stopping, true); |
7 | for (i = 0; i < NUM_CONTEXTS; i++) { | ||
8 | ctx_run(i, finish_cb, NULL); <--- enters dead coroutine! | ||
9 | to_schedule[i] = NULL; | ||
10 | } | ||
4 | 11 | ||
5 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 12 | Make sure only to set to_schedule[id] if this coroutine really needs to |
6 | Message-id: 20210728183340.2018313-1-philmd@redhat.com | 13 | be scheduled! |
14 | |||
15 | Reported-by: "R.Nageswara Sastry" <nasastry@in.ibm.com> | ||
16 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
17 | Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> | ||
18 | Message-id: 20171106190233.1175-1-stefanha@redhat.com | ||
7 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 19 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
8 | --- | 20 | --- |
9 | MAINTAINERS | 1 + | 21 | tests/test-aio-multithread.c | 5 ++--- |
10 | 1 file changed, 1 insertion(+) | 22 | 1 file changed, 2 insertions(+), 3 deletions(-) |
11 | 23 | ||
12 | diff --git a/MAINTAINERS b/MAINTAINERS | 24 | diff --git a/tests/test-aio-multithread.c b/tests/test-aio-multithread.c |
13 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/MAINTAINERS | 26 | --- a/tests/test-aio-multithread.c |
15 | +++ b/MAINTAINERS | 27 | +++ b/tests/test-aio-multithread.c |
16 | @@ -XXX,XX +XXX,XX @@ F: block/null.c | 28 | @@ -XXX,XX +XXX,XX @@ static void finish_cb(void *opaque) |
17 | NVMe Block Driver | 29 | static coroutine_fn void test_multi_co_schedule_entry(void *opaque) |
18 | M: Stefan Hajnoczi <stefanha@redhat.com> | 30 | { |
19 | R: Fam Zheng <fam@euphon.net> | 31 | g_assert(to_schedule[id] == NULL); |
20 | +R: Philippe Mathieu-Daudé <philmd@redhat.com> | 32 | - atomic_mb_set(&to_schedule[id], qemu_coroutine_self()); |
21 | L: qemu-block@nongnu.org | 33 | |
22 | S: Supported | 34 | while (!atomic_mb_read(&now_stopping)) { |
23 | F: block/nvme* | 35 | int n; |
36 | |||
37 | n = g_test_rand_int_range(0, NUM_CONTEXTS); | ||
38 | schedule_next(n); | ||
39 | + | ||
40 | + atomic_mb_set(&to_schedule[id], qemu_coroutine_self()); | ||
41 | qemu_coroutine_yield(); | ||
42 | - | ||
43 | g_assert(to_schedule[id] == NULL); | ||
44 | - atomic_mb_set(&to_schedule[id], qemu_coroutine_self()); | ||
45 | } | ||
46 | } | ||
47 | |||
24 | -- | 48 | -- |
25 | 2.31.1 | 49 | 2.13.6 |
26 | 50 | ||
51 | diff view generated by jsdifflib |
1 | From: Fabian Ebner <f.ebner@proxmox.com> | 1 | From: Sergio Lopez <slp@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Linux SCSI can throw spurious -EAGAIN in some corner cases in its | 3 | Commit b7a745d added a qemu_bh_cancel call to the completion function |
4 | completion path, which will end up being the result in the completed | 4 | as an optimization to prevent it from unnecessarily rescheduling itself. |
5 | io_uring request. | ||
6 | 5 | ||
7 | Resubmitting such requests should allow block jobs to complete, even | 6 | This completion function is scheduled from worker_thread, after setting |
8 | if such spurious errors are encountered. | 7 | the state of a ThreadPoolElement to THREAD_DONE. |
9 | 8 | ||
10 | Co-authored-by: Stefan Hajnoczi <stefanha@gmail.com> | 9 | This was considered to be safe, as the completion function restarts the |
11 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> | 10 | loop just after the call to qemu_bh_cancel. But, as this loop lacks a HW |
12 | Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> | 11 | memory barrier, the read of req->state may actually happen _before_ the |
13 | Message-id: 20210729091029.65369-1-f.ebner@proxmox.com | 12 | call, seeing it still as THREAD_QUEUED, and ending the completion |
13 | function without having processed a pending TPE linked at pool->head: | ||
14 | |||
15 | worker thread | I/O thread | ||
16 | ------------------------------------------------------------------------ | ||
17 | | speculatively read req->state | ||
18 | req->state = THREAD_DONE; | | ||
19 | qemu_bh_schedule(p->completion_bh) | | ||
20 | bh->scheduled = 1; | | ||
21 | | qemu_bh_cancel(p->completion_bh) | ||
22 | | bh->scheduled = 0; | ||
23 | | if (req->state == THREAD_DONE) | ||
24 | | // sees THREAD_QUEUED | ||
25 | |||
26 | The source of the misunderstanding was that qemu_bh_cancel is now being | ||
27 | used by the _consumer_ rather than the producer, and therefore now needs | ||
28 | to have acquire semantics just like e.g. aio_bh_poll. | ||
29 | |||
30 | In some situations, if there are no other independent requests in the | ||
31 | same aio context that could eventually trigger the scheduling of the | ||
32 | completion function, the omitted TPE and all operations pending on it | ||
33 | will get stuck forever. | ||
34 | |||
35 | [Added Sergio's updated wording about the HW memory barrier. | ||
36 | --Stefan] | ||
37 | |||
38 | Signed-off-by: Sergio Lopez <slp@redhat.com> | ||
39 | Message-id: 20171108063447.2842-1-slp@redhat.com | ||
14 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 40 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
15 | --- | 41 | --- |
16 | block/io_uring.c | 16 +++++++++++++++- | 42 | util/async.c | 2 +- |
17 | 1 file changed, 15 insertions(+), 1 deletion(-) | 43 | 1 file changed, 1 insertion(+), 1 deletion(-) |
18 | 44 | ||
19 | diff --git a/block/io_uring.c b/block/io_uring.c | 45 | diff --git a/util/async.c b/util/async.c |
20 | index XXXXXXX..XXXXXXX 100644 | 46 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/block/io_uring.c | 47 | --- a/util/async.c |
22 | +++ b/block/io_uring.c | 48 | +++ b/util/async.c |
23 | @@ -XXX,XX +XXX,XX @@ static void luring_process_completions(LuringState *s) | 49 | @@ -XXX,XX +XXX,XX @@ void qemu_bh_schedule(QEMUBH *bh) |
24 | total_bytes = ret + luringcb->total_read; | 50 | */ |
25 | 51 | void qemu_bh_cancel(QEMUBH *bh) | |
26 | if (ret < 0) { | 52 | { |
27 | - if (ret == -EINTR) { | 53 | - bh->scheduled = 0; |
28 | + /* | 54 | + atomic_mb_set(&bh->scheduled, 0); |
29 | + * Only writev/readv/fsync requests on regular files or host block | 55 | } |
30 | + * devices are submitted. Therefore -EAGAIN is not expected but it's | 56 | |
31 | + * known to happen sometimes with Linux SCSI. Submit again and hope | 57 | /* This func is async.The bottom half will do the delete action at the finial |
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 | } | ||
46 | -- | 58 | -- |
47 | 2.31.1 | 59 | 2.13.6 |
48 | 60 | ||
61 | diff view generated by jsdifflib |