All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 00/13] Block layer patches
@ 2018-11-22 16:54 Kevin Wolf
  2018-11-22 16:54 ` [Qemu-devel] [PULL 01/13] iotests: Replace time.clock() with Timeout Kevin Wolf
                   ` (14 more replies)
  0 siblings, 15 replies; 20+ messages in thread
From: Kevin Wolf @ 2018-11-22 16:54 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

The following changes since commit 47c1cc30e440860aa695358f7c2dd0b9d7b53d16:

  Update version for v3.1.0-rc2 release (2018-11-20 18:10:26 +0000)

are available in the Git repository at:

  git://repo.or.cz/qemu/kevin.git tags/for-upstream

for you to fetch changes up to 924956b1efc50af7cc334b7a14f56aa213ca27ef:

  iotests: Enhance 223 to cover multiple bitmap granularities (2018-11-22 16:43:52 +0100)

----------------------------------------------------------------
Block layer patches:

- block: Fix update of BDRV_O_AUTO_RDONLY in update_flags_from_options()
- qemu-img: Fix memory leak and typo in error message
- nvme: Fixes for lockups and crashes
- scsi-disk: Fix crash if underlying host file or disk returns error
- Several qemu-iotests fixes and improvements

----------------------------------------------------------------
Alberto Garcia (1):
      block: Fix update of BDRV_O_AUTO_RDONLY in update_flags_from_options()

Daniel P. Berrangé (1):
      iotests: fix nbd test 233 to work correctly with raw images

Eric Blake (2):
      iotests: Skip 233 if certtool not installed
      iotests: Enhance 223 to cover multiple bitmap granularities

Igor Druzhinin (1):
      nvme: call blk_drain in NVMe reset code to avoid lockups

Kevin Wolf (3):
      iotests: Replace time.clock() with Timeout
      iotests: Replace assertEquals() with assertEqual()
      Revert "nvme: fix oob access issue(CVE-2018-16847)"

Logan Gunthorpe (1):
      nvme: fix bug with PCI IRQ pins on teardown

Max Reitz (2):
      qemu-img: Fix typo
      qemu-img: Fix leak

Paolo Bonzini (1):
      nvme: fix out-of-bounds access to the CMB

Richard W.M. Jones (1):
      scsi-disk: Fix crash if underlying host file or disk returns error

 block.c                       |  4 +--
 hw/block/nvme.c               | 12 +++-----
 hw/scsi/scsi-disk.c           |  2 +-
 qemu-img.c                    |  3 +-
 tests/nvme-test.c             | 68 ++++++++++++++++++++++++++++++++++++-------
 tests/Makefile.include        |  2 +-
 tests/qemu-iotests/041        |  6 ++--
 tests/qemu-iotests/118        | 20 +++++--------
 tests/qemu-iotests/223        | 43 ++++++++++++++++++++++-----
 tests/qemu-iotests/223.out    | 32 +++++++++++++++-----
 tests/qemu-iotests/233        |  9 ++++--
 tests/qemu-iotests/common.tls |  3 ++
 tests/qemu-iotests/iotests.py |  2 +-
 13 files changed, 148 insertions(+), 58 deletions(-)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 01/13] iotests: Replace time.clock() with Timeout
  2018-11-22 16:54 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
@ 2018-11-22 16:54 ` Kevin Wolf
  2018-11-22 16:54 ` [Qemu-devel] [PULL 02/13] iotests: Replace assertEquals() with assertEqual() Kevin Wolf
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Kevin Wolf @ 2018-11-22 16:54 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

time.clock() is deprecated since Python 3.3. Current Python versions
warn that the function will be removed in Python 3.8, and those warnings
make the test case 118 fail.

Replace it with the Timeout mechanism that is compatible with both
Python 2 and 3, and makes the code even a little nicer.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/qemu-iotests/118 | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/tests/qemu-iotests/118 b/tests/qemu-iotests/118
index ff3b2ae3e7..c4f4c213ca 100755
--- a/tests/qemu-iotests/118
+++ b/tests/qemu-iotests/118
@@ -53,21 +53,17 @@ class ChangeBaseClass(iotests.QMPTestCase):
         if not self.has_real_tray:
             return
 
-        timeout = time.clock() + 3
-        while not self.has_opened and time.clock() < timeout:
-            self.process_events()
-        if not self.has_opened:
-            self.fail('Timeout while waiting for the tray to open')
+        with iotests.Timeout(3, 'Timeout while waiting for the tray to open'):
+            while not self.has_opened:
+                self.process_events()
 
     def wait_for_close(self):
         if not self.has_real_tray:
             return
 
