1 | The following changes since commit 6157b0e19721aadb4c7fdcfe57b2924af6144b14: | 1 | The following changes since commit ca61fa4b803e5d0abaf6f1ceb690f23bb78a4def: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-6.0-pull-= | 3 | Merge remote-tracking branch 'remotes/quic/tags/pull-hex-20211006' into staging (2021-10-06 12:11:14 -0700) |
4 | request' into staging (2021-03-14 17:47:49 +0000) | ||
5 | 4 | ||
6 | are available in the Git repository at: | 5 | are available in the Git repository at: |
7 | 6 | ||
8 | https://gitlab.com/stefanha/qemu.git tags/block-pull-request | 7 | https://gitlab.com/stefanha/qemu.git tags/block-pull-request |
9 | 8 | ||
10 | for you to fetch changes up to fb0b154c801e3447e505de420195fb7038695941: | 9 | for you to fetch changes up to 1cc7eada97914f090125e588497986f6f7900514: |
11 | 10 | ||
12 | virtio-blk: Respect discard granularity (2021-03-15 09:48:53 +0000) | 11 | iothread: use IOThreadParamInfo in iothread_[set|get]_param() (2021-10-07 15:29:50 +0100) |
13 | 12 | ||
14 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
15 | Pull request | 14 | Pull request |
16 | 15 | ||
17 | ---------------------------------------------------------------- | 16 | ---------------------------------------------------------------- |
18 | 17 | ||
19 | Akihiko Odaki (1): | 18 | Stefano Garzarella (2): |
20 | virtio-blk: Respect discard granularity | 19 | iothread: rename PollParamInfo to IOThreadParamInfo |
20 | iothread: use IOThreadParamInfo in iothread_[set|get]_param() | ||
21 | 21 | ||
22 | include/hw/virtio/virtio-blk.h | 1 + | 22 | iothread.c | 28 +++++++++++++++------------- |
23 | hw/block/virtio-blk.c | 8 +++++++- | 23 | 1 file changed, 15 insertions(+), 13 deletions(-) |
24 | hw/core/machine.c | 1 + | ||
25 | 3 files changed, 9 insertions(+), 1 deletion(-) | ||
26 | 24 | ||
27 | --=20 | 25 | -- |
28 | 2.29.2 | 26 | 2.31.1 |
29 | 27 | ||
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 | From: Akihiko Odaki <akihiko.odaki@gmail.com> | 1 | From: Stefano Garzarella <sgarzare@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Report the configured granularity for discard operation to the | 3 | Commit 0445409d74 ("iothread: generalize |
4 | guest. If this is not set use the block size. | 4 | iothread_set_param/iothread_get_param") moved common code to set and |
5 | get IOThread parameters in two new functions. | ||
5 | 6 | ||
6 | Since until now we have ignored the configured discard granularity | 7 | These functions are called inside callbacks, so we don't need to use an |
7 | and always reported the block size, let's add | 8 | opaque pointer. Let's replace `void *opaque` parameter with |
8 | 'report-discard-granularity' property and disable it for older | 9 | `IOThreadParamInfo *info`. |
9 | machine types to avoid migration issues. | ||
10 | 10 | ||
11 | Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> | 11 | Suggested-by: Kevin Wolf <kwolf@redhat.com> |
12 | Reviewed-by: Stefano Garzarella <sgarzare@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 | ||
13 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 15 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
14 | Message-Id: <20210225001239.47046-1-akihiko.odaki@gmail.com> | ||
15 | --- | 16 | --- |
16 | include/hw/virtio/virtio-blk.h | 1 + | 17 | iothread.c | 18 ++++++++++-------- |
17 | hw/block/virtio-blk.c | 8 +++++++- | 18 | 1 file changed, 10 insertions(+), 8 deletions(-) |
18 | hw/core/machine.c | 1 + | ||
19 | 3 files changed, 9 insertions(+), 1 deletion(-) | ||
20 | 19 | ||
21 | diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h | 20 | diff --git a/iothread.c b/iothread.c |
22 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/include/hw/virtio/virtio-blk.h | 22 | --- a/iothread.c |
24 | +++ b/include/hw/virtio/virtio-blk.h | 23 | +++ b/iothread.c |
25 | @@ -XXX,XX +XXX,XX @@ struct VirtIOBlkConf | 24 | @@ -XXX,XX +XXX,XX @@ static IOThreadParamInfo aio_max_batch_info = { |
26 | uint16_t num_queues; | ||
27 | uint16_t queue_size; | ||
28 | bool seg_max_adjust; | ||
29 | + bool report_discard_granularity; | ||
30 | uint32_t max_discard_sectors; | ||
31 | uint32_t max_write_zeroes_sectors; | ||
32 | bool x_enable_wce_if_config_wce; | ||
33 | diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c | ||
34 | index XXXXXXX..XXXXXXX 100644 | ||
35 | --- a/hw/block/virtio-blk.c | ||
36 | +++ b/hw/block/virtio-blk.c | ||
37 | @@ -XXX,XX +XXX,XX @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config) | ||
38 | blkcfg.wce = blk_enable_write_cache(s->blk); | ||
39 | virtio_stw_p(vdev, &blkcfg.num_queues, s->conf.num_queues); | ||
40 | if (virtio_has_feature(s->host_features, VIRTIO_BLK_F_DISCARD)) { | ||
41 | + uint32_t discard_granularity = conf->discard_granularity; | ||
42 | + if (discard_granularity == -1 || !s->conf.report_discard_granularity) { | ||
43 | + discard_granularity = blk_size; | ||
44 | + } | ||
45 | virtio_stl_p(vdev, &blkcfg.max_discard_sectors, | ||
46 | s->conf.max_discard_sectors); | ||
47 | virtio_stl_p(vdev, &blkcfg.discard_sector_alignment, | ||
48 | - blk_size >> BDRV_SECTOR_BITS); | ||
49 | + discard_granularity >> BDRV_SECTOR_BITS); | ||
50 | /* | ||
51 | * We support only one segment per request since multiple segments | ||
52 | * are not widely used and there are no userspace APIs that allow | ||
53 | @@ -XXX,XX +XXX,XX @@ static Property virtio_blk_properties[] = { | ||
54 | IOThread *), | ||
55 | DEFINE_PROP_BIT64("discard", VirtIOBlock, host_features, | ||
56 | VIRTIO_BLK_F_DISCARD, true), | ||
57 | + DEFINE_PROP_BOOL("report-discard-granularity", VirtIOBlock, | ||
58 | + conf.report_discard_granularity, true), | ||
59 | DEFINE_PROP_BIT64("write-zeroes", VirtIOBlock, host_features, | ||
60 | VIRTIO_BLK_F_WRITE_ZEROES, true), | ||
61 | DEFINE_PROP_UINT32("max-discard-sectors", VirtIOBlock, | ||
62 | diff --git a/hw/core/machine.c b/hw/core/machine.c | ||
63 | index XXXXXXX..XXXXXXX 100644 | ||
64 | --- a/hw/core/machine.c | ||
65 | +++ b/hw/core/machine.c | ||
66 | @@ -XXX,XX +XXX,XX @@ | ||
67 | GlobalProperty hw_compat_5_2[] = { | ||
68 | { "ICH9-LPC", "smm-compat", "on"}, | ||
69 | { "PIIX4_PM", "smm-compat", "on"}, | ||
70 | + { "virtio-blk-device", "report-discard-granularity", "off" }, | ||
71 | }; | 25 | }; |
72 | const size_t hw_compat_5_2_len = G_N_ELEMENTS(hw_compat_5_2); | 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); | ||
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 | } | ||
73 | 88 | ||
74 | -- | 89 | -- |
75 | 2.29.2 | 90 | 2.31.1 |
76 | 91 | ||
92 | diff view generated by jsdifflib |