1 | The following changes since commit 58560ad254fbda71d4daa6622d71683190070ee2: | 1 | The following changes since commit ca61fa4b803e5d0abaf6f1ceb690f23bb78a4def: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.2-20191024' into staging (2019-10-24 16:22:58 +0100) | 3 | Merge remote-tracking branch 'remotes/quic/tags/pull-hex-20211006' into staging (2021-10-06 12:11:14 -0700) |
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 d154ef37ff885918fa3e512fd7a8e42870291667: | 9 | for you to fetch changes up to 1cc7eada97914f090125e588497986f6f7900514: |
10 | 10 | ||
11 | yield_until_fd_readable: make it work with any AioContect (2019-10-25 14:38:29 +0200) | 11 | iothread: use IOThreadParamInfo in iothread_[set|get]_param() (2021-10-07 15:29:50 +0100) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Pull request | 14 | Pull request |
15 | 15 | ||
16 | ---------------------------------------------------------------- | 16 | ---------------------------------------------------------------- |
17 | 17 | ||
18 | Dietmar Maurer (1): | 18 | Stefano Garzarella (2): |
19 | yield_until_fd_readable: make it work with any AioContect | 19 | iothread: rename PollParamInfo to IOThreadParamInfo |
20 | iothread: use IOThreadParamInfo in iothread_[set|get]_param() | ||
20 | 21 | ||
21 | Julia Suvorova (1): | 22 | iothread.c | 28 +++++++++++++++------------- |
22 | virtio-blk: Add blk_drain() to virtio_blk_device_unrealize() | 23 | 1 file changed, 15 insertions(+), 13 deletions(-) |
23 | |||
24 | hw/block/virtio-blk.c | 1 + | ||
25 | util/qemu-coroutine-io.c | 7 +++++-- | ||
26 | 2 files changed, 6 insertions(+), 2 deletions(-) | ||
27 | 24 | ||
28 | -- | 25 | -- |
29 | 2.21.0 | 26 | 2.31.1 |
30 | 27 | ||
31 | 28 | ||
29 | diff view generated by jsdifflib |
1 | From: Julia Suvorova <jusual@redhat.com> | 1 | From: Stefano Garzarella <sgarzare@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | QEMU does not wait for completed I/O requests, assuming that the guest | 3 | Commit 1793ad0247 ("iothread: add aio-max-batch parameter") added |
4 | driver will reset the device before calling unrealize(). This does not | 4 | a new parameter (aio-max-batch) to IOThread and used PollParamInfo |
5 | happen on Windows, and QEMU crashes in virtio_notify(), getting the | 5 | structure to handle it. |
6 | result of a completed I/O request on hot-unplugged device. | ||
7 | 6 | ||
8 | Signed-off-by: Julia Suvorova <jusual@redhat.com> | 7 | Since it is not a parameter of the polling mechanism, we rename the |
9 | Message-Id: <20191018142856.31870-1-jusual@redhat.com> | 8 | structure to a more generic IOThreadParamInfo. |
9 | |||
10 | Suggested-by: Kevin Wolf <kwolf@redhat.com> | ||
11 | Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> | ||
12 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
13 | Message-id: 20210727145936.147032-2-sgarzare@redhat.com | ||
10 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 14 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
11 | --- | 15 | --- |
12 | hw/block/virtio-blk.c | 1 + | 16 | iothread.c | 14 +++++++------- |
13 | 1 file changed, 1 insertion(+) | 17 | 1 file changed, 7 insertions(+), 7 deletions(-) |
14 | 18 | ||
15 | diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c | 19 | diff --git a/iothread.c b/iothread.c |
16 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/block/virtio-blk.c | 21 | --- a/iothread.c |
18 | +++ b/hw/block/virtio-blk.c | 22 | +++ b/iothread.c |
19 | @@ -XXX,XX +XXX,XX @@ static void virtio_blk_device_unrealize(DeviceState *dev, Error **errp) | 23 | @@ -XXX,XX +XXX,XX @@ static void iothread_complete(UserCreatable *obj, Error **errp) |
20 | VirtIODevice *vdev = VIRTIO_DEVICE(dev); | 24 | typedef struct { |
21 | VirtIOBlock *s = VIRTIO_BLK(dev); | 25 | const char *name; |
22 | 26 | ptrdiff_t offset; /* field's byte offset in IOThread struct */ | |
23 | + blk_drain(s->blk); | 27 | -} PollParamInfo; |
24 | virtio_blk_data_plane_destroy(s->dataplane); | 28 | +} IOThreadParamInfo; |
25 | s->dataplane = NULL; | 29 | |
26 | qemu_del_vm_change_state_handler(s->change); | 30 | -static PollParamInfo poll_max_ns_info = { |
31 | +static IOThreadParamInfo poll_max_ns_info = { | ||
32 | "poll-max-ns", offsetof(IOThread, poll_max_ns), | ||
33 | }; | ||
34 | -static PollParamInfo poll_grow_info = { | ||
35 | +static IOThreadParamInfo poll_grow_info = { | ||
36 | "poll-grow", offsetof(IOThread, poll_grow), | ||
37 | }; | ||
38 | -static PollParamInfo poll_shrink_info = { | ||
39 | +static IOThreadParamInfo poll_shrink_info = { | ||
40 | "poll-shrink", offsetof(IOThread, poll_shrink), | ||
41 | }; | ||
42 | -static PollParamInfo aio_max_batch_info = { | ||
43 | +static IOThreadParamInfo aio_max_batch_info = { | ||
44 | "aio-max-batch", offsetof(IOThread, aio_max_batch), | ||
45 | }; | ||
46 | |||
47 | @@ -XXX,XX +XXX,XX @@ static void iothread_get_param(Object *obj, Visitor *v, | ||
48 | const char *name, void *opaque, Error **errp) | ||
49 | { | ||
50 | IOThread *iothread = IOTHREAD(obj); | ||
51 | - PollParamInfo *info = opaque; | ||
52 | + IOThreadParamInfo *info = opaque; | ||
53 | int64_t *field = (void *)iothread + info->offset; | ||
54 | |||
55 | visit_type_int64(v, name, field, errp); | ||
56 | @@ -XXX,XX +XXX,XX @@ static bool iothread_set_param(Object *obj, Visitor *v, | ||
57 | const char *name, void *opaque, Error **errp) | ||
58 | { | ||
59 | IOThread *iothread = IOTHREAD(obj); | ||
60 | - PollParamInfo *info = opaque; | ||
61 | + IOThreadParamInfo *info = opaque; | ||
62 | int64_t *field = (void *)iothread + info->offset; | ||
63 | int64_t value; | ||
64 | |||
27 | -- | 65 | -- |
28 | 2.21.0 | 66 | 2.31.1 |
29 | 67 | ||
30 | 68 | diff view generated by jsdifflib |
1 | From: Dietmar Maurer <dietmar@proxmox.com> | 1 | From: Stefano Garzarella <sgarzare@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Simply use qemu_get_current_aio_context(). | 3 | Commit 0445409d74 ("iothread: generalize |
4 | iothread_set_param/iothread_get_param") moved common code to set and | ||
5 | get IOThread parameters in two new functions. | ||
4 | 6 | ||
5 | Signed-off-by: Dietmar Maurer <dietmar@proxmox.com> | 7 | These functions are called inside callbacks, so we don't need to use an |
6 | Message-Id: <20191024045610.9071-1-dietmar@proxmox.com> | 8 | opaque pointer. Let's replace `void *opaque` parameter with |
9 | `IOThreadParamInfo *info`. | ||
10 | |||
11 | Suggested-by: Kevin Wolf <kwolf@redhat.com> | ||
12 | Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> | ||
13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
14 | Message-id: 20210727145936.147032-3-sgarzare@redhat.com | ||
7 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 15 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
8 | --- | 16 | --- |
9 | util/qemu-coroutine-io.c | 7 +++++-- | 17 | iothread.c | 18 ++++++++++-------- |
10 | 1 file changed, 5 insertions(+), 2 deletions(-) | 18 | 1 file changed, 10 insertions(+), 8 deletions(-) |
11 | 19 | ||
12 | diff --git a/util/qemu-coroutine-io.c b/util/qemu-coroutine-io.c | 20 | diff --git a/iothread.c b/iothread.c |
13 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/util/qemu-coroutine-io.c | 22 | --- a/iothread.c |
15 | +++ b/util/qemu-coroutine-io.c | 23 | +++ b/iothread.c |
16 | @@ -XXX,XX +XXX,XX @@ qemu_co_send_recv(int sockfd, void *buf, size_t bytes, bool do_send) | 24 | @@ -XXX,XX +XXX,XX @@ static IOThreadParamInfo aio_max_batch_info = { |
25 | }; | ||
26 | |||
27 | static void iothread_get_param(Object *obj, Visitor *v, | ||
28 | - const char *name, void *opaque, Error **errp) | ||
29 | + const char *name, IOThreadParamInfo *info, Error **errp) | ||
30 | { | ||
31 | IOThread *iothread = IOTHREAD(obj); | ||
32 | - IOThreadParamInfo *info = opaque; | ||
33 | int64_t *field = (void *)iothread + info->offset; | ||
34 | |||
35 | visit_type_int64(v, name, field, errp); | ||
17 | } | 36 | } |
18 | 37 | ||
19 | typedef struct { | 38 | static bool iothread_set_param(Object *obj, Visitor *v, |
20 | + AioContext *ctx; | 39 | - const char *name, void *opaque, Error **errp) |
21 | Coroutine *co; | 40 | + const char *name, IOThreadParamInfo *info, Error **errp) |
22 | int fd; | ||
23 | } FDYieldUntilData; | ||
24 | @@ -XXX,XX +XXX,XX @@ typedef struct { | ||
25 | static void fd_coroutine_enter(void *opaque) | ||
26 | { | 41 | { |
27 | FDYieldUntilData *data = opaque; | 42 | IOThread *iothread = IOTHREAD(obj); |
28 | - qemu_set_fd_handler(data->fd, NULL, NULL, NULL); | 43 | - IOThreadParamInfo *info = opaque; |
29 | + aio_set_fd_handler(data->ctx, data->fd, false, NULL, NULL, NULL, NULL); | 44 | int64_t *field = (void *)iothread + info->offset; |
30 | qemu_coroutine_enter(data->co); | 45 | int64_t value; |
46 | |||
47 | @@ -XXX,XX +XXX,XX @@ static bool iothread_set_param(Object *obj, Visitor *v, | ||
48 | static void iothread_get_poll_param(Object *obj, Visitor *v, | ||
49 | const char *name, void *opaque, Error **errp) | ||
50 | { | ||
51 | + IOThreadParamInfo *info = opaque; | ||
52 | |||
53 | - iothread_get_param(obj, v, name, opaque, errp); | ||
54 | + iothread_get_param(obj, v, name, info, errp); | ||
31 | } | 55 | } |
32 | 56 | ||
33 | @@ -XXX,XX +XXX,XX @@ void coroutine_fn yield_until_fd_readable(int fd) | 57 | static void iothread_set_poll_param(Object *obj, Visitor *v, |
34 | FDYieldUntilData data; | 58 | const char *name, void *opaque, Error **errp) |
35 | 59 | { | |
36 | assert(qemu_in_coroutine()); | 60 | IOThread *iothread = IOTHREAD(obj); |
37 | + data.ctx = qemu_get_current_aio_context(); | 61 | + IOThreadParamInfo *info = opaque; |
38 | data.co = qemu_coroutine_self(); | 62 | |
39 | data.fd = fd; | 63 | - if (!iothread_set_param(obj, v, name, opaque, errp)) { |
40 | - qemu_set_fd_handler(fd, fd_coroutine_enter, NULL, &data); | 64 | + if (!iothread_set_param(obj, v, name, info, errp)) { |
41 | + aio_set_fd_handler( | 65 | return; |
42 | + data.ctx, fd, false, fd_coroutine_enter, NULL, NULL, &data); | 66 | } |
43 | qemu_coroutine_yield(); | 67 | |
68 | @@ -XXX,XX +XXX,XX @@ static void iothread_set_poll_param(Object *obj, Visitor *v, | ||
69 | static void iothread_get_aio_param(Object *obj, Visitor *v, | ||
70 | const char *name, void *opaque, Error **errp) | ||
71 | { | ||
72 | + IOThreadParamInfo *info = opaque; | ||
73 | |||
74 | - iothread_get_param(obj, v, name, opaque, errp); | ||
75 | + iothread_get_param(obj, v, name, info, errp); | ||
44 | } | 76 | } |
77 | |||
78 | static void iothread_set_aio_param(Object *obj, Visitor *v, | ||
79 | const char *name, void *opaque, Error **errp) | ||
80 | { | ||
81 | IOThread *iothread = IOTHREAD(obj); | ||
82 | + IOThreadParamInfo *info = opaque; | ||
83 | |||
84 | - if (!iothread_set_param(obj, v, name, opaque, errp)) { | ||
85 | + if (!iothread_set_param(obj, v, name, info, errp)) { | ||
86 | return; | ||
87 | } | ||
88 | |||
45 | -- | 89 | -- |
46 | 2.21.0 | 90 | 2.31.1 |
47 | 91 | ||
48 | 92 | diff view generated by jsdifflib |