-        timeout = time.clock() + 3
-        while not self.has_closed and time.clock() < timeout:
-            self.process_events()
-        if not self.has_opened:
-            self.fail('Timeout while waiting for the tray to close')
+        with iotests.Timeout(3, 'Timeout while waiting for the tray to close'):
+            while not self.has_closed:
+                self.process_events()
 
 class GeneralChangeTestsBaseClass(ChangeBaseClass):
 
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 02/13] iotests: Replace assertEquals() with assertEqual()
  2018-11-22 16:54 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
  2018-11-22 16:54 ` [Qemu-devel] [PULL 01/13] iotests: Replace time.clock() with Timeout Kevin Wolf
@ 2018-11-22 16:54 ` Kevin Wolf
  2018-11-22 16:54 ` [Qemu-devel] [PULL 03/13] iotests: Skip 233 if certtool not installed Kevin Wolf
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Kevin Wolf @ 2018-11-22 16:54 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

TestCase.assertEquals() is deprecated since Python 2.7. Recent Python
versions print a warning when the function is called, which makes test
cases fail.

Replace it with the preferred spelling assertEqual().

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/qemu-iotests/041        | 6 +++---
 tests/qemu-iotests/118        | 4 ++--
 tests/qemu-iotests/iotests.py | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041
index 3615011d98..26bf1701eb 100755
--- a/tests/qemu-iotests/041
+++ b/tests/qemu-iotests/041
@@ -469,7 +469,7 @@ new_state = "1"
             self.assert_qmp(event, 'data/id', 'drive0')
             event = self.vm.get_qmp_event(wait=True)
 
-        self.assertEquals(event['event'], 'BLOCK_JOB_ERROR')
+        self.assertEqual(event['event'], 'BLOCK_JOB_ERROR')
         self.assert_qmp(event, 'data/device', 'drive0')
         self.assert_qmp(event, 'data/operation', 'read')
         result = self.vm.qmp('query-block-jobs')
@@ -494,7 +494,7 @@ new_state = "1"
             self.assert_qmp(event, 'data/id', 'drive0')
             event = self.vm.get_qmp_event(wait=True)
 
-        self.assertEquals(event['event'], 'BLOCK_JOB_ERROR')
+        self.assertEqual(event['event'], 'BLOCK_JOB_ERROR')
         self.assert_qmp(event, 'data/device', 'drive0')
         self.assert_qmp(event, 'data/operation', 'read')
         result = self.vm.qmp('query-block-jobs')
@@ -625,7 +625,7 @@ new_state = "1"
         self.assert_qmp(result, 'return', {})
 
         event = self.vm.event_wait(name='BLOCK_JOB_ERROR')
-        self.assertEquals(event['event'], 'BLOCK_JOB_ERROR')
+        self.assertEqual(event['event'], 'BLOCK_JOB_ERROR')
         self.assert_qmp(event, 'data/device', 'drive0')
         self.assert_qmp(event, 'data/operation', 'write')
         result = self.vm.qmp('query-block-jobs')
diff --git a/tests/qemu-iotests/118 b/tests/qemu-iotests/118
index c4f4c213ca..603e10e8a2 100755
--- a/tests/qemu-iotests/118
+++ b/tests/qemu-iotests/118
@@ -261,7 +261,7 @@ class GeneralChangeTestsBaseClass(ChangeBaseClass):
         result = self.vm.qmp('blockdev-close-tray', id=self.device_name)
         # Should be a no-op
         self.assert_qmp(result, 'return', {})
-        self.assertEquals(self.vm.get_qmp_events(wait=False), [])
+        self.assertEqual(self.vm.get_qmp_events(wait=False), [])
 
     def test_remove_on_closed(self):
         if not self.has_real_tray:
@@ -448,7 +448,7 @@ class TestChangeReadOnly(ChangeBaseClass):
                                                        read_only_mode='retain')
         self.assert_qmp(result, 'error/class', 'GenericError')
 
-        self.assertEquals(self.vm.get_qmp_events(wait=False), [])
+        self.assertEqual(self.vm.get_qmp_events(wait=False), [])
 
         result = self.vm.qmp('query-block')
         self.assert_qmp(result, 'return[0]/inserted/ro', False)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 27bb2b600c..d537538ba0 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -581,7 +581,7 @@ class QMPTestCase(unittest.TestCase):
     def wait_ready_and_cancel(self, drive='drive0'):
         self.wait_ready(drive=drive)
         event = self.cancel_and_wait(drive=drive)
-        self.assertEquals(event['event'], 'BLOCK_JOB_COMPLETED')
+        self.assertEqual(event['event'], 'BLOCK_JOB_COMPLETED')
         self.assert_qmp(event, 'data/type', 'mirror')
         self.assert_qmp(event, 'data/offset', event['data']['len'])
 
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 03/13] iotests: Skip 233 if certtool not installed
  2018-11-22 16:54 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
  2018-11-22 16:54 ` [Qemu-devel] [PULL 01/13] iotests: Replace time.clock() with Timeout Kevin Wolf
  2018-11-22 16:54 ` [Qemu-devel] [PULL 02/13] iotests: Replace assertEquals() with assertEqual() Kevin Wolf
@ 2018-11-22 16:54 ` Kevin Wolf
  2018-11-22 16:54 ` [Qemu-devel] [PULL 04/13] qemu-img: Fix typo Kevin Wolf
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Kevin Wolf @ 2018-11-22 16:54 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Eric Blake <eblake@redhat.com>

The use of TLS while building qemu is optional. While the
'certtool' binary should be available on every platform that
supports building against TLS, that does not imply that the
developer has installed it.  Make the test gracefully skip
in that case.

Reported-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/common.tls | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/qemu-iotests/common.tls b/tests/qemu-iotests/common.tls
index 39f17c1b99..eae81789bb 100644
--- a/tests/qemu-iotests/common.tls
+++ b/tests/qemu-iotests/common.tls
@@ -31,6 +31,9 @@ tls_x509_cleanup()
 
 tls_x509_init()
 {
+    (certtool --help) >/dev/null 2>&1 || \
+	_notrun "certtool utility not found, skipping test"
+
     mkdir -p "${tls_dir}"
 
     # use a fixed key so we don't waste system entropy on
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 04/13] qemu-img: Fix typo
  2018-11-22 16:54 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (2 preceding siblings ...)
  2018-11-22 16:54 ` [Qemu-devel] [PULL 03/13] iotests: Skip 233 if certtool not installed Kevin Wolf
@ 2018-11-22 16:54 ` Kevin Wolf
  2018-11-22 16:54 ` [Qemu-devel] [PULL 05/13] qemu-img: Fix leak Kevin Wolf
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Kevin Wolf @ 2018-11-22 16:54 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Max Reitz <mreitz@redhat.com>

Fixes: d402b6a21a825a5c07aac9251990860723d49f5d
Reported-by: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 qemu-img.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qemu-img.c b/qemu-img.c
index 13a6ca31b4..a9a2470e1a 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -261,7 +261,7 @@ static int print_block_option_help(const char *filename, const char *fmt)
             return 1;
         }
         if (!proto_drv->create_opts) {
-            error_report("Protocal driver '%s' does not support image creation",
+            error_report("Protocol driver '%s' does not support image creation",
                          proto_drv->format_name);
             return 1;
         }
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 05/13] qemu-img: Fix leak
  2018-11-22 16:54 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (3 preceding siblings ...)
  2018-11-22 16:54 ` [Qemu-devel] [PULL 04/13] qemu-img: Fix typo Kevin Wolf
@ 2018-11-22 16:54 ` Kevin Wolf
  2018-11-22 16:54 ` [Qemu-devel] [PULL 06/13] scsi-disk: Fix crash if underlying host file or disk returns error Kevin Wolf
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Kevin Wolf @ 2018-11-22 16:54 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Max Reitz <mreitz@redhat.com>

create_opts was leaked here.  This is not too bad since the process is
about to exit anyway, but relying on that does not make the code nicer
to read.

Fixes: d402b6a21a825a5c07aac9251990860723d49f5d
Reported-by: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 qemu-img.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/qemu-img.c b/qemu-img.c
index a9a2470e1a..ad04f59565 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -263,6 +263,7 @@ static int print_block_option_help(const char *filename, const char *fmt)
         if (!proto_drv->create_opts) {
             error_report("Protocol driver '%s' does not support image creation",
                          proto_drv->format_name);
+            qemu_opts_free(create_opts);
             return 1;
         }
         create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 06/13] scsi-disk: Fix crash if underlying host file or disk returns error
  2018-11-22 16:54 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (4 preceding siblings ...)
  2018-11-22 16:54 ` [Qemu-devel] [PULL 05/13] qemu-img: Fix leak Kevin Wolf
@ 2018-11-22 16:54 ` Kevin Wolf
  2018-11-22 16:54 ` [Qemu-devel] [PULL 07/13] block: Fix update of BDRV_O_AUTO_RDONLY in update_flags_from_options() Kevin Wolf
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Kevin Wolf @ 2018-11-22 16:54 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: "Richard W.M. Jones" <rjones@redhat.com>

