1 | The following changes since commit 8048082f7a11040a366942a2de8abb4c3d0020c9: | 1 | The following changes since commit ca61fa4b803e5d0abaf6f1ceb690f23bb78a4def: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2017-11-15-1' into staging (2017-11-16 11:34:24 +0000) | 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 | git://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 341e0b5658681f46680024cdbfc998717d85cc35: | 9 | for you to fetch changes up to 1cc7eada97914f090125e588497986f6f7900514: |
10 | 10 | ||
11 | throttle-groups: forget timer and schedule next TGM on detach (2017-11-16 14:12:57 +0000) | 11 | iothread: use IOThreadParamInfo in iothread_[set|get]_param() (2021-10-07 15:29:50 +0100) |
12 | |||
13 | ---------------------------------------------------------------- | ||
14 | Pull request | ||
12 | 15 | ||
13 | ---------------------------------------------------------------- | 16 | ---------------------------------------------------------------- |
14 | 17 | ||
15 | ---------------------------------------------------------------- | 18 | Stefano Garzarella (2): |
19 | iothread: rename PollParamInfo to IOThreadParamInfo | ||
20 | iothread: use IOThreadParamInfo in iothread_[set|get]_param() | ||
16 | 21 | ||
17 | Stefan Hajnoczi (1): | 22 | iothread.c | 28 +++++++++++++++------------- |
18 | throttle-groups: forget timer and schedule next TGM on detach | 23 | 1 file changed, 15 insertions(+), 13 deletions(-) |
19 | |||
20 | block/throttle-groups.c | 12 ++++++++++++ | ||
21 | 1 file changed, 12 insertions(+) | ||
22 | 24 | ||
23 | -- | 25 | -- |
24 | 2.13.6 | 26 | 2.31.1 |
25 | 27 | ||
26 | 28 | ||
29 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Stefano Garzarella <sgarzare@redhat.com> | ||
1 | 2 | ||
3 | Commit 1793ad0247 ("iothread: add aio-max-batch parameter") added | ||
4 | a new parameter (aio-max-batch) to IOThread and used PollParamInfo | ||
5 | structure to handle it. | ||
6 | |||
7 | Since it is not a parameter of the polling mechanism, we rename the | ||
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 | ||
14 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
15 | --- | ||
16 | iothread.c | 14 +++++++------- | ||
17 | 1 file changed, 7 insertions(+), 7 deletions(-) | ||
18 | |||
19 | diff --git a/iothread.c b/iothread.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/iothread.c | ||
22 | +++ b/iothread.c | ||
23 | @@ -XXX,XX +XXX,XX @@ static void iothread_complete(UserCreatable *obj, Error **errp) | ||
24 | typedef struct { | ||
25 | const char *name; | ||
26 | ptrdiff_t offset; /* field's byte offset in IOThread struct */ | ||
27 | -} PollParamInfo; | ||
28 | +} IOThreadParamInfo; | ||
29 | |||
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 | |||
65 | -- | ||
66 | 2.31.1 | ||
67 | |||
68 | diff view generated by jsdifflib |
1 | tg->any_timer_armed[] must be cleared when detaching pending timers from | 1 | From: Stefano Garzarella <sgarzare@redhat.com> |
---|---|---|---|
2 | the AioContext. Failure to do so leads to hung I/O because it looks | ||
3 | like there are still timers pending when in fact they have been removed. | ||
4 | 2 | ||
5 | Other ThrottleGroupMembers might have requests pending too so it's | 3 | Commit 0445409d74 ("iothread: generalize |
6 | necessary to schedule the next TGM so it can set a timer. | 4 | iothread_set_param/iothread_get_param") moved common code to set and |
5 | get IOThread parameters in two new functions. | ||
7 | 6 | ||
8 | This patch fixes hung I/O when QEMU is launched with drives that are in | 7 | These functions are called inside callbacks, so we don't need to use an |
9 | the same throttling group: | 8 | opaque pointer. Let's replace `void *opaque` parameter with |
9 | `IOThreadParamInfo *info`. | ||
10 | 10 | ||
11 | (guest)$ dd if=/dev/zero of=/dev/vdb oflag=direct bs=512 & | 11 | Suggested-by: Kevin Wolf <kwolf@redhat.com> |
12 | (guest)$ dd if=/dev/zero of=/dev/vdc oflag=direct bs=512 & | 12 | Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> |
13 | (qemu) stop | 13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
14 | (qemu) cont | 14 | Message-id: 20210727145936.147032-3-sgarzare@redhat.com |
15 | ...I/O is stuck... | ||
16 | |||
17 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
18 | Message-id: 20171116112150.27607-1-stefanha@redhat.com | ||
19 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 15 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
20 | --- | 16 | --- |
21 | block/throttle-groups.c | 12 ++++++++++++ | 17 | iothread.c | 18 ++++++++++-------- |
22 | 1 file changed, 12 insertions(+) | 18 | 1 file changed, 10 insertions(+), 8 deletions(-) |
23 | 19 | ||
24 | diff --git a/block/throttle-groups.c b/block/throttle-groups.c | 20 | diff --git a/iothread.c b/iothread.c |
25 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/block/throttle-groups.c | 22 | --- a/iothread.c |
27 | +++ b/block/throttle-groups.c | 23 | +++ b/iothread.c |
28 | @@ -XXX,XX +XXX,XX @@ void throttle_group_attach_aio_context(ThrottleGroupMember *tgm, | 24 | @@ -XXX,XX +XXX,XX @@ static IOThreadParamInfo aio_max_batch_info = { |
29 | 25 | }; | |
30 | void throttle_group_detach_aio_context(ThrottleGroupMember *tgm) | 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) | ||
31 | { | 30 | { |
32 | + ThrottleGroup *tg = container_of(tgm->throttle_state, ThrottleGroup, ts); | 31 | IOThread *iothread = IOTHREAD(obj); |
33 | ThrottleTimers *tt = &tgm->throttle_timers; | 32 | - IOThreadParamInfo *info = opaque; |
34 | + int i; | 33 | int64_t *field = (void *)iothread + info->offset; |
35 | 34 | ||
36 | /* Requests must have been drained */ | 35 | visit_type_int64(v, name, field, errp); |
37 | assert(tgm->pending_reqs[0] == 0 && tgm->pending_reqs[1] == 0); | ||
38 | assert(qemu_co_queue_empty(&tgm->throttled_reqs[0])); | ||
39 | assert(qemu_co_queue_empty(&tgm->throttled_reqs[1])); | ||
40 | |||
41 | + /* Kick off next ThrottleGroupMember, if necessary */ | ||
42 | + qemu_mutex_lock(&tg->lock); | ||
43 | + for (i = 0; i < 2; i++) { | ||
44 | + if (timer_pending(tt->timers[i])) { | ||
45 | + tg->any_timer_armed[i] = false; | ||
46 | + schedule_next_request(tgm, i); | ||
47 | + } | ||
48 | + } | ||
49 | + qemu_mutex_unlock(&tg->lock); | ||
50 | + | ||
51 | throttle_timers_detach_aio_context(tt); | ||
52 | tgm->aio_context = NULL; | ||
53 | } | 36 | } |
37 | |||
38 | static bool iothread_set_param(Object *obj, Visitor *v, | ||
39 | - const char *name, void *opaque, Error **errp) | ||
40 | + const char *name, IOThreadParamInfo *info, Error **errp) | ||
41 | { | ||
42 | IOThread *iothread = IOTHREAD(obj); | ||
43 | - IOThreadParamInfo *info = opaque; | ||
44 | int64_t *field = (void *)iothread + info->offset; | ||
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); | ||
55 | } | ||
56 | |||
57 | static void iothread_set_poll_param(Object *obj, Visitor *v, | ||
58 | const char *name, void *opaque, Error **errp) | ||
59 | { | ||
60 | IOThread *iothread = IOTHREAD(obj); | ||
61 | + IOThreadParamInfo *info = opaque; | ||
62 | |||
63 | - if (!iothread_set_param(obj, v, name, opaque, errp)) { | ||
64 | + if (!iothread_set_param(obj, v, name, info, errp)) { | ||
65 | return; | ||
66 | } | ||
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); | ||
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 | |||
54 | -- | 89 | -- |
55 | 2.13.6 | 90 | 2.31.1 |
56 | 91 | ||
57 | 92 | diff view generated by jsdifflib |