1
The following changes since commit 7208429223963c405c62fa2611398f1aa8033593:
1
The following changes since commit fea445e8fe9acea4f775a832815ee22bdf2b0222:
2
2
3
Merge tag 'mem-2022-10-28' of https://github.com/davidhildenbrand/qemu into staging (2022-10-30 18:31:59 -0400)
3
Merge tag 'pull-maintainer-final-for-real-this-time-200324-1' of https://gitlab.com/stsquad/qemu into staging (2024-03-21 10:31:56 +0000)
4
4
5
are available in the Git repository at:
5
are available in the Git repository at:
6
6
7
https://gitlab.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 6c32fc0df9cd901add75618c831fb26a9eb742cb:
9
for you to fetch changes up to 9352f80cd926fe2dde7c89b93ee33bb0356ff40e:
10
10
11
block/blkio: Make driver nvme-io_uring take a "path" instead of a "filename" (2022-10-31 14:35:14 -0400)
11
coroutine: reserve 5,000 mappings (2024-03-21 13:14:30 -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
16
I was too quick in sending the coroutine pool sizing change for -rc0 and still
17
"path" instead of a "filename"". I have sent the pull request now so everything
17
needed to address feedback from Daniel Berrangé.
18
is ready for the soft freeze tomorrow if we decide to go ahead with the patch.
19
18
20
----------------------------------------------------------------
19
----------------------------------------------------------------
21
20
22
Alberto Faria (3):
21
Stefan Hajnoczi (1):
23
block/blkio: Add virtio-blk-vfio-pci BlockDriver
22
coroutine: reserve 5,000 mappings
24
block/blkio: Tolerate device size changes
25
block/blkio: Make driver nvme-io_uring take a "path" instead of a
26
"filename"
27
23
28
qapi/block-core.json | 22 +++++++++++++++++++--
24
util/qemu-coroutine.c | 15 ++++++++++-----
29
block/blkio.c | 47 ++++++++++++++++++++++++++++++++++++++++----
25
1 file changed, 10 insertions(+), 5 deletions(-)
30
2 files changed, 63 insertions(+), 6 deletions(-)
31
26
32
--
27
--
33
2.38.1
28
2.44.0
29
30
diff view generated by jsdifflib
Deleted patch
1
From: Alberto Faria <afaria@redhat.com>
2
1
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
Deleted patch
1
From: Alberto Faria <afaria@redhat.com>
2
1
3
Some libblkio drivers may be able to work with regular files (e.g.,
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
8
Also implement BlockDriver::bdrv_co_truncate for the case where no
9
preallocation is needed and the device already has a size compatible
10
with what was requested.
11
12
Signed-off-by: Alberto Faria <afaria@redhat.com>
13
Message-id: 20221029122031.975273-1-afaria@redhat.com
14
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
15
---
16
block/blkio.c | 27 +++++++++++++++++++++++++++
17
1 file changed, 27 insertions(+)
18
19
diff --git a/block/blkio.c b/block/blkio.c
20
index XXXXXXX..XXXXXXX 100644
21
--- a/block/blkio.c
22
+++ b/block/blkio.c
23
@@ -XXX,XX +XXX,XX @@ static int64_t blkio_getlength(BlockDriverState *bs)
24
return capacity;
25
}
26
27
+static int coroutine_fn blkio_truncate(BlockDriverState *bs, int64_t offset,
28
+ bool exact, PreallocMode prealloc,
29
+ BdrvRequestFlags flags, Error **errp)
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;
37
+ }
38
+
39
+ current_length = blkio_getlength(bs);
40
+
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;
47
+ }
48
+
49
+ return 0;
50
+}
51
+
52
static int blkio_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
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, \
68
--
69
2.38.1
diff view generated by jsdifflib
1
From: Alberto Faria <afaria@redhat.com>
1
Daniel P. Berrangé <berrange@redhat.com> pointed out that the coroutine
2
pool size heuristic is very conservative. Instead of halving
3
max_map_count, he suggested reserving 5,000 mappings for non-coroutine
4
users based on observations of guests he has access to.
2
5
3
The nvme-io_uring driver expects a character special file such as
6
Fixes: 86a637e48104 ("coroutine: cap per-thread local pool size")
4
/dev/ng0n1. Follow the convention of having a "filename" option when a
7
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
5
regular file is expected, and a "path" option otherwise.
8
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
6
9
Message-id: 20240320181232.1464819-1-stefanha@redhat.com
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>
10
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
14
---
11
---
15
qapi/block-core.json | 4 ++--
12
util/qemu-coroutine.c | 15 ++++++++++-----
16
block/blkio.c | 12 ++++++++----
13
1 file changed, 10 insertions(+), 5 deletions(-)
17
2 files changed, 10 insertions(+), 6 deletions(-)
18
14
19
diff --git a/qapi/block-core.json b/qapi/block-core.json
15
diff --git a/util/qemu-coroutine.c b/util/qemu-coroutine.c
20
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
21
--- a/qapi/block-core.json
17
--- a/util/qemu-coroutine.c
22
+++ b/qapi/block-core.json
18
+++ b/util/qemu-coroutine.c
23
@@ -XXX,XX +XXX,XX @@
19
@@ -XXX,XX +XXX,XX @@ static unsigned int get_global_pool_hard_max_size(void)
24
#
20
NULL) &&
25
# Driver specific block device options for the nvme-io_uring backend.
21
qemu_strtoi(contents, NULL, 10, &max_map_count) == 0) {
26
#
22
/*
27
-# @filename: path to the image file
23
- * This is a conservative upper bound that avoids exceeding
28
+# @path: path to the image file
24
- * max_map_count. Leave half for non-coroutine users like library
29
#
25
- * dependencies, vhost-user, etc. Each coroutine takes up 2 VMAs so
30
# Since: 7.2
26
- * halve the amount again.
31
##
27
+ * This is an upper bound that avoids exceeding max_map_count. Leave a
32
{ 'struct': 'BlockdevOptionsNvmeIoUring',
28
+ * fixed amount for non-coroutine users like library dependencies,
33
- 'data': { 'filename': 'str' },
29
+ * vhost-user, etc. Each coroutine takes up 2 VMAs so halve the
34
+ 'data': { 'path': 'str' },
30
+ * remaining amount.
35
'if': 'CONFIG_BLKIO' }
31
*/
36
32
- return max_map_count / 4;
37
##
33
+ if (max_map_count > 5000) {
38
diff --git a/block/blkio.c b/block/blkio.c
34
+ return (max_map_count - 5000) / 2;
39
index XXXXXXX..XXXXXXX 100644
35
+ } else {
40
--- a/block/blkio.c
36
+ /* Disable the global pool but threads still have local pools */
41
+++ b/block/blkio.c
37
+ return 0;
42
@@ -XXX,XX +XXX,XX @@ static int blkio_io_uring_open(BlockDriverState *bs, QDict *options, int flags,
38
+ }
43
static int blkio_nvme_io_uring(BlockDriverState *bs, QDict *options, int flags,
39
}
44
Error **errp)
40
#endif
45
{
41
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
--
42
--
72
2.38.1
43
2.44.0
44
45
diff view generated by jsdifflib