Commit 40dce4ee6 "scsi-disk: fix rerror/werror=ignore" introduced a
bug which causes qemu to crash with the assertion error below if the
host file or disk returns an error:

  qemu-system-x86_64: hw/scsi/scsi-bus.c:1374: scsi_req_complete:
  Assertion `req->status == -1' failed.

Kevin Wolf suggested this fix:

  < kwolf> Hm, should the final return false; in that patch
           actually be a return true?
  < kwolf> Because I think he didn't intend to change anything
           except BLOCK_ERROR_ACTION_IGNORE

Buglink: https://bugs.launchpad.net/qemu/+bug/1804323
Fixes: 40dce4ee61c68395f6d463fae792f61b7c003bce
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/scsi/scsi-disk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 6eb258d3f3..0e9027c8f3 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -482,7 +482,7 @@ static bool scsi_handle_rw_error(SCSIDiskReq *r, int error, bool acct_failed)
     if (action == BLOCK_ERROR_ACTION_STOP) {
         scsi_req_retry(&r->req);
     }
-    return false;
+    return true;
 }
 
 static void scsi_write_complete_noio(SCSIDiskReq *r, int ret)
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 07/13] block: Fix update of BDRV_O_AUTO_RDONLY in update_flags_from_options()
  2018-11-22 16:54 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (5 preceding siblings ...)
  2018-11-22 16:54 ` [Qemu-devel] [PULL 06/13] scsi-disk: Fix crash if underlying host file or disk returns error Kevin Wolf
@ 2018-11-22 16:54 ` Kevin Wolf
  2018-11-22 16:54 ` [Qemu-devel] [PULL 08/13] iotests: fix nbd test 233 to work correctly with raw images Kevin Wolf
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Kevin Wolf @ 2018-11-22 16:54 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Alberto Garcia <berto@igalia.com>

