1 | The following changes since commit 29e0855c5af62bbb0b0b6fed792e004dad92ba95: | 1 | The following changes since commit 7208429223963c405c62fa2611398f1aa8033593: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/elmarco/tags/slirp-pull-request' into staging (2020-03-22 21:00:38 +0000) | 3 | Merge tag 'mem-2022-10-28' of https://github.com/davidhildenbrand/qemu into staging (2022-10-30 18:31:59 -0400) |
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 ff807d559205a434fd37d3343f01a0ab128bd190: | 9 | for you to fetch changes up to 6c32fc0df9cd901add75618c831fb26a9eb742cb: |
10 | 10 | ||
11 | aio-posix: fix io_uring with external events (2020-03-23 11:05:44 +0000) | 11 | block/blkio: Make driver nvme-io_uring take a "path" instead of a "filename" (2022-10-31 14:35:14 -0400) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Pull request | 14 | Pull request |
15 | 15 | ||
16 | Note that we're still discussing "block/blkio: Make driver nvme-io_uring take a | ||
17 | "path" instead of a "filename"". I have sent the pull request now so everything | ||
18 | is ready for the soft freeze tomorrow if we decide to go ahead with the patch. | ||
19 | |||
16 | ---------------------------------------------------------------- | 20 | ---------------------------------------------------------------- |
17 | 21 | ||
18 | Stefan Hajnoczi (1): | 22 | Alberto Faria (3): |
19 | aio-posix: fix io_uring with external events | 23 | block/blkio: Add virtio-blk-vfio-pci BlockDriver |
24 | block/blkio: Tolerate device size changes | ||
25 | block/blkio: Make driver nvme-io_uring take a "path" instead of a | ||
26 | "filename" | ||
20 | 27 | ||
21 | util/fdmon-io_uring.c | 13 ++++++++++++- | 28 | qapi/block-core.json | 22 +++++++++++++++++++-- |
22 | 1 file changed, 12 insertions(+), 1 deletion(-) | 29 | block/blkio.c | 47 ++++++++++++++++++++++++++++++++++++++++---- |
30 | 2 files changed, 63 insertions(+), 6 deletions(-) | ||
23 | 31 | ||
24 | -- | 32 | -- |
25 | 2.24.1 | 33 | 2.38.1 |
26 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Alberto Faria <afaria@redhat.com> | ||
1 | 2 | ||
3 | libblkio 1.1.0 [1] introduces a virtio-blk-vfio-pci driver, which | ||
4 | accesses a virtio-blk PCI device using VFIO. Add a corresponding | ||
5 | BlockDriver. | ||
6 | |||
7 | [1] https://gitlab.com/libblkio/libblkio/-/tree/v1.1.0 | ||
8 | |||
9 | Signed-off-by: Alberto Faria <afaria@redhat.com> | ||
10 | Message-id: 20221028131635.710267-1-afaria@redhat.com | ||
11 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
12 | --- | ||
13 | qapi/block-core.json | 18 ++++++++++++++++++ | ||
14 | block/blkio.c | 8 ++++++++ | ||
15 | 2 files changed, 26 insertions(+) | ||
16 | |||
17 | diff --git a/qapi/block-core.json b/qapi/block-core.json | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/qapi/block-core.json | ||
20 | +++ b/qapi/block-core.json | ||
21 | @@ -XXX,XX +XXX,XX @@ | ||
22 | 'raw', 'rbd', | ||
23 | { 'name': 'replication', 'if': 'CONFIG_REPLICATION' }, | ||
24 | 'ssh', 'throttle', 'vdi', 'vhdx', | ||
25 | + { 'name': 'virtio-blk-vfio-pci', 'if': 'CONFIG_BLKIO' }, | ||
26 | { 'name': 'virtio-blk-vhost-user', 'if': 'CONFIG_BLKIO' }, | ||
27 | { 'name': 'virtio-blk-vhost-vdpa', 'if': 'CONFIG_BLKIO' }, | ||
28 | 'vmdk', 'vpc', 'vvfat' ] } | ||
29 | @@ -XXX,XX +XXX,XX @@ | ||
30 | 'data': { 'filename': 'str' }, | ||
31 | 'if': 'CONFIG_BLKIO' } | ||
32 | |||
33 | +## | ||
34 | +# @BlockdevOptionsVirtioBlkVfioPci: | ||
35 | +# | ||
36 | +# Driver specific block device options for the virtio-blk-vfio-pci backend. | ||
37 | +# | ||
38 | +# @path: path to the PCI device's sysfs directory (e.g. | ||
39 | +# /sys/bus/pci/devices/0000:00:01.0). | ||
40 | +# | ||
41 | +# Since: 7.2 | ||
42 | +## | ||
43 | +{ 'struct': 'BlockdevOptionsVirtioBlkVfioPci', | ||
44 | + 'data': { 'path': 'str' }, | ||
45 | + 'if': 'CONFIG_BLKIO' } | ||
46 | + | ||
47 | ## | ||
48 | # @BlockdevOptionsVirtioBlkVhostUser: | ||
49 | # | ||
50 | @@ -XXX,XX +XXX,XX @@ | ||
51 | 'throttle': 'BlockdevOptionsThrottle', | ||
52 | 'vdi': 'BlockdevOptionsGenericFormat', | ||
53 | 'vhdx': 'BlockdevOptionsGenericFormat', | ||
54 | + 'virtio-blk-vfio-pci': | ||
55 | + { 'type': 'BlockdevOptionsVirtioBlkVfioPci', | ||
56 | + 'if': 'CONFIG_BLKIO' }, | ||
57 | 'virtio-blk-vhost-user': | ||
58 | { 'type': 'BlockdevOptionsVirtioBlkVhostUser', | ||
59 | 'if': 'CONFIG_BLKIO' }, | ||
60 | diff --git a/block/blkio.c b/block/blkio.c | ||
61 | index XXXXXXX..XXXXXXX 100644 | ||
62 | --- a/block/blkio.c | ||
63 | +++ b/block/blkio.c | ||
64 | @@ -XXX,XX +XXX,XX @@ | ||
65 | */ | ||
66 | #define DRIVER_IO_URING "io_uring" | ||
67 | #define DRIVER_NVME_IO_URING "nvme-io_uring" | ||
68 | +#define DRIVER_VIRTIO_BLK_VFIO_PCI "virtio-blk-vfio-pci" | ||
69 | #define DRIVER_VIRTIO_BLK_VHOST_USER "virtio-blk-vhost-user" | ||
70 | #define DRIVER_VIRTIO_BLK_VHOST_VDPA "virtio-blk-vhost-vdpa" | ||
71 | |||
72 | @@ -XXX,XX +XXX,XX @@ static int blkio_file_open(BlockDriverState *bs, QDict *options, int flags, | ||
73 | ret = blkio_io_uring_open(bs, options, flags, errp); | ||
74 | } else if (strcmp(blkio_driver, DRIVER_NVME_IO_URING) == 0) { | ||
75 | ret = blkio_nvme_io_uring(bs, options, flags, errp); | ||
76 | + } else if (strcmp(blkio_driver, DRIVER_VIRTIO_BLK_VFIO_PCI) == 0) { | ||
77 | + ret = blkio_virtio_blk_common_open(bs, options, flags, errp); | ||
78 | } else if (strcmp(blkio_driver, DRIVER_VIRTIO_BLK_VHOST_USER) == 0) { | ||
79 | ret = blkio_virtio_blk_common_open(bs, options, flags, errp); | ||
80 | } else if (strcmp(blkio_driver, DRIVER_VIRTIO_BLK_VHOST_VDPA) == 0) { | ||
81 | @@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_nvme_io_uring = BLKIO_DRIVER( | ||
82 | .bdrv_needs_filename = true, | ||
83 | ); | ||
84 | |||
85 | +static BlockDriver bdrv_virtio_blk_vfio_pci = BLKIO_DRIVER( | ||
86 | + DRIVER_VIRTIO_BLK_VFIO_PCI | ||
87 | +); | ||
88 | + | ||
89 | static BlockDriver bdrv_virtio_blk_vhost_user = BLKIO_DRIVER( | ||
90 | DRIVER_VIRTIO_BLK_VHOST_USER | ||
91 | ); | ||
92 | @@ -XXX,XX +XXX,XX @@ static void bdrv_blkio_init(void) | ||
93 | { | ||
94 | bdrv_register(&bdrv_io_uring); | ||
95 | bdrv_register(&bdrv_nvme_io_uring); | ||
96 | + bdrv_register(&bdrv_virtio_blk_vfio_pci); | ||
97 | bdrv_register(&bdrv_virtio_blk_vhost_user); | ||
98 | bdrv_register(&bdrv_virtio_blk_vhost_vdpa); | ||
99 | } | ||
100 | -- | ||
101 | 2.38.1 | diff view generated by jsdifflib |
1 | When external event sources are disabled fdmon-io_uring falls back to | 1 | From: Alberto Faria <afaria@redhat.com> |
---|---|---|---|
2 | fdmon-poll. The ->need_wait() callback needs to watch for this so it | ||
3 | can return true when external event sources are disabled. | ||
4 | 2 | ||
5 | It is also necessary to call ->wait() when AioHandlers have changed | 3 | Some libblkio drivers may be able to work with regular files (e.g., |
6 | because io_uring is asynchronous and we must submit new sqes. | 4 | io_uring) or otherwise resizable devices. Conservatively set |
5 | BlockDriver::has_variable_length to true to ensure bdrv_nb_sectors() | ||
6 | always gives up-to-date results. | ||
7 | 7 | ||
8 | Both of these changes to ->need_wait() together fix tests/test-aio -p | 8 | Also implement BlockDriver::bdrv_co_truncate for the case where no |
9 | /aio/external-client, which failed with: | 9 | preallocation is needed and the device already has a size compatible |
10 | with what was requested. | ||
10 | 11 | ||
11 | test-aio: tests/test-aio.c:404: test_aio_external_client: Assertion `aio_poll(ctx, false)' failed. | 12 | Signed-off-by: Alberto Faria <afaria@redhat.com> |
12 | 13 | Message-id: 20221029122031.975273-1-afaria@redhat.com | |
13 | Reported-by: Julia Suvorova <jusual@redhat.com> | ||
14 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
15 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> | ||
16 | Message-id: 20200319163559.117903-1-stefanha@redhat.com | ||
17 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 14 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
18 | --- | 15 | --- |
19 | util/fdmon-io_uring.c | 13 ++++++++++++- | 16 | block/blkio.c | 27 +++++++++++++++++++++++++++ |
20 | 1 file changed, 12 insertions(+), 1 deletion(-) | 17 | 1 file changed, 27 insertions(+) |
21 | 18 | ||
22 | diff --git a/util/fdmon-io_uring.c b/util/fdmon-io_uring.c | 19 | diff --git a/block/blkio.c b/block/blkio.c |
23 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/util/fdmon-io_uring.c | 21 | --- a/block/blkio.c |
25 | +++ b/util/fdmon-io_uring.c | 22 | +++ b/block/blkio.c |
26 | @@ -XXX,XX +XXX,XX @@ static int fdmon_io_uring_wait(AioContext *ctx, AioHandlerList *ready_list, | 23 | @@ -XXX,XX +XXX,XX @@ static int64_t blkio_getlength(BlockDriverState *bs) |
27 | 24 | return capacity; | |
28 | static bool fdmon_io_uring_need_wait(AioContext *ctx) | 25 | } |
29 | { | 26 | |
30 | - return io_uring_cq_ready(&ctx->fdmon_io_uring); | 27 | +static int coroutine_fn blkio_truncate(BlockDriverState *bs, int64_t offset, |
31 | + /* Have io_uring events completed? */ | 28 | + bool exact, PreallocMode prealloc, |
32 | + if (io_uring_cq_ready(&ctx->fdmon_io_uring)) { | 29 | + BdrvRequestFlags flags, Error **errp) |
33 | + return true; | 30 | +{ |
31 | + int64_t current_length; | ||
32 | + | ||
33 | + if (prealloc != PREALLOC_MODE_OFF) { | ||
34 | + error_setg(errp, "Unsupported preallocation mode '%s'", | ||
35 | + PreallocMode_str(prealloc)); | ||
36 | + return -ENOTSUP; | ||
34 | + } | 37 | + } |
35 | + | 38 | + |
36 | + /* Do we need to submit new io_uring sqes? */ | 39 | + current_length = blkio_getlength(bs); |
37 | + if (!QSLIST_EMPTY_RCU(&ctx->submit_list)) { | 40 | + |
38 | + return true; | 41 | + if (offset > current_length) { |
42 | + error_setg(errp, "Cannot grow device"); | ||
43 | + return -EINVAL; | ||
44 | + } else if (exact && offset != current_length) { | ||
45 | + error_setg(errp, "Cannot resize device"); | ||
46 | + return -ENOTSUP; | ||
39 | + } | 47 | + } |
40 | + | 48 | + |
41 | + /* Are we falling back to fdmon-poll? */ | 49 | + return 0; |
42 | + return atomic_read(&ctx->external_disable_cnt); | 50 | +} |
43 | } | 51 | + |
44 | 52 | static int blkio_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) | |
45 | static const FDMonOps fdmon_io_uring_ops = { | 53 | { |
54 | return 0; | ||
55 | @@ -XXX,XX +XXX,XX @@ static void blkio_refresh_limits(BlockDriverState *bs, Error **errp) | ||
56 | { \ | ||
57 | .format_name = name, \ | ||
58 | .protocol_name = name, \ | ||
59 | + .has_variable_length = true, \ | ||
60 | .instance_size = sizeof(BDRVBlkioState), \ | ||
61 | .bdrv_file_open = blkio_file_open, \ | ||
62 | .bdrv_close = blkio_close, \ | ||
63 | .bdrv_getlength = blkio_getlength, \ | ||
64 | + .bdrv_co_truncate = blkio_truncate, \ | ||
65 | .bdrv_get_info = blkio_get_info, \ | ||
66 | .bdrv_attach_aio_context = blkio_attach_aio_context, \ | ||
67 | .bdrv_detach_aio_context = blkio_detach_aio_context, \ | ||
46 | -- | 68 | -- |
47 | 2.24.1 | 69 | 2.38.1 |
48 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Alberto Faria <afaria@redhat.com> | ||
1 | 2 | ||
3 | The nvme-io_uring driver expects a character special file such as | ||
4 | /dev/ng0n1. Follow the convention of having a "filename" option when a | ||
5 | regular file is expected, and a "path" option otherwise. | ||
6 | |||
7 | This makes io_uring the only libblkio-based driver with a "filename" | ||
8 | option, as it accepts a regular file (even though it can also take a | ||
9 | block special file). | ||
10 | |||
11 | Signed-off-by: Alberto Faria <afaria@redhat.com> | ||
12 | Message-id: 20221028233854.839933-1-afaria@redhat.com | ||
13 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
14 | --- | ||
15 | qapi/block-core.json | 4 ++-- | ||
16 | block/blkio.c | 12 ++++++++---- | ||
17 | 2 files changed, 10 insertions(+), 6 deletions(-) | ||
18 | |||
19 | diff --git a/qapi/block-core.json b/qapi/block-core.json | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/qapi/block-core.json | ||
22 | +++ b/qapi/block-core.json | ||
23 | @@ -XXX,XX +XXX,XX @@ | ||
24 | # | ||
25 | # Driver specific block device options for the nvme-io_uring backend. | ||
26 | # | ||
27 | -# @filename: path to the image file | ||
28 | +# @path: path to the image file | ||
29 | # | ||
30 | # Since: 7.2 | ||
31 | ## | ||
32 | { 'struct': 'BlockdevOptionsNvmeIoUring', | ||
33 | - 'data': { 'filename': 'str' }, | ||
34 | + 'data': { 'path': 'str' }, | ||
35 | 'if': 'CONFIG_BLKIO' } | ||
36 | |||
37 | ## | ||
38 | diff --git a/block/blkio.c b/block/blkio.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/block/blkio.c | ||
41 | +++ b/block/blkio.c | ||
42 | @@ -XXX,XX +XXX,XX @@ static int blkio_io_uring_open(BlockDriverState *bs, QDict *options, int flags, | ||
43 | static int blkio_nvme_io_uring(BlockDriverState *bs, QDict *options, int flags, | ||
44 | Error **errp) | ||
45 | { | ||
46 | - const char *filename = qdict_get_str(options, "filename"); | ||
47 | + const char *path = qdict_get_try_str(options, "path"); | ||
48 | BDRVBlkioState *s = bs->opaque; | ||
49 | int ret; | ||
50 | |||
51 | - ret = blkio_set_str(s->blkio, "path", filename); | ||
52 | - qdict_del(options, "filename"); | ||
53 | + if (!path) { | ||
54 | + error_setg(errp, "missing 'path' option"); | ||
55 | + return -EINVAL; | ||
56 | + } | ||
57 | + | ||
58 | + ret = blkio_set_str(s->blkio, "path", path); | ||
59 | + qdict_del(options, "path"); | ||
60 | if (ret < 0) { | ||
61 | error_setg_errno(errp, -ret, "failed to set path: %s", | ||
62 | blkio_get_error_msg()); | ||
63 | @@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_io_uring = BLKIO_DRIVER( | ||
64 | |||
65 | static BlockDriver bdrv_nvme_io_uring = BLKIO_DRIVER( | ||
66 | DRIVER_NVME_IO_URING, | ||
67 | - .bdrv_needs_filename = true, | ||
68 | ); | ||
69 | |||
70 | static BlockDriver bdrv_virtio_blk_vfio_pci = BLKIO_DRIVER( | ||
71 | -- | ||
72 | 2.38.1 | diff view generated by jsdifflib |