1
The following changes since commit 013a18edbbc59cdad019100c7d03c0494642b74c:
1
The following changes since commit b384cd95eb9c6f73ad84ed1bb0717a26e29cc78f:
2
2
3
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-2020051=
3
Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging (2018-01-19 16:35:25 +0000)
4
4' into staging (2020-05-14 16:17:55 +0100)
5
4
6
are available in the Git repository at:
5
are available in the Git repository at:
7
6
8
https://github.com/stefanha/qemu.git tags/block-pull-request
7
git://github.com/stefanha/qemu.git tags/block-pull-request
9
8
10
for you to fetch changes up to ba607ca8bff4d2c2062902f8355657c865ac7c29:
9
for you to fetch changes up to bcbb3866da19cce4360c828b6ec1c2a137757927:
11
10
12
aio-posix: disable fdmon-io_uring when GSource is used (2020-05-18 18:16:00=
11
block/parallels: add backing support to readv/writev (2018-01-22 14:02:33 +0000)
13
+0100)
14
12
15
----------------------------------------------------------------
13
----------------------------------------------------------------
16
Pull request
14
Pull request
17
15
16
v2:
17
* Drop merge failure from a previous pull request that broke virtio-blk on ARM
18
guests
19
* Add Parallels XML patch series
20
18
----------------------------------------------------------------
21
----------------------------------------------------------------
19
22
20
Philippe Mathieu-Daud=C3=A9 (6):
23
Edgar Kaziakhmedov (1):
21
tests/fuzz/Makefile: Do not link code using unavailable devices
24
block/parallels: add backing support to readv/writev
22
Makefile: List fuzz targets in 'make help'
23
tests/fuzz: Add missing space in test description
24
tests/fuzz: Remove unuseful/unused typedefs
25
tests/fuzz: Extract pciconfig_fuzz_qos() method
26
tests/fuzz: Extract ioport_fuzz_qtest() method
27
25
28
Stefan Hajnoczi (2):
26
Klim Kireev (4):
29
aio-posix: don't duplicate fd handler deletion in
27
docs/interop/prl-xml: description of Parallels Disk format
30
fdmon_io_uring_destroy()
28
configure: add dependency
31
aio-posix: disable fdmon-io_uring when GSource is used
29
block/parallels: move some structures into header
30
block/parallels: replace some magic numbers
32
31
33
Makefile | 6 +++-
32
Stefan Hajnoczi (1):
34
tests/qtest/fuzz/Makefile.include | 6 ++--
33
block: add block_set_io_throttle virtio-blk-pci QMP example
35
include/block/aio.h | 3 ++
36
tests/qtest/fuzz/i440fx_fuzz.c | 47 ++++++++++++++++++++-----------
37
util/aio-posix.c | 13 +++++++++
38
util/aio-win32.c | 4 +++
39
util/async.c | 1 +
40
util/fdmon-io_uring.c | 13 +++++++--
41
8 files changed, 69 insertions(+), 24 deletions(-)
42
34
43
--=20
35
docs/interop/prl-xml.txt | 158 +++++++++++++++++++++++++++++++++++++++++++++++
44
2.25.3
36
qapi/block-core.json | 18 ++++++
37
configure | 27 ++++++++
38
block/Makefile.objs | 2 +
39
block/parallels.h | 88 ++++++++++++++++++++++++++
40
block/parallels.c | 108 ++++++++++++++------------------
41
scripts/checkpatch.pl | 1 +
42
7 files changed, 342 insertions(+), 60 deletions(-)
43
create mode 100644 docs/interop/prl-xml.txt
44
create mode 100644 block/parallels.h
45
45
46
--
47
2.14.3
48
49
diff view generated by jsdifflib
1
The glib event loop does not call fdmon_io_uring_wait() so fd handlers
1
The block_set_io_throttle command can look up BlockBackends by the
2
waiting to be submitted build up in the list. There is no benefit is
2
attached qdev device ID. virtio-blk-pci is a special case because the
3
using io_uring when the glib GSource is being used, so disable it
3
actual VirtIOBlock device is the "/virtio-backend" child of the PCI
4
instead of implementing a more complex fix.
4
adapter device.
5
5
6
This fixes a memory leak where AioHandlers would build up and increasing
6
Add a QMP schema example so clients will know how to use
7
amounts of CPU time were spent iterating them in aio_pending(). The
7
block_set_io_throttle on the virtio-blk-pci device.
8
symptom is that guests become slow when QEMU is built with io_uring
9
support.
10
8
11
Buglink: https://bugs.launchpad.net/qemu/+bug/1877716
9
The alternative is to implement some sort of aliasing for qmp_get_blk()
12
Fixes: 73fd282e7b6dd4e4ea1c3bbb3d302c8db51e4ccf ("aio-posix: add io_uring fd monitoring implementation")
10
but that is likely to cause confusion and could break future use cases.
11
Let's not go there.
12
13
Cc: Kevin Wolf <kwolf@redhat.com>
13
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
14
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
14
Tested-by: Oleksandr Natalenko <oleksandr@redhat.com>
15
Reviewed-by: Alberto Garcia <berto@igalia.com>
15
Message-id: 20200511183630.279750-3-stefanha@redhat.com
16
Message-id: 20180117090700.25811-1-stefanha@redhat.com
16
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
17
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
17
---
18
---
18
include/block/aio.h | 3 +++
19
qapi/block-core.json | 18 ++++++++++++++++++
19
util/aio-posix.c | 12 ++++++++++++
20
1 file changed, 18 insertions(+)
20
util/aio-win32.c | 4 ++++
21
util/async.c | 1 +
22
4 files changed, 20 insertions(+)
23
21
24
diff --git a/include/block/aio.h b/include/block/aio.h
22
diff --git a/qapi/block-core.json b/qapi/block-core.json
25
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
26
--- a/include/block/aio.h
24
--- a/qapi/block-core.json
27
+++ b/include/block/aio.h
25
+++ b/qapi/block-core.json
28
@@ -XXX,XX +XXX,XX @@ void aio_context_setup(AioContext *ctx);
26
@@ -XXX,XX +XXX,XX @@
29
*/
27
# Example:
30
void aio_context_destroy(AioContext *ctx);
28
#
31
29
# -> { "execute": "block_set_io_throttle",
32
+/* Used internally, do not call outside AioContext code */
30
+# "arguments": { "id": "virtio-blk-pci0/virtio-backend",
33
+void aio_context_use_g_source(AioContext *ctx);
31
+# "bps": 0,
34
+
32
+# "bps_rd": 0,
35
/**
33
+# "bps_wr": 0,
36
* aio_context_set_poll_params:
34
+# "iops": 512,
37
* @ctx: the aio context
35
+# "iops_rd": 0,
38
diff --git a/util/aio-posix.c b/util/aio-posix.c
36
+# "iops_wr": 0,
39
index XXXXXXX..XXXXXXX 100644
37
+# "bps_max": 0,
40
--- a/util/aio-posix.c
38
+# "bps_rd_max": 0,
41
+++ b/util/aio-posix.c
39
+# "bps_wr_max": 0,
42
@@ -XXX,XX +XXX,XX @@ void aio_context_destroy(AioContext *ctx)
40
+# "iops_max": 0,
43
aio_free_deleted_handlers(ctx);
41
+# "iops_rd_max": 0,
44
}
42
+# "iops_wr_max": 0,
45
43
+# "bps_max_length": 0,
46
+void aio_context_use_g_source(AioContext *ctx)
44
+# "iops_size": 0 } }
47
+{
45
+# <- { "return": {} }
48
+ /*
46
+#
49
+ * Disable io_uring when the glib main loop is used because it doesn't
47
+# -> { "execute": "block_set_io_throttle",
50
+ * support mixed glib/aio_poll() usage. It relies on aio_poll() being
48
# "arguments": { "id": "ide0-1-0",
51
+ * called regularly so that changes to the monitored file descriptors are
49
# "bps": 1000000,
52
+ * submitted, otherwise a list of pending fd handlers builds up.
50
# "bps_rd": 0,
53
+ */
54
+ fdmon_io_uring_destroy(ctx);
55
+ aio_free_deleted_handlers(ctx);
56
+}
57
+
58
void aio_context_set_poll_params(AioContext *ctx, int64_t max_ns,
59
int64_t grow, int64_t shrink, Error **errp)
60
{
61
diff --git a/util/aio-win32.c b/util/aio-win32.c
62
index XXXXXXX..XXXXXXX 100644
63
--- a/util/aio-win32.c
64
+++ b/util/aio-win32.c
65
@@ -XXX,XX +XXX,XX @@ void aio_context_destroy(AioContext *ctx)
66
{
67
}
68
69
+void aio_context_use_g_source(AioContext *ctx)
70
+{
71
+}
72
+
73
void aio_context_set_poll_params(AioContext *ctx, int64_t max_ns,
74
int64_t grow, int64_t shrink, Error **errp)
75
{
76
diff --git a/util/async.c b/util/async.c
77
index XXXXXXX..XXXXXXX 100644
78
--- a/util/async.c
79
+++ b/util/async.c
80
@@ -XXX,XX +XXX,XX @@ static GSourceFuncs aio_source_funcs = {
81
82
GSource *aio_get_g_source(AioContext *ctx)
83
{
84
+ aio_context_use_g_source(ctx);
85
g_source_ref(&ctx->source);
86
return &ctx->source;
87
}
88
--
51
--
89
2.25.3
52
2.14.3
90
53
54
diff view generated by jsdifflib
1
The io_uring file descriptor monitoring implementation has an internal
1
From: Klim Kireev <klim.kireev@virtuozzo.com>
2
list of fd handlers that are pending submission to io_uring.
3
fdmon_io_uring_destroy() deletes all fd handlers on the list.
4
2
5
Don't delete fd handlers directly in fdmon_io_uring_destroy() for two
3
This patch adds main information about Parallels Disk
6
reasons:
4
format, which consists of DiskDescriptor.xml and other files.
7
1. This duplicates the aio-posix.c AioHandler deletion code and could
8
become outdated if the struct changes.
9
2. Only handlers with the FDMON_IO_URING_REMOVE flag set are safe to
10
remove. If the flag is not set then something still has a pointer to
11
the fd handler. Let aio-posix.c and its user worry about that. In
12
practice this isn't an issue because fdmon_io_uring_destroy() is only
13
called when shutting down so all users have removed their fd
14
handlers, but the next patch will need this!
15
5
16
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6
Signed-off-by: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
17
Tested-by: Oleksandr Natalenko <oleksandr@redhat.com>
7
Signed-off-by: Klim Kireev <klim.kireev@virtuozzo.com>
18
Message-id: 20200511183630.279750-2-stefanha@redhat.com
8
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
9
Signed-off-by: Denis V. Lunev <den@openvz.org>
10
Message-id: 20180112090122.1702-2-klim.kireev@virtuozzo.com
11
CC: Stefan Hajnoczi <stefanha@redhat.com>
19
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
20
---
13
---
21
util/aio-posix.c | 1 +
14
docs/interop/prl-xml.txt | 158 +++++++++++++++++++++++++++++++++++++++++++++++
22
util/fdmon-io_uring.c | 13 ++++++++++---
15
1 file changed, 158 insertions(+)
23
2 files changed, 11 insertions(+), 3 deletions(-)
16
create mode 100644 docs/interop/prl-xml.txt
24
17
25
diff --git a/util/aio-posix.c b/util/aio-posix.c
18
diff --git a/docs/interop/prl-xml.txt b/docs/interop/prl-xml.txt
26
index XXXXXXX..XXXXXXX 100644
19
new file mode 100644
27
--- a/util/aio-posix.c
20
index XXXXXXX..XXXXXXX
28
+++ b/util/aio-posix.c
21
--- /dev/null
29
@@ -XXX,XX +XXX,XX @@ void aio_context_destroy(AioContext *ctx)
22
+++ b/docs/interop/prl-xml.txt
30
{
23
@@ -XXX,XX +XXX,XX @@
31
fdmon_io_uring_destroy(ctx);
24
+= License =
32
fdmon_epoll_disable(ctx);
33
+ aio_free_deleted_handlers(ctx);
34
}
35
36
void aio_context_set_poll_params(AioContext *ctx, int64_t max_ns,
37
diff --git a/util/fdmon-io_uring.c b/util/fdmon-io_uring.c
38
index XXXXXXX..XXXXXXX 100644
39
--- a/util/fdmon-io_uring.c
40
+++ b/util/fdmon-io_uring.c
41
@@ -XXX,XX +XXX,XX @@ void fdmon_io_uring_destroy(AioContext *ctx)
42
43
io_uring_queue_exit(&ctx->fdmon_io_uring);
44
45
- /* No need to submit these anymore, just free them. */
46
+ /* Move handlers due to be removed onto the deleted list */
47
while ((node = QSLIST_FIRST_RCU(&ctx->submit_list))) {
48
+ unsigned flags = atomic_fetch_and(&node->flags,
49
+ ~(FDMON_IO_URING_PENDING |
50
+ FDMON_IO_URING_ADD |
51
+ FDMON_IO_URING_REMOVE));
52
+
25
+
53
+ if (flags & FDMON_IO_URING_REMOVE) {
26
+Copyright (c) 2015-2017, Virtuozzo, Inc.
54
+ QLIST_INSERT_HEAD_RCU(&ctx->deleted_aio_handlers, node, node_deleted);
27
+Authors:
55
+ }
28
+ 2015 Denis Lunev <den@openvz.org>
29
+ 2015 Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
30
+ 2016-2017 Klim Kireev <klim.kireev@virtuozzo.com>
31
+ 2016-2017 Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
56
+
32
+
57
QSLIST_REMOVE_HEAD_RCU(&ctx->submit_list, node_submitted);
33
+This work is licensed under the terms of the GNU GPL, version 2 or later.
58
- QLIST_REMOVE(node, node);
34
+See the COPYING file in the top-level directory.
59
- g_free(node);
35
+
60
}
36
+This specification contains minimal information about Parallels Disk Format,
61
37
+which is enough to proper work with QEMU. Nevertheless, Parallels Cloud Server
62
ctx->fdmon_ops = &fdmon_poll_ops;
38
+and Parallels Desktop are able to add some unspecified nodes to xml and use
39
+them, but they are for internal work and don't affect functionality. Also it
40
+uses auxiliary xml "Snapshot.xml", which allows to store optional snapshot
41
+information, but it doesn't influence open/read/write functionality. QEMU and
42
+other software should not use fields not covered in this document and
43
+Snapshot.xml file and must leave them as is.
44
+
45
+= Parallels Disk Format =
46
+
47
+Parallels disk consists of two parts: the set of snapshots and the disk
48
+descriptor file, which stores information about all files and snapshots.
49
+
50
+== Definitions ==
51
+ Snapshot a record of the contents captured at a particular time,
52
+ capable of storing current state. A snapshot has UUID and
53
+ parent UUID.
54
+
55
+ Snapshot image an overlay representing the difference between this
56
+ snapshot and some earlier snapshot.
57
+
58
+ Overlay an image storing the different sectors between two captured
59
+ states.
60
+
61
+ Root image snapshot image with no parent, the root of snapshot tree.
62
+
63
+ Storage the backing storage for a subset of the virtual disk. When
64
+ there is more than one storage in a Parallels disk then that
65
+ is referred to as a split image. In this case every storage
66
+ covers specific address space area of the disk and has its
67
+ particular root image. Split images are not considered here
68
+ and are not supported. Each storage consists of disk
69
+ parameters and a list of images. The list of images always
70
+ contains a root image and may also contain overlays. The
71
+ root image can be an expandable Parallels image file or
72
+ plain. Overlays must be expandable.
73
+
74
+ Description DiskDescriptor.xml stores information about disk parameters,
75
+ file snapshots, storages.
76
+
77
+ Top The overlay between actual state and some previous snapshot.
78
+ Snapshot It is not a snapshot in the classical sense because it
79
+ serves as the active image that the guest writes to.
80
+
81
+ Sector a 512-byte data chunk.
82
+
83
+== Description file ==
84
+All information is placed in a single XML element Parallels_disk_image.
85
+The element has only one attribute "Version", that must be 1.0.
86
+Schema of DiskDescriptor.xml:
87
+
88
+<Parallels_disk_image Version="1.0">
89
+ <Disk_Parameters>
90
+ ...
91
+ </Disk_Parameters>
92
+ <StorageData>
93
+ ...
94
+ </StorageData>
95
+ <Snapshots>
96
+ ...
97
+ </Snapshots>
98
+</Parallels_disk_image>
99
+
100
+== Disk_Parameters element ==
101
+The Disk_Parameters element describes the physical layout of the virtual disk
102
+and some general settings.
103
+
104
+The Disk_Parameters element MUST contain the following child elements:
105
+ * Disk_size - number of sectors in the disk,
106
+ desired size of the disk.
107
+ * Cylinders - number of the disk cylinders.
108
+ * Heads - number of the disk heads.
109
+ * Sectors - number of the disk sectors per cylinder
110
+ (sector size is 512 bytes)
111
+ Limitation: Product of the Heads, Sectors and Cylinders
112
+ values MUST be equal to the value of the Disk_size parameter.
113
+ * Padding - must be 0. Parallels Cloud Server and Parallels Desktop may
114
+ use padding set to 1, however this case is not covered
115
+ by this spec, QEMU and other software should not open
116
+ such disks and should not create them.
117
+
118
+== StorageData element ==
119
+This element of the file describes the root image and all snapshot images.
120
+
121
+The StorageData element consists of the Storage child element, as shown below:
122
+<StorageData>
123
+ <Storage>
124
+ ...
125
+ </Storage>
126
+</StorageData>
127
+
128
+A Storage element has following child elements:
129
+ * Start - start sector of the storage, in case of non split storage
130
+ equals to 0.
131
+ * End - number of sector following the last sector, in case of non
132
+ split storage equals to Disk_size.
133
+ * Blocksize - storage cluster size, number of sectors per one cluster.
134
+ Cluster size for each "Compressed" (see below) image in
135
+ parallels disk must be equal to this field. Note: cluster
136
+ size for Parallels Expandable Image is in 'tracks' field of
137
+ its header (see docs/interop/parallels.txt).
138
+ * Several Image child elements.
139
+
140
+Each Image element has following child elements:
141
+ * GUID - image identifier, UUID in curly brackets.
142
+ For instance, {12345678-9abc-def1-2345-6789abcdef12}.
143
+ The GUID is used by the Snapshots element to reference images
144
+ (see below)
145
+ * Type - image type of the element. It can be:
146
+ "Plain" for raw files.
147
+ "Compressed" for expanding disks.
148
+ * File - path to image file. Path can be relative to DiskDecriptor.xml or
149
+ absolute.
150
+
151
+== Snapshots element ==
152
+The Snapshots element describes the snapshot relations with the snapshot tree.
153
+
154
+The element contains the set of Shot child elements, as shown below:
155
+<Snapshots>
156
+ <TopGUID> ... </TopGUID> /* Optional child element */
157
+ <Shot>
158
+ ...
159
+ </Shot>
160
+ <Shot>
161
+ ...
162
+ </Shot>
163
+ ...
164
+</Snapshots>
165
+
166
+Each Shot element contains the following child elements:
167
+ * GUID - an image GUID.
168
+ * ParentGUID - GUID of the image of the parent snapshot.
169
+
170
+The software may traverse snapshots from child to parent using <ParentGUID>
171
+field as reference. ParentGUID of root snapshot is
172
+{00000000-0000-0000-0000-000000000000}. There should be only one root
173
+snapshot. Top snapshot could be described via two ways: via TopGUID child
174
+element of the Snapshots element or via predefined GUID
175
+{5fbaabe3-6958-40ff-92a7-860e329aab41}. If TopGUID is defined, predefined GUID is
176
+interpreted as usual GUID. All snapshot images (except Top Snapshot) should be
177
+opened read-only. There is another predefined GUID,
178
+BackupID = {704718e1-2314-44c8-9087-d78ed36b0f4e}, which is used by original and
179
+some third-party software for backup, QEMU and other software may operate with
180
+images with GUID = BackupID as usual, however, it is not recommended to use this
181
+GUID for new disks. Top snapshot cannot have this GUID.
63
--
182
--
64
2.25.3
183
2.14.3
65
184
185
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Klim Kireev <klim.kireev@virtuozzo.com>
2
2
3
Extract generic ioport_fuzz_qtest() method from
3
This dependency is required for adequate Parallels images support.
4
i440fx_fuzz_qtest(). This will help to write tests
4
Typically the disk consists of several images which are glued by
5
not specific to the i440FX controller.
5
XML disk descriptor. Also XML hides inside several important parameters
6
which are not available in the image header.
6
7
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
The patch also adds clause to checkpatch.pl to understand libxml2 types.
8
Message-id: 20200514143433.18569-7-philmd@redhat.com
9
10
Signed-off-by: Denis V. Lunev <den@openvz.org>
11
Signed-off-by: Klim Kireev <klim.kireev@virtuozzo.com>
12
Signed-off-by: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
13
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
14
Message-id: 20180112090122.1702-3-klim.kireev@virtuozzo.com
15
CC: Stefan Hajnoczi <stefanha@redhat.com>
9
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
16
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10
---
17
---
11
tests/qtest/fuzz/i440fx_fuzz.c | 11 +++++++++--
18
configure | 27 +++++++++++++++++++++++++++
12
1 file changed, 9 insertions(+), 2 deletions(-)
19
block/Makefile.objs | 2 ++
20
scripts/checkpatch.pl | 1 +
21
3 files changed, 30 insertions(+)
13
22
14
diff --git a/tests/qtest/fuzz/i440fx_fuzz.c b/tests/qtest/fuzz/i440fx_fuzz.c
23
diff --git a/configure b/configure
24
index XXXXXXX..XXXXXXX 100755
25
--- a/configure
26
+++ b/configure
27
@@ -XXX,XX +XXX,XX @@ tcmalloc="no"
28
jemalloc="no"
29
replication="yes"
30
vxhs=""
31
+libxml2=""
32
33
supported_cpu="no"
34
supported_os="no"
35
@@ -XXX,XX +XXX,XX @@ for opt do
36
;;
37
--enable-numa) numa="yes"
38
;;
39
+ --disable-libxml2) libxml2="no"
40
+ ;;
41
+ --enable-libxml2) libxml2="yes"
42
+ ;;
43
--disable-tcmalloc) tcmalloc="no"
44
;;
45
--enable-tcmalloc) tcmalloc="yes"
46
@@ -XXX,XX +XXX,XX @@ disabled with --disable-FEATURE, default is enabled if available:
47
tpm TPM support
48
libssh2 ssh block device support
49
numa libnuma support
50
+ libxml2 for Parallels image format
51
tcmalloc tcmalloc support
52
jemalloc jemalloc support
53
replication replication support
54
@@ -XXX,XX +XXX,XX @@ EOF
55
fi
56
fi
57
58
+##########################################
59
+# libxml2 probe
60
+if test "$libxml2" != "no" ; then
61
+ if $pkg_config --exists libxml-2.0; then
62
+ libxml2="yes"
63
+ libxml2_cflags=$($pkg_config --cflags libxml-2.0)
64
+ libxml2_libs=$($pkg_config --libs libxml-2.0)
65
+ else
66
+ if test "$libxml2" = "yes"; then
67
+ feature_not_found "libxml2" "Install libxml2 devel"
68
+ fi
69
+ libxml2="no"
70
+ fi
71
+fi
72
73
##########################################
74
# glusterfs probe
75
@@ -XXX,XX +XXX,XX @@ echo "lzo support $lzo"
76
echo "snappy support $snappy"
77
echo "bzip2 support $bzip2"
78
echo "NUMA host support $numa"
79
+echo "libxml2 $libxml2"
80
echo "tcmalloc support $tcmalloc"
81
echo "jemalloc support $jemalloc"
82
echo "avx2 optimization $avx2_opt"
83
@@ -XXX,XX +XXX,XX @@ if test "$have_rtnetlink" = "yes" ; then
84
echo "CONFIG_RTNETLINK=y" >> $config_host_mak
85
fi
86
87
+if test "$libxml2" = "yes" ; then
88
+ echo "CONFIG_LIBXML2=y" >> $config_host_mak
89
+ echo "LIBXML2_CFLAGS=$libxml2_cflags" >> $config_host_mak
90
+ echo "LIBXML2_LIBS=$libxml2_libs" >> $config_host_mak
91
+fi
92
+
93
if test "$replication" = "yes" ; then
94
echo "CONFIG_REPLICATION=y" >> $config_host_mak
95
fi
96
diff --git a/block/Makefile.objs b/block/Makefile.objs
15
index XXXXXXX..XXXXXXX 100644
97
index XXXXXXX..XXXXXXX 100644
16
--- a/tests/qtest/fuzz/i440fx_fuzz.c
98
--- a/block/Makefile.objs
17
+++ b/tests/qtest/fuzz/i440fx_fuzz.c
99
+++ b/block/Makefile.objs
18
@@ -XXX,XX +XXX,XX @@ enum action_id {
100
@@ -XXX,XX +XXX,XX @@ block-obj-$(if $(CONFIG_BZIP2),m,n) += dmg-bz2.o
19
ACTION_MAX
101
dmg-bz2.o-libs := $(BZIP2_LIBS)
20
};
102
qcow.o-libs := -lz
21
103
linux-aio.o-libs := -laio
22
-static void i440fx_fuzz_qtest(QTestState *s,
104
+parallels.o-cflags := $(LIBXML2_CFLAGS)
23
+static void ioport_fuzz_qtest(QTestState *s,
105
+parallels.o-libs := $(LIBXML2_LIBS)
24
const unsigned char *Data, size_t Size) {
106
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
25
/*
107
index XXXXXXX..XXXXXXX 100755
26
* loop over the Data, breaking it up into actions. each action has an
108
--- a/scripts/checkpatch.pl
27
@@ -XXX,XX +XXX,XX @@ static void i440fx_fuzz_qtest(QTestState *s,
109
+++ b/scripts/checkpatch.pl
28
flush_events(s);
110
@@ -XXX,XX +XXX,XX @@ our @typeList = (
29
}
111
    qr{${Ident}_handler_fn},
30
112
    qr{target_(?:u)?long},
31
+static void i440fx_fuzz_qtest(QTestState *s,
113
    qr{hwaddr},
32
+ const unsigned char *Data,
114
+    qr{xml${Ident}},
33
+ size_t Size)
115
);
34
+{
116
35
+ ioport_fuzz_qtest(s, Data, Size);
117
# This can be modified by sub possible. Since it can be empty, be careful
36
+}
37
+
38
static void pciconfig_fuzz_qos(QTestState *s, QPCIBus *bus,
39
const unsigned char *Data, size_t Size) {
40
/*
41
- * Same as i440fx_fuzz_qtest, but using QOS. devfn is incorporated into the
42
+ * Same as ioport_fuzz_qtest, but using QOS. devfn is incorporated into the
43
* value written over Port IO
44
*/
45
struct {
46
--
118
--
47
2.25.3
119
2.14.3
48
120
121
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Klim Kireev <klim.kireev@virtuozzo.com>
2
2
3
Some devices availability depends on CONFIG options.
3
To implement xml format, some defines and structures
4
Use these options to only link tests when requested device
4
from parallels.c are required.
5
is available.
6
5
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Signed-off-by: Klim Kireev <klim.kireev@virtuozzo.com>
8
Message-id: 20200514143433.18569-2-philmd@redhat.com
7
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
8
Signed-off-by: Denis V. Lunev <den@openvz.org>
9
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
10
Signed-off-by: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
11
Message-id: 20180112090122.1702-4-klim.kireev@virtuozzo.com
12
CC: Stefan Hajnoczi <stefanha@redhat.com>
9
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
13
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10
---
14
---
11
tests/qtest/fuzz/Makefile.include | 6 +++---
15
block/parallels.h | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
12
1 file changed, 3 insertions(+), 3 deletions(-)
16
block/parallels.c | 53 +---------------------------------
17
2 files changed, 87 insertions(+), 52 deletions(-)
18
create mode 100644 block/parallels.h
13
19
14
diff --git a/tests/qtest/fuzz/Makefile.include b/tests/qtest/fuzz/Makefile.include
20
diff --git a/block/parallels.h b/block/parallels.h
21
new file mode 100644
22
index XXXXXXX..XXXXXXX
23
--- /dev/null
24
+++ b/block/parallels.h
25
@@ -XXX,XX +XXX,XX @@
26
+/*
27
+* Block driver for Parallels disk image format
28
+*
29
+* Copyright (c) 2015-2017 Virtuozzo, Inc.
30
+* Authors:
31
+* 2016-2017 Klim S. Kireev <klim.kireev@virtuozzo.com>
32
+* 2015 Denis V. Lunev <den@openvz.org>
33
+*
34
+* This code was originally based on comparing different disk images created
35
+* by Parallels. Currently it is based on opened OpenVZ sources
36
+* available at
37
+* https://github.com/OpenVZ/ploop
38
+*
39
+* Permission is hereby granted, free of charge, to any person obtaining a copy
40
+* of this software and associated documentation files (the "Software"), to deal
41
+* in the Software without restriction, including without limitation the rights
42
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
43
+* copies of the Software, and to permit persons to whom the Software is
44
+* furnished to do so, subject to the following conditions:
45
+*
46
+* The above copyright notice and this permission notice shall be included in
47
+* all copies or substantial portions of the Software.
48
+*
49
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
52
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
55
+* THE SOFTWARE.
56
+*/
57
+#ifndef BLOCK_PARALLELS_H
58
+#define BLOCK_PARALLELS_H
59
+#include "qemu/coroutine.h"
60
+#include "qemu/typedefs.h"
61
+
62
+#define DEFAULT_CLUSTER_SIZE 1048576 /* 1 MiB */
63
+
64
+/* always little-endian */
65
+typedef struct ParallelsHeader {
66
+ char magic[16]; /* "WithoutFreeSpace" */
67
+ uint32_t version;
68
+ uint32_t heads;
69
+ uint32_t cylinders;
70
+ uint32_t tracks;
71
+ uint32_t bat_entries;
72
+ uint64_t nb_sectors;
73
+ uint32_t inuse;
74
+ uint32_t data_off;
75
+ char padding[12];
76
+} QEMU_PACKED ParallelsHeader;
77
+
78
+typedef enum ParallelsPreallocMode {
79
+ PRL_PREALLOC_MODE_FALLOCATE = 0,
80
+ PRL_PREALLOC_MODE_TRUNCATE = 1,
81
+ PRL_PREALLOC_MODE__MAX = 2,
82
+} ParallelsPreallocMode;
83
+
84
+typedef struct BDRVParallelsState {
85
+ /** Locking is conservative, the lock protects
86
+ * - image file extending (truncate, fallocate)
87
+ * - any access to block allocation table
88
+ */
89
+ CoMutex lock;
90
+
91
+ ParallelsHeader *header;
92
+ uint32_t header_size;
93
+ bool header_unclean;
94
+
95
+ unsigned long *bat_dirty_bmap;
96
+ unsigned int bat_dirty_block;
97
+
98
+ uint32_t *bat_bitmap;
99
+ unsigned int bat_size;
100
+
101
+ int64_t data_end;
102
+ uint64_t prealloc_size;
103
+ ParallelsPreallocMode prealloc_mode;
104
+
105
+ unsigned int tracks;
106
+
107
+ unsigned int off_multiplier;
108
+ Error *migration_blocker;
109
+} BDRVParallelsState;
110
+
111
+#endif
112
diff --git a/block/parallels.c b/block/parallels.c
15
index XXXXXXX..XXXXXXX 100644
113
index XXXXXXX..XXXXXXX 100644
16
--- a/tests/qtest/fuzz/Makefile.include
114
--- a/block/parallels.c
17
+++ b/tests/qtest/fuzz/Makefile.include
115
+++ b/block/parallels.c
18
@@ -XXX,XX +XXX,XX @@ fuzz-obj-y += tests/qtest/fuzz/fork_fuzz.o
116
@@ -XXX,XX +XXX,XX @@
19
fuzz-obj-y += tests/qtest/fuzz/qos_fuzz.o
117
#include "qemu/bswap.h"
20
118
#include "qemu/bitmap.h"
21
# Targets
119
#include "migration/blocker.h"
22
-fuzz-obj-y += tests/qtest/fuzz/i440fx_fuzz.o
120
+#include "parallels.h"
23
-fuzz-obj-y += tests/qtest/fuzz/virtio_net_fuzz.o
121
24
-fuzz-obj-y += tests/qtest/fuzz/virtio_scsi_fuzz.o
122
/**************************************************************/
25
+fuzz-obj-$(CONFIG_PCI_I440FX) += tests/qtest/fuzz/i440fx_fuzz.o
123
26
+fuzz-obj-$(CONFIG_VIRTIO_NET) += tests/qtest/fuzz/virtio_net_fuzz.o
124
@@ -XXX,XX +XXX,XX @@
27
+fuzz-obj-$(CONFIG_SCSI) += tests/qtest/fuzz/virtio_scsi_fuzz.o
125
#define HEADER_INUSE_MAGIC (0x746F6E59)
28
126
#define MAX_PARALLELS_IMAGE_FACTOR (1ull << 32)
29
FUZZ_CFLAGS += -I$(SRC_PATH)/tests -I$(SRC_PATH)/tests/qtest
127
128
-#define DEFAULT_CLUSTER_SIZE 1048576 /* 1 MiB */
129
-
130
-
131
-// always little-endian
132
-typedef struct ParallelsHeader {
133
- char magic[16]; // "WithoutFreeSpace"
134
- uint32_t version;
135
- uint32_t heads;
136
- uint32_t cylinders;
137
- uint32_t tracks;
138
- uint32_t bat_entries;
139
- uint64_t nb_sectors;
140
- uint32_t inuse;
141
- uint32_t data_off;
142
- char padding[12];
143
-} QEMU_PACKED ParallelsHeader;
144
-
145
-
146
-typedef enum ParallelsPreallocMode {
147
- PRL_PREALLOC_MODE_FALLOCATE = 0,
148
- PRL_PREALLOC_MODE_TRUNCATE = 1,
149
- PRL_PREALLOC_MODE__MAX = 2,
150
-} ParallelsPreallocMode;
151
-
152
static QEnumLookup prealloc_mode_lookup = {
153
.array = (const char *const[]) {
154
"falloc",
155
@@ -XXX,XX +XXX,XX @@ static QEnumLookup prealloc_mode_lookup = {
156
.size = PRL_PREALLOC_MODE__MAX
157
};
158
159
-typedef struct BDRVParallelsState {
160
- /** Locking is conservative, the lock protects
161
- * - image file extending (truncate, fallocate)
162
- * - any access to block allocation table
163
- */
164
- CoMutex lock;
165
-
166
- ParallelsHeader *header;
167
- uint32_t header_size;
168
- bool header_unclean;
169
-
170
- unsigned long *bat_dirty_bmap;
171
- unsigned int bat_dirty_block;
172
-
173
- uint32_t *bat_bitmap;
174
- unsigned int bat_size;
175
-
176
- int64_t data_end;
177
- uint64_t prealloc_size;
178
- ParallelsPreallocMode prealloc_mode;
179
-
180
- unsigned int tracks;
181
-
182
- unsigned int off_multiplier;
183
- Error *migration_blocker;
184
-} BDRVParallelsState;
185
-
186
-
187
#define PARALLELS_OPT_PREALLOC_MODE "prealloc-mode"
188
#define PARALLELS_OPT_PREALLOC_SIZE "prealloc-size"
30
189
31
--
190
--
32
2.25.3
191
2.14.3
33
192
193
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
1
3
List softmmu fuzz targets in 'make help' output:
4
5
$ make help
6
...
7
Architecture specific targets:
8
aarch64-softmmu/all - Build for aarch64-softmmu
9
aarch64-softmmu/fuzz - Build fuzzer for aarch64-softmmu
10
alpha-softmmu/all - Build for alpha-softmmu
11
alpha-softmmu/fuzz - Build fuzzer for alpha-softmmu
12
arm-softmmu/all - Build for arm-softmmu
13
arm-softmmu/fuzz - Build fuzzer for arm-softmmu
14
...
15
16
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
17
Message-id: 20200514143433.18569-3-philmd@redhat.com
18
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
19
---
20
Makefile | 6 +++++-
21
1 file changed, 5 insertions(+), 1 deletion(-)
22
23
diff --git a/Makefile b/Makefile
24
index XXXXXXX..XXXXXXX 100644
25
--- a/Makefile
26
+++ b/Makefile
27
@@ -XXX,XX +XXX,XX @@ endif
28
    @$(if $(TARGET_DIRS), \
29
        echo 'Architecture specific targets:'; \
30
        $(foreach t, $(TARGET_DIRS), \
31
-        $(call print-help-run,$(t)/all,Build for $(t));) \
32
+        $(call print-help-run,$(t)/all,Build for $(t)); \
33
+        $(if $(CONFIG_FUZZ), \
34
+            $(if $(findstring softmmu,$(t)), \
35
+                $(call print-help-run,$(t)/fuzz,Build fuzzer for $(t)); \
36
+        ))) \
37
        echo '')
38
    @$(if $(TOOLS), \
39
        echo 'Tools targets:'; \
40
--
41
2.25.3
42
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
1
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4
Message-id: 20200514143433.18569-4-philmd@redhat.com
5
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6
---
7
tests/qtest/fuzz/i440fx_fuzz.c | 6 +++---
8
1 file changed, 3 insertions(+), 3 deletions(-)
9
10
diff --git a/tests/qtest/fuzz/i440fx_fuzz.c b/tests/qtest/fuzz/i440fx_fuzz.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/tests/qtest/fuzz/i440fx_fuzz.c
13
+++ b/tests/qtest/fuzz/i440fx_fuzz.c
14
@@ -XXX,XX +XXX,XX @@ static void register_pci_fuzz_targets(void)
15
/* Uses simple qtest commands and reboots to reset state */
16
fuzz_add_target(&(FuzzTarget){
17
.name = "i440fx-qtest-reboot-fuzz",
18
- .description = "Fuzz the i440fx using raw qtest commands and"
19
+ .description = "Fuzz the i440fx using raw qtest commands and "
20
"rebooting after each run",
21
.get_init_cmdline = i440fx_argv,
22
.fuzz = i440fx_fuzz_qtest});
23
@@ -XXX,XX +XXX,XX @@ static void register_pci_fuzz_targets(void)
24
/* Uses libqos and forks to prevent state leakage */
25
fuzz_add_qos_target(&(FuzzTarget){
26
.name = "i440fx-qos-fork-fuzz",
27
- .description = "Fuzz the i440fx using raw qtest commands and"
28
+ .description = "Fuzz the i440fx using raw qtest commands and "
29
"rebooting after each run",
30
.pre_vm_init = &fork_init,
31
.fuzz = i440fx_fuzz_qos_fork,},
32
@@ -XXX,XX +XXX,XX @@ static void register_pci_fuzz_targets(void)
33
*/
34
fuzz_add_qos_target(&(FuzzTarget){
35
.name = "i440fx-qos-noreset-fuzz",
36
- .description = "Fuzz the i440fx using raw qtest commands and"
37
+ .description = "Fuzz the i440fx using raw qtest commands and "
38
"rebooting after each run",
39
.fuzz = i440fx_fuzz_qos,},
40
"i440FX-pcihost",
41
--
42
2.25.3
43
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Klim Kireev <klim.kireev@virtuozzo.com>
2
2
3
These typedefs are not used. Use a simple structure,
3
Signed-off-by: Klim Kireev <klim.kireev@virtuozzo.com>
4
remote the typedefs.
4
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
5
5
Signed-off-by: Denis V. Lunev <den@openvz.org>
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
7
Message-id: 20200514143433.18569-5-philmd@redhat.com
7
Signed-off-by: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
8
Message-id: 20180112090122.1702-5-klim.kireev@virtuozzo.com
9
CC: Stefan Hajnoczi <stefanha@redhat.com>
8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9
---
11
---
10
tests/qtest/fuzz/i440fx_fuzz.c | 10 ++++------
12
block/parallels.h | 2 ++
11
1 file changed, 4 insertions(+), 6 deletions(-)
13
block/parallels.c | 5 +++--
14
2 files changed, 5 insertions(+), 2 deletions(-)
12
15
13
diff --git a/tests/qtest/fuzz/i440fx_fuzz.c b/tests/qtest/fuzz/i440fx_fuzz.c
16
diff --git a/block/parallels.h b/block/parallels.h
14
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
15
--- a/tests/qtest/fuzz/i440fx_fuzz.c
18
--- a/block/parallels.h
16
+++ b/tests/qtest/fuzz/i440fx_fuzz.c
19
+++ b/block/parallels.h
17
@@ -XXX,XX +XXX,XX @@ static void i440fx_fuzz_qtest(QTestState *s,
20
@@ -XXX,XX +XXX,XX @@
18
* loop over the Data, breaking it up into actions. each action has an
21
#include "qemu/coroutine.h"
19
* opcode, address offset and value
22
#include "qemu/typedefs.h"
20
*/
23
21
- typedef struct QTestFuzzAction {
24
+#define HEADS_NUMBER 16
22
+ struct {
25
+#define SEC_IN_CYL 32
23
uint8_t opcode;
26
#define DEFAULT_CLUSTER_SIZE 1048576 /* 1 MiB */
24
uint8_t addr;
27
25
uint32_t value;
28
/* always little-endian */
26
- } QTestFuzzAction;
29
diff --git a/block/parallels.c b/block/parallels.c
27
- QTestFuzzAction a;
30
index XXXXXXX..XXXXXXX 100644
28
+ } a;
31
--- a/block/parallels.c
29
32
+++ b/block/parallels.c
30
while (Size >= sizeof(a)) {
33
@@ -XXX,XX +XXX,XX @@ static int parallels_create(const char *filename, QemuOpts *opts, Error **errp)
31
/* make a copy of the action so we can normalize the values in-place */
34
memcpy(header.magic, HEADER_MAGIC2, sizeof(header.magic));
32
@@ -XXX,XX +XXX,XX @@ static void i440fx_fuzz_qos(QTestState *s,
35
header.version = cpu_to_le32(HEADER_VERSION);
33
* Same as i440fx_fuzz_qtest, but using QOS. devfn is incorporated into the
36
/* don't care much about geometry, it is not used on image level */
34
* value written over Port IO
37
- header.heads = cpu_to_le32(16);
35
*/
38
- header.cylinders = cpu_to_le32(total_size / BDRV_SECTOR_SIZE / 16 / 32);
36
- typedef struct QOSFuzzAction {
39
+ header.heads = cpu_to_le32(HEADS_NUMBER);
37
+ struct {
40
+ header.cylinders = cpu_to_le32(total_size / BDRV_SECTOR_SIZE
38
uint8_t opcode;
41
+ / HEADS_NUMBER / SEC_IN_CYL);
39
uint8_t offset;
42
header.tracks = cpu_to_le32(cl_size >> BDRV_SECTOR_BITS);
40
int devfn;
43
header.bat_entries = cpu_to_le32(bat_entries);
41
uint32_t value;
44
header.nb_sectors = cpu_to_le64(DIV_ROUND_UP(total_size, BDRV_SECTOR_SIZE));
42
- } QOSFuzzAction;
43
+ } a;
44
45
static QPCIBus *bus;
46
if (!bus) {
47
bus = qpci_new_pc(s, fuzz_qos_alloc);
48
}
49
50
- QOSFuzzAction a;
51
while (Size >= sizeof(a)) {
52
memcpy(&a, Data, sizeof(a));
53
switch (a.opcode % ACTION_MAX) {
54
--
45
--
55
2.25.3
46
2.14.3
56
47
48
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
2
2
3
Extract the generic pciconfig_fuzz_qos() method from
3
Since parallels format supports backing files, refine
4
i440fx_fuzz_qos(). This will help to write tests not
4
readv/writev (allocate_clusters) to redirect read/write requests
5
specific to the i440FX controller.
5
to a backing file (if cluster is not available in the current bs).
6
6
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Signed-off-by: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
8
Message-id: 20200514143433.18569-6-philmd@redhat.com
8
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
9
Signed-off-by: Denis V. Lunev <den@openvz.org>
10
Signed-off-by: Klim Kireev <klim.kireev@virtuozzo.com>
11
Message-id: 20180112090122.1702-6-klim.kireev@virtuozzo.com
12
CC: Stefan Hajnoczi <stefanha@redhat.com>
9
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
13
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10
---
14
---
11
tests/qtest/fuzz/i440fx_fuzz.c | 20 ++++++++++++++------
15
block/parallels.c | 50 ++++++++++++++++++++++++++++++++++++++++++++------
12
1 file changed, 14 insertions(+), 6 deletions(-)
16
1 file changed, 44 insertions(+), 6 deletions(-)
13
17
14
diff --git a/tests/qtest/fuzz/i440fx_fuzz.c b/tests/qtest/fuzz/i440fx_fuzz.c
18
diff --git a/block/parallels.c b/block/parallels.c
15
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
16
--- a/tests/qtest/fuzz/i440fx_fuzz.c
20
--- a/block/parallels.c
17
+++ b/tests/qtest/fuzz/i440fx_fuzz.c
21
+++ b/block/parallels.c
18
@@ -XXX,XX +XXX,XX @@ static void i440fx_fuzz_qtest(QTestState *s,
22
@@ -XXX,XX +XXX,XX @@ static int64_t block_status(BDRVParallelsState *s, int64_t sector_num,
19
flush_events(s);
23
static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num,
20
}
24
int nb_sectors, int *pnum)
21
25
{
22
-static void i440fx_fuzz_qos(QTestState *s,
26
+ int ret;
23
+static void pciconfig_fuzz_qos(QTestState *s, QPCIBus *bus,
27
BDRVParallelsState *s = bs->opaque;
24
const unsigned char *Data, size_t Size) {
28
int64_t pos, space, idx, to_allocate, i, len;
25
/*
29
26
* Same as i440fx_fuzz_qtest, but using QOS. devfn is incorporated into the
30
@@ -XXX,XX +XXX,XX @@ static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num,
27
@@ -XXX,XX +XXX,XX @@ static void i440fx_fuzz_qos(QTestState *s,
31
return len;
28
uint32_t value;
32
}
29
} a;
33
if (s->data_end + space > (len >> BDRV_SECTOR_BITS)) {
30
34
- int ret;
31
- static QPCIBus *bus;
35
space += s->prealloc_size;
32
- if (!bus) {
36
if (s->prealloc_mode == PRL_PREALLOC_MODE_FALLOCATE) {
33
- bus = qpci_new_pc(s, fuzz_qos_alloc);
37
ret = bdrv_pwrite_zeroes(bs->file,
34
- }
38
@@ -XXX,XX +XXX,XX @@ static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num,
35
-
39
}
36
while (Size >= sizeof(a)) {
40
}
37
memcpy(&a, Data, sizeof(a));
41
38
switch (a.opcode % ACTION_MAX) {
42
+ /* Try to read from backing to fill empty clusters
39
@@ -XXX,XX +XXX,XX @@ static void i440fx_fuzz_qos(QTestState *s,
43
+ * FIXME: 1. previous write_zeroes may be redundant
40
flush_events(s);
44
+ * 2. most of data we read from backing will be rewritten by
41
}
45
+ * parallels_co_writev. On aligned-to-cluster write we do not need
42
46
+ * this read at all.
43
+static void i440fx_fuzz_qos(QTestState *s,
47
+ * 3. it would be good to combine write of data from backing and new
44
+ const unsigned char *Data,
48
+ * data into one write call */
45
+ size_t Size)
49
+ if (bs->backing) {
46
+{
50
+ int64_t nb_cow_sectors = to_allocate * s->tracks;
47
+ static QPCIBus *bus;
51
+ int64_t nb_cow_bytes = nb_cow_sectors << BDRV_SECTOR_BITS;
52
+ QEMUIOVector qiov;
53
+ struct iovec iov = {
54
+ .iov_len = nb_cow_bytes,
55
+ .iov_base = qemu_blockalign(bs, nb_cow_bytes)
56
+ };
57
+ qemu_iovec_init_external(&qiov, &iov, 1);
48
+
58
+
49
+ if (!bus) {
59
+ ret = bdrv_co_readv(bs->backing, idx * s->tracks, nb_cow_sectors,
50
+ bus = qpci_new_pc(s, fuzz_qos_alloc);
60
+ &qiov);
61
+ if (ret < 0) {
62
+ qemu_vfree(iov.iov_base);
63
+ return ret;
64
+ }
65
+
66
+ ret = bdrv_co_writev(bs->file, s->data_end, nb_cow_sectors, &qiov);
67
+ qemu_vfree(iov.iov_base);
68
+ if (ret < 0) {
69
+ return ret;
70
+ }
51
+ }
71
+ }
52
+
72
+
53
+ pciconfig_fuzz_qos(s, bus, Data, Size);
73
for (i = 0; i < to_allocate; i++) {
54
+}
74
s->bat_bitmap[idx + i] = cpu_to_le32(s->data_end / s->off_multiplier);
75
s->data_end += s->tracks;
76
@@ -XXX,XX +XXX,XX @@ static coroutine_fn int parallels_co_readv(BlockDriverState *bs,
77
78
nbytes = n << BDRV_SECTOR_BITS;
79
80
+ qemu_iovec_reset(&hd_qiov);
81
+ qemu_iovec_concat(&hd_qiov, qiov, bytes_done, nbytes);
55
+
82
+
56
static void i440fx_fuzz_qos_fork(QTestState *s,
83
if (position < 0) {
57
const unsigned char *Data, size_t Size) {
84
- qemu_iovec_memset(qiov, bytes_done, 0, nbytes);
58
if (fork() == 0) {
85
+ if (bs->backing) {
86
+ ret = bdrv_co_readv(bs->backing, sector_num, n, &hd_qiov);
87
+ if (ret < 0) {
88
+ break;
89
+ }
90
+ } else {
91
+ qemu_iovec_memset(&hd_qiov, 0, 0, nbytes);
92
+ }
93
} else {
94
- qemu_iovec_reset(&hd_qiov);
95
- qemu_iovec_concat(&hd_qiov, qiov, bytes_done, nbytes);
96
-
97
ret = bdrv_co_readv(bs->file, position, n, &hd_qiov);
98
if (ret < 0) {
99
break;
100
@@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_parallels = {
101
.bdrv_co_flush_to_os = parallels_co_flush_to_os,
102
.bdrv_co_readv = parallels_co_readv,
103
.bdrv_co_writev = parallels_co_writev,
104
-
105
+ .supports_backing = true,
106
.bdrv_create = parallels_create,
107
.bdrv_check = parallels_check,
108
.create_opts = &parallels_create_opts,
59
--
109
--
60
2.25.3
110
2.14.3
61
111
112
diff view generated by jsdifflib