Commit e35bdc123a4ace9f4d3fcca added the auto-read-only option and the
code to update its corresponding flag in update_flags_from_options(),
but forgot to clear the flag if auto-read-only is false.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reported-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/block.c b/block.c
index 3feac08535..9cd6f4a50d 100644
--- a/block.c
+++ b/block.c
@@ -1137,7 +1137,7 @@ static int bdrv_open_flags(BlockDriverState *bs, int flags)
 
 static void update_flags_from_options(int *flags, QemuOpts *opts)
 {
-    *flags &= ~BDRV_O_CACHE_MASK;
+    *flags &= ~(BDRV_O_CACHE_MASK | BDRV_O_RDWR | BDRV_O_AUTO_RDONLY);
 
     assert(qemu_opt_find(opts, BDRV_OPT_CACHE_NO_FLUSH));
     if (qemu_opt_get_bool_del(opts, BDRV_OPT_CACHE_NO_FLUSH, false)) {
@@ -1149,8 +1149,6 @@ static void update_flags_from_options(int *flags, QemuOpts *opts)
         *flags |= BDRV_O_NOCACHE;
     }
 
-    *flags &= ~BDRV_O_RDWR;
-
     assert(qemu_opt_find(opts, BDRV_OPT_READ_ONLY));
     if (!qemu_opt_get_bool_del(opts, BDRV_OPT_READ_ONLY, false)) {
         *flags |= BDRV_O_RDWR;
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 08/13] iotests: fix nbd test 233 to work correctly with raw images
  2018-11-22 16:54 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (6 preceding siblings ...)
  2018-11-22 16:54 ` [Qemu-devel] [PULL 07/13] block: Fix update of BDRV_O_AUTO_RDONLY in update_flags_from_options() Kevin Wolf
@ 2018-11-22 16:54 ` Kevin Wolf
  2018-11-22 16:54 ` [Qemu-devel] [PULL 09/13] nvme: call blk_drain in NVMe reset code to avoid lockups Kevin Wolf
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Kevin Wolf @ 2018-11-22 16:54 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Daniel P. Berrangé <berrange@redhat.com>

The first qemu-io command must honour the $IMGFMT that is set rather
than hardcoding qcow2. The qemu-nbd commands should also set $IMGFMT
to avoid the insecure format probe warning.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/233 | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/qemu-iotests/233 b/tests/qemu-iotests/233
index a4da60d0ad..1814efe333 100755
--- a/tests/qemu-iotests/233
+++ b/tests/qemu-iotests/233
@@ -66,7 +66,7 @@ $QEMU_IO -c 'w -P 0x11 1m 1m' "$TEST_IMG" | _filter_qemu_io
 
 echo
 echo "== check TLS client to plain server fails =="
-nbd_server_start_tcp_socket "$TEST_IMG"
+nbd_server_start_tcp_socket -f $IMGFMT "$TEST_IMG"
 
 $QEMU_IMG info --image-opts \
     --object tls-creds-x509,dir=${tls_dir}/client1,endpoint=client,id=tls0 \
@@ -78,7 +78,10 @@ nbd_server_stop
 echo
 echo "== check plain client to TLS server fails =="
 
-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"
+nbd_server_start_tcp_socket \
+    --object tls-creds-x509,dir=${tls_dir}/server1,endpoint=server,id=tls0,verify-peer=yes \
+    --tls-creds tls0 \
+    -f $IMGFMT "$TEST_IMG"
 
 $QEMU_IMG info nbd://localhost:$nbd_tcp_port 2>&1 | sed "s/$nbd_tcp_port/PORT/g"
 
@@ -104,7 +107,7 @@ $QEMU_IO -c 'r -P 0x11 1m 1m' -c 'w -P 0x22 1m 1m' --image-opts \
     driver=nbd,host=$nbd_tcp_addr,port=$nbd_tcp_port,tls-creds=tls0 \
     2>&1 | _filter_qemu_io
 
-$QEMU_IO -f qcow2 -r -U -c 'r -P 0x22 1m 1m' "$TEST_IMG" | _filter_qemu_io
+$QEMU_IO -f $IMGFMT -r -U -c 'r -P 0x22 1m 1m' "$TEST_IMG" | _filter_qemu_io
 
 # success, all done
 echo "*** done"
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 09/13] nvme: call blk_drain in NVMe reset code to avoid lockups
  2018-11-22 16:54 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (7 preceding siblings ...)
  2018-11-22 16:54 ` [Qemu-devel] [PULL 08/13] iotests: fix nbd test 233 to work correctly with raw images Kevin Wolf
@ 2018-11-22 16:54 ` Kevin Wolf
  2018-11-22 16:54 ` [Qemu-devel] [PULL 10/13] nvme: fix out-of-bounds access to the CMB Kevin Wolf
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Kevin Wolf @ 2018-11-22 16:54 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Igor Druzhinin <igor.druzhinin@citrix.com>

When blk_flush called in NVMe reset path S/C queues are already freed
which means that re-entering AIO handling loop having some IO requests
unfinished will lockup or crash as their SG structures being potentially
reused. Call blk_drain before freeing the queues to avoid this nasty
scenario.

Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/block/nvme.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index d0226e7fdc..28d284346d 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -797,6 +797,8 @@ static void nvme_clear_ctrl(NvmeCtrl *n)
 {
     int i;
 
+    blk_drain(n->conf.blk);
+
     for (i = 0; i < n->num_queues; i++) {
         if (n->sq[i] != NULL) {
             nvme_free_sq(n->sq[i], n);
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 10/13] nvme: fix out-of-bounds access to the CMB
  2018-11-22 16:54 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (8 preceding siblings ...)
  2018-11-22 16:54 ` [Qemu-devel] [PULL 09/13] nvme: call blk_drain in NVMe reset code to avoid lockups Kevin Wolf
@ 2018-11-22 16:54 ` Kevin Wolf
  2018-11-22 16:54 ` [Qemu-devel] [PULL 11/13] Revert "nvme: fix oob access issue(CVE-2018-16847)" Kevin Wolf
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Kevin Wolf @ 2018-11-22 16:54 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Paolo Bonzini <pbonzini@redhat.com>

Because the CMB BAR has a min_access_size of 2, if you read the last
byte it will try to memcpy *2* bytes from n->cmbuf, causing an off-by-one
error.  This is CVE-2018-16847.

Another way to fix this might be to register the CMB as a RAM memory
region, which would also be more efficient.  However, that might be a
change for big-endian machines; I didn't think this through and I don't
know how real hardware works.  Add a basic testcase for the CMB in case
somebody does this change later on.

Cc: Keith Busch <keith.busch@intel.com>
Cc: qemu-block@nongnu.org
Reported-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Tested-by: Li Qiang <liq3ea@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/block/nvme.c        |  2 +-
 tests/nvme-test.c      | 68 +++++++++++++++++++++++++++++++++++-------
 tests/Makefile.include |  2 +-
 3 files changed, 60 insertions(+), 12 deletions(-)

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 28d284346d..8c35cab2b4 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -1201,7 +1201,7 @@ static const MemoryRegionOps nvme_cmb_ops = {
     .write = nvme_cmb_write,
     .endianness = DEVICE_LITTLE_ENDIAN,
     .impl = {
-        .min_access_size = 2,
+        .min_access_size = 1,
         .max_access_size = 8,
     },
 };
diff --git a/tests/nvme-test.c b/tests/nvme-test.c
index 7674a446e4..2700ba838a 100644
--- a/tests/nvme-test.c
+++ b/tests/nvme-test.c
@@ -8,25 +8,73 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/units.h"
 #include "libqtest.h"
+#include "libqos/libqos-pc.h"
+
+static QOSState *qnvme_start(const char *extra_opts)
+{
+    QOSState *qs;
+    const char *arch = qtest_get_arch();
+    const char *cmd = "-drive id=drv0,if=none,file=null-co://,format=raw "
+                      "-device nvme,addr=0x4.0,serial=foo,drive=drv0 %s";
+
+    if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
+        qs = qtest_pc_boot(cmd, extra_opts ? : "");
+        global_qtest = qs->qts;
+        return qs;
+    }
+
+    g_printerr("nvme tests are only available on x86\n");
+    exit(EXIT_FAILURE);
+}
+
+static void qnvme_stop(QOSState *qs)
+{
+    qtest_shutdown(qs);
+}
 
-/* Tests only initialization so far. TODO: Replace with functional tests */
 static void nop(void)
 {
+    QOSState *qs;
+
+    qs = qnvme_start(NULL);
+    qnvme_stop(qs);
 }
 
-int main(int argc, char **argv)
+static void nvmetest_cmb_test(void)
 {
-    int ret;
+    const int cmb_bar_size = 2 * MiB;
+    QOSState *qs;
+    QPCIDevice *pdev;
+    QPCIBar bar;
 
-    g_test_init(&argc, &argv, NULL);
-    qtest_add_func("/nvme/nop", nop);
+    qs = qnvme_start("-global nvme.cmb_size_mb=2");
+    pdev = qpci_device_find(qs->pcibus, QPCI_DEVFN(4,0));
+    g_assert(pdev != NULL);
+
+    qpci_device_enable(pdev);
+    bar = qpci_iomap(pdev, 2, NULL);
+
+    qpci_io_writel(pdev, bar, 0, 0xccbbaa99);
+    g_assert_cmpint(qpci_io_readb(pdev, bar, 0), ==, 0x99);
+    g_assert_cmpint(qpci_io_readw(pdev, bar, 0), ==, 0xaa99);
+
+    /* Test partially out-of-bounds accesses.  */
+    qpci_io_writel(pdev, bar, cmb_bar_size - 1, 0x44332211);
+    g_assert_cmpint(qpci_io_readb(pdev, bar, cmb_bar_size - 1), ==, 0x11);
+    g_assert_cmpint(qpci_io_readw(pdev, bar, cmb_bar_size - 1), !=, 0x2211);
+    g_assert_cmpint(qpci_io_readl(pdev, bar, cmb_bar_size - 1), !=, 0x44332211);
+    g_free(pdev);
 
-    qtest_start("-drive id=drv0,if=none,file=null-co://,format=raw "
-                "-device nvme,drive=drv0,serial=foo");
-    ret = g_test_run();
+    qnvme_stop(qs);
+}
 
-    qtest_end();
+int main(int argc, char **argv)
+{
+    g_test_init(&argc, &argv, NULL);
+    qtest_add_func("/nvme/nop", nop);
+    qtest_add_func("/nvme/cmb_test", nvmetest_cmb_test);
 
-    return ret;
+    return g_test_run();
 }
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 613242bc6e..fb0b449c02 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -730,7 +730,7 @@ tests/test-hmp$(EXESUF): tests/test-hmp.o
 tests/machine-none-test$(EXESUF): tests/machine-none-test.o
 tests/drive_del-test$(EXESUF): tests/drive_del-test.o $(libqos-virtio-obj-y)
 tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y)
-tests/nvme-test$(EXESUF): tests/nvme-test.o
+tests/nvme-test$(EXESUF): tests/nvme-test.o $(libqos-pc-obj-y)
 tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o
 tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o
 tests/ac97-test$(EXESUF): tests/ac97-test.o
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 11/13] Revert "nvme: fix oob access issue(CVE-2018-16847)"
  2018-11-22 16:54 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (9 preceding siblings ...)
  2018-11-22 16:54 ` [Qemu-devel] [PULL 10/13] nvme: fix out-of-bounds access to the CMB Kevin Wolf
@ 2018-11-22 16:54 ` Kevin Wolf
  2018-11-22 16:54 ` [Qemu-devel] [PULL 12/13] nvme: fix bug with PCI IRQ pins on teardown Kevin Wolf
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Kevin Wolf @ 2018-11-22 16:54 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

This reverts commit 5e3c0220d7e4f0361c4d36c697a8842f2b583402.
We have a better fix commited for this now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/block/nvme.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 8c35cab2b4..84062d388f 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -1177,10 +1177,6 @@ static void nvme_cmb_write(void *opaque, hwaddr addr, uint64_t data,
     unsigned size)
 {
     NvmeCtrl *n = (NvmeCtrl *)opaque;
-
-    if (addr + size > NVME_CMBSZ_GETSIZE(n->bar.cmbsz)) {
-        return;
-    }
     memcpy(&n->cmbuf[addr], &data, size);
 }
 
@@ -1189,9 +1185,6 @@ static uint64_t nvme_cmb_read(void *opaque, hwaddr addr, unsigned size)
     uint64_t val;
     NvmeCtrl *n = (NvmeCtrl *)opaque;
 
-    if (addr + size > NVME_CMBSZ_GETSIZE(n->bar.cmbsz)) {
-        return 0;
-    }
     memcpy(&val, &n->cmbuf[addr], size);
     return val;
 }
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 12/13] nvme: fix bug with PCI IRQ pins on teardown
  2018-11-22 16:54 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (10 preceding siblings ...)
  2018-11-22 16:54 ` [Qemu-devel] [PULL 11/13] Revert "nvme: fix oob access issue(CVE-2018-16847)" Kevin Wolf
@ 2018-11-22 16:54 ` Kevin Wolf
  2018-11-22 16:54 ` [Qemu-devel] [PULL 13/13] iotests: Enhance 223 to cover multiple bitmap granularities Kevin Wolf
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Kevin Wolf @ 2018-11-22 16:54 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Logan Gunthorpe <logang@deltatee.com>

When the submission and completion queues are being torn down
the IRQ will be asserted for the completion queue when the
submsission queue is deleted. Then when the completion queue
is deleted it stays asserted. Thus, on systems that do
not use MSI, no further interrupts can be triggered on the host.

Linux sees this as a long delay when unbinding the nvme device.
Eventually the interrupt timeout occurs and it continues.

To fix this we ensure we deassert the IRQ for a CQ when it is
deleted.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hw/block/nvme.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 84062d388f..1687a8e151 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -554,6 +554,7 @@ static uint16_t nvme_del_cq(NvmeCtrl *n, NvmeCmd *cmd)
         trace_nvme_err_invalid_del_cq_notempty(qid);
         return NVME_INVALID_QUEUE_DEL;
     }
+    nvme_irq_deassert(n, cq);
     trace_nvme_del_cq(qid);
     nvme_free_cq(cq, n);
     return NVME_SUCCESS;
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 13/13] iotests: Enhance 223 to cover multiple bitmap granularities
  2018-11-22 16:54 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (11 preceding siblings ...)
  2018-11-22 16:54 ` [Qemu-devel] [PULL 12/13] nvme: fix bug with PCI IRQ pins on teardown Kevin Wolf
@ 2018-11-22 16:54 ` Kevin Wolf
  2018-11-22 17:19 ` [Qemu-devel] [PULL 00/13] Block layer patches Peter Maydell
  2018-11-23 10:52 ` no-reply
  14 siblings, 0 replies; 20+ messages in thread
From: Kevin Wolf @ 2018-11-22 16:54 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Eric Blake <eblake@redhat.com>

Testing granularity at the same size as the cluster isn't quite
as fun as what happens when it is larger or smaller.  This
enhancement also shows that qemu's nbd server can serve the
same disk over multiple exports simultaneously.

Signed-off-by: Eric Blake <eblake@redhat.com>
Tested-by: John Snow <jsnow@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/223     | 43 +++++++++++++++++++++++++++++++-------
 tests/qemu-iotests/223.out | 32 +++++++++++++++++++++-------
 2 files changed, 60 insertions(+), 15 deletions(-)

diff --git a/tests/qemu-iotests/223 b/tests/qemu-iotests/223
index 72419e0338..397b865d34 100755
--- a/tests/qemu-iotests/223
+++ b/tests/qemu-iotests/223
@@ -57,10 +57,11 @@ run_qemu()
 }
 
 echo
-echo "=== Create partially sparse image, then add dirty bitmap ==="
+echo "=== Create partially sparse image, then add dirty bitmaps ==="
 echo
 
-_make_test_img 4M
+# Two bitmaps, to contrast granularity issues
+_make_test_img -o cluster_size=4k 4M
 $QEMU_IO -c 'w -P 0x11 1M 2M' "$TEST_IMG" | _filter_qemu_io
 run_qemu <<EOF
 { "execute": "qmp_capabilities" }
@@ -78,7 +79,16 @@ run_qemu <<EOF
   "arguments": {
     "node": "n",
     "name": "b",
-    "persistent": true
+    "persistent": true,
+    "granularity": 65536
+  }
+}
+{ "execute": "block-dirty-bitmap-add",
+  "arguments": {
+    "node": "n",
+    "name": "b2",
+    "persistent": true,
+    "granularity": 512
   }
 }
 { "execute": "quit" }
@@ -88,10 +98,11 @@ echo
 echo "=== Write part of the file under active bitmap ==="
 echo
 
-$QEMU_IO -c 'w -P 0x22 2M 2M' "$TEST_IMG" | _filter_qemu_io
+$QEMU_IO -c 'w -P 0x22 512 512' -c 'w -P 0x33 2M 2M' "$TEST_IMG" \
+    | _filter_qemu_io
 
 echo
-echo "=== End dirty bitmap, and start serving image over NBD ==="
+echo "=== End dirty bitmaps, and start serving image over NBD ==="
 echo
 
 _launch_qemu 2> >(_filter_nbd)
@@ -103,6 +114,8 @@ _send_qemu_cmd $QEMU_HANDLE '{"execute":"blockdev-add",
     "file":{"driver":"file", "filename":"'"$TEST_IMG"'"}}}' "return"
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"x-block-dirty-bitmap-disable",
   "arguments":{"node":"n", "name":"b"}}' "return"
+_send_qemu_cmd $QEMU_HANDLE '{"execute":"x-block-dirty-bitmap-disable",
+  "arguments":{"node":"n", "name":"b2"}}' "return"
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-start",
   "arguments":{"addr":{"type":"unix",
     "data":{"path":"'"$TEST_DIR/nbd"'"}}}}' "return"
@@ -110,26 +123,40 @@ _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-add",
   "arguments":{"device":"n"}}' "return"
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"x-nbd-server-add-bitmap",
   "arguments":{"name":"n", "bitmap":"b"}}' "return"
+_send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-add",
+  "arguments":{"device":"n", "name":"n2"}}' "return"
+_send_qemu_cmd $QEMU_HANDLE '{"execute":"x-nbd-server-add-bitmap",
+  "arguments":{"name":"n2", "bitmap":"b2"}}' "return"
 
 echo
-echo "=== Contrast normal status with dirty-bitmap status ==="
+echo "=== Contrast normal status to large granularity dirty-bitmap ==="
 echo
 
 QEMU_IO_OPTIONS=$QEMU_IO_OPTIONS_NO_FMT
 IMG="driver=nbd,export=n,server.type=unix,server.path=$TEST_DIR/nbd"
-$QEMU_IO -r -c 'r -P 0 0 1m' -c 'r -P 0x11 1m 1m' \
-  -c 'r -P 0x22 2m 2m' --image-opts "$IMG" | _filter_qemu_io
+$QEMU_IO -r -c 'r -P 0x22 512 512' -c 'r -P 0 512k 512k' -c 'r -P 0x11 1m 1m' \
+  -c 'r -P 0x33 2m 2m' --image-opts "$IMG" | _filter_qemu_io
 $QEMU_IMG map --output=json --image-opts \
   "$IMG" | _filter_qemu_img_map
 $QEMU_IMG map --output=json --image-opts \
   "$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b" | _filter_qemu_img_map
 
+echo
+echo "=== Contrast to small granularity dirty-bitmap ==="
+echo
+
+IMG="driver=nbd,export=n2,server.type=unix,server.path=$TEST_DIR/nbd"
+$QEMU_IMG map --output=json --image-opts \
+  "$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b2" | _filter_qemu_img_map
+
 echo
 echo "=== End NBD server ==="
 echo
 
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-remove",
   "arguments":{"name":"n"}}' "return"
+_send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-remove",
+  "arguments":{"name":"n2"}}' "return"
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"nbd-server-stop"}' "return"
 _send_qemu_cmd $QEMU_HANDLE '{"execute":"quit"}' "return"
 
diff --git a/tests/qemu-iotests/223.out b/tests/qemu-iotests/223.out
index 33021c8e6a..de417477de 100644
--- a/tests/qemu-iotests/223.out
+++ b/tests/qemu-iotests/223.out
@@ -1,6 +1,6 @@
 QA output created by 223
 
-=== Create partially sparse image, then add dirty bitmap ===
+=== Create partially sparse image, then add dirty bitmaps ===
 
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4194304
 wrote 2097152/2097152 bytes at offset 1048576
@@ -11,15 +11,18 @@ QMP_VERSION
 {"return": {}}
 {"return": {}}
 {"return": {}}
+{"return": {}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
 
 
 === Write part of the file under active bitmap ===
 
+wrote 512/512 bytes at offset 512
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 2097152/2097152 bytes at offset 2097152
 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 
-=== End dirty bitmap, and start serving image over NBD ===
+=== End dirty bitmaps, and start serving image over NBD ===
 
 {"return": {}}
 {"return": {}}
@@ -27,18 +30,32 @@ wrote 2097152/2097152 bytes at offset 2097152
 {"return": {}}
 {"return": {}}
 {"return": {}}
+{"return": {}}
+{"return": {}}
+{"return": {}}
 
-=== Contrast normal status with dirty-bitmap status ===
+=== Contrast normal status to large granularity dirty-bitmap ===
 
-read 1048576/1048576 bytes at offset 0
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 512/512 bytes at offset 512
+512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 524288/524288 bytes at offset 524288
+512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 read 1048576/1048576 bytes at offset 1048576
 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 read 2097152/2097152 bytes at offset 2097152
 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-[{ "start": 0, "length": 1048576, "depth": 0, "zero": true, "data": false},
+[{ "start": 0, "length": 4096, "depth": 0, "zero": false, "data": true},
+{ "start": 4096, "length": 1044480, "depth": 0, "zero": true, "data": false},
 { "start": 1048576, "length": 3145728, "depth": 0, "zero": false, "data": true}]
-[{ "start": 0, "length": 2097152, "depth": 0, "zero": false, "data": true},
+[{ "start": 0, "length": 65536, "depth": 0, "zero": false, "data": false},
+{ "start": 65536, "length": 2031616, "depth": 0, "zero": false, "data": true},
+{ "start": 2097152, "length": 2097152, "depth": 0, "zero": false, "data": false}]
+
+=== Contrast to small granularity dirty-bitmap ===
+
+[{ "start": 0, "length": 512, "depth": 0, "zero": false, "data": true},
+{ "start": 512, "length": 512, "depth": 0, "zero": false, "data": false},
+{ "start": 1024, "length": 2096128, "depth": 0, "zero": false, "data": true},
 { "start": 2097152, "length": 2097152, "depth": 0, "zero": false, "data": false}]
 
 === End NBD server ===
@@ -46,4 +63,5 @@ read 2097152/2097152 bytes at offset 2097152
 {"return": {}}
 {"return": {}}
 {"return": {}}
+{"return": {}}
 *** done
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PULL 00/13] Block layer patches
  2018-11-22 16:54 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (12 preceding siblings ...)
  2018-11-22 16:54 ` [Qemu-devel] [PULL 13/13] iotests: Enhance 223 to cover multiple bitmap granularities Kevin Wolf
@ 2018-11-22 17:19 ` Peter Maydell
  2018-11-23 10:52 ` no-reply
  14 siblings, 0 replies; 20+ messages in thread
From: Peter Maydell @ 2018-11-22 17:19 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: Qemu-block, QEMU Developers, Paolo Bonzini

On 22 November 2018 at 16:54, Kevin Wolf <kwolf@redhat.com> wrote:
> The following changes since commit 47c1cc30e440860aa695358f7c2dd0b9d7b53d16:
>
>   Update version for v3.1.0-rc2 release (2018-11-20 18:10:26 +0000)
>
> are available in the Git repository at:
>
>   git://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to 924956b1efc50af7cc334b7a14f56aa213ca27ef:
>
>   iotests: Enhance 223 to cover multiple bitmap granularities (2018-11-22 16:43:52 +0100)
>
> ----------------------------------------------------------------
> Block layer patches:
>
> - block: Fix update of BDRV_O_AUTO_RDONLY in update_flags_from_options()
> - qemu-img: Fix memory leak and typo in error message
> - nvme: Fixes for lockups and crashes
> - scsi-disk: Fix crash if underlying host file or disk returns error
> - Several qemu-iotests fixes and improvements
>
> ----------------------------------------------------------------

Hi; this seems to fail make check on s390x, sparc64, ppc64 (ie all
the bigendian hosts):

TEST: tests/nvme-test... (pid=12356)
  /i386/nvme/nop:                                                      OK
  /i386/nvme/cmb_test:                                                 **
ERROR:/home/linux1/qemu/tests/nvme-test.c:60:nvmetest_cmb_test:
assertion failed (qpci_io_re
adb(pdev, bar, 0) == 0x99): (0 == 153)
FAIL

thanks
-- PMM

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PULL 00/13] Block layer patches
  2018-11-22 16:54 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (13 preceding siblings ...)
  2018-11-22 17:19 ` [Qemu-devel] [PULL 00/13] Block layer patches Peter Maydell
@ 2018-11-23 10:52 ` no-reply
  14 siblings, 0 replies; 20+ messages in thread
