1
The following changes since commit 47c1cc30e440860aa695358f7c2dd0b9d7b53d16:
1
The following changes since commit ee59483267de29056b5b2ee2421ef3844e5c9932:
2
2
3
Update version for v3.1.0-rc2 release (2018-11-20 18:10:26 +0000)
3
Merge tag 'qemu-openbios-20230307' of https://github.com/mcayland/qemu into staging (2023-03-09 16:55:03 +0000)
4
4
5
are available in the Git repository at:
5
are available in the Git repository at:
6
6
7
git://repo.or.cz/qemu/kevin.git tags/for-upstream
7
https://repo.or.cz/qemu/kevin.git tags/for-upstream
8
8
9
for you to fetch changes up to 924956b1efc50af7cc334b7a14f56aa213ca27ef:
9
for you to fetch changes up to ecf8191314798391b1df80bcb829c0ead4f8acc9:
10
10
11
iotests: Enhance 223 to cover multiple bitmap granularities (2018-11-22 16:43:52 +0100)
11
qed: remove spurious BDRV_POLL_WHILE() (2023-03-10 15:14:46 +0100)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Block layer patches:
14
Block layer patches
15
15
16
- block: Fix update of BDRV_O_AUTO_RDONLY in update_flags_from_options()
16
- fuse: Fix fallocate(PUNCH_HOLE) to zero out the range
17
- qemu-img: Fix memory leak and typo in error message
17
- qed: remove spurious BDRV_POLL_WHILE()
18
- nvme: Fixes for lockups and crashes
19
- scsi-disk: Fix crash if underlying host file or disk returns error
20
- Several qemu-iotests fixes and improvements
21
18
22
----------------------------------------------------------------
19
----------------------------------------------------------------
23
Alberto Garcia (1):
20
Hanna Czenczek (2):
24
block: Fix update of BDRV_O_AUTO_RDONLY in update_flags_from_options()
21
block/fuse: Let PUNCH_HOLE write zeroes
22
iotests/308: Add test for 'write -zu'
25
23
26
Daniel P. Berrangé (1):
24
Stefan Hajnoczi (1):
27
iotests: fix nbd test 233 to work correctly with raw images
25
qed: remove spurious BDRV_POLL_WHILE()
28
26
29
Eric Blake (2):
27
block/export/fuse.c | 11 ++++++++++-
30
iotests: Skip 233 if certtool not installed
28
block/qed.c | 1 -
31
iotests: Enhance 223 to cover multiple bitmap granularities
29
tests/qemu-iotests/308 | 43 +++++++++++++++++++++++++++++++++++++++++++
32
30
tests/qemu-iotests/308.out | 35 +++++++++++++++++++++++++++++++++++
33
Igor Druzhinin (1):
31
4 files changed, 88 insertions(+), 2 deletions(-)
34
nvme: call blk_drain in NVMe reset code to avoid lockups
35
36
Kevin Wolf (3):
37
iotests: Replace time.clock() with Timeout
38
iotests: Replace assertEquals() with assertEqual()
39
Revert "nvme: fix oob access issue(CVE-2018-16847)"
40
41
Logan Gunthorpe (1):
42
nvme: fix bug with PCI IRQ pins on teardown
43
44
Max Reitz (2):
45
qemu-img: Fix typo
46
qemu-img: Fix leak
47
48
Paolo Bonzini (1):
49
nvme: fix out-of-bounds access to the CMB
50
51
Richard W.M. Jones (1):
52
scsi-disk: Fix crash if underlying host file or disk returns error
53
54
block.c | 4 +--
55
hw/block/nvme.c | 12 +++-----
56
hw/scsi/scsi-disk.c | 2 +-
57
qemu-img.c | 3 +-
58
tests/nvme-test.c | 68 ++++++++++++++++++++++++++++++++++++-------
59
tests/Makefile.include | 2 +-
60
tests/qemu-iotests/041 | 6 ++--
61
tests/qemu-iotests/118 | 20 +++++--------
62
tests/qemu-iotests/223 | 43 ++++++++++++++++++++++-----
63
tests/qemu-iotests/223.out | 32 +++++++++++++++-----
64
tests/qemu-iotests/233 | 9 ++++--
65
tests/qemu-iotests/common.tls | 3 ++
66
tests/qemu-iotests/iotests.py | 2 +-
67
13 files changed, 148 insertions(+), 58 deletions(-)
68
diff view generated by jsdifflib
Deleted patch
1
time.clock() is deprecated since Python 3.3. Current Python versions
2
warn that the function will be removed in Python 3.8, and those warnings
3
make the test case 118 fail.
4
1
5
Replace it with the Timeout mechanism that is compatible with both
6
Python 2 and 3, and makes the code even a little nicer.
7
8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9
Reviewed-by: John Snow <jsnow@redhat.com>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
11
---
12
tests/qemu-iotests/118 | 16 ++++++----------
13
1 file changed, 6 insertions(+), 10 deletions(-)
14
15
diff --git a/tests/qemu-iotests/118 b/tests/qemu-iotests/118
16
index XXXXXXX..XXXXXXX 100755
17
--- a/tests/qemu-iotests/118
18
+++ b/tests/qemu-iotests/118
19
@@ -XXX,XX +XXX,XX @@ class ChangeBaseClass(iotests.QMPTestCase):
20
if not self.has_real_tray:
21
return
22
23
- timeout = time.clock() + 3
24
- while not self.has_opened and time.clock() < timeout:
25
- self.process_events()
26
- if not self.has_opened:
27
- self.fail('Timeout while waiting for the tray to open')
28
+ with iotests.Timeout(3, 'Timeout while waiting for the tray to open'):
29
+ while not self.has_opened:
30
+ self.process_events()
31
32
def wait_for_close(self):
33
if not self.has_real_tray:
34
return
35
36
- timeout = time.clock() + 3
37
- while not self.has_closed and time.clock() < timeout:
38
- self.process_events()
39
- if not self.has_opened:
40
- self.fail('Timeout while waiting for the tray to close')
41
+ with iotests.Timeout(3, 'Timeout while waiting for the tray to close'):
42
+ while not self.has_closed:
43
+ self.process_events()
44
45
class GeneralChangeTestsBaseClass(ChangeBaseClass):
46
47
--
48
2.19.1
49
50
diff view generated by jsdifflib
Deleted patch
1
TestCase.assertEquals() is deprecated since Python 2.7. Recent Python
2
versions print a warning when the function is called, which makes test
3
cases fail.
4
1
5
Replace it with the preferred spelling assertEqual().
6
7
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
8
Reviewed-by: John Snow <jsnow@redhat.com>
9
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
10
---
11
tests/qemu-iotests/041 | 6 +++---
12
tests/qemu-iotests/118 | 4 ++--
13
tests/qemu-iotests/iotests.py | 2 +-
14
3 files changed, 6 insertions(+), 6 deletions(-)
15
16
diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
17
index XXXXXXX..XXXXXXX 100755
18
--- a/tests/qemu-iotests/041
19
+++ b/tests/qemu-iotests/041
20
@@ -XXX,XX +XXX,XX @@ new_state = "1"
21
self.assert_qmp(event, 'data/id', 'drive0')
22
event = self.vm.get_qmp_event(wait=True)
23
24
- self.assertEquals(event['event'], 'BLOCK_JOB_ERROR')
25
+ self.assertEqual(event['event'], 'BLOCK_JOB_ERROR')
26
self.assert_qmp(event, 'data/device', 'drive0')
27
self.assert_qmp(event, 'data/operation', 'read')
28
result = self.vm.qmp('query-block-jobs')
29
@@ -XXX,XX +XXX,XX @@ new_state = "1"
30
self.assert_qmp(event, 'data/id', 'drive0')
31
event = self.vm.get_qmp_event(wait=True)
32
33
- self.assertEquals(event['event'], 'BLOCK_JOB_ERROR')
34
+ self.assertEqual(event['event'], 'BLOCK_JOB_ERROR')
35
self.assert_qmp(event, 'data/device', 'drive0')
36
self.assert_qmp(event, 'data/operation', 'read')
37
result = self.vm.qmp('query-block-jobs')
38
@@ -XXX,XX +XXX,XX @@ new_state = "1"
39
self.assert_qmp(result, 'return', {})
40
41
event = self.vm.event_wait(name='BLOCK_JOB_ERROR')
42
- self.assertEquals(event['event'], 'BLOCK_JOB_ERROR')
43
+ self.assertEqual(event['event'], 'BLOCK_JOB_ERROR')
44
self.assert_qmp(event, 'data/device', 'drive0')
45
self.assert_qmp(event, 'data/operation', 'write')
46
result = self.vm.qmp('query-block-jobs')
47
diff --git a/tests/qemu-iotests/118 b/tests/qemu-iotests/118
48
index XXXXXXX..XXXXXXX 100755
49
--- a/tests/qemu-iotests/118
50
+++ b/tests/qemu-iotests/118
51
@@ -XXX,XX +XXX,XX @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
52
result = self.vm.qmp('blockdev-close-tray', id=self.device_name)
53
# Should be a no-op
54
self.assert_qmp(result, 'return', {})
55
- self.assertEquals(self.vm.get_qmp_events(wait=False), [])
56
+ self.assertEqual(self.vm.get_qmp_events(wait=False), [])
57
58
def test_remove_on_closed(self):
59
if not self.has_real_tray:
60
@@ -XXX,XX +XXX,XX @@ class TestChangeReadOnly(ChangeBaseClass):
61
read_only_mode='retain')
62
self.assert_qmp(result, 'error/class', 'GenericError')
63
64
- self.assertEquals(self.vm.get_qmp_events(wait=False), [])
65
+ self.assertEqual(self.vm.get_qmp_events(wait=False), [])
66
67
result = self.vm.qmp('query-block')
68
self.assert_qmp(result, 'return[0]/inserted/ro', False)
69
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
70
index XXXXXXX..XXXXXXX 100644
71
--- a/tests/qemu-iotests/iotests.py
72
+++ b/tests/qemu-iotests/iotests.py
73
@@ -XXX,XX +XXX,XX @@ class QMPTestCase(unittest.TestCase):
74
def wait_ready_and_cancel(self, drive='drive0'):
75
self.wait_ready(drive=drive)
76
event = self.cancel_and_wait(drive=drive)
77
- self.assertEquals(event['event'], 'BLOCK_JOB_COMPLETED')
78
+ self.assertEqual(event['event'], 'BLOCK_JOB_COMPLETED')
79
self.assert_qmp(event, 'data/type', 'mirror')
80
self.assert_qmp(event, 'data/offset', event['data']['len'])
81
82
--
83
2.19.1
84
85
diff view generated by jsdifflib
Deleted patch
1
From: Eric Blake <eblake@redhat.com>
2
1
3
The use of TLS while building qemu is optional. While the
4
'certtool' binary should be available on every platform that
5
supports building against TLS, that does not imply that the
6
developer has installed it. Make the test gracefully skip
7
in that case.
8
9
Reported-by: Kevin Wolf <kwolf@redhat.com>
10
Signed-off-by: Eric Blake <eblake@redhat.com>
11
Reviewed-by: John Snow <jsnow@redhat.com>
12
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
13
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
14
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
15
---
16
tests/qemu-iotests/common.tls | 3 +++
17
1 file changed, 3 insertions(+)
18
19
diff --git a/tests/qemu-iotests/common.tls b/tests/qemu-iotests/common.tls
20
index XXXXXXX..XXXXXXX 100644
21
--- a/tests/qemu-iotests/common.tls
22
+++ b/tests/qemu-iotests/common.tls
23
@@ -XXX,XX +XXX,XX @@ tls_x509_cleanup()
24
25
tls_x509_init()
26
{
27
+ (certtool --help) >/dev/null 2>&1 || \
28
+    _notrun "certtool utility not found, skipping test"
29
+
30
mkdir -p "${tls_dir}"
31
32
# use a fixed key so we don't waste system entropy on
33
--
34
2.19.1
35
36
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
Fixes: d402b6a21a825a5c07aac9251990860723d49f5d
4
Reported-by: Kevin Wolf <kwolf@redhat.com>
5
Cc: qemu-stable@nongnu.org
6
Signed-off-by: Max Reitz <mreitz@redhat.com>
7
Reviewed-by: John Snow <jsnow@redhat.com>
8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9
---
10
qemu-img.c | 2 +-
11
1 file changed, 1 insertion(+), 1 deletion(-)
12
13
diff --git a/qemu-img.c b/qemu-img.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/qemu-img.c
16
+++ b/qemu-img.c
17
@@ -XXX,XX +XXX,XX @@ static int print_block_option_help(const char *filename, const char *fmt)
18
return 1;
19
}
20
if (!proto_drv->create_opts) {
21
- error_report("Protocal driver '%s' does not support image creation",
22
+ error_report("Protocol driver '%s' does not support image creation",
23
proto_drv->format_name);
24
return 1;
25
}
26
--
27
2.19.1
28
29
diff view generated by jsdifflib
Deleted patch
1
From: Max Reitz <mreitz@redhat.com>
2
1
3
create_opts was leaked here. This is not too bad since the process is
4
about to exit anyway, but relying on that does not make the code nicer
5
to read.
6
7
Fixes: d402b6a21a825a5c07aac9251990860723d49f5d
8
Reported-by: Kevin Wolf <kwolf@redhat.com>
9
Cc: qemu-stable@nongnu.org
10
Signed-off-by: Max Reitz <mreitz@redhat.com>
11
Reviewed-by: John Snow <jsnow@redhat.com>
12
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13
---
14
qemu-img.c | 1 +
15
1 file changed, 1 insertion(+)
16
17
diff --git a/qemu-img.c b/qemu-img.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/qemu-img.c
20
+++ b/qemu-img.c
21
@@ -XXX,XX +XXX,XX @@ static int print_block_option_help(const char *filename, const char *fmt)
22
if (!proto_drv->create_opts) {
23
error_report("Protocol driver '%s' does not support image creation",
24
proto_drv->format_name);
25
+ qemu_opts_free(create_opts);
26
return 1;
27
}
28
create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
29
--
30
2.19.1
31
32
diff view generated by jsdifflib
Deleted patch
1
From: "Richard W.M. Jones" <rjones@redhat.com>
2
1
3
Commit 40dce4ee6 "scsi-disk: fix rerror/werror=ignore" introduced a
4
bug which causes qemu to crash with the assertion error below if the
5
host file or disk returns an error:
6
7
qemu-system-x86_64: hw/scsi/scsi-bus.c:1374: scsi_req_complete:
8
Assertion `req->status == -1' failed.
9
10
Kevin Wolf suggested this fix:
11
12
< kwolf> Hm, should the final return false; in that patch
13
actually be a return true?
14
< kwolf> Because I think he didn't intend to change anything
15
except BLOCK_ERROR_ACTION_IGNORE
16
17
Buglink: https://bugs.launchpad.net/qemu/+bug/1804323
18
Fixes: 40dce4ee61c68395f6d463fae792f61b7c003bce
19
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
20
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
21
---
22
hw/scsi/scsi-disk.c | 2 +-
23
1 file changed, 1 insertion(+), 1 deletion(-)
24
25
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
26
index XXXXXXX..XXXXXXX 100644
27
--- a/hw/scsi/scsi-disk.c
28
+++ b/hw/scsi/scsi-disk.c
29
@@ -XXX,XX +XXX,XX @@ static bool scsi_handle_rw_error(SCSIDiskReq *r, int error, bool acct_failed)
30
if (action == BLOCK_ERROR_ACTION_STOP) {
31
scsi_req_retry(&r->req);
32
}
33
- return false;
34
+ return true;
35
}
36
37
static void scsi_write_complete_noio(SCSIDiskReq *r, int ret)
38
--
39
2.19.1
40
41
diff view generated by jsdifflib
Deleted patch
1
From: Alberto Garcia <berto@igalia.com>
2
1
3
Commit e35bdc123a4ace9f4d3fcca added the auto-read-only option and the
4
code to update its corresponding flag in update_flags_from_options(),
5
but forgot to clear the flag if auto-read-only is false.
6
7
Signed-off-by: Alberto Garcia <berto@igalia.com>
8
Reported-by: Max Reitz <mreitz@redhat.com>
9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10
---
11
block.c | 4 +---
12
1 file changed, 1 insertion(+), 3 deletions(-)
13
14
diff --git a/block.c b/block.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/block.c
17
+++ b/block.c
18
@@ -XXX,XX +XXX,XX @@ static int bdrv_open_flags(BlockDriverState *bs, int flags)
19
20
static void update_flags_from_options(int *flags, QemuOpts *opts)
21
{
22
- *flags &= ~BDRV_O_CACHE_MASK;
23
+ *flags &= ~(BDRV_O_CACHE_MASK | BDRV_O_RDWR | BDRV_O_AUTO_RDONLY);
24
25
assert(qemu_opt_find(opts, BDRV_OPT_CACHE_NO_FLUSH));
26
if (qemu_opt_get_bool_del(opts, BDRV_OPT_CACHE_NO_FLUSH, false)) {
27
@@ -XXX,XX +XXX,XX @@ static void update_flags_from_options(int *flags, QemuOpts *opts)
28
*flags |= BDRV_O_NOCACHE;
29
}
30
31
- *flags &= ~BDRV_O_RDWR;
32
-
33
assert(qemu_opt_find(opts, BDRV_OPT_READ_ONLY));
34
if (!qemu_opt_get_bool_del(opts, BDRV_OPT_READ_ONLY, false)) {
35
*flags |= BDRV_O_RDWR;
36
--
37
2.19.1
38
39
diff view generated by jsdifflib
1
From: Eric Blake <eblake@redhat.com>
1
From: Hanna Czenczek <hreitz@redhat.com>
2
2
3
Testing granularity at the same size as the cluster isn't quite
3
fallocate(2) says about PUNCH_HOLE: "After a successful call, subsequent
4
as fun as what happens when it is larger or smaller. This
4
reads from this range will return zeros." As it is, PUNCH_HOLE is
5
enhancement also shows that qemu's nbd server can serve the
5
implemented as a call to blk_pdiscard(), which does not guarantee this.
6
same disk over multiple exports simultaneously.
7
6
8
Signed-off-by: Eric Blake <eblake@redhat.com>
7
We must call blk_pwrite_zeroes() instead. The difference to ZERO_RANGE
9
Tested-by: John Snow <jsnow@redhat.com>
8
is that we pass the `BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK` flags to
10
Reviewed-by: John Snow <jsnow@redhat.com>
9
the call -- the storage is supposed to be unmapped, and a slow fallback
10
by actually writing zeroes as data is not allowed.
11
12
Closes: https://gitlab.com/qemu-project/qemu/-/issues/1507
13
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
14
Message-Id: <20230227104725.33511-2-hreitz@redhat.com>
15
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
11
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
16
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12
---
17
---
13
tests/qemu-iotests/223 | 43 +++++++++++++++++++++++++++++++-------
18
block/export/fuse.c | 11 ++++++++++-
14
tests/qemu-iotests/223.out | 32 +++++++++++++++++++++-------
19
1 file changed, 10 insertions(+), 1 deletion(-)
15
2 files changed, 60 insertions(+), 15 deletions(-)
16
20
17
diff --git a/tests/qemu-iotests/223 b/tests/qemu-iotests/223
21
diff --git a/block/export/fuse.c b/block/export/fuse.c
18
index XXXXXXX..XXXXXXX 100755
22
index XXXXXXX..XXXXXXX 100644
19
--- a/tests/qemu-iotests/223
23
--- a/block/export/fuse.c
20
+++ b/tests/qemu-iotests/223
24
+++ b/block/export/fuse.c
21
@@ -XXX,XX +XXX,XX @@ run_qemu()
25
@@ -XXX,XX +XXX,XX @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t inode, int mode,
22
}
26
do {
23
27
int size = MIN(length, BDRV_REQUEST_MAX_BYTES);
24
echo
28
25
-echo "=== Create partially sparse image, then add dirty bitmap ==="
29
- ret = blk_pdiscard(exp->common.blk, offset, size);
26
+echo "=== Create partially sparse image, then add dirty bitmaps ==="
30
+ ret = blk_pwrite_zeroes(exp->common.blk, offset, size,
27
echo
31
+ BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK);
28
32
+ if (ret == -ENOTSUP) {
29
-_make_test_img 4M
33
+ /*
30
+# Two bitmaps, to contrast granularity issues
34
+ * fallocate() specifies to return EOPNOTSUPP for unsupported
31
+_make_test_img -o cluster_size=4k 4M
35
+ * operations
32
$QEMU_IO -c 'w -P 0x11 1M 2M' "$TEST_IMG" | _filter_qemu_io
36
+ */
33
run_qemu <<EOF
37
+ ret = -EOPNOTSUPP;
34
{ "execute": "qmp_capabilities" }
38
+ }
35
@@ -XXX,XX +XXX,XX @@ run_qemu <<EOF
36
"arguments": {
37
"node": "n",
38
"name": "b",
39
- "persistent": true
40
+ "persistent": true,
41
+ "granularity": 65536
42
+ }
43
+}
44
+{ "execute": "block-dirty-bitmap-add",
45
+ "arguments": {
46
+ "node": "n",
47
+ "name": "b2",
48
+ "persistent": true,
49
+ "granularity": 512
50
}
51
}
52
{ "execute": "quit" }
53
@@ -XXX,XX +XXX,XX @@ echo
54
echo "=== Write part of the file under active bitmap ==="
55
echo
56
57
-$QEMU_IO -c 'w -P 0x22 2M 2M' "$TEST_IMG" | _filter_qemu_io
58
+$QEMU_IO -c 'w -P 0x22 512 512' -c 'w -P 0x33 2M 2M' "$TEST_IMG" \
59
+ | _filter_qemu_io
60
61
echo
62
-echo "=== End dirty bitmap, and start serving image over NBD ==="
63
+echo "=== End dirty bitmaps, and start serving image over NBD ==="
64
echo
65
66
_launch_qemu 2> >(_filter_nbd)
67
@@ -XXX,XX +XXX,XX @@ _send_qemu_cmd $QEMU_HANDLE '{"execute":"blockdev-add",
68
"file":{"driver":"file", "filename":"'"$TEST_IMG"'"}}}' "return"
69
_send_qemu_cmd $QEMU_HANDLE '{"execute":"x-block-dirty-bitmap-disable",
70
"arguments":{"node":"n", "name":"b"}}' "return"
71
+_send_qemu_cmd $QEMU_HANDLE '{"execute":"x-block-dirty-bitmap-disable",
72
+ "arguments":{"node":"n", "name":"b2"}}' "return"
73
_send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-start",
74
"arguments":{"addr":{"type":"unix",
75
"data":{"path":"'"$TEST_DIR/nbd"'"}}}}' "return"
76
@@ -XXX,XX +XXX,XX @@ _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-add",
77
"arguments":{"device":"n"}}' "return"
78
_send_qemu_cmd $QEMU_HANDLE '{"execute":"x-nbd-server-add-bitmap",
79
"arguments":{"name":"n", "bitmap":"b"}}' "return"
80
+_send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-add",
81
+ "arguments":{"device":"n", "name":"n2"}}' "return"
82
+_send_qemu_cmd $QEMU_HANDLE '{"execute":"x-nbd-server-add-bitmap",
83
+ "arguments":{"name":"n2", "bitmap":"b2"}}' "return"
84
85
echo
86
-echo "=== Contrast normal status with dirty-bitmap status ==="
87
+echo "=== Contrast normal status to large granularity dirty-bitmap ==="
88
echo
89
90
QEMU_IO_OPTIONS=$QEMU_IO_OPTIONS_NO_FMT
91
IMG="driver=nbd,export=n,server.type=unix,server.path=$TEST_DIR/nbd"
92
-$QEMU_IO -r -c 'r -P 0 0 1m' -c 'r -P 0x11 1m 1m' \
93
- -c 'r -P 0x22 2m 2m' --image-opts "$IMG" | _filter_qemu_io
94
+$QEMU_IO -r -c 'r -P 0x22 512 512' -c 'r -P 0 512k 512k' -c 'r -P 0x11 1m 1m' \
95
+ -c 'r -P 0x33 2m 2m' --image-opts "$IMG" | _filter_qemu_io
96
$QEMU_IMG map --output=json --image-opts \
97
"$IMG" | _filter_qemu_img_map
98
$QEMU_IMG map --output=json --image-opts \
99
"$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b" | _filter_qemu_img_map
100
101
+echo
102
+echo "=== Contrast to small granularity dirty-bitmap ==="
103
+echo
104
+
39
+
105
+IMG="driver=nbd,export=n2,server.type=unix,server.path=$TEST_DIR/nbd"
40
offset += size;
106
+$QEMU_IMG map --output=json --image-opts \
41
length -= size;
107
+ "$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b2" | _filter_qemu_img_map
42
} while (ret == 0 && length > 0);
108
+
109
echo
110
echo "=== End NBD server ==="
111
echo
112
113
_send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-remove",
114
"arguments":{"name":"n"}}' "return"
115
+_send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-remove",
116
+ "arguments":{"name":"n2"}}' "return"
117
_send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-stop"}' "return"
118
_send_qemu_cmd $QEMU_HANDLE '{"execute":"quit"}' "return"
119
120
diff --git a/tests/qemu-iotests/223.out b/tests/qemu-iotests/223.out
121
index XXXXXXX..XXXXXXX 100644
122
--- a/tests/qemu-iotests/223.out
123
+++ b/tests/qemu-iotests/223.out
124
@@ -XXX,XX +XXX,XX @@
125
QA output created by 223
126
127
-=== Create partially sparse image, then add dirty bitmap ===
128
+=== Create partially sparse image, then add dirty bitmaps ===
129
130
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4194304
131
wrote 2097152/2097152 bytes at offset 1048576
132
@@ -XXX,XX +XXX,XX @@ QMP_VERSION
133
{"return": {}}
134
{"return": {}}
135
{"return": {}}
136
+{"return": {}}
137
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
138
139
140
=== Write part of the file under active bitmap ===
141
142
+wrote 512/512 bytes at offset 512
143
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
144
wrote 2097152/2097152 bytes at offset 2097152
145
2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
146
147
-=== End dirty bitmap, and start serving image over NBD ===
148
+=== End dirty bitmaps, and start serving image over NBD ===
149
150
{"return": {}}
151
{"return": {}}
152
@@ -XXX,XX +XXX,XX @@ wrote 2097152/2097152 bytes at offset 2097152
153
{"return": {}}
154
{"return": {}}
155
{"return": {}}
156
+{"return": {}}
157
+{"return": {}}
158
+{"return": {}}
159
160
-=== Contrast normal status with dirty-bitmap status ===
161
+=== Contrast normal status to large granularity dirty-bitmap ===
162
163
-read 1048576/1048576 bytes at offset 0
164
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
165
+read 512/512 bytes at offset 512
166
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
167
+read 524288/524288 bytes at offset 524288
168
+512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
169
read 1048576/1048576 bytes at offset 1048576
170
1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
171
read 2097152/2097152 bytes at offset 2097152
172
2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
173
-[{ "start": 0, "length": 1048576, "depth": 0, "zero": true, "data": false},
174
+[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true},
175
+{ "start": 4096, "length": 1044480, "depth": 0, "zero": true, "data": false},
176
{ "start": 1048576, "length": 3145728, "depth": 0, "zero": false, "data": true}]
177
-[{ "start": 0, "length": 2097152, "depth": 0, "zero": false, "data": true},
178
+[{ "start": 0, "length": 65536, "depth": 0, "zero": false, "data": false},
179
+{ "start": 65536, "length": 2031616, "depth": 0, "zero": false, "data": true},
180
+{ "start": 2097152, "length": 2097152, "depth": 0, "zero": false, "data": false}]
181
+
182
+=== Contrast to small granularity dirty-bitmap ===
183
+
184
+[{ "start": 0, "length": 512, "depth": 0, "zero": false, "data": true},
185
+{ "start": 512, "length": 512, "depth": 0, "zero": false, "data": false},
186
+{ "start": 1024, "length": 2096128, "depth": 0, "zero": false, "data": true},
187
{ "start": 2097152, "length": 2097152, "depth": 0, "zero": false, "data": false}]
188
189
=== End NBD server ===
190
@@ -XXX,XX +XXX,XX @@ read 2097152/2097152 bytes at offset 2097152
191
{"return": {}}
192
{"return": {}}
193
{"return": {}}
194
+{"return": {}}
195
*** done
196
--
43
--
197
2.19.1
44
2.39.2
198
199
diff view generated by jsdifflib
1
From: Daniel P. Berrangé <berrange@redhat.com>
1
From: Hanna Czenczek <hreitz@redhat.com>
2
2
3
The first qemu-io command must honour the $IMGFMT that is set rather
3
Try writing zeroes to a FUSE export while allowing the area to be
4
than hardcoding qcow2. The qemu-nbd commands should also set $IMGFMT
4
unmapped; block/file-posix.c generally implements writing zeroes with
5
to avoid the insecure format probe warning.
5
BDRV_REQ_MAY_UNMAP ('write -zu') by calling fallocate(PUNCH_HOLE). This
6
used to lead to a blk_pdiscard() in the FUSE export, which may or may
7
not lead to the area being zeroed. HEAD^ fixed this to use
8
blk_pwrite_zeroes() instead (again with BDRV_REQ_MAY_UNMAP), so verify
9
that running `qemu-io 'write -zu'` on a FUSE exports always results in
10
zeroes being written.
6
11
7
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
12
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
8
Reviewed-by: Eric Blake <eblake@redhat.com>
13
Message-Id: <20230227104725.33511-3-hreitz@redhat.com>
14
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
15
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10
---
16
---
11
tests/qemu-iotests/233 | 9 ++++++---
17
tests/qemu-iotests/308 | 43 ++++++++++++++++++++++++++++++++++++++
12
1 file changed, 6 insertions(+), 3 deletions(-)
18
tests/qemu-iotests/308.out | 35 +++++++++++++++++++++++++++++++
19
2 files changed, 78 insertions(+)
13
20
14
diff --git a/tests/qemu-iotests/233 b/tests/qemu-iotests/233
21
diff --git a/tests/qemu-iotests/308 b/tests/qemu-iotests/308
15
index XXXXXXX..XXXXXXX 100755
22
index XXXXXXX..XXXXXXX 100755
16
--- a/tests/qemu-iotests/233
23
--- a/tests/qemu-iotests/308
17
+++ b/tests/qemu-iotests/233
24
+++ b/tests/qemu-iotests/308
18
@@ -XXX,XX +XXX,XX @@ $QEMU_IO -c 'w -P 0x11 1m 1m' "$TEST_IMG" | _filter_qemu_io
25
@@ -XXX,XX +XXX,XX @@ echo
19
26
echo '=== Compare copy with original ==='
20
echo
27
21
echo "== check TLS client to plain server fails =="
28
$QEMU_IMG compare -f raw -F $IMGFMT "$COPIED_IMG" "$TEST_IMG"
22
-nbd_server_start_tcp_socket "$TEST_IMG"
29
+_cleanup_test_img
23
+nbd_server_start_tcp_socket -f $IMGFMT "$TEST_IMG"
30
+
24
31
+echo
25
$QEMU_IMG info --image-opts \
32
+echo '=== Writing zeroes while unmapping ==='
26
--object tls-creds-x509,dir=${tls_dir}/client1,endpoint=client,id=tls0 \
33
+# Regression test for https://gitlab.com/qemu-project/qemu/-/issues/1507
27
@@ -XXX,XX +XXX,XX @@ nbd_server_stop
34
+_make_test_img 64M
28
echo
35
+$QEMU_IO -c 'write -s /dev/urandom 0 64M' "$TEST_IMG" | _filter_qemu_io
29
echo "== check plain client to TLS server fails =="
36
+
30
37
+_launch_qemu
31
-nbd_server_start_tcp_socket --object tls-creds-x509,dir=${tls_dir}/server1,endpoint=server,id=tls0,verify-peer=yes --tls-creds tls0 "$TEST_IMG"
38
+_send_qemu_cmd $QEMU_HANDLE \
32
+nbd_server_start_tcp_socket \
39
+ "{'execute': 'qmp_capabilities'}" \
33
+ --object tls-creds-x509,dir=${tls_dir}/server1,endpoint=server,id=tls0,verify-peer=yes \
40
+ 'return'
34
+ --tls-creds tls0 \
41
+
35
+ -f $IMGFMT "$TEST_IMG"
42
+_send_qemu_cmd $QEMU_HANDLE \
36
43
+ "{'execute': 'blockdev-add',
37
$QEMU_IMG info nbd://localhost:$nbd_tcp_port 2>&1 | sed "s/$nbd_tcp_port/PORT/g"
44
+ 'arguments': {
38
45
+ 'driver': '$IMGFMT',
39
@@ -XXX,XX +XXX,XX @@ $QEMU_IO -c 'r -P 0x11 1m 1m' -c 'w -P 0x22 1m 1m' --image-opts \
46
+ 'node-name': 'node-format',
40
driver=nbd,host=$nbd_tcp_addr,port=$nbd_tcp_port,tls-creds=tls0 \
47
+ 'file': {
41
2>&1 | _filter_qemu_io
48
+ 'driver': 'file',
42
49
+ 'filename': '$TEST_IMG'
43
-$QEMU_IO -f qcow2 -r -U -c 'r -P 0x22 1m 1m' "$TEST_IMG" | _filter_qemu_io
50
+ }
44
+$QEMU_IO -f $IMGFMT -r -U -c 'r -P 0x22 1m 1m' "$TEST_IMG" | _filter_qemu_io
51
+ } }" \
52
+ 'return'
53
+
54
+fuse_export_add 'export' "'mountpoint': '$EXT_MP', 'writable': true"
55
+
56
+# Try writing zeroes by unmapping
57
+$QEMU_IO -f raw -c 'write -zu 0 64M' "$EXT_MP" | _filter_qemu_io
58
+
59
+# Check the result
60
+$QEMU_IO -f raw -c 'read -P 0 0 64M' "$EXT_MP" | _filter_qemu_io
61
+
62
+_send_qemu_cmd $QEMU_HANDLE \
63
+ "{'execute': 'quit'}" \
64
+ 'return'
65
+
66
+wait=yes _cleanup_qemu
67
+
68
+# Check the original image
69
+$QEMU_IO -c 'read -P 0 0 64M' "$TEST_IMG" | _filter_qemu_io
70
+
71
+_cleanup_test_img
45
72
46
# success, all done
73
# success, all done
47
echo "*** done"
74
echo "*** done"
75
diff --git a/tests/qemu-iotests/308.out b/tests/qemu-iotests/308.out
76
index XXXXXXX..XXXXXXX 100644
77
--- a/tests/qemu-iotests/308.out
78
+++ b/tests/qemu-iotests/308.out
79
@@ -XXX,XX +XXX,XX @@ OK: Post-truncate image size is as expected
80
81
=== Compare copy with original ===
82
Images are identical.
83
+
84
+=== Writing zeroes while unmapping ===
85
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
86
+wrote 67108864/67108864 bytes at offset 0
87
+64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
88
+{'execute': 'qmp_capabilities'}
89
+{"return": {}}
90
+{'execute': 'blockdev-add',
91
+ 'arguments': {
92
+ 'driver': 'IMGFMT',
93
+ 'node-name': 'node-format',
94
+ 'file': {
95
+ 'driver': 'file',
96
+ 'filename': 'TEST_DIR/t.IMGFMT'
97
+ }
98
+ } }
99
+{"return": {}}
100
+{'execute': 'block-export-add',
101
+ 'arguments': {
102
+ 'type': 'fuse',
103
+ 'id': 'export',
104
+ 'node-name': 'node-format',
105
+ 'mountpoint': 'TEST_DIR/t.IMGFMT.fuse', 'writable': true
106
+ } }
107
+{"return": {}}
108
+wrote 67108864/67108864 bytes at offset 0
109
+64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
110
+read 67108864/67108864 bytes at offset 0
111
+64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
112
+{'execute': 'quit'}
113
+{"return": {}}
114
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
115
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_EXPORT_DELETED", "data": {"id": "export"}}
116
+read 67108864/67108864 bytes at offset 0
117
+64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
118
*** done
48
--
119
--
49
2.19.1
120
2.39.2
50
51
diff view generated by jsdifflib
Deleted patch
1
From: Igor Druzhinin <igor.druzhinin@citrix.com>
2
1
3
When blk_flush called in NVMe reset path S/C queues are already freed
4
which means that re-entering AIO handling loop having some IO requests
5
unfinished will lockup or crash as their SG structures being potentially
6
reused. Call blk_drain before freeing the queues to avoid this nasty
7
scenario.
8
9
Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
10
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
11
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12
---
13
hw/block/nvme.c | 2 ++
14
1 file changed, 2 insertions(+)
15
16
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/block/nvme.c
19
+++ b/hw/block/nvme.c
20
@@ -XXX,XX +XXX,XX @@ static void nvme_clear_ctrl(NvmeCtrl *n)
21
{
22
int i;
23
24
+ blk_drain(n->conf.blk);
25
+
26
for (i = 0; i < n->num_queues; i++) {
27
if (n->sq[i] != NULL) {
28
nvme_free_sq(n->sq[i], n);
29
--
30
2.19.1
31
32
diff view generated by jsdifflib
Deleted patch
1
From: Paolo Bonzini <pbonzini@redhat.com>
2
1
3
Because the CMB BAR has a min_access_size of 2, if you read the last
4
byte it will try to memcpy *2* bytes from n->cmbuf, causing an off-by-one
5
error. This is CVE-2018-16847.
6
7
Another way to fix this might be to register the CMB as a RAM memory
8
region, which would also be more efficient. However, that might be a
9
change for big-endian machines; I didn't think this through and I don't
10
know how real hardware works. Add a basic testcase for the CMB in case
11
somebody does this change later on.
12
13
Cc: Keith Busch <keith.busch@intel.com>
14
Cc: qemu-block@nongnu.org
15
Reported-by: Li Qiang <liq3ea@gmail.com>
16
Reviewed-by: Li Qiang <liq3ea@gmail.com>
17
Tested-by: Li Qiang <liq3ea@gmail.com>
18
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
19
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
20
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
21
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
22
---
23
hw/block/nvme.c | 2 +-
24
tests/nvme-test.c | 68 +++++++++++++++++++++++++++++++++++-------
25
tests/Makefile.include | 2 +-
26
3 files changed, 60 insertions(+), 12 deletions(-)
27
28
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
29
index XXXXXXX..XXXXXXX 100644
30
--- a/hw/block/nvme.c
31
+++ b/hw/block/nvme.c
32
@@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps nvme_cmb_ops = {
33
.write = nvme_cmb_write,
34
.endianness = DEVICE_LITTLE_ENDIAN,
35
.impl = {
36
- .min_access_size = 2,
37
+ .min_access_size = 1,
38
.max_access_size = 8,
39
},
40
};
41
diff --git a/tests/nvme-test.c b/tests/nvme-test.c
42
index XXXXXXX..XXXXXXX 100644
43
--- a/tests/nvme-test.c
44
+++ b/tests/nvme-test.c
45
@@ -XXX,XX +XXX,XX @@
46
*/
47
48
#include "qemu/osdep.h"
49
+#include "qemu/units.h"
50
#include "libqtest.h"
51
+#include "libqos/libqos-pc.h"
52
+
53
+static QOSState *qnvme_start(const char *extra_opts)
54
+{
55
+ QOSState *qs;
56
+ const char *arch = qtest_get_arch();
57
+ const char *cmd = "-drive id=drv0,if=none,file=null-co://,format=raw "
58
+ "-device nvme,addr=0x4.0,serial=foo,drive=drv0 %s";
59
+
60
+ if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
61
+ qs = qtest_pc_boot(cmd, extra_opts ? : "");
62
+ global_qtest = qs->qts;
63
+ return qs;
64
+ }
65
+
66
+ g_printerr("nvme tests are only available on x86\n");
67
+ exit(EXIT_FAILURE);
68
+}
69
+
70
+static void qnvme_stop(QOSState *qs)
71
+{
72
+ qtest_shutdown(qs);
73
+}
74
75
-/* Tests only initialization so far. TODO: Replace with functional tests */
76
static void nop(void)
77
{
78
+ QOSState *qs;
79
+
80
+ qs = qnvme_start(NULL);
81
+ qnvme_stop(qs);
82
}
83
84
-int main(int argc, char **argv)
85
+static void nvmetest_cmb_test(void)
86
{
87
- int ret;
88
+ const int cmb_bar_size = 2 * MiB;
89
+ QOSState *qs;
90
+ QPCIDevice *pdev;
91
+ QPCIBar bar;
92
93
- g_test_init(&argc, &argv, NULL);
94
- qtest_add_func("/nvme/nop", nop);
95
+ qs = qnvme_start("-global nvme.cmb_size_mb=2");
96
+ pdev = qpci_device_find(qs->pcibus, QPCI_DEVFN(4,0));
97
+ g_assert(pdev != NULL);
98
+
99
+ qpci_device_enable(pdev);
100
+ bar = qpci_iomap(pdev, 2, NULL);
101
+
102
+ qpci_io_writel(pdev, bar, 0, 0xccbbaa99);
103
+ g_assert_cmpint(qpci_io_readb(pdev, bar, 0), ==, 0x99);
104
+ g_assert_cmpint(qpci_io_readw(pdev, bar, 0), ==, 0xaa99);
105
+
106
+ /* Test partially out-of-bounds accesses. */
107
+ qpci_io_writel(pdev, bar, cmb_bar_size - 1, 0x44332211);
108
+ g_assert_cmpint(qpci_io_readb(pdev, bar, cmb_bar_size - 1), ==, 0x11);
109
+ g_assert_cmpint(qpci_io_readw(pdev, bar, cmb_bar_size - 1), !=, 0x2211);
110
+ g_assert_cmpint(qpci_io_readl(pdev, bar, cmb_bar_size - 1), !=, 0x44332211);
111
+ g_free(pdev);
112
113
- qtest_start("-drive id=drv0,if=none,file=null-co://,format=raw "
114
- "-device nvme,drive=drv0,serial=foo");
115
- ret = g_test_run();
116
+ qnvme_stop(qs);
117
+}
118
119
- qtest_end();
120
+int main(int argc, char **argv)
121
+{
122
+ g_test_init(&argc, &argv, NULL);
123
+ qtest_add_func("/nvme/nop", nop);
124
+ qtest_add_func("/nvme/cmb_test", nvmetest_cmb_test);
125
126
- return ret;
127
+ return g_test_run();
128
}
129
diff --git a/tests/Makefile.include b/tests/Makefile.include
130
index XXXXXXX..XXXXXXX 100644
131
--- a/tests/Makefile.include
132
+++ b/tests/Makefile.include
133
@@ -XXX,XX +XXX,XX @@ tests/test-hmp$(EXESUF): tests/test-hmp.o
134
tests/machine-none-test$(EXESUF): tests/machine-none-test.o
135
tests/drive_del-test$(EXESUF): tests/drive_del-test.o $(libqos-virtio-obj-y)
136
tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y)
137
-tests/nvme-test$(EXESUF): tests/nvme-test.o
138
+tests/nvme-test$(EXESUF): tests/nvme-test.o $(libqos-pc-obj-y)
139
tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o
140
tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o
141
tests/ac97-test$(EXESUF): tests/ac97-test.o
142
--
143
2.19.1
144
145
diff view generated by jsdifflib
1
This reverts commit 5e3c0220d7e4f0361c4d36c697a8842f2b583402.
1
From: Stefan Hajnoczi <stefanha@redhat.com>
2
We have a better fix commited for this now.
3
2
3
This looks like a copy-paste or merge error. BDRV_POLL_WHILE() is
4
already called above. It's not needed in the qemu_in_coroutine() case.
5
6
Fixes: 9fb4dfc570ce ("qed: make bdrv_qed_do_open a coroutine_fn")
7
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8
Message-Id: <20230309163134.398707-1-stefanha@redhat.com>
9
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
4
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5
---
11
---
6
hw/block/nvme.c | 7 -------
12
block/qed.c | 1 -
7
1 file changed, 7 deletions(-)
13
1 file changed, 1 deletion(-)
8
14
9
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
15
diff --git a/block/qed.c b/block/qed.c
10
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
11
--- a/hw/block/nvme.c
17
--- a/block/qed.c
12
+++ b/hw/block/nvme.c
18
+++ b/block/qed.c
13
@@ -XXX,XX +XXX,XX @@ static void nvme_cmb_write(void *opaque, hwaddr addr, uint64_t data,
19
@@ -XXX,XX +XXX,XX @@ static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags,
14
unsigned size)
20
qemu_coroutine_enter(qemu_coroutine_create(bdrv_qed_open_entry, &qoc));
15
{
21
BDRV_POLL_WHILE(bs, qoc.ret == -EINPROGRESS);
16
NvmeCtrl *n = (NvmeCtrl *)opaque;
22
}
17
-
23
- BDRV_POLL_WHILE(bs, qoc.ret == -EINPROGRESS);
18
- if (addr + size > NVME_CMBSZ_GETSIZE(n->bar.cmbsz)) {
24
return qoc.ret;
19
- return;
20
- }
21
memcpy(&n->cmbuf[addr], &data, size);
22
}
25
}
23
26
24
@@ -XXX,XX +XXX,XX @@ static uint64_t nvme_cmb_read(void *opaque, hwaddr addr, unsigned size)
25
uint64_t val;
26
NvmeCtrl *n = (NvmeCtrl *)opaque;
27
28
- if (addr + size > NVME_CMBSZ_GETSIZE(n->bar.cmbsz)) {
29
- return 0;
30
- }
31
memcpy(&val, &n->cmbuf[addr], size);
32
return val;
33
}
34
--
27
--
35
2.19.1
28
2.39.2
36
37
diff view generated by jsdifflib
Deleted patch
1
From: Logan Gunthorpe <logang@deltatee.com>
2
1
3
When the submission and completion queues are being torn down
4
the IRQ will be asserted for the completion queue when the
5
submsission queue is deleted. Then when the completion queue
6
is deleted it stays asserted. Thus, on systems that do
7
not use MSI, no further interrupts can be triggered on the host.
8
9
Linux sees this as a long delay when unbinding the nvme device.
10
Eventually the interrupt timeout occurs and it continues.
11
12
To fix this we ensure we deassert the IRQ for a CQ when it is
13
deleted.
14
15
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
16
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
17
---
18
hw/block/nvme.c | 1 +
19
1 file changed, 1 insertion(+)
20
21
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
22
index XXXXXXX..XXXXXXX 100644
23
--- a/hw/block/nvme.c
24
+++ b/hw/block/nvme.c
25
@@ -XXX,XX +XXX,XX @@ static uint16_t nvme_del_cq(NvmeCtrl *n, NvmeCmd *cmd)
26
trace_nvme_err_invalid_del_cq_notempty(qid);
27
return NVME_INVALID_QUEUE_DEL;
28
}
29
+ nvme_irq_deassert(n, cq);
30
trace_nvme_del_cq(qid);
31
nvme_free_cq(cq, n);
32
return NVME_SUCCESS;
33
--
34
2.19.1
35
36
diff view generated by jsdifflib