1 | The following changes since commit 0b5e750bea635b167eb03d86c3d9a09bbd43bc06: | 1 | The following changes since commit ca61fa4b803e5d0abaf6f1ceb690f23bb78a4def: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2019-02-12 10:53:37 +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 42824b4d16da56a50ff4027f6cd22378e0e2666e: | 9 | for you to fetch changes up to 1cc7eada97914f090125e588497986f6f7900514: |
10 | 10 | ||
11 | virtio-blk: set correct config size for the host driver (2019-02-13 16:18:17 +0800) | 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 | Fix a virtio-blk migration regression. | ||
17 | |||
18 | ---------------------------------------------------------------- | 16 | ---------------------------------------------------------------- |
19 | 17 | ||
20 | Changpeng Liu (1): | 18 | Stefano Garzarella (2): |
21 | virtio-blk: set correct config size for the host driver | 19 | iothread: rename PollParamInfo to IOThreadParamInfo |
20 | iothread: use IOThreadParamInfo in iothread_[set|get]_param() | ||
22 | 21 | ||
23 | hw/block/virtio-blk.c | 13 +++++++++---- | 22 | iothread.c | 28 +++++++++++++++------------- |
24 | 1 file changed, 9 insertions(+), 4 deletions(-) | 23 | 1 file changed, 15 insertions(+), 13 deletions(-) |
25 | 24 | ||
26 | -- | 25 | -- |
27 | 2.20.1 | 26 | 2.31.1 |
28 | 27 | ||
29 | 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: Changpeng Liu <changpeng.liu@intel.com> | 1 | From: Stefano Garzarella <sgarzare@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Commit caa1ee43 "vhost-user-blk: add discard/write zeroes features | 3 | Commit 0445409d74 ("iothread: generalize |
4 | support" added fields to struct virtio_blk_config. This changes | 4 | iothread_set_param/iothread_get_param") moved common code to set and |
5 | the size of the config space and breaks migration from QEMU 3.1 | 5 | get IOThread parameters in two new functions. |
6 | and older: | ||
7 | 6 | ||
8 | qemu-system-ppc64: get_pci_config_device: Bad config data: i=0x10 read: 41 device: 1 cmask: ff wmask: 80 w1cmask:0 | 7 | These functions are called inside callbacks, so we don't need to use an |
9 | qemu-system-ppc64: Failed to load PCIDevice:config | 8 | opaque pointer. Let's replace `void *opaque` parameter with |
10 | qemu-system-ppc64: Failed to load virtio-blk:virtio | 9 | `IOThreadParamInfo *info`. |
11 | qemu-system-ppc64: error while loading state for instance 0x0 of device 'pci@800000020000000:01.0/virtio-blk' | ||
12 | qemu-system-ppc64: load of migration failed: Invalid argument | ||
13 | 10 | ||
14 | Since virtio-blk doesn't support the "discard" and "write zeroes" | 11 | Suggested-by: Kevin Wolf <kwolf@redhat.com> |
15 | features, it shouldn't even expose the associated fields in the | 12 | Signed-off-by: Stefano Garzarella <sgarzare@redhat.com> |
16 | config space actually. Just include all fields up to num_queues to | 13 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
17 | match QEMU 3.1 and older. | 14 | Message-id: 20210727145936.147032-3-sgarzare@redhat.com |
18 | |||
19 | Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> | ||
20 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
21 | Message-id: 1550022537-27565-1-git-send-email-changpeng.liu@intel.com | ||
22 | Message-Id: <1550022537-27565-1-git-send-email-changpeng.liu@intel.com> | ||
23 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 15 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
24 | --- | 16 | --- |
25 | hw/block/virtio-blk.c | 13 +++++++++---- | 17 | iothread.c | 18 ++++++++++-------- |
26 | 1 file changed, 9 insertions(+), 4 deletions(-) | 18 | 1 file changed, 10 insertions(+), 8 deletions(-) |
27 | 19 | ||
28 | diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c | 20 | diff --git a/iothread.c b/iothread.c |
29 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
30 | --- a/hw/block/virtio-blk.c | 22 | --- a/iothread.c |
31 | +++ b/hw/block/virtio-blk.c | 23 | +++ b/iothread.c |
32 | @@ -XXX,XX +XXX,XX @@ | 24 | @@ -XXX,XX +XXX,XX @@ static IOThreadParamInfo aio_max_batch_info = { |
33 | #include "hw/virtio/virtio-bus.h" | 25 | }; |
34 | #include "hw/virtio/virtio-access.h" | 26 | |
35 | 27 | static void iothread_get_param(Object *obj, Visitor *v, | |
36 | +/* We don't support discard yet, hide associated config fields. */ | 28 | - const char *name, void *opaque, Error **errp) |
37 | +#define VIRTIO_BLK_CFG_SIZE offsetof(struct virtio_blk_config, \ | 29 | + const char *name, IOThreadParamInfo *info, Error **errp) |
38 | + max_discard_sectors) | ||
39 | + | ||
40 | static void virtio_blk_init_request(VirtIOBlock *s, VirtQueue *vq, | ||
41 | VirtIOBlockReq *req) | ||
42 | { | 30 | { |
43 | @@ -XXX,XX +XXX,XX @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config) | 31 | IOThread *iothread = IOTHREAD(obj); |
44 | blkcfg.alignment_offset = 0; | 32 | - IOThreadParamInfo *info = opaque; |
45 | blkcfg.wce = blk_enable_write_cache(s->blk); | 33 | int64_t *field = (void *)iothread + info->offset; |
46 | virtio_stw_p(vdev, &blkcfg.num_queues, s->conf.num_queues); | 34 | |
47 | - memcpy(config, &blkcfg, sizeof(struct virtio_blk_config)); | 35 | visit_type_int64(v, name, field, errp); |
48 | + memcpy(config, &blkcfg, VIRTIO_BLK_CFG_SIZE); | ||
49 | + QEMU_BUILD_BUG_ON(VIRTIO_BLK_CFG_SIZE > sizeof(blkcfg)); | ||
50 | } | 36 | } |
51 | 37 | ||
52 | static void virtio_blk_set_config(VirtIODevice *vdev, const uint8_t *config) | 38 | static bool iothread_set_param(Object *obj, Visitor *v, |
53 | @@ -XXX,XX +XXX,XX @@ static void virtio_blk_set_config(VirtIODevice *vdev, const uint8_t *config) | 39 | - const char *name, void *opaque, Error **errp) |
54 | VirtIOBlock *s = VIRTIO_BLK(vdev); | 40 | + const char *name, IOThreadParamInfo *info, Error **errp) |
55 | struct virtio_blk_config blkcfg; | 41 | { |
56 | 42 | IOThread *iothread = IOTHREAD(obj); | |
57 | - memcpy(&blkcfg, config, sizeof(blkcfg)); | 43 | - IOThreadParamInfo *info = opaque; |
58 | + memcpy(&blkcfg, config, VIRTIO_BLK_CFG_SIZE); | 44 | int64_t *field = (void *)iothread + info->offset; |
59 | + QEMU_BUILD_BUG_ON(VIRTIO_BLK_CFG_SIZE > sizeof(blkcfg)); | 45 | int64_t value; |
60 | 46 | ||
61 | aio_context_acquire(blk_get_aio_context(s->blk)); | 47 | @@ -XXX,XX +XXX,XX @@ static bool iothread_set_param(Object *obj, Visitor *v, |
62 | blk_set_enable_write_cache(s->blk, blkcfg.wce != 0); | 48 | static void iothread_get_poll_param(Object *obj, Visitor *v, |
63 | @@ -XXX,XX +XXX,XX @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp) | 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)) { | ||
64 | return; | 65 | return; |
65 | } | 66 | } |
66 | 67 | ||
67 | - virtio_init(vdev, "virtio-blk", VIRTIO_ID_BLOCK, | 68 | @@ -XXX,XX +XXX,XX @@ static void iothread_set_poll_param(Object *obj, Visitor *v, |
68 | - sizeof(struct virtio_blk_config)); | 69 | static void iothread_get_aio_param(Object *obj, Visitor *v, |
69 | + virtio_init(vdev, "virtio-blk", VIRTIO_ID_BLOCK, VIRTIO_BLK_CFG_SIZE); | 70 | const char *name, void *opaque, Error **errp) |
70 | 71 | { | |
71 | s->blk = conf->conf.blk; | 72 | + IOThreadParamInfo *info = opaque; |
72 | s->rq = NULL; | 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 | |||
73 | -- | 89 | -- |
74 | 2.20.1 | 90 | 2.31.1 |
75 | 91 | ||
76 | 92 | diff view generated by jsdifflib |