From: no-reply @ 2018-11-23 10:52 UTC (permalink / raw)
  To: kwolf; +Cc: famz, qemu-block, peter.maydell, qemu-devel

Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20181122165417.23894-1-kwolf@redhat.com
Type: series
Subject: [Qemu-devel] [PULL 00/13] Block layer patches

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
e0ba295 iotests: Enhance 223 to cover multiple bitmap granularities
8f69d38 nvme: fix bug with PCI IRQ pins on teardown
34506f4 Revert "nvme: fix oob access issue(CVE-2018-16847)"
f9e29f0 nvme: fix out-of-bounds access to the CMB
5b2b7aa nvme: call blk_drain in NVMe reset code to avoid lockups
40ede8d iotests: fix nbd test 233 to work correctly with raw images
81f0a87 block: Fix update of BDRV_O_AUTO_RDONLY in update_flags_from_options()
9d1d446 scsi-disk: Fix crash if underlying host file or disk returns error
114cf31 qemu-img: Fix leak
d1fac5e qemu-img: Fix typo
1e187df iotests: Skip 233 if certtool not installed
fdf543f iotests: Replace assertEquals() with assertEqual()
3b508f4 iotests: Replace time.clock() with Timeout

=== OUTPUT BEGIN ===
Checking PATCH 1/13: iotests: Replace time.clock() with Timeout...
Checking PATCH 2/13: iotests: Replace assertEquals() with assertEqual()...
Checking PATCH 3/13: iotests: Skip 233 if certtool not installed...
Checking PATCH 4/13: qemu-img: Fix typo...
Checking PATCH 5/13: qemu-img: Fix leak...
Checking PATCH 6/13: scsi-disk: Fix crash if underlying host file or disk returns error...
Checking PATCH 7/13: block: Fix update of BDRV_O_AUTO_RDONLY in update_flags_from_options()...
Checking PATCH 8/13: iotests: fix nbd test 233 to work correctly with raw images...
Checking PATCH 9/13: nvme: call blk_drain in NVMe reset code to avoid lockups...
Checking PATCH 10/13: nvme: fix out-of-bounds access to the CMB...
ERROR: space required after that ',' (ctx:VxV)
#107: FILE: tests/nvme-test.c:53:
+    pdev = qpci_device_find(qs->pcibus, QPCI_DEVFN(4,0));
                                                     ^

total: 1 errors, 0 warnings, 99 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 11/13: Revert "nvme: fix oob access issue(CVE-2018-16847)"...
Checking PATCH 12/13: nvme: fix bug with PCI IRQ pins on teardown...
Checking PATCH 13/13: iotests: Enhance 223 to cover multiple bitmap granularities...
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PULL 00/13] Block layer patches
  2019-07-19 13:43 Kevin Wolf
@ 2019-07-22  9:11 ` Peter Maydell
  0 siblings, 0 replies; 20+ messages in thread
From: Peter Maydell @ 2019-07-22  9:11 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: QEMU Developers, Qemu-block

On Fri, 19 Jul 2019 at 14:43, Kevin Wolf <kwolf@redhat.com> wrote:
>
> The following changes since commit 0274f45bdef73283f2c213610f11d4e5dcba43b6:
>
>   Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-4.1-pull-request' into staging (2019-07-19 09:44:43 +0100)
>
> are available in the Git repository at:
>
>   git://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to 49278ec065da3fbf90f7effcde3b39ac606b2e9e:
>
>   iotests: Test quitting with job on throttled node (2019-07-19 15:17:55 +0200)
>
> ----------------------------------------------------------------
> Block layer patches:
>
> - block: Fix forbidden use of polling in drained_end
> - block: Don't wait for I/O throttling while exiting QEMU
> - iotests: Use read-zeroes for the null driver to be Valgrind-friendly
>
> ----------------------------------------------------------------


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.1
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 00/13] Block layer patches
@ 2019-07-19 13:43 Kevin Wolf
  2019-07-22  9:11 ` Peter Maydell
  0 siblings, 1 reply; 20+ messages in thread
From: Kevin Wolf @ 2019-07-19 13:43 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

The following changes since commit 0274f45bdef73283f2c213610f11d4e5dcba43b6:

  Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-4.1-pull-request' into staging (2019-07-19 09:44:43 +0100)

are available in the Git repository at:

  git://repo.or.cz/qemu/kevin.git tags/for-upstream

for you to fetch changes up to 49278ec065da3fbf90f7effcde3b39ac606b2e9e:

  iotests: Test quitting with job on throttled node (2019-07-19 15:17:55 +0200)

----------------------------------------------------------------
Block layer patches:

- block: Fix forbidden use of polling in drained_end
- block: Don't wait for I/O throttling while exiting QEMU
- iotests: Use read-zeroes for the null driver to be Valgrind-friendly

----------------------------------------------------------------
Andrey Shinkevich (1):
      iotests: Set read-zeroes on in null block driver for Valgrind

Max Reitz (12):
      block: Introduce BdrvChild.parent_quiesce_counter
      tests: Add job commit by drained_end test
      block: Add @drained_end_counter
      block: Make bdrv_parent_drained_[^_]*() static
      tests: Lock AioContexts in test-block-iothread
      block: Do not poll in bdrv_do_drained_end()
      tests: Extend commit by drained_end test
      block: Loop unsafely in bdrv*drained_end()
      iotests: Add @has_quit to vm.shutdown()
      iotests: Test commit with a filter on the chain
      vl: Drain before (block) job cancel when quitting
      iotests: Test quitting with job on throttled node

 include/block/block.h         |  42 ++++++++----
 include/block/block_int.h     |  15 ++++-
 block.c                       |  52 ++++++++++-----
 block/block-backend.c         |   6 +-
 block/io.c                    | 134 +++++++++++++++++++++++++++----------
 blockjob.c                    |   2 +-
 tests/test-bdrv-drain.c       | 147 ++++++++++++++++++++++++++++++++++++++++
 tests/test-block-iothread.c   |  40 +++++++----
 vl.c                          |  11 +++
 python/qemu/machine.py        |   5 +-
 tests/qemu-iotests/040        |  40 ++++++++++-
 tests/qemu-iotests/040.out    |   4 +-
 tests/qemu-iotests/051        |  10 +--
 tests/qemu-iotests/051.pc.out |  10 +--
 tests/qemu-iotests/093        |   9 +--
 tests/qemu-iotests/136        |   1 +
 tests/qemu-iotests/186        |  20 +++---
 tests/qemu-iotests/186.out    | 152 +++++++++++++++++++++---------------------
 tests/qemu-iotests/218        |  55 ++++++++++++++-
 tests/qemu-iotests/218.out    |   4 ++
 tests/qemu-iotests/227        |   4 +-
 tests/qemu-iotests/227.out    |   4 +-
 tests/qemu-iotests/238        |   2 +-
 tests/qemu-iotests/240        |   8 +--
 tests/qemu-iotests/255        |   2 +-
 25 files changed, 576 insertions(+), 203 deletions(-)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [Qemu-devel] [PULL 00/13] Block layer patches
  2018-07-30 15:09 Kevin Wolf
@ 2018-07-31  9:02 ` Peter Maydell
  0 siblings, 0 replies; 20+ messages in thread
From: Peter Maydell @ 2018-07-31  9:02 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: Qemu-block, QEMU Developers

On 30 July 2018 at 16:09, Kevin Wolf <kwolf@redhat.com> wrote:
> The following changes since commit 6d9dd5fb9d0e9f4a174f53a0e20a39fbe809c71e:
>
>   Merge remote-tracking branch 'remotes/armbru/tags/pull-qobject-2018-07-27-v2' into staging (2018-07-30 09:55:47 +0100)
>
> are available in the git repository at:
>
>   git://repo.or.cz/qemu/kevin.git tags/for-upstream
>
> for you to fetch changes up to 1239ac241fe170bb9fcf0be74bfff04f6f1c2560:
>
>   qemu-iotests: Test query-blockstats with -drive and -blockdev (2018-07-30 15:35:37 +0200)
>
> ----------------------------------------------------------------
> Block layer patches:
>
> - qemu-img convert -C is now required to enable copy offloading
> - file-posix: Fix write_zeroes with unmap on block devices (would fall
>   back to explicit writes on recent kernels)
> - Fix query-blockstats interface for use with -blockdev
> - Minor fixes and documentation updates
>
> ----------------------------------------------------------------

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Qemu-devel] [PULL 00/13] Block layer patches
@ 2018-07-30 15:09 Kevin Wolf
  2018-07-31  9:02 ` Peter Maydell
  0 siblings, 1 reply; 20+ messages in thread
From: Kevin Wolf @ 2018-07-30 15:09 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

The following changes since commit 6d9dd5fb9d0e9f4a174f53a0e20a39fbe809c71e:

  Merge remote-tracking branch 'remotes/armbru/tags/pull-qobject-2018-07-27-v2' into staging (2018-07-30 09:55:47 +0100)

are available in the git repository at:

  git://repo.or.cz/qemu/kevin.git tags/for-upstream

for you to fetch changes up to 1239ac241fe170bb9fcf0be74bfff04f6f1c2560:

  qemu-iotests: Test query-blockstats with -drive and -blockdev (2018-07-30 15:35:37 +0200)

----------------------------------------------------------------
Block layer patches:

- qemu-img convert -C is now required to enable copy offloading
- file-posix: Fix write_zeroes with unmap on block devices (would fall
  back to explicit writes on recent kernels)
- Fix query-blockstats interface for use with -blockdev
- Minor fixes and documentation updates

----------------------------------------------------------------
Fam Zheng (6):
      file-posix: Handle EINTR in preallocation=full write
      docs: Describe using images in writing iotests
      iotests: Don't lock /dev/null in 226
      Revert "qemu-img: Document copy offloading implications with -S and -c"
      qemu-img: Add -C option for convert with copy offloading
      iotests: Add test for 'qemu-img convert -C' compatibility

KONRAD Frederic (1):
      qcow: fix a reference leak

Kevin Wolf (5):
      block: Fix documentation for BDRV_REQ_MAY_UNMAP
      file-posix: Fix write_zeroes with unmap on block devices
      block/qapi: Add 'qdev' field to query-blockstats result
      block/qapi: Include anonymous BBs in query-blockstats
      qemu-iotests: Test query-blockstats with -drive and -blockdev

Leonid Bloch (1):
      qcow2: A grammar fix in conflicting cache sizing error message

 qapi/block-core.json       |  14 +++-
 include/block/block.h      |  11 +--
 block/file-posix.c         |  62 ++++++++++----
 block/qapi.c               |  16 +++-
 block/qcow.c               |   1 +
 block/qcow2.c              |   2 +-
 qemu-img.c                 |  21 ++++-
 docs/devel/testing.rst     |  11 +++
 qemu-img-cmds.hx           |   2 +-
 qemu-img.texi              |  14 ++--
 tests/qemu-iotests/082     |   8 ++
 tests/qemu-iotests/082.out |  11 +++
 tests/qemu-iotests/103.out |   4 +-
 tests/qemu-iotests/137.out |   2 +-
 tests/qemu-iotests/226     |   4 +-
 tests/qemu-iotests/227     | 101 ++++++++++++++++++++++
 tests/qemu-iotests/227.out | 205 +++++++++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/group   |   1 +
 18 files changed, 449 insertions(+), 41 deletions(-)
 create mode 100755 tests/qemu-iotests/227
 create mode 100644 tests/qemu-iotests/227.out

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2019-07-22  9:11 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-22 16:54 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
2018-11-22 16:54 ` [Qemu-devel] [PULL 01/13] iotests: Replace time.clock() with Timeout Kevin Wolf
2018-11-22 16:54 ` [Qemu-devel] [PULL 02/13] iotests: Replace assertEquals() with assertEqual() Kevin Wolf
2018-11-22 16:54 ` [Qemu-devel] [PULL 03/13] iotests: Skip 233 if certtool not installed Kevin Wolf
2018-11-22 16:54 ` [Qemu-devel] [PULL 04/13] qemu-img: Fix typo Kevin Wolf
2018-11-22 16:54 ` [Qemu-devel] [PULL 05/13] qemu-img: Fix leak Kevin Wolf
2018-11-22 16:54 ` [Qemu-devel] [PULL 06/13] scsi-disk: Fix crash if underlying host file or disk returns error Kevin Wolf
2018-11-22 16:54 ` [Qemu-devel] [PULL 07/13] block: Fix update of BDRV_O_AUTO_RDONLY in update_flags_from_options() Kevin Wolf
2018-11-22 16:54 ` [Qemu-devel] [PULL 08/13] iotests: fix nbd test 233 to work correctly with raw images Kevin Wolf
2018-11-22 16:54 ` [Qemu-devel] [PULL 09/13] nvme: call blk_drain in NVMe reset code to avoid lockups Kevin Wolf
2018-11-22 16:54 ` [Qemu-devel] [PULL 10/13] nvme: fix out-of-bounds access to the CMB Kevin Wolf
2018-11-22 16:54 ` [Qemu-devel] [PULL 11/13] Revert "nvme: fix oob access issue(CVE-2018-16847)" Kevin Wolf
2018-11-22 16:54 ` [Qemu-devel] [PULL 12/13] nvme: fix bug with PCI IRQ pins on teardown Kevin Wolf
2018-11-22 16:54 ` [Qemu-devel] [PULL 13/13] iotests: Enhance 223 to cover multiple bitmap granularities Kevin Wolf
2018-11-22 17:19 ` [Qemu-devel] [PULL 00/13] Block layer patches Peter Maydell
2018-11-23 10:52 ` no-reply
  -- strict thread matches above, loose matches on Subject: below --
2019-07-19 13:43 Kevin Wolf
2019-07-22  9:11 ` Peter Maydell
2018-07-30 15:09 Kevin Wolf
2018-07-31  9:02 ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.