qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 00/13] Block layer patches
@ 2019-07-19 13:43 Kevin Wolf
  2019-07-19 13:43 ` [Qemu-devel] [PULL 01/13] iotests: Set read-zeroes on in null block driver for Valgrind Kevin Wolf
                   ` (13 more replies)
  0 siblings, 14 replies; 23+ 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] 23+ messages in thread

* [Qemu-devel] [PULL 01/13] iotests: Set read-zeroes on in null block driver for Valgrind
  2019-07-19 13:43 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
@ 2019-07-19 13:43 ` Kevin Wolf
  2019-07-24  7:18   ` Christian Borntraeger
  2019-07-19 13:43 ` [Qemu-devel] [PULL 02/13] block: Introduce BdrvChild.parent_quiesce_counter Kevin Wolf
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 23+ messages in thread
From: Kevin Wolf @ 2019-07-19 13:43 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>

The Valgrind tool reports about the uninitialised buffer 'buf'
instantiated on the stack of the function guess_disk_lchs().
Pass 'read-zeroes=on' to the null block driver to make it deterministic.
The output of the tests 051, 186 and 227 now includes the parameter
'read-zeroes'. So, the benchmark output files are being changed too.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 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/227        |   4 +-
 tests/qemu-iotests/227.out    |   4 +-
 tests/qemu-iotests/238        |   2 +-
 tests/qemu-iotests/240        |   8 +-
 10 files changed, 111 insertions(+), 109 deletions(-)

diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
index 200660f977..ce942a5444 100755
--- a/tests/qemu-iotests/051
+++ b/tests/qemu-iotests/051
@@ -251,11 +251,11 @@ echo
 # Cannot use the test image because cache=none might not work on the host FS
 # Use cdrom so that we won't get errors about missing media
 
-run_qemu -drive driver=null-co,cache=none
-run_qemu -drive driver=null-co,cache=directsync
-run_qemu -drive driver=null-co,cache=writeback
-run_qemu -drive driver=null-co,cache=writethrough
-run_qemu -drive driver=null-co,cache=unsafe
+run_qemu -drive driver=null-co,read-zeroes=on,cache=none
+run_qemu -drive driver=null-co,read-zeroes=on,cache=directsync
+run_qemu -drive driver=null-co,read-zeroes=on,cache=writeback
+run_qemu -drive driver=null-co,read-zeroes=on,cache=writethrough
+run_qemu -drive driver=null-co,read-zeroes=on,cache=unsafe
 run_qemu -drive driver=null-co,cache=invalid_value
 
 # Can't test direct=on here because O_DIRECT might not be supported on this FS
diff --git a/tests/qemu-iotests/051.pc.out b/tests/qemu-iotests/051.pc.out
index 2d811c166c..000557c7c8 100644
--- a/tests/qemu-iotests/051.pc.out
+++ b/tests/qemu-iotests/051.pc.out
@@ -245,23 +245,23 @@ QEMU X.Y.Z monitor - type 'help' for more information
 
 === Cache modes ===
 
-Testing: -drive driver=null-co,cache=none
+Testing: -drive driver=null-co,read-zeroes=on,cache=none
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) quit
 
-Testing: -drive driver=null-co,cache=directsync
+Testing: -drive driver=null-co,read-zeroes=on,cache=directsync
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) quit
 
-Testing: -drive driver=null-co,cache=writeback
+Testing: -drive driver=null-co,read-zeroes=on,cache=writeback
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) quit
 
-Testing: -drive driver=null-co,cache=writethrough
+Testing: -drive driver=null-co,read-zeroes=on,cache=writethrough
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) quit
 
-Testing: -drive driver=null-co,cache=unsafe
+Testing: -drive driver=null-co,read-zeroes=on,cache=unsafe
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) quit
 
diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093
index d88fbc182e..4b2cac1d0c 100755
--- a/tests/qemu-iotests/093
+++ b/tests/qemu-iotests/093
@@ -38,7 +38,7 @@ class ThrottleTestCase(iotests.QMPTestCase):
     def setUp(self):
         self.vm = iotests.VM()
         for i in range(0, self.max_drives):
-            self.vm.add_drive(self.test_img)
+            self.vm.add_drive(self.test_img, "file.read-zeroes=on")
         self.vm.launch()
 
     def tearDown(self):
@@ -273,7 +273,8 @@ class ThrottleTestGroupNames(iotests.QMPTestCase):
     def setUp(self):
         self.vm = iotests.VM()
         for i in range(0, self.max_drives):
-            self.vm.add_drive(self.test_img, "throttling.iops-total=100")
+            self.vm.add_drive(self.test_img,
+                              "throttling.iops-total=100,file.read-zeroes=on")
         self.vm.launch()
 
     def tearDown(self):
@@ -378,10 +379,10 @@ class ThrottleTestRemovableMedia(iotests.QMPTestCase):
     def test_removable_media(self):
         # Add a couple of dummy nodes named cd0 and cd1
         result = self.vm.qmp("blockdev-add", driver="null-aio",
-                             node_name="cd0")
+                             read_zeroes=True, node_name="cd0")
         self.assert_qmp(result, 'return', {})
         result = self.vm.qmp("blockdev-add", driver="null-aio",
-                             node_name="cd1")
+                             read_zeroes=True, node_name="cd1")
         self.assert_qmp(result, 'return', {})
 
         # Attach a CD drive with cd0 inserted
diff --git a/tests/qemu-iotests/136 b/tests/qemu-iotests/136
index af7ffa4540..a46a7b7630 100755
--- a/tests/qemu-iotests/136
+++ b/tests/qemu-iotests/136
@@ -74,6 +74,7 @@ sector = "%d"
                           (self.account_invalid and "on" or "off"))
         drive_args.append("stats-account-failed=%s" %
                           (self.account_failed and "on" or "off"))
+        drive_args.append("file.image.read-zeroes=on")
         self.create_blkdebug_file()
         self.vm = iotests.VM().add_drive('blkdebug:%s:%s' %
                                          (blkdebug_file, self.test_img),
diff --git a/tests/qemu-iotests/186 b/tests/qemu-iotests/186
index 7e7d45babc..5f6b18c150 100755
--- a/tests/qemu-iotests/186
+++ b/tests/qemu-iotests/186
@@ -86,8 +86,8 @@ echo "=== -blockdev/-device=<node-name> ==="
 echo
 
 for dev in $fixed $removable; do
-    check_info_block -blockdev driver=null-co,node-name=null -device $dev,drive=null
-    check_info_block -blockdev driver=null-co,node-name=null -device $dev,drive=null,id=qdev_id
+    check_info_block -blockdev driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null
+    check_info_block -blockdev driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null,id=qdev_id
 done
 
 echo
@@ -97,7 +97,7 @@ echo
 # This creates two BlockBackends that will show up in 'info block'!
 # A monitor-owned one from -drive, and anonymous one from -device
 for dev in $fixed $removable; do
-    check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=null,id=qdev_id
+    check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null,id=qdev_id
 done
 
 echo
@@ -105,8 +105,8 @@ echo "=== -drive if=none/-device=<bb-name> (with medium) ==="
 echo
 
 for dev in $fixed $removable; do
-    check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=none0
-    check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=none0,id=qdev_id
+    check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=none0
+    check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=none0,id=qdev_id
 done
 
 echo
@@ -125,15 +125,15 @@ echo "=== -drive if=... ==="
 echo
 
 check_info_block -drive if=floppy
-check_info_block -drive if=floppy,driver=null-co
+check_info_block -drive if=floppy,driver=null-co,read-zeroes=on
 
-check_info_block -drive if=ide,driver=null-co
+check_info_block -drive if=ide,driver=null-co,read-zeroes=on
 check_info_block -drive if=ide,media=cdrom
-check_info_block -drive if=ide,driver=null-co,media=cdrom
+check_info_block -drive if=ide,driver=null-co,read-zeroes=on,media=cdrom
 
-check_info_block -drive if=virtio,driver=null-co
+check_info_block -drive if=virtio,driver=null-co,read-zeroes=on
 
-check_info_block -drive if=pflash,driver=null-co,size=1M
+check_info_block -drive if=pflash,driver=null-co,read-zeroes=on,size=1M
 
 # success, all done
 echo "*** done"
diff --git a/tests/qemu-iotests/186.out b/tests/qemu-iotests/186.out
index 716b01ac3d..5b3504042a 100644
--- a/tests/qemu-iotests/186.out
+++ b/tests/qemu-iotests/186.out
@@ -54,103 +54,103 @@ qdev_id: [not inserted]
 
 === -blockdev/-device=<node-name> ===
 
-Testing: -blockdev driver=null-co,node-name=null -device ide-hd,drive=null
+Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=null
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-null: null-co:// (null-co)
+null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
     Attached to:      PATH
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -blockdev driver=null-co,node-name=null -device ide-hd,drive=null,id=qdev_id
+Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=null,id=qdev_id
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-null: null-co:// (null-co)
+null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
     Attached to:      qdev_id
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -blockdev driver=null-co,node-name=null -device scsi-hd,drive=null
+Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=null
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-null: null-co:// (null-co)
+null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
     Attached to:      PATH
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -blockdev driver=null-co,node-name=null -device scsi-hd,drive=null,id=qdev_id
+Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=null,id=qdev_id
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-null: null-co:// (null-co)
+null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
     Attached to:      qdev_id
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -blockdev driver=null-co,node-name=null -device virtio-blk-pci,drive=null
+Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=null
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-null: null-co:// (null-co)
+null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
     Attached to:      PATH
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -blockdev driver=null-co,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
+Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-null: null-co:// (null-co)
+null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
     Attached to:      PATH
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -blockdev driver=null-co,node-name=null -device floppy,drive=null
+Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=null
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-null: null-co:// (null-co)
+null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
     Attached to:      PATH
     Removable device: not locked, tray closed
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -blockdev driver=null-co,node-name=null -device floppy,drive=null,id=qdev_id
+Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=null,id=qdev_id
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-null: null-co:// (null-co)
+null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
     Attached to:      qdev_id
     Removable device: not locked, tray closed
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -blockdev driver=null-co,node-name=null -device ide-cd,drive=null
+Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=null
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-null: null-co:// (null-co)
+null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
     Attached to:      PATH
     Removable device: not locked, tray closed
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -blockdev driver=null-co,node-name=null -device ide-cd,drive=null,id=qdev_id
+Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=null,id=qdev_id
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-null: null-co:// (null-co)
+null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
     Attached to:      qdev_id
     Removable device: not locked, tray closed
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -blockdev driver=null-co,node-name=null -device scsi-cd,drive=null
+Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=null
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-null: null-co:// (null-co)
+null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
     Attached to:      PATH
     Removable device: not locked, tray closed
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -blockdev driver=null-co,node-name=null -device scsi-cd,drive=null,id=qdev_id
+Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=null,id=qdev_id
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-null: null-co:// (null-co)
+null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
     Attached to:      qdev_id
     Removable device: not locked, tray closed
     Cache mode:       writeback
@@ -159,76 +159,76 @@ null: null-co:// (null-co)
 
 === -drive if=none/-device=<node-name> ===
 
-Testing: -drive if=none,driver=null-co,node-name=null -device ide-hd,drive=null,id=qdev_id
+Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=null,id=qdev_id
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-none0 (null): null-co:// (null-co)
+none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Removable device: not locked, tray closed
     Cache mode:       writeback
 
-null: null-co:// (null-co)
+null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      qdev_id
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -drive if=none,driver=null-co,node-name=null -device scsi-hd,drive=null,id=qdev_id
+Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=null,id=qdev_id
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-none0 (null): null-co:// (null-co)
+none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Removable device: not locked, tray closed
     Cache mode:       writeback
 
-null: null-co:// (null-co)
+null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      qdev_id
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -drive if=none,driver=null-co,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
+Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-none0 (null): null-co:// (null-co)
+none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Removable device: not locked, tray closed
     Cache mode:       writeback
 
-null: null-co:// (null-co)
+null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      PATH
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -drive if=none,driver=null-co,node-name=null -device floppy,drive=null,id=qdev_id
+Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=null,id=qdev_id
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-none0 (null): null-co:// (null-co)
+none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Removable device: not locked, tray closed
     Cache mode:       writeback
 
-null: null-co:// (null-co)
+null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      qdev_id
     Removable device: not locked, tray closed
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -drive if=none,driver=null-co,node-name=null -device ide-cd,drive=null,id=qdev_id
+Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=null,id=qdev_id
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-none0 (null): null-co:// (null-co)
+none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Removable device: not locked, tray closed
     Cache mode:       writeback
 
-null: null-co:// (null-co)
+null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      qdev_id
     Removable device: not locked, tray closed
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -drive if=none,driver=null-co,node-name=null -device scsi-cd,drive=null,id=qdev_id
+Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=null,id=qdev_id
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-none0 (null): null-co:// (null-co)
+none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Removable device: not locked, tray closed
     Cache mode:       writeback
 
-null: null-co:// (null-co)
+null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      qdev_id
     Removable device: not locked, tray closed
     Cache mode:       writeback
@@ -237,103 +237,103 @@ null: null-co:// (null-co)
 
 === -drive if=none/-device=<bb-name> (with medium) ===
 
-Testing: -drive if=none,driver=null-co,node-name=null -device ide-hd,drive=none0
+Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=none0
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-none0 (null): null-co:// (null-co)
+none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      PATH
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -drive if=none,driver=null-co,node-name=null -device ide-hd,drive=none0,id=qdev_id
+Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=none0,id=qdev_id
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-none0 (null): null-co:// (null-co)
+none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      qdev_id
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -drive if=none,driver=null-co,node-name=null -device scsi-hd,drive=none0
+Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=none0
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-none0 (null): null-co:// (null-co)
+none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      PATH
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -drive if=none,driver=null-co,node-name=null -device scsi-hd,drive=none0,id=qdev_id
+Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=none0,id=qdev_id
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-none0 (null): null-co:// (null-co)
+none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      qdev_id
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -drive if=none,driver=null-co,node-name=null -device virtio-blk-pci,drive=none0
+Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=none0
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-none0 (null): null-co:// (null-co)
+none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      PATH
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -drive if=none,driver=null-co,node-name=null -device virtio-blk-pci,drive=none0,id=qdev_id
+Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=none0,id=qdev_id
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-none0 (null): null-co:// (null-co)
+none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      PATH
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -drive if=none,driver=null-co,node-name=null -device floppy,drive=none0
+Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=none0
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-none0 (null): null-co:// (null-co)
+none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      PATH
     Removable device: not locked, tray closed
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -drive if=none,driver=null-co,node-name=null -device floppy,drive=none0,id=qdev_id
+Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=none0,id=qdev_id
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-none0 (null): null-co:// (null-co)
+none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      qdev_id
     Removable device: not locked, tray closed
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -drive if=none,driver=null-co,node-name=null -device ide-cd,drive=none0
+Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=none0
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-none0 (null): null-co:// (null-co)
+none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      PATH
     Removable device: not locked, tray closed
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -drive if=none,driver=null-co,node-name=null -device ide-cd,drive=none0,id=qdev_id
+Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=none0,id=qdev_id
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-none0 (null): null-co:// (null-co)
+none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      qdev_id
     Removable device: not locked, tray closed
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -drive if=none,driver=null-co,node-name=null -device scsi-cd,drive=none0
+Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=none0
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-none0 (null): null-co:// (null-co)
+none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      PATH
     Removable device: not locked, tray closed
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -drive if=none,driver=null-co,node-name=null -device scsi-cd,drive=none0,id=qdev_id
+Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=none0,id=qdev_id
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-none0 (null): null-co:// (null-co)
+none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      qdev_id
     Removable device: not locked, tray closed
     Cache mode:       writeback
@@ -408,19 +408,19 @@ floppy0: [not inserted]
     Removable device: not locked, tray closed
 (qemu) quit
 
-Testing: -drive if=floppy,driver=null-co
+Testing: -drive if=floppy,driver=null-co,read-zeroes=on
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-floppy0 (NODE_NAME): null-co:// (null-co)
+floppy0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      PATH
     Removable device: not locked, tray closed
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -drive if=ide,driver=null-co
+Testing: -drive if=ide,driver=null-co,read-zeroes=on
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-ide0-hd0 (NODE_NAME): null-co:// (null-co)
+ide0-hd0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      PATH
     Cache mode:       writeback
 (qemu) quit
@@ -433,27 +433,27 @@ ide0-cd0: [not inserted]
     Removable device: not locked, tray closed
 (qemu) quit
 
-Testing: -drive if=ide,driver=null-co,media=cdrom
+Testing: -drive if=ide,driver=null-co,read-zeroes=on,media=cdrom
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-ide0-cd0 (NODE_NAME): null-co:// (null-co, read-only)
+ide0-cd0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co, read-only)
     Attached to:      PATH
     Removable device: not locked, tray closed
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -drive if=virtio,driver=null-co
+Testing: -drive if=virtio,driver=null-co,read-zeroes=on
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-virtio0 (NODE_NAME): null-co:// (null-co)
+virtio0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
     Attached to:      PATH
     Cache mode:       writeback
 (qemu) quit
 
-Testing: -drive if=pflash,driver=null-co,size=1M
+Testing: -drive if=pflash,driver=null-co,read-zeroes=on,size=1M
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) info block
-pflash0 (NODE_NAME): json:{"driver": "null-co", "size": "1M"} (null-co)
+pflash0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co", "size": "1M"} (null-co)
     Attached to:      PATH
     Cache mode:       writeback
 (qemu) quit
diff --git a/tests/qemu-iotests/227 b/tests/qemu-iotests/227
index bdd727a721..637d7c3726 100755
--- a/tests/qemu-iotests/227
+++ b/tests/qemu-iotests/227
@@ -57,7 +57,7 @@ echo
 echo '=== blockstats with -drive if=virtio ==='
 echo
 
-run_qemu -drive driver=null-co,if=virtio <<EOF
+run_qemu -drive driver=null-co,read-zeroes=on,if=virtio <<EOF
 { "execute": "qmp_capabilities" }
 { "execute": "query-blockstats"}
 { "execute": "quit" }
@@ -87,7 +87,7 @@ echo
 echo '=== blockstats with -blockdev and -device ==='
 echo
 
-run_qemu -blockdev driver=null-co,node-name=null -device virtio-blk,drive=null,id=virtio0 <<EOF
+run_qemu -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk,drive=null,id=virtio0 <<EOF
 { "execute": "qmp_capabilities" }
 { "execute": "query-blockstats"}
 { "execute": "quit" }
diff --git a/tests/qemu-iotests/227.out b/tests/qemu-iotests/227.out
index e77efaf4cf..3dd3ca5708 100644
--- a/tests/qemu-iotests/227.out
+++ b/tests/qemu-iotests/227.out
@@ -2,7 +2,7 @@ QA output created by 227
 
 === blockstats with -drive if=virtio ===
 
-Testing: -drive driver=null-co,if=virtio
+Testing: -drive driver=null-co,read-zeroes=on,if=virtio
 {
     QMP_VERSION
 }
@@ -150,7 +150,7 @@ Testing: -blockdev driver=null-co,node-name=null
 
 === blockstats with -blockdev and -device ===
 
-Testing: -blockdev driver=null-co,node-name=null -device virtio-blk,drive=null,id=virtio0
+Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk,drive=null,id=virtio0
 {
     QMP_VERSION
 }
diff --git a/tests/qemu-iotests/238 b/tests/qemu-iotests/238
index 1c0a46fa90..08bc7e6b4b 100755
--- a/tests/qemu-iotests/238
+++ b/tests/qemu-iotests/238
@@ -31,7 +31,7 @@ else:
 vm = iotests.VM()
 vm.launch()
 
-log(vm.qmp('blockdev-add', node_name='hd0', driver='null-co'))
+log(vm.qmp('blockdev-add', node_name='hd0', driver='null-co', read_zeroes=True))
 log(vm.qmp('object-add', qom_type='iothread', id='iothread0'))
 log(vm.qmp('device_add', id='scsi0', driver=virtio_scsi_device, iothread='iothread0'))
 log(vm.qmp('device_add', id='scsi-hd0', driver='scsi-hd', drive='hd0'))
diff --git a/tests/qemu-iotests/240 b/tests/qemu-iotests/240
index 5be6b9c0f7..f73bc07d80 100755
--- a/tests/qemu-iotests/240
+++ b/tests/qemu-iotests/240
@@ -76,7 +76,7 @@ echo
 
 run_qemu <<EOF
 { "execute": "qmp_capabilities" }
-{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0"}}
+{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0"}}
 { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
 { "execute": "device_add", "arguments": {"id": "scsi0", "driver": "${virtio_scsi}", "iothread": "iothread0"}}
 { "execute": "device_add", "arguments": {"id": "scsi-hd0", "driver": "scsi-hd", "drive": "hd0"}}
@@ -94,7 +94,7 @@ echo
 
 run_qemu <<EOF
 { "execute": "qmp_capabilities" }
-{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true}}
+{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0", "read-only": true}}
 { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
 { "execute": "device_add", "arguments": {"id": "scsi0", "driver": "${virtio_scsi}", "iothread": "iothread0"}}
 { "execute": "device_add", "arguments": {"id": "scsi-hd0", "driver": "scsi-hd", "drive": "hd0"}}
@@ -112,7 +112,7 @@ echo
 
 run_qemu <<EOF
 { "execute": "qmp_capabilities" }
-{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true}}
+{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0", "read-only": true}}
 { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
 { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread1"}}
 { "execute": "device_add", "arguments": {"id": "scsi0", "driver": "${virtio_scsi}", "iothread": "iothread0"}}
@@ -134,7 +134,7 @@ echo
 
 run_qemu <<EOF
 { "execute": "qmp_capabilities" }
-{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true}}
+{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0", "read-only": true}}
 { "execute": "nbd-server-start", "arguments": {"addr":{"type":"unix","data":{"path":"$TEST_DIR/nbd"}}}}
 { "execute": "nbd-server-add", "arguments": {"device":"hd0"}}
 { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
-- 
2.20.1



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

* [Qemu-devel] [PULL 02/13] block: Introduce BdrvChild.parent_quiesce_counter
  2019-07-19 13:43 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
  2019-07-19 13:43 ` [Qemu-devel] [PULL 01/13] iotests: Set read-zeroes on in null block driver for Valgrind Kevin Wolf
@ 2019-07-19 13:43 ` Kevin Wolf
  2019-07-19 13:43 ` [Qemu-devel] [PULL 03/13] tests: Add job commit by drained_end test Kevin Wolf
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Kevin Wolf @ 2019-07-19 13:43 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Max Reitz <mreitz@redhat.com>

Commit 5cb2737e925042e6c7cd3fb0b01313950b03cddf laid out why
bdrv_do_drained_end() must decrement the quiesce_counter after
bdrv_drain_invoke().  It did not give a very good reason why it has to
happen after bdrv_parent_drained_end(), instead only claiming symmetry
to bdrv_do_drained_begin().

It turns out that delaying it for so long is wrong.

Situation: We have an active commit job (i.e. a mirror job) from top to
base for the following graph:

                  filter
                    |
                  [file]
                    |
                    v
top --[backing]--> base

Now the VM is closed, which results in the job being cancelled and a
bdrv_drain_all() happening pretty much simultaneously.

Beginning the drain means the job is paused once whenever one of its
nodes is quiesced.  This is reversed when the drain ends.

With how the code currently is, after base's drain ends (which means
that it will have unpaused the job once), its quiesce_counter remains at
1 while it goes to undrain its parents (bdrv_parent_drained_end()).  For
some reason or another, undraining filter causes the job to be kicked
and enter mirror_exit_common(), where it proceeds to invoke
block_job_remove_all_bdrv().

Now base will be detached from the job.  Because its quiesce_counter is
still 1, it will unpause the job once more.  So in total, undraining
base will unpause the job twice.  Eventually, this will lead to the
job's pause_count going negative -- well, it would, were there not an
assertion against this, which crashes qemu.

The general problem is that if in bdrv_parent_drained_end() we undrain
parent A, and then undrain parent B, which then leads to A detaching the
child, bdrv_replace_child_noperm() will undrain A as if we had not done
so yet; that is, one time too many.

It follows that we cannot decrement the quiesce_counter after invoking
bdrv_parent_drained_end().

Unfortunately, decrementing it before bdrv_parent_drained_end() would be
wrong, too.  Imagine the above situation in reverse: Undraining A leads
to B detaching the child.  If we had already decremented the
quiesce_counter by that point, bdrv_replace_child_noperm() would undrain
B one time too little; because it expects bdrv_parent_drained_end() to
issue this undrain.  But bdrv_parent_drained_end() won't do that,
because B is no longer a parent.

Therefore, we have to do something else.  This patch opts for
introducing a second quiesce_counter that counts how many times a
child's parent has been quiesced (though c->role->drained_*).  With
that, bdrv_replace_child_noperm() just has to undrain the parent exactly
that many times when removing a child, and it will always be right.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 include/block/block.h     |  7 +++++++
 include/block/block_int.h |  9 +++++++++
 block.c                   | 15 +++++----------
 block/io.c                | 14 +++++++++++---
 4 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/include/block/block.h b/include/block/block.h
index 734c9d2f76..bff3317696 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -617,6 +617,13 @@ void bdrv_parent_drained_begin(BlockDriverState *bs, BdrvChild *ignore,
  */
 void bdrv_parent_drained_begin_single(BdrvChild *c, bool poll);
 
+/**
+ * bdrv_parent_drained_end_single:
+ *
+ * End a quiesced section for the parent of @c.
+ */
+void bdrv_parent_drained_end_single(BdrvChild *c);
+
 /**
  * bdrv_parent_drained_end:
  *
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 50902531b7..f5b044fcdb 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -729,6 +729,15 @@ struct BdrvChild {
      */
     bool frozen;
 
+    /*
+     * How many times the parent of this child has been drained
+     * (through role->drained_*).
+     * Usually, this is equal to bs->quiesce_counter (potentially
+     * reduced by bdrv_drain_all_count).  It may differ while the
+     * child is entering or leaving a drained section.
+     */
+    int parent_quiesce_counter;
+
     QLIST_ENTRY(BdrvChild) next;
     QLIST_ENTRY(BdrvChild) next_parent;
 };
diff --git a/block.c b/block.c
index 29e931e217..8440712ca0 100644
--- a/block.c
+++ b/block.c
@@ -2251,24 +2251,19 @@ static void bdrv_replace_child_noperm(BdrvChild *child,
         if (child->role->detach) {
             child->role->detach(child);
         }
-        if (old_bs->quiesce_counter && child->role->drained_end) {
-            int num = old_bs->quiesce_counter;
-            if (child->role->parent_is_bds) {
-                num -= bdrv_drain_all_count;
-            }
-            assert(num >= 0);
-            for (i = 0; i < num; i++) {
-                child->role->drained_end(child);
-            }
+        while (child->parent_quiesce_counter) {
+            bdrv_parent_drained_end_single(child);
         }
         QLIST_REMOVE(child, next_parent);
+    } else {
+        assert(child->parent_quiesce_counter == 0);
     }
 
     child->bs = new_bs;
 
     if (new_bs) {
         QLIST_INSERT_HEAD(&new_bs->parents, child, next_parent);
-        if (new_bs->quiesce_counter && child->role->drained_begin) {
+        if (new_bs->quiesce_counter) {
             int num = new_bs->quiesce_counter;
             if (child->role->parent_is_bds) {
                 num -= bdrv_drain_all_count;
diff --git a/block/io.c b/block/io.c
index 24a18759fd..1e618f9a37 100644
--- a/block/io.c
+++ b/block/io.c
@@ -55,6 +55,15 @@ void bdrv_parent_drained_begin(BlockDriverState *bs, BdrvChild *ignore,
     }
 }
 
+void bdrv_parent_drained_end_single(BdrvChild *c)
+{
+    assert(c->parent_quiesce_counter > 0);
+    c->parent_quiesce_counter--;
+    if (c->role->drained_end) {
+        c->role->drained_end(c);
+    }
+}
+
 void bdrv_parent_drained_end(BlockDriverState *bs, BdrvChild *ignore,
                              bool ignore_bds_parents)
 {
@@ -64,9 +73,7 @@ void bdrv_parent_drained_end(BlockDriverState *bs, BdrvChild *ignore,
         if (c == ignore || (ignore_bds_parents && c->role->parent_is_bds)) {
             continue;
         }
-        if (c->role->drained_end) {
-            c->role->drained_end(c);
-        }
+        bdrv_parent_drained_end_single(c);
     }
 }
 
@@ -96,6 +103,7 @@ static bool bdrv_parent_drained_poll(BlockDriverState *bs, BdrvChild *ignore,
 
 void bdrv_parent_drained_begin_single(BdrvChild *c, bool poll)
 {
+    c->parent_quiesce_counter++;
     if (c->role->drained_begin) {
         c->role->drained_begin(c);
     }
-- 
2.20.1



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

* [Qemu-devel] [PULL 03/13] tests: Add job commit by drained_end test
  2019-07-19 13:43 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
  2019-07-19 13:43 ` [Qemu-devel] [PULL 01/13] iotests: Set read-zeroes on in null block driver for Valgrind Kevin Wolf
  2019-07-19 13:43 ` [Qemu-devel] [PULL 02/13] block: Introduce BdrvChild.parent_quiesce_counter Kevin Wolf
@ 2019-07-19 13:43 ` Kevin Wolf
  2019-07-19 13:43 ` [Qemu-devel] [PULL 04/13] block: Add @drained_end_counter Kevin Wolf
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Kevin Wolf @ 2019-07-19 13:43 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Max Reitz <mreitz@redhat.com>

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/test-bdrv-drain.c | 119 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 119 insertions(+)

diff --git a/tests/test-bdrv-drain.c b/tests/test-bdrv-drain.c
index 12e2ecf517..3503ce3b69 100644
--- a/tests/test-bdrv-drain.c
+++ b/tests/test-bdrv-drain.c
@@ -1527,6 +1527,122 @@ static void test_set_aio_context(void)
     iothread_join(b);
 }
 
+
+typedef struct TestDropBackingBlockJob {
+    BlockJob common;
+    bool should_complete;
+    bool *did_complete;
+} TestDropBackingBlockJob;
+
+static int coroutine_fn test_drop_backing_job_run(Job *job, Error **errp)
+{
+    TestDropBackingBlockJob *s =
+        container_of(job, TestDropBackingBlockJob, common.job);
+
+    while (!s->should_complete) {
+        job_sleep_ns(job, 0);
+    }
+
+    return 0;
+}
+
+static void test_drop_backing_job_commit(Job *job)
+{
+    TestDropBackingBlockJob *s =
+        container_of(job, TestDropBackingBlockJob, common.job);
+
+    bdrv_set_backing_hd(blk_bs(s->common.blk), NULL, &error_abort);
+
+    *s->did_complete = true;
+}
+
+static const BlockJobDriver test_drop_backing_job_driver = {
+    .job_driver = {
+        .instance_size  = sizeof(TestDropBackingBlockJob),
+        .free           = block_job_free,
+        .user_resume    = block_job_user_resume,
+        .drain          = block_job_drain,
+        .run            = test_drop_backing_job_run,
+        .commit         = test_drop_backing_job_commit,
+    }
+};
+
+/**
+ * Creates a child node with three parent nodes on it, and then runs a
+ * block job on the final one, parent-node-2.
+ *
+ * (TODO: parent-node-0 currently serves no purpose, but will as of a
+ * follow-up patch.)
+ *
+ * The job is then asked to complete before a section where the child
+ * is drained.
+ *
+ * Ending this section will undrain the child's parents, first
+ * parent-node-2, then parent-node-1, then parent-node-0 -- the parent
+ * list is in reverse order of how they were added.  Ending the drain
+ * on parent-node-2 will resume the job, thus completing it and
+ * scheduling job_exit().
+ *
+ * Ending the drain on parent-node-1 will poll the AioContext, which
+ * lets job_exit() and thus test_drop_backing_job_commit() run.  That
+ * function removes the child as parent-node-2's backing file.
+ *
+ * In old (and buggy) implementations, there are two problems with
+ * that:
+ * (A) bdrv_drain_invoke() polls for every node that leaves the
+ *     drained section.  This means that job_exit() is scheduled
+ *     before the child has left the drained section.  Its
+ *     quiesce_counter is therefore still 1 when it is removed from
+ *     parent-node-2.
+ *
+ * (B) bdrv_replace_child_noperm() calls drained_end() on the old
+ *     child's parents as many times as the child is quiesced.  This
+ *     means it will call drained_end() on parent-node-2 once.
+ *     Because parent-node-2 is no longer quiesced at this point, this
+ *     will fail.
+ *
+ * bdrv_replace_child_noperm() therefore must call drained_end() on
+ * the parent only if it really is still drained because the child is
+ * drained.
+ */
+static void test_blockjob_commit_by_drained_end(void)
+{
+    BlockDriverState *bs_child, *bs_parents[3];
+    TestDropBackingBlockJob *job;
+    bool job_has_completed = false;
+    int i;
+
+    bs_child = bdrv_new_open_driver(&bdrv_test, "child-node", BDRV_O_RDWR,
+                                    &error_abort);
+
+    for (i = 0; i < 3; i++) {
+        char name[32];
+        snprintf(name, sizeof(name), "parent-node-%i", i);
+        bs_parents[i] = bdrv_new_open_driver(&bdrv_test, name, BDRV_O_RDWR,
+                                             &error_abort);
+        bdrv_set_backing_hd(bs_parents[i], bs_child, &error_abort);
+    }
+
+    job = block_job_create("job", &test_drop_backing_job_driver, NULL,
+                           bs_parents[2], 0, BLK_PERM_ALL, 0, 0, NULL, NULL,
+                           &error_abort);
+
+    job->did_complete = &job_has_completed;
+
+    job_start(&job->common.job);
+
+    job->should_complete = true;
+    bdrv_drained_begin(bs_child);
+    g_assert(!job_has_completed);
+    bdrv_drained_end(bs_child);
+    g_assert(job_has_completed);
+
+    bdrv_unref(bs_parents[0]);
+    bdrv_unref(bs_parents[1]);
+    bdrv_unref(bs_parents[2]);
+    bdrv_unref(bs_child);
+}
+
 int main(int argc, char **argv)
 {
     int ret;
@@ -1610,6 +1726,9 @@ int main(int argc, char **argv)
 
     g_test_add_func("/bdrv-drain/set_aio_context", test_set_aio_context);
 
+    g_test_add_func("/bdrv-drain/blockjob/commit_by_drained_end",
+                    test_blockjob_commit_by_drained_end);
+
     ret = g_test_run();
     qemu_event_destroy(&done_event);
     return ret;
-- 
2.20.1



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

* [Qemu-devel] [PULL 04/13] block: Add @drained_end_counter
  2019-07-19 13:43 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (2 preceding siblings ...)
  2019-07-19 13:43 ` [Qemu-devel] [PULL 03/13] tests: Add job commit by drained_end test Kevin Wolf
@ 2019-07-19 13:43 ` Kevin Wolf
  2019-07-19 13:43 ` [Qemu-devel] [PULL 05/13] block: Make bdrv_parent_drained_[^_]*() static Kevin Wolf
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Kevin Wolf @ 2019-07-19 13:43 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Max Reitz <mreitz@redhat.com>

Callers can now pass a pointer to an integer that bdrv_drain_invoke()
(and its recursive callees) will increment for every
bdrv_drain_invoke_entry() operation they schedule.
bdrv_drain_invoke_entry() in turn will decrement it once it has invoked
BlockDriver.bdrv_co_drain_end().

We use atomic operations to access the pointee, because the
bdrv_do_drained_end() caller may wish to end drained sections for
multiple nodes in different AioContexts (bdrv_drain_all_end() does, for
example).

This is the first step to moving the polling for BdrvCoDrainData.done to
become true out of bdrv_drain_invoke() and into the root drained_end
function.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/io.c | 58 +++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 40 insertions(+), 18 deletions(-)

diff --git a/block/io.c b/block/io.c
index 1e618f9a37..c42e18b068 100644
--- a/block/io.c
+++ b/block/io.c
@@ -194,6 +194,7 @@ typedef struct {
     bool poll;
     BdrvChild *parent;
     bool ignore_bds_parents;
+    int *drained_end_counter;
 } BdrvCoDrainData;
 
 static void coroutine_fn bdrv_drain_invoke_entry(void *opaque)
@@ -211,13 +212,18 @@ static void coroutine_fn bdrv_drain_invoke_entry(void *opaque)
     atomic_mb_set(&data->done, true);
     bdrv_dec_in_flight(bs);
 
-    if (data->begin) {
+    if (data->drained_end_counter) {
+        atomic_dec(data->drained_end_counter);
+    }
+
+    if (data->begin || data->drained_end_counter) {
         g_free(data);
     }
 }
 
 /* Recursively call BlockDriver.bdrv_co_drain_begin/end callbacks */
-static void bdrv_drain_invoke(BlockDriverState *bs, bool begin)
+static void bdrv_drain_invoke(BlockDriverState *bs, bool begin,
+                              int *drained_end_counter)
 {
     BdrvCoDrainData *data;
 
@@ -230,16 +236,25 @@ static void bdrv_drain_invoke(BlockDriverState *bs, bool begin)
     *data = (BdrvCoDrainData) {
         .bs = bs,
         .done = false,
-        .begin = begin
+        .begin = begin,
+        .drained_end_counter = drained_end_counter,
     };
 
+    if (!begin && drained_end_counter) {
+        atomic_inc(drained_end_counter);
+    }
+
     /* Make sure the driver callback completes during the polling phase for
      * drain_begin. */
     bdrv_inc_in_flight(bs);
     data->co = qemu_coroutine_create(bdrv_drain_invoke_entry, data);
     aio_co_schedule(bdrv_get_aio_context(bs), data->co);
 
-    if (!begin) {
+    /*
+     * TODO: Drop this and make callers pass @drained_end_counter and poll
+     * themselves
+     */
+    if (!begin && !drained_end_counter) {
         BDRV_POLL_WHILE(bs, !data->done);
         g_free(data);
     }
@@ -281,7 +296,8 @@ static void bdrv_do_drained_begin(BlockDriverState *bs, bool recursive,
                                   BdrvChild *parent, bool ignore_bds_parents,
                                   bool poll);
 static void bdrv_do_drained_end(BlockDriverState *bs, bool recursive,
-                                BdrvChild *parent, bool ignore_bds_parents);
+                                BdrvChild *parent, bool ignore_bds_parents,
+                                int *drained_end_counter);
 
 static void bdrv_co_drain_bh_cb(void *opaque)
 {
@@ -308,7 +324,8 @@ static void bdrv_co_drain_bh_cb(void *opaque)
                                   data->ignore_bds_parents, data->poll);
         } else {
             bdrv_do_drained_end(bs, data->recursive, data->parent,
-                                data->ignore_bds_parents);
+                                data->ignore_bds_parents,
+                                data->drained_end_counter);
         }
         if (ctx == co_ctx) {
             aio_context_release(ctx);
@@ -326,7 +343,8 @@ static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs,
                                                 bool begin, bool recursive,
                                                 BdrvChild *parent,
                                                 bool ignore_bds_parents,
-                                                bool poll)
+                                                bool poll,
+                                                int *drained_end_counter)
 {
     BdrvCoDrainData data;
 
@@ -343,7 +361,9 @@ static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs,
         .parent = parent,
         .ignore_bds_parents = ignore_bds_parents,
         .poll = poll,
+        .drained_end_counter = drained_end_counter,
     };
+
     if (bs) {
         bdrv_inc_in_flight(bs);
     }
@@ -367,7 +387,7 @@ void bdrv_do_drained_begin_quiesce(BlockDriverState *bs,
     }
 
     bdrv_parent_drained_begin(bs, parent, ignore_bds_parents);
-    bdrv_drain_invoke(bs, true);
+    bdrv_drain_invoke(bs, true, NULL);
 }
 
 static void bdrv_do_drained_begin(BlockDriverState *bs, bool recursive,
@@ -378,7 +398,7 @@ static void bdrv_do_drained_begin(BlockDriverState *bs, bool recursive,
 
     if (qemu_in_coroutine()) {
         bdrv_co_yield_to_drain(bs, true, recursive, parent, ignore_bds_parents,
-                               poll);
+                               poll, NULL);
         return;
     }
 
@@ -419,20 +439,21 @@ void bdrv_subtree_drained_begin(BlockDriverState *bs)
 }
 
 static void bdrv_do_drained_end(BlockDriverState *bs, bool recursive,
-                                BdrvChild *parent, bool ignore_bds_parents)
+                                BdrvChild *parent, bool ignore_bds_parents,
+                                int *drained_end_counter)
 {
     BdrvChild *child, *next;
     int old_quiesce_counter;
 
     if (qemu_in_coroutine()) {
         bdrv_co_yield_to_drain(bs, false, recursive, parent, ignore_bds_parents,
-                               false);
+                               false, drained_end_counter);
         return;
     }
     assert(bs->quiesce_counter > 0);
 
     /* Re-enable things in child-to-parent order */
-    bdrv_drain_invoke(bs, false);
+    bdrv_drain_invoke(bs, false, drained_end_counter);
     bdrv_parent_drained_end(bs, parent, ignore_bds_parents);
 
     old_quiesce_counter = atomic_fetch_dec(&bs->quiesce_counter);
@@ -444,19 +465,20 @@ static void bdrv_do_drained_end(BlockDriverState *bs, bool recursive,
         assert(!ignore_bds_parents);
         bs->recursive_quiesce_counter--;
         QLIST_FOREACH_SAFE(child, &bs->children, next, next) {
-            bdrv_do_drained_end(child->bs, true, child, ignore_bds_parents);
+            bdrv_do_drained_end(child->bs, true, child, ignore_bds_parents,
+                                drained_end_counter);
         }
     }
 }
 
 void bdrv_drained_end(BlockDriverState *bs)
 {
-    bdrv_do_drained_end(bs, false, NULL, false);
+    bdrv_do_drained_end(bs, false, NULL, false, NULL);
 }
 
 void bdrv_subtree_drained_end(BlockDriverState *bs)
 {
-    bdrv_do_drained_end(bs, true, NULL, false);
+    bdrv_do_drained_end(bs, true, NULL, false, NULL);
 }
 
 void bdrv_apply_subtree_drain(BdrvChild *child, BlockDriverState *new_parent)
@@ -473,7 +495,7 @@ void bdrv_unapply_subtree_drain(BdrvChild *child, BlockDriverState *old_parent)
     int i;
 
     for (i = 0; i < old_parent->recursive_quiesce_counter; i++) {
-        bdrv_do_drained_end(child->bs, true, child, false);
+        bdrv_do_drained_end(child->bs, true, child, false, NULL);
     }
 }
 
@@ -543,7 +565,7 @@ void bdrv_drain_all_begin(void)
     BlockDriverState *bs = NULL;
 
     if (qemu_in_coroutine()) {
-        bdrv_co_yield_to_drain(NULL, true, false, NULL, true, true);
+        bdrv_co_yield_to_drain(NULL, true, false, NULL, true, true, NULL);
         return;
     }
 
@@ -579,7 +601,7 @@ void bdrv_drain_all_end(void)
         AioContext *aio_context = bdrv_get_aio_context(bs);
 
         aio_context_acquire(aio_context);
-        bdrv_do_drained_end(bs, false, NULL, true);
+        bdrv_do_drained_end(bs, false, NULL, true, NULL);
         aio_context_release(aio_context);
     }
 
-- 
2.20.1



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

* [Qemu-devel] [PULL 05/13] block: Make bdrv_parent_drained_[^_]*() static
  2019-07-19 13:43 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (3 preceding siblings ...)
  2019-07-19 13:43 ` [Qemu-devel] [PULL 04/13] block: Add @drained_end_counter Kevin Wolf
@ 2019-07-19 13:43 ` Kevin Wolf
  2019-07-19 13:43 ` [Qemu-devel] [PULL 06/13] tests: Lock AioContexts in test-block-iothread Kevin Wolf
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Kevin Wolf @ 2019-07-19 13:43 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Max Reitz <mreitz@redhat.com>

These functions are not used outside of block/io.c, there is no reason
why they should be globally available.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 include/block/block.h | 18 ------------------
 block/io.c            |  8 ++++----
 2 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/include/block/block.h b/include/block/block.h
index bff3317696..a81645e8a3 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -600,15 +600,6 @@ int bdrv_probe_geometry(BlockDriverState *bs, HDGeometry *geo);
 void bdrv_io_plug(BlockDriverState *bs);
 void bdrv_io_unplug(BlockDriverState *bs);
 
-/**
- * bdrv_parent_drained_begin:
- *
- * Begin a quiesced section of all users of @bs. This is part of
- * bdrv_drained_begin.
- */
-void bdrv_parent_drained_begin(BlockDriverState *bs, BdrvChild *ignore,
-                               bool ignore_bds_parents);
-
 /**
  * bdrv_parent_drained_begin_single:
  *
@@ -624,15 +615,6 @@ void bdrv_parent_drained_begin_single(BdrvChild *c, bool poll);
  */
 void bdrv_parent_drained_end_single(BdrvChild *c);
 
-/**
- * bdrv_parent_drained_end:
- *
- * End a quiesced section of all users of @bs. This is part of
- * bdrv_drained_end.
- */
-void bdrv_parent_drained_end(BlockDriverState *bs, BdrvChild *ignore,
-                             bool ignore_bds_parents);
-
 /**
  * bdrv_drain_poll:
  *
diff --git a/block/io.c b/block/io.c
index c42e18b068..b0b33174d3 100644
--- a/block/io.c
+++ b/block/io.c
@@ -42,8 +42,8 @@ static void bdrv_parent_cb_resize(BlockDriverState *bs);
 static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs,
     int64_t offset, int bytes, BdrvRequestFlags flags);
 
-void bdrv_parent_drained_begin(BlockDriverState *bs, BdrvChild *ignore,
-                               bool ignore_bds_parents)
+static void bdrv_parent_drained_begin(BlockDriverState *bs, BdrvChild *ignore,
+                                      bool ignore_bds_parents)
 {
     BdrvChild *c, *next;
 
@@ -64,8 +64,8 @@ void bdrv_parent_drained_end_single(BdrvChild *c)
     }
 }
 
-void bdrv_parent_drained_end(BlockDriverState *bs, BdrvChild *ignore,
-                             bool ignore_bds_parents)
+static void bdrv_parent_drained_end(BlockDriverState *bs, BdrvChild *ignore,
+                                    bool ignore_bds_parents)
 {
     BdrvChild *c, *next;
 
-- 
2.20.1



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

* [Qemu-devel] [PULL 06/13] tests: Lock AioContexts in test-block-iothread
  2019-07-19 13:43 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (4 preceding siblings ...)
  2019-07-19 13:43 ` [Qemu-devel] [PULL 05/13] block: Make bdrv_parent_drained_[^_]*() static Kevin Wolf
@ 2019-07-19 13:43 ` Kevin Wolf
  2019-07-19 13:43 ` [Qemu-devel] [PULL 07/13] block: Do not poll in bdrv_do_drained_end() Kevin Wolf
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Kevin Wolf @ 2019-07-19 13:43 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Max Reitz <mreitz@redhat.com>

When changing a node's AioContext, the caller must acquire the old
AioContext (unless it currently runs in that old context).  Therefore,
unless the node currently is in the main context, we always have to
acquire the old context around calls that may change a node's
AioContext.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/test-block-iothread.c | 40 ++++++++++++++++++++++++-------------
 1 file changed, 26 insertions(+), 14 deletions(-)

diff --git a/tests/test-block-iothread.c b/tests/test-block-iothread.c
index 79d9cf8a57..1949d5e61a 100644
--- a/tests/test-block-iothread.c
+++ b/tests/test-block-iothread.c
@@ -348,8 +348,8 @@ static void test_sync_op(const void *opaque)
     if (t->blkfn) {
         t->blkfn(blk);
     }
-    aio_context_release(ctx);
     blk_set_aio_context(blk, qemu_get_aio_context(), &error_abort);
+    aio_context_release(ctx);
 
     bdrv_unref(bs);
     blk_unref(blk);
@@ -476,6 +476,7 @@ static void test_propagate_basic(void)
 {
     IOThread *iothread = iothread_new();
     AioContext *ctx = iothread_get_aio_context(iothread);
+    AioContext *main_ctx;
     BlockBackend *blk;
     BlockDriverState *bs_a, *bs_b, *bs_verify;
     QDict *options;
@@ -504,12 +505,14 @@ static void test_propagate_basic(void)
     g_assert(bdrv_get_aio_context(bs_b) == ctx);
 
     /* Switch the AioContext back */
-    ctx = qemu_get_aio_context();
-    blk_set_aio_context(blk, ctx, &error_abort);
-    g_assert(blk_get_aio_context(blk) == ctx);
-    g_assert(bdrv_get_aio_context(bs_a) == ctx);
-    g_assert(bdrv_get_aio_context(bs_verify) == ctx);
-    g_assert(bdrv_get_aio_context(bs_b) == ctx);
+    main_ctx = qemu_get_aio_context();
+    aio_context_acquire(ctx);
+    blk_set_aio_context(blk, main_ctx, &error_abort);
+    aio_context_release(ctx);
+    g_assert(blk_get_aio_context(blk) == main_ctx);
+    g_assert(bdrv_get_aio_context(bs_a) == main_ctx);
+    g_assert(bdrv_get_aio_context(bs_verify) == main_ctx);
+    g_assert(bdrv_get_aio_context(bs_b) == main_ctx);
 
     bdrv_unref(bs_verify);
     bdrv_unref(bs_b);
@@ -534,6 +537,7 @@ static void test_propagate_diamond(void)
 {
     IOThread *iothread = iothread_new();
     AioContext *ctx = iothread_get_aio_context(iothread);
+    AioContext *main_ctx;
     BlockBackend *blk;
     BlockDriverState *bs_a, *bs_b, *bs_c, *bs_verify;
     QDict *options;
@@ -573,13 +577,15 @@ static void test_propagate_diamond(void)
     g_assert(bdrv_get_aio_context(bs_c) == ctx);
 
     /* Switch the AioContext back */
-    ctx = qemu_get_aio_context();
-    blk_set_aio_context(blk, ctx, &error_abort);
-    g_assert(blk_get_aio_context(blk) == ctx);
-    g_assert(bdrv_get_aio_context(bs_verify) == ctx);
-    g_assert(bdrv_get_aio_context(bs_a) == ctx);
-    g_assert(bdrv_get_aio_context(bs_b) == ctx);
-    g_assert(bdrv_get_aio_context(bs_c) == ctx);
+    main_ctx = qemu_get_aio_context();
+    aio_context_acquire(ctx);
+    blk_set_aio_context(blk, main_ctx, &error_abort);
+    aio_context_release(ctx);
+    g_assert(blk_get_aio_context(blk) == main_ctx);
+    g_assert(bdrv_get_aio_context(bs_verify) == main_ctx);
+    g_assert(bdrv_get_aio_context(bs_a) == main_ctx);
+    g_assert(bdrv_get_aio_context(bs_b) == main_ctx);
+    g_assert(bdrv_get_aio_context(bs_c) == main_ctx);
 
     blk_unref(blk);
     bdrv_unref(bs_verify);
@@ -685,7 +691,9 @@ static void test_attach_second_node(void)
     g_assert(bdrv_get_aio_context(bs) == ctx);
     g_assert(bdrv_get_aio_context(filter) == ctx);
 
+    aio_context_acquire(ctx);
     blk_set_aio_context(blk, main_ctx, &error_abort);
+    aio_context_release(ctx);
     g_assert(blk_get_aio_context(blk) == main_ctx);
     g_assert(bdrv_get_aio_context(bs) == main_ctx);
     g_assert(bdrv_get_aio_context(filter) == main_ctx);
@@ -712,7 +720,9 @@ static void test_attach_preserve_blk_ctx(void)
     g_assert(bdrv_get_aio_context(bs) == ctx);
 
     /* Remove the node again */
+    aio_context_acquire(ctx);
     blk_remove_bs(blk);
+    aio_context_release(ctx);
     g_assert(blk_get_aio_context(blk) == ctx);
     g_assert(bdrv_get_aio_context(bs) == qemu_get_aio_context());
 
@@ -721,7 +731,9 @@ static void test_attach_preserve_blk_ctx(void)
     g_assert(blk_get_aio_context(blk) == ctx);
     g_assert(bdrv_get_aio_context(bs) == ctx);
 
+    aio_context_acquire(ctx);
     blk_set_aio_context(blk, qemu_get_aio_context(), &error_abort);
+    aio_context_release(ctx);
     bdrv_unref(bs);
     blk_unref(blk);
 }
-- 
2.20.1



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

* [Qemu-devel] [PULL 07/13] block: Do not poll in bdrv_do_drained_end()
  2019-07-19 13:43 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (5 preceding siblings ...)
  2019-07-19 13:43 ` [Qemu-devel] [PULL 06/13] tests: Lock AioContexts in test-block-iothread Kevin Wolf
@ 2019-07-19 13:43 ` Kevin Wolf
  2019-07-19 13:43 ` [Qemu-devel] [PULL 08/13] tests: Extend commit by drained_end test Kevin Wolf
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Kevin Wolf @ 2019-07-19 13:43 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Max Reitz <mreitz@redhat.com>

We should never poll anywhere in bdrv_do_drained_end() (including its
recursive callees like bdrv_drain_invoke()), because it does not cope
well with graph changes.  In fact, it has been written based on the
postulation that no graph changes will happen in it.

Instead, the callers that want to poll must poll, i.e. all currently
globally available wrappers: bdrv_drained_end(),
bdrv_subtree_drained_end(), bdrv_unapply_subtree_drain(), and
bdrv_drain_all_end().  Graph changes there do not matter.

They can poll simply by passing a pointer to a drained_end_counter and
wait until it reaches 0.

This patch also adds a non-polling global wrapper for
bdrv_do_drained_end() that takes a drained_end_counter pointer.  We need
such a variant because now no function called anywhere from
bdrv_do_drained_end() must poll.  This includes
BdrvChildRole.drained_end(), which already must not poll according to
its interface documentation, but bdrv_child_cb_drained_end() just
violates that by invoking bdrv_drained_end() (which does poll).
Therefore, BdrvChildRole.drained_end() must take a *drained_end_counter
parameter, which bdrv_child_cb_drained_end() can pass on to the new
bdrv_drained_end_no_poll() function.

Note that we now have a pattern of all drained_end-related functions
either polling or receiving a *drained_end_counter to let the caller
poll based on that.

A problem with a single poll loop is that when the drained section in
bdrv_set_aio_context_ignore() ends, some nodes in the subgraph may be in
the old contexts, while others are in the new context already.  To let
the collective poll in bdrv_drained_end() work correctly, we must not
hold a lock to the old context, so that the old context can make
progress in case it is different from the current context.

(In the process, remove the comment saying that the current context is
always the old context, because it is wrong.)

In all other places, all nodes in a subtree must be in the same context,
so we can just poll that.  The exception of course is
bdrv_drain_all_end(), but that always runs in the main context, so we
can just poll NULL (like bdrv_drain_all_begin() does).

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 include/block/block.h     | 25 ++++++++++++
 include/block/block_int.h |  6 ++-
 block.c                   | 37 ++++++++++++++----
 block/block-backend.c     |  6 +--
 block/io.c                | 80 ++++++++++++++++++++++++++++-----------
 blockjob.c                |  2 +-
 6 files changed, 120 insertions(+), 36 deletions(-)

diff --git a/include/block/block.h b/include/block/block.h
index a81645e8a3..60f00479e0 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -612,6 +612,9 @@ void bdrv_parent_drained_begin_single(BdrvChild *c, bool poll);
  * bdrv_parent_drained_end_single:
  *
  * End a quiesced section for the parent of @c.
+ *
+ * This polls @bs's AioContext until all scheduled sub-drained_ends
+ * have settled, which may result in graph changes.
  */
 void bdrv_parent_drained_end_single(BdrvChild *c);
 
@@ -661,9 +664,31 @@ void bdrv_subtree_drained_begin(BlockDriverState *bs);
  * bdrv_drained_end:
  *
  * End a quiescent section started by bdrv_drained_begin().
+ *
+ * This polls @bs's AioContext until all scheduled sub-drained_ends
+ * have settled.  On one hand, that may result in graph changes.  On
+ * the other, this requires that all involved nodes (@bs and all of
+ * its parents) are in the same AioContext, and that the caller has
+ * acquired it.
+ * If there are any nodes that are in different contexts from @bs,
+ * these contexts must not be acquired.
  */
 void bdrv_drained_end(BlockDriverState *bs);
 
+/**
+ * bdrv_drained_end_no_poll:
+ *
+ * Same as bdrv_drained_end(), but do not poll for the subgraph to
+ * actually become unquiesced.  Therefore, no graph changes will occur
+ * with this function.
+ *
+ * *drained_end_counter is incremented for every background operation
+ * that is scheduled, and will be decremented for every operation once
+ * it settles.  The caller must poll until it reaches 0.  The counter
+ * should be accessed using atomic operations only.
+ */
+void bdrv_drained_end_no_poll(BlockDriverState *bs, int *drained_end_counter);
+
 /**
  * End a quiescent section started by bdrv_subtree_drained_begin().
  */
diff --git a/include/block/block_int.h b/include/block/block_int.h
index f5b044fcdb..3aa1e832a8 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -664,11 +664,15 @@ struct BdrvChildRole {
      * These functions must not change the graph (and therefore also must not
      * call aio_poll(), which could change the graph indirectly).
      *
+     * If drained_end() schedules background operations, it must atomically
+     * increment *drained_end_counter for each such operation and atomically
+     * decrement it once the operation has settled.
+     *
      * Note that this can be nested. If drained_begin() was called twice, new
      * I/O is allowed only after drained_end() was called twice, too.
      */
     void (*drained_begin)(BdrvChild *child);
-    void (*drained_end)(BdrvChild *child);
+    void (*drained_end)(BdrvChild *child, int *drained_end_counter);
 
     /*
      * Returns whether the parent has pending requests for the child. This
diff --git a/block.c b/block.c
index 8440712ca0..9c94f7f28a 100644
--- a/block.c
+++ b/block.c
@@ -911,10 +911,11 @@ static bool bdrv_child_cb_drained_poll(BdrvChild *child)
     return bdrv_drain_poll(bs, false, NULL, false);
 }
 
-static void bdrv_child_cb_drained_end(BdrvChild *child)
+static void bdrv_child_cb_drained_end(BdrvChild *child,
+                                      int *drained_end_counter)
 {
     BlockDriverState *bs = child->opaque;
-    bdrv_drained_end(bs);
+    bdrv_drained_end_no_poll(bs, drained_end_counter);
 }
 
 static void bdrv_child_cb_attach(BdrvChild *child)
@@ -5923,9 +5924,11 @@ static void bdrv_attach_aio_context(BlockDriverState *bs,
 void bdrv_set_aio_context_ignore(BlockDriverState *bs,
                                  AioContext *new_context, GSList **ignore)
 {
+    AioContext *old_context = bdrv_get_aio_context(bs);
+    AioContext *current_context = qemu_get_current_aio_context();
     BdrvChild *child;
 
-    if (bdrv_get_aio_context(bs) == new_context) {
+    if (old_context == new_context) {
         return;
     }
 
@@ -5949,13 +5952,31 @@ void bdrv_set_aio_context_ignore(BlockDriverState *bs,
 
     bdrv_detach_aio_context(bs);
 
-    /* This function executes in the old AioContext so acquire the new one in
-     * case it runs in a different thread.
-     */
-    aio_context_acquire(new_context);
+    /* Acquire the new context, if necessary */
+    if (current_context != new_context) {
+        aio_context_acquire(new_context);
+    }
+
     bdrv_attach_aio_context(bs, new_context);
+
+    /*
+     * If this function was recursively called from
+     * bdrv_set_aio_context_ignore(), there may be nodes in the
+     * subtree that have not yet been moved to the new AioContext.
+     * Release the old one so bdrv_drained_end() can poll them.
+     */
+    if (current_context != old_context) {
+        aio_context_release(old_context);
+    }
+
     bdrv_drained_end(bs);
-    aio_context_release(new_context);
+
+    if (current_context != old_context) {
+        aio_context_acquire(old_context);
+    }
+    if (current_context != new_context) {
+        aio_context_release(new_context);
+    }
 }
 
 static bool bdrv_parent_can_set_aio_context(BdrvChild *c, AioContext *ctx,
diff --git a/block/block-backend.c b/block/block-backend.c
index a8d160fd5d..0056b526b8 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -121,7 +121,7 @@ static void blk_root_inherit_options(int *child_flags, QDict *child_options,
 }
 static void blk_root_drained_begin(BdrvChild *child);
 static bool blk_root_drained_poll(BdrvChild *child);
-static void blk_root_drained_end(BdrvChild *child);
+static void blk_root_drained_end(BdrvChild *child, int *drained_end_counter);
 
 static void blk_root_change_media(BdrvChild *child, bool load);
 static void blk_root_resize(BdrvChild *child);
@@ -1249,7 +1249,7 @@ int blk_pread_unthrottled(BlockBackend *blk, int64_t offset, uint8_t *buf,
 
     blk_root_drained_begin(blk->root);
     ret = blk_pread(blk, offset, buf, count);
-    blk_root_drained_end(blk->root);
+    blk_root_drained_end(blk->root, NULL);
     return ret;
 }
 
@@ -2236,7 +2236,7 @@ static bool blk_root_drained_poll(BdrvChild *child)
     return !!blk->in_flight;
 }
 
-static void blk_root_drained_end(BdrvChild *child)
+static void blk_root_drained_end(BdrvChild *child, int *drained_end_counter)
 {
     BlockBackend *blk = child->opaque;
     assert(blk->quiesce_counter);
diff --git a/block/io.c b/block/io.c
index b0b33174d3..8f23cab82e 100644
--- a/block/io.c
+++ b/block/io.c
@@ -55,17 +55,26 @@ static void bdrv_parent_drained_begin(BlockDriverState *bs, BdrvChild *ignore,
     }
 }
 
-void bdrv_parent_drained_end_single(BdrvChild *c)
+static void bdrv_parent_drained_end_single_no_poll(BdrvChild *c,
+                                                   int *drained_end_counter)
 {
     assert(c->parent_quiesce_counter > 0);
     c->parent_quiesce_counter--;
     if (c->role->drained_end) {
-        c->role->drained_end(c);
+        c->role->drained_end(c, drained_end_counter);
     }
 }
 
+void bdrv_parent_drained_end_single(BdrvChild *c)
+{
+    int drained_end_counter = 0;
+    bdrv_parent_drained_end_single_no_poll(c, &drained_end_counter);
+    BDRV_POLL_WHILE(c->bs, atomic_read(&drained_end_counter) > 0);
+}
+
 static void bdrv_parent_drained_end(BlockDriverState *bs, BdrvChild *ignore,
-                                    bool ignore_bds_parents)
+                                    bool ignore_bds_parents,
+                                    int *drained_end_counter)
 {
     BdrvChild *c, *next;
 
@@ -73,7 +82,7 @@ static void bdrv_parent_drained_end(BlockDriverState *bs, BdrvChild *ignore,
         if (c == ignore || (ignore_bds_parents && c->role->parent_is_bds)) {
             continue;
         }
-        bdrv_parent_drained_end_single(c);
+        bdrv_parent_drained_end_single_no_poll(c, drained_end_counter);
     }
 }
 
@@ -212,13 +221,11 @@ static void coroutine_fn bdrv_drain_invoke_entry(void *opaque)
     atomic_mb_set(&data->done, true);
     bdrv_dec_in_flight(bs);
 
-    if (data->drained_end_counter) {
+    if (!data->begin) {
         atomic_dec(data->drained_end_counter);
     }
 
-    if (data->begin || data->drained_end_counter) {
-        g_free(data);
-    }
+    g_free(data);
 }
 
 /* Recursively call BlockDriver.bdrv_co_drain_begin/end callbacks */
@@ -240,7 +247,7 @@ static void bdrv_drain_invoke(BlockDriverState *bs, bool begin,
         .drained_end_counter = drained_end_counter,
     };
 
-    if (!begin && drained_end_counter) {
+    if (!begin) {
         atomic_inc(drained_end_counter);
     }
 
@@ -249,15 +256,6 @@ static void bdrv_drain_invoke(BlockDriverState *bs, bool begin,
     bdrv_inc_in_flight(bs);
     data->co = qemu_coroutine_create(bdrv_drain_invoke_entry, data);
     aio_co_schedule(bdrv_get_aio_context(bs), data->co);
-
-    /*
-     * TODO: Drop this and make callers pass @drained_end_counter and poll
-     * themselves
-     */
-    if (!begin && !drained_end_counter) {
-        BDRV_POLL_WHILE(bs, !data->done);
-        g_free(data);
-    }
 }
 
 /* Returns true if BDRV_POLL_WHILE() should go into a blocking aio_poll() */
@@ -320,9 +318,11 @@ static void bdrv_co_drain_bh_cb(void *opaque)
         }
         bdrv_dec_in_flight(bs);
         if (data->begin) {
+            assert(!data->drained_end_counter);
             bdrv_do_drained_begin(bs, data->recursive, data->parent,
                                   data->ignore_bds_parents, data->poll);
         } else {
+            assert(!data->poll);
             bdrv_do_drained_end(bs, data->recursive, data->parent,
                                 data->ignore_bds_parents,
                                 data->drained_end_counter);
@@ -438,6 +438,20 @@ void bdrv_subtree_drained_begin(BlockDriverState *bs)
     bdrv_do_drained_begin(bs, true, NULL, false, true);
 }
 
+/**
+ * This function does not poll, nor must any of its recursively called
+ * functions.  The *drained_end_counter pointee will be incremented
+ * once for every background operation scheduled, and decremented once
+ * the operation settles.  Therefore, the pointer must remain valid
+ * until the pointee reaches 0.  That implies that whoever sets up the
+ * pointee has to poll until it is 0.
+ *
+ * We use atomic operations to access *drained_end_counter, because
+ * (1) when called from bdrv_set_aio_context_ignore(), the subgraph of
+ *     @bs may contain nodes in different AioContexts,
+ * (2) bdrv_drain_all_end() uses the same counter for all nodes,
+ *     regardless of which AioContext they are in.
+ */
 static void bdrv_do_drained_end(BlockDriverState *bs, bool recursive,
                                 BdrvChild *parent, bool ignore_bds_parents,
                                 int *drained_end_counter)
@@ -445,6 +459,8 @@ static void bdrv_do_drained_end(BlockDriverState *bs, bool recursive,
     BdrvChild *child, *next;
     int old_quiesce_counter;
 
+    assert(drained_end_counter != NULL);
+
     if (qemu_in_coroutine()) {
         bdrv_co_yield_to_drain(bs, false, recursive, parent, ignore_bds_parents,
                                false, drained_end_counter);
@@ -454,7 +470,8 @@ static void bdrv_do_drained_end(BlockDriverState *bs, bool recursive,
 
     /* Re-enable things in child-to-parent order */
     bdrv_drain_invoke(bs, false, drained_end_counter);
-    bdrv_parent_drained_end(bs, parent, ignore_bds_parents);
+    bdrv_parent_drained_end(bs, parent, ignore_bds_parents,
+                            drained_end_counter);
 
     old_quiesce_counter = atomic_fetch_dec(&bs->quiesce_counter);
     if (old_quiesce_counter == 1) {
@@ -473,12 +490,21 @@ static void bdrv_do_drained_end(BlockDriverState *bs, bool recursive,
 
 void bdrv_drained_end(BlockDriverState *bs)
 {
-    bdrv_do_drained_end(bs, false, NULL, false, NULL);
+    int drained_end_counter = 0;
+    bdrv_do_drained_end(bs, false, NULL, false, &drained_end_counter);
+    BDRV_POLL_WHILE(bs, atomic_read(&drained_end_counter) > 0);
+}
+
+void bdrv_drained_end_no_poll(BlockDriverState *bs, int *drained_end_counter)
+{
+    bdrv_do_drained_end(bs, false, NULL, false, drained_end_counter);
 }
 
 void bdrv_subtree_drained_end(BlockDriverState *bs)
 {
-    bdrv_do_drained_end(bs, true, NULL, false, NULL);
+    int drained_end_counter = 0;
+    bdrv_do_drained_end(bs, true, NULL, false, &drained_end_counter);
+    BDRV_POLL_WHILE(bs, atomic_read(&drained_end_counter) > 0);
 }
 
 void bdrv_apply_subtree_drain(BdrvChild *child, BlockDriverState *new_parent)
@@ -492,11 +518,15 @@ void bdrv_apply_subtree_drain(BdrvChild *child, BlockDriverState *new_parent)
 
 void bdrv_unapply_subtree_drain(BdrvChild *child, BlockDriverState *old_parent)
 {
+    int drained_end_counter = 0;
     int i;
 
     for (i = 0; i < old_parent->recursive_quiesce_counter; i++) {
-        bdrv_do_drained_end(child->bs, true, child, false, NULL);
+        bdrv_do_drained_end(child->bs, true, child, false,
+                            &drained_end_counter);
     }
+
+    BDRV_POLL_WHILE(child->bs, atomic_read(&drained_end_counter) > 0);
 }
 
 /*
@@ -596,15 +626,19 @@ void bdrv_drain_all_begin(void)
 void bdrv_drain_all_end(void)
 {
     BlockDriverState *bs = NULL;
+    int drained_end_counter = 0;
 
     while ((bs = bdrv_next_all_states(bs))) {
         AioContext *aio_context = bdrv_get_aio_context(bs);
 
         aio_context_acquire(aio_context);
-        bdrv_do_drained_end(bs, false, NULL, true, NULL);
+        bdrv_do_drained_end(bs, false, NULL, true, &drained_end_counter);
         aio_context_release(aio_context);
     }
 
+    assert(qemu_get_current_aio_context() == qemu_get_aio_context());
+    AIO_WAIT_WHILE(NULL, atomic_read(&drained_end_counter) > 0);
+
     assert(bdrv_drain_all_count > 0);
     bdrv_drain_all_count--;
 }
diff --git a/blockjob.c b/blockjob.c
index 458ae76f51..20b7f557da 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -135,7 +135,7 @@ static bool child_job_drained_poll(BdrvChild *c)
     }
 }
 
-static void child_job_drained_end(BdrvChild *c)
+static void child_job_drained_end(BdrvChild *c, int *drained_end_counter)
 {
     BlockJob *job = c->opaque;
     job_resume(&job->job);
-- 
2.20.1



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

* [Qemu-devel] [PULL 08/13] tests: Extend commit by drained_end test
  2019-07-19 13:43 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (6 preceding siblings ...)
  2019-07-19 13:43 ` [Qemu-devel] [PULL 07/13] block: Do not poll in bdrv_do_drained_end() Kevin Wolf
@ 2019-07-19 13:43 ` Kevin Wolf
  2019-07-19 13:43 ` [Qemu-devel] [PULL 09/13] block: Loop unsafely in bdrv*drained_end() Kevin Wolf
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Kevin Wolf @ 2019-07-19 13:43 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Max Reitz <mreitz@redhat.com>

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/test-bdrv-drain.c | 36 ++++++++++++++++++++++++++++++++----
 1 file changed, 32 insertions(+), 4 deletions(-)

diff --git a/tests/test-bdrv-drain.c b/tests/test-bdrv-drain.c
index 3503ce3b69..03fa1142a1 100644
--- a/tests/test-bdrv-drain.c
+++ b/tests/test-bdrv-drain.c
@@ -1532,6 +1532,7 @@ typedef struct TestDropBackingBlockJob {
     BlockJob common;
     bool should_complete;
     bool *did_complete;
+    BlockDriverState *detach_also;
 } TestDropBackingBlockJob;
 
 static int coroutine_fn test_drop_backing_job_run(Job *job, Error **errp)
@@ -1552,6 +1553,7 @@ static void test_drop_backing_job_commit(Job *job)
         container_of(job, TestDropBackingBlockJob, common.job);
 
     bdrv_set_backing_hd(blk_bs(s->common.blk), NULL, &error_abort);
+    bdrv_set_backing_hd(s->detach_also, NULL, &error_abort);
 
     *s->did_complete = true;
 }
@@ -1571,9 +1573,6 @@ static const BlockJobDriver test_drop_backing_job_driver = {
  * Creates a child node with three parent nodes on it, and then runs a
  * block job on the final one, parent-node-2.
  *
- * (TODO: parent-node-0 currently serves no purpose, but will as of a
- * follow-up patch.)
- *
  * The job is then asked to complete before a section where the child
  * is drained.
  *
@@ -1585,7 +1584,7 @@ static const BlockJobDriver test_drop_backing_job_driver = {
  *
  * Ending the drain on parent-node-1 will poll the AioContext, which
  * lets job_exit() and thus test_drop_backing_job_commit() run.  That
- * function removes the child as parent-node-2's backing file.
+ * function first removes the child as parent-node-2's backing file.
  *
  * In old (and buggy) implementations, there are two problems with
  * that:
@@ -1604,6 +1603,34 @@ static const BlockJobDriver test_drop_backing_job_driver = {
  * bdrv_replace_child_noperm() therefore must call drained_end() on
  * the parent only if it really is still drained because the child is
  * drained.
+ *
+ * If removing child from parent-node-2 was successful (as it should
+ * be), test_drop_backing_job_commit() will then also remove the child
+ * from parent-node-0.
+ *
+ * With an old version of our drain infrastructure ((A) above), that
+ * resulted in the following flow:
+ *
+ * 1. child attempts to leave its drained section.  The call recurses
+ *    to its parents.
+ *
+ * 2. parent-node-2 leaves the drained section.  Polling in
+ *    bdrv_drain_invoke() will schedule job_exit().
+ *
+ * 3. parent-node-1 leaves the drained section.  Polling in
+ *    bdrv_drain_invoke() will run job_exit(), thus disconnecting
+ *    parent-node-0 from the child node.
+ *
+ * 4. bdrv_parent_drained_end() uses a QLIST_FOREACH_SAFE() loop to
+ *    iterate over the parents.  Thus, it now accesses the BdrvChild
+ *    object that used to connect parent-node-0 and the child node.
+ *    However, that object no longer exists, so it accesses a dangling
+ *    pointer.
+ *
+ * The solution is to only poll once when running a bdrv_drained_end()
+ * operation, specifically at the end when all drained_end()
+ * operations for all involved nodes have been scheduled.
+ * Note that this also solves (A) above, thus hiding (B).
  */
 static void test_blockjob_commit_by_drained_end(void)
 {
@@ -1627,6 +1654,7 @@ static void test_blockjob_commit_by_drained_end(void)
                            bs_parents[2], 0, BLK_PERM_ALL, 0, 0, NULL, NULL,
                            &error_abort);
 
+    job->detach_also = bs_parents[0];
     job->did_complete = &job_has_completed;
 
     job_start(&job->common.job);
-- 
2.20.1



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

* [Qemu-devel] [PULL 09/13] block: Loop unsafely in bdrv*drained_end()
  2019-07-19 13:43 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (7 preceding siblings ...)
  2019-07-19 13:43 ` [Qemu-devel] [PULL 08/13] tests: Extend commit by drained_end test Kevin Wolf
@ 2019-07-19 13:43 ` Kevin Wolf
  2019-07-19 13:43 ` [Qemu-devel] [PULL 10/13] iotests: Add @has_quit to vm.shutdown() Kevin Wolf
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Kevin Wolf @ 2019-07-19 13:43 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Max Reitz <mreitz@redhat.com>

The graph must not change in these loops (or a QLIST_FOREACH_SAFE would
not even be enough).  We now ensure this by only polling once in the
root bdrv_drained_end() call, so we can drop the _SAFE suffix.  Doing so
makes it clear that the graph must not change.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/io.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/block/io.c b/block/io.c
index 8f23cab82e..b89e155d21 100644
--- a/block/io.c
+++ b/block/io.c
@@ -76,9 +76,9 @@ static void bdrv_parent_drained_end(BlockDriverState *bs, BdrvChild *ignore,
                                     bool ignore_bds_parents,
                                     int *drained_end_counter)
 {
-    BdrvChild *c, *next;
+    BdrvChild *c;
 
-    QLIST_FOREACH_SAFE(c, &bs->parents, next_parent, next) {
+    QLIST_FOREACH(c, &bs->parents, next_parent) {
         if (c == ignore || (ignore_bds_parents && c->role->parent_is_bds)) {
             continue;
         }
@@ -456,7 +456,7 @@ static void bdrv_do_drained_end(BlockDriverState *bs, bool recursive,
                                 BdrvChild *parent, bool ignore_bds_parents,
                                 int *drained_end_counter)
 {
-    BdrvChild *child, *next;
+    BdrvChild *child;
     int old_quiesce_counter;
 
     assert(drained_end_counter != NULL);
@@ -481,7 +481,7 @@ static void bdrv_do_drained_end(BlockDriverState *bs, bool recursive,
     if (recursive) {
         assert(!ignore_bds_parents);
         bs->recursive_quiesce_counter--;
-        QLIST_FOREACH_SAFE(child, &bs->children, next, next) {
+        QLIST_FOREACH(child, &bs->children, next) {
             bdrv_do_drained_end(child->bs, true, child, ignore_bds_parents,
                                 drained_end_counter);
         }
-- 
2.20.1



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

* [Qemu-devel] [PULL 10/13] iotests: Add @has_quit to vm.shutdown()
  2019-07-19 13:43 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (8 preceding siblings ...)
  2019-07-19 13:43 ` [Qemu-devel] [PULL 09/13] block: Loop unsafely in bdrv*drained_end() Kevin Wolf
@ 2019-07-19 13:43 ` Kevin Wolf
  2019-07-19 13:43 ` [Qemu-devel] [PULL 11/13] iotests: Test commit with a filter on the chain Kevin Wolf
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Kevin Wolf @ 2019-07-19 13:43 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Max Reitz <mreitz@redhat.com>

If a test has issued a quit command already (which may be useful to do
explicitly because the test wants to show its effects),
QEMUMachine.shutdown() should not do so again.  Otherwise, the VM may
well return an ECONNRESET which will lead QEMUMachine.shutdown() to
killing it, which then turns into a "qemu received signal 9" line.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 python/qemu/machine.py | 5 +++--
 tests/qemu-iotests/255 | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/python/qemu/machine.py b/python/qemu/machine.py
index 49445e675b..128a3d1dc2 100644
--- a/python/qemu/machine.py
+++ b/python/qemu/machine.py
@@ -329,13 +329,14 @@ class QEMUMachine(object):
         self._load_io_log()
         self._post_shutdown()
 
-    def shutdown(self):
+    def shutdown(self, has_quit=False):
         """
         Terminate the VM and clean up
         """
         if self.is_running():
             try:
-                self._qmp.cmd('quit')
+                if not has_quit:
+                    self._qmp.cmd('quit')
                 self._qmp.close()
             except:
                 self._popen.kill()
diff --git a/tests/qemu-iotests/255 b/tests/qemu-iotests/255
index 49433ec122..3632d507d0 100755
--- a/tests/qemu-iotests/255
+++ b/tests/qemu-iotests/255
@@ -132,4 +132,4 @@ with iotests.FilePath('src.qcow2') as src_path, \
     vm.qmp_log('block-job-cancel', device='job0')
     vm.qmp_log('quit')
 
-    vm.shutdown()
+    vm.shutdown(has_quit=True)
-- 
2.20.1



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

* [Qemu-devel] [PULL 11/13] iotests: Test commit with a filter on the chain
  2019-07-19 13:43 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (9 preceding siblings ...)
  2019-07-19 13:43 ` [Qemu-devel] [PULL 10/13] iotests: Add @has_quit to vm.shutdown() Kevin Wolf
@ 2019-07-19 13:43 ` Kevin Wolf
  2019-07-19 13:43 ` [Qemu-devel] [PULL 12/13] vl: Drain before (block) job cancel when quitting Kevin Wolf
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Kevin Wolf @ 2019-07-19 13:43 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Max Reitz <mreitz@redhat.com>

Before the previous patches, the first case resulted in a failed
assertion (which is noted as qemu receiving a SIGABRT in the test
output), and the second usually triggered a segmentation fault.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/040     | 40 +++++++++++++++++++++++++++++++++++++-
 tests/qemu-iotests/040.out |  4 ++--
 2 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040
index b81133a474..aa0b1847e3 100755
--- a/tests/qemu-iotests/040
+++ b/tests/qemu-iotests/040
@@ -92,9 +92,10 @@ class TestSingleDrive(ImageCommitTestCase):
 
         self.vm.add_device("scsi-hd,id=scsi0,drive=drive0")
         self.vm.launch()
+        self.has_quit = False
 
     def tearDown(self):
-        self.vm.shutdown()
+        self.vm.shutdown(has_quit=self.has_quit)
         os.remove(test_img)
         os.remove(mid_img)
         os.remove(backing_img)
@@ -109,6 +110,43 @@ class TestSingleDrive(ImageCommitTestCase):
         self.assertEqual(-1, qemu_io('-f', 'raw', '-c', 'read -P 0xab 0 524288', backing_img).find("verification failed"))
         self.assertEqual(-1, qemu_io('-f', 'raw', '-c', 'read -P 0xef 524288 524288', backing_img).find("verification failed"))
 
+    def test_commit_with_filter_and_quit(self):
+        result = self.vm.qmp('object-add', qom_type='throttle-group', id='tg')
+        self.assert_qmp(result, 'return', {})
+
+        # Add a filter outside of the backing chain
+        result = self.vm.qmp('blockdev-add', driver='throttle', node_name='filter', throttle_group='tg', file='mid')
+        self.assert_qmp(result, 'return', {})
+
+        result = self.vm.qmp('block-commit', device='drive0')
+        self.assert_qmp(result, 'return', {})
+
+        # Quit immediately, thus forcing a simultaneous cancel of the
+        # block job and a bdrv_drain_all()
+        result = self.vm.qmp('quit')
+        self.assert_qmp(result, 'return', {})
+
+        self.has_quit = True
+
+    # Same as above, but this time we add the filter after starting the job
+    def test_commit_plus_filter_and_quit(self):
+        result = self.vm.qmp('object-add', qom_type='throttle-group', id='tg')
+        self.assert_qmp(result, 'return', {})
+
+        result = self.vm.qmp('block-commit', device='drive0')
+        self.assert_qmp(result, 'return', {})
+
+        # Add a filter outside of the backing chain
+        result = self.vm.qmp('blockdev-add', driver='throttle', node_name='filter', throttle_group='tg', file='mid')
+        self.assert_qmp(result, 'return', {})
+
+        # Quit immediately, thus forcing a simultaneous cancel of the
+        # block job and a bdrv_drain_all()
+        result = self.vm.qmp('quit')
+        self.assert_qmp(result, 'return', {})
+
+        self.has_quit = True
+
     def test_device_not_found(self):
         result = self.vm.qmp('block-commit', device='nonexistent', top='%s' % mid_img)
         self.assert_qmp(result, 'error/class', 'DeviceNotFound')
diff --git a/tests/qemu-iotests/040.out b/tests/qemu-iotests/040.out
index 802ffaa0c0..220a5fa82c 100644
--- a/tests/qemu-iotests/040.out
+++ b/tests/qemu-iotests/040.out
@@ -1,5 +1,5 @@
-...........................................
+...............................................
 ----------------------------------------------------------------------
-Ran 43 tests
+Ran 47 tests
 
 OK
-- 
2.20.1



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

* [Qemu-devel] [PULL 12/13] vl: Drain before (block) job cancel when quitting
  2019-07-19 13:43 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (10 preceding siblings ...)
  2019-07-19 13:43 ` [Qemu-devel] [PULL 11/13] iotests: Test commit with a filter on the chain Kevin Wolf
@ 2019-07-19 13:43 ` Kevin Wolf
  2019-07-19 13:43 ` [Qemu-devel] [PULL 13/13] iotests: Test quitting with job on throttled node Kevin Wolf
  2019-07-22  9:11 ` [Qemu-devel] [PULL 00/13] Block layer patches Peter Maydell
  13 siblings, 0 replies; 23+ messages in thread
From: Kevin Wolf @ 2019-07-19 13:43 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Max Reitz <mreitz@redhat.com>

If the main loop cancels all block jobs while the block layer is not
drained, this cancelling may not happen instantaneously.  We can start a
drained section before vm_shutdown(), which entails another
bdrv_drain_all(); this nested bdrv_drain_all() will thus be a no-op,
basically.

We do not have to end the drained section, because we actually do not
want any requests to happen from this point on.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 vl.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/vl.c b/vl.c
index a5808f9a02..53335a5470 100644
--- a/vl.c
+++ b/vl.c
@@ -4480,6 +4480,17 @@ int main(int argc, char **argv, char **envp)
      */
     migration_shutdown();
 
+    /*
+     * We must cancel all block jobs while the block layer is drained,
+     * or cancelling will be affected by throttling and thus may block
+     * for an extended period of time.
+     * vm_shutdown() will bdrv_drain_all(), so we may as well include
+     * it in the drained section.
+     * We do not need to end this section, because we do not want any
+     * requests happening from here on anyway.
+     */
+    bdrv_drain_all_begin();
+
     /* No more vcpu or device emulation activity beyond this point */
     vm_shutdown();
 
-- 
2.20.1



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

* [Qemu-devel] [PULL 13/13] iotests: Test quitting with job on throttled node
  2019-07-19 13:43 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (11 preceding siblings ...)
  2019-07-19 13:43 ` [Qemu-devel] [PULL 12/13] vl: Drain before (block) job cancel when quitting Kevin Wolf
@ 2019-07-19 13:43 ` Kevin Wolf
  2019-07-22  9:11 ` [Qemu-devel] [PULL 00/13] Block layer patches Peter Maydell
  13 siblings, 0 replies; 23+ messages in thread
From: Kevin Wolf @ 2019-07-19 13:43 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, peter.maydell, qemu-devel

From: Max Reitz <mreitz@redhat.com>

When qemu quits, all throttling should be ignored.  That means, if there
is a mirror job running from a throttled node, it should be cancelled
immediately and qemu close without blocking.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/218     | 55 ++++++++++++++++++++++++++++++++++++--
 tests/qemu-iotests/218.out |  4 +++
 2 files changed, 57 insertions(+), 2 deletions(-)

diff --git a/tests/qemu-iotests/218 b/tests/qemu-iotests/218
index 92c331b6fb..2554d84581 100755
--- a/tests/qemu-iotests/218
+++ b/tests/qemu-iotests/218
@@ -27,9 +27,9 @@
 # Creator/Owner: Max Reitz <mreitz@redhat.com>
 
 import iotests
-from iotests import log
+from iotests import log, qemu_img, qemu_io_silent
 
-iotests.verify_platform(['linux'])
+iotests.verify_image_format(supported_fmts=['qcow2', 'raw'])
 
 
 # Launches the VM, adds two null-co nodes (source and target), and
@@ -136,3 +136,54 @@ with iotests.VM() as vm:
 
     log(vm.event_wait('BLOCK_JOB_CANCELLED'),
         filters=[iotests.filter_qmp_event])
+
+log('')
+log('=== Cancel mirror job from throttled node by quitting ===')
+log('')
+
+with iotests.VM() as vm, \
+     iotests.FilePath('src.img') as src_img_path:
+
+    assert qemu_img('create', '-f', iotests.imgfmt, src_img_path, '64M') == 0
+    assert qemu_io_silent('-f', iotests.imgfmt, src_img_path,
+                          '-c', 'write -P 42 0M 64M') == 0
+
+    vm.launch()
+
+    ret = vm.qmp('object-add', qom_type='throttle-group', id='tg',
+                 props={'x-bps-read': 4096})
+    assert ret['return'] == {}
+
+    ret = vm.qmp('blockdev-add',
+                 node_name='source',
+                 driver=iotests.imgfmt,
+                 file={
+                     'driver': 'file',
+                     'filename': src_img_path
+                 })
+    assert ret['return'] == {}
+
+    ret = vm.qmp('blockdev-add',
+                 node_name='throttled-source',
+                 driver='throttle',
+                 throttle_group='tg',
+                 file='source')
+    assert ret['return'] == {}
+
+    ret = vm.qmp('blockdev-add',
+                 node_name='target',
+                 driver='null-co',
+                 size=(64 * 1048576))
+    assert ret['return'] == {}
+
+    ret = vm.qmp('blockdev-mirror',
+                 job_id='mirror',
+                 device='throttled-source',
+                 target='target',
+                 sync='full')
+    assert ret['return'] == {}
+
+    log(vm.qmp('quit'))
+
+    with iotests.Timeout(5, 'Timeout waiting for VM to quit'):
+        vm.shutdown(has_quit=True)
diff --git a/tests/qemu-iotests/218.out b/tests/qemu-iotests/218.out
index 825a657081..5a86a97550 100644
--- a/tests/qemu-iotests/218.out
+++ b/tests/qemu-iotests/218.out
@@ -28,3 +28,7 @@ Cancelling job
 Cancelling job
 {"return": {}}
 {"data": {"device": "mirror", "len": 1048576, "offset": 1048576, "speed": 0, "type": "mirror"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
+
+=== Cancel mirror job from throttled node by quitting ===
+
+{"return": {}}
-- 
2.20.1



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

* Re: [Qemu-devel] [PULL 00/13] Block layer patches
  2019-07-19 13:43 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
                   ` (12 preceding siblings ...)
  2019-07-19 13:43 ` [Qemu-devel] [PULL 13/13] iotests: Test quitting with job on throttled node Kevin Wolf
@ 2019-07-22  9:11 ` Peter Maydell
  13 siblings, 0 replies; 23+ 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] 23+ messages in thread

* Re: [Qemu-devel] [PULL 01/13] iotests: Set read-zeroes on in null block driver for Valgrind
  2019-07-19 13:43 ` [Qemu-devel] [PULL 01/13] iotests: Set read-zeroes on in null block driver for Valgrind Kevin Wolf
@ 2019-07-24  7:18   ` Christian Borntraeger
  2019-07-24  7:30     ` Andrey Shinkevich
  0 siblings, 1 reply; 23+ messages in thread
From: Christian Borntraeger @ 2019-07-24  7:18 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block
  Cc: peter.maydell, qemu-s390x, qemu-devel, Andrey Shinkevich


On 19.07.19 15:43, Kevin Wolf wrote:
> From: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
> 
> The Valgrind tool reports about the uninitialised buffer 'buf'
> instantiated on the stack of the function guess_disk_lchs().
> Pass 'read-zeroes=on' to the null block driver to make it deterministic.
> The output of the tests 051, 186 and 227 now includes the parameter
> 'read-zeroes'. So, the benchmark output files are being changed too.
> 
> Suggested-by: Kevin Wolf <kwolf@redhat.com>
> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  tests/qemu-iotests/051        |  10 +--
>  tests/qemu-iotests/051.pc.out |  10 +--
>  tests/qemu-iotests/093        |   9 +-
[...9


I now get the following on s390.
Seems that you only fixed 051.pc.out but not 051.out

    051      ...        [09:01:49]             ...              051      ^[[1m^[[31mfail      ^[[0m [09:01:49] [09:01:50]                    output mismatch (see 051.out.bad)
    --- tests/qemu-iotests/051.out	2019-07-09 18:34:26.734654933 +0200
    +++ build/tests/qemu-iotests/051.out.bad	2019-07-24 09:01:50.015024901 +0200
    @@ -149,23 +149,23 @@
     
     === Cache modes ===
     
    -Testing: -drive driver=null-co,cache=none
    +Testing: -drive driver=null-co,read-zeroes=on,cache=none
     QEMU X.Y.Z monitor - type 'help' for more information
     (qemu) quit
     
    -Testing: -drive driver=null-co,cache=directsync
    +Testing: -drive driver=null-co,read-zeroes=on,cache=directsync
     QEMU X.Y.Z monitor - type 'help' for more information
     (qemu) quit
     
    -Testing: -drive driver=null-co,cache=writeback
    +Testing: -drive driver=null-co,read-zeroes=on,cache=writeback
     QEMU X.Y.Z monitor - type 'help' for more information
     (qemu) quit
     
    -Testing: -drive driver=null-co,cache=writethrough
    +Testing: -drive driver=null-co,read-zeroes=on,cache=writethrough
     QEMU X.Y.Z monitor - type 'help' for more information
     (qemu) quit
     
    -Testing: -drive driver=null-co,cache=unsafe
    +Testing: -drive driver=null-co,read-zeroes=on,cache=unsafe
     QEMU X.Y.Z monitor - type 'help' for more information
     (qemu) quit
     

> 
> diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
> index 200660f977..ce942a5444 100755
> --- a/tests/qemu-iotests/051
> +++ b/tests/qemu-iotests/051
> @@ -251,11 +251,11 @@ echo
>  # Cannot use the test image because cache=none might not work on the host FS
>  # Use cdrom so that we won't get errors about missing media
>  
> -run_qemu -drive driver=null-co,cache=none
> -run_qemu -drive driver=null-co,cache=directsync
> -run_qemu -drive driver=null-co,cache=writeback
> -run_qemu -drive driver=null-co,cache=writethrough
> -run_qemu -drive driver=null-co,cache=unsafe
> +run_qemu -drive driver=null-co,read-zeroes=on,cache=none
> +run_qemu -drive driver=null-co,read-zeroes=on,cache=directsync
> +run_qemu -drive driver=null-co,read-zeroes=on,cache=writeback
> +run_qemu -drive driver=null-co,read-zeroes=on,cache=writethrough
> +run_qemu -drive driver=null-co,read-zeroes=on,cache=unsafe
>  run_qemu -drive driver=null-co,cache=invalid_value
>  
>  # Can't test direct=on here because O_DIRECT might not be supported on this FS
> diff --git a/tests/qemu-iotests/051.pc.out b/tests/qemu-iotests/051.pc.out
> index 2d811c166c..000557c7c8 100644
> --- a/tests/qemu-iotests/051.pc.out
> +++ b/tests/qemu-iotests/051.pc.out
> @@ -245,23 +245,23 @@ QEMU X.Y.Z monitor - type 'help' for more information
>  
>  === Cache modes ===
>  
> -Testing: -drive driver=null-co,cache=none
> +Testing: -drive driver=null-co,read-zeroes=on,cache=none
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) quit
>  
> -Testing: -drive driver=null-co,cache=directsync
> +Testing: -drive driver=null-co,read-zeroes=on,cache=directsync
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) quit
>  
> -Testing: -drive driver=null-co,cache=writeback
> +Testing: -drive driver=null-co,read-zeroes=on,cache=writeback
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) quit
>  
> -Testing: -drive driver=null-co,cache=writethrough
> +Testing: -drive driver=null-co,read-zeroes=on,cache=writethrough
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) quit
>  
> -Testing: -drive driver=null-co,cache=unsafe
> +Testing: -drive driver=null-co,read-zeroes=on,cache=unsafe
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) quit
>  
> diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093
> index d88fbc182e..4b2cac1d0c 100755
> --- a/tests/qemu-iotests/093
> +++ b/tests/qemu-iotests/093
> @@ -38,7 +38,7 @@ class ThrottleTestCase(iotests.QMPTestCase):
>      def setUp(self):
>          self.vm = iotests.VM()
>          for i in range(0, self.max_drives):
> -            self.vm.add_drive(self.test_img)
> +            self.vm.add_drive(self.test_img, "file.read-zeroes=on")
>          self.vm.launch()
>  
>      def tearDown(self):
> @@ -273,7 +273,8 @@ class ThrottleTestGroupNames(iotests.QMPTestCase):
>      def setUp(self):
>          self.vm = iotests.VM()
>          for i in range(0, self.max_drives):
> -            self.vm.add_drive(self.test_img, "throttling.iops-total=100")
> +            self.vm.add_drive(self.test_img,
> +                              "throttling.iops-total=100,file.read-zeroes=on")
>          self.vm.launch()
>  
>      def tearDown(self):
> @@ -378,10 +379,10 @@ class ThrottleTestRemovableMedia(iotests.QMPTestCase):
>      def test_removable_media(self):
>          # Add a couple of dummy nodes named cd0 and cd1
>          result = self.vm.qmp("blockdev-add", driver="null-aio",
> -                             node_name="cd0")
> +                             read_zeroes=True, node_name="cd0")
>          self.assert_qmp(result, 'return', {})
>          result = self.vm.qmp("blockdev-add", driver="null-aio",
> -                             node_name="cd1")
> +                             read_zeroes=True, node_name="cd1")
>          self.assert_qmp(result, 'return', {})
>  
>          # Attach a CD drive with cd0 inserted
> diff --git a/tests/qemu-iotests/136 b/tests/qemu-iotests/136
> index af7ffa4540..a46a7b7630 100755
> --- a/tests/qemu-iotests/136
> +++ b/tests/qemu-iotests/136
> @@ -74,6 +74,7 @@ sector = "%d"
>                            (self.account_invalid and "on" or "off"))
>          drive_args.append("stats-account-failed=%s" %
>                            (self.account_failed and "on" or "off"))
> +        drive_args.append("file.image.read-zeroes=on")
>          self.create_blkdebug_file()
>          self.vm = iotests.VM().add_drive('blkdebug:%s:%s' %
>                                           (blkdebug_file, self.test_img),
> diff --git a/tests/qemu-iotests/186 b/tests/qemu-iotests/186
> index 7e7d45babc..5f6b18c150 100755
> --- a/tests/qemu-iotests/186
> +++ b/tests/qemu-iotests/186
> @@ -86,8 +86,8 @@ echo "=== -blockdev/-device=<node-name> ==="
>  echo
>  
>  for dev in $fixed $removable; do
> -    check_info_block -blockdev driver=null-co,node-name=null -device $dev,drive=null
> -    check_info_block -blockdev driver=null-co,node-name=null -device $dev,drive=null,id=qdev_id
> +    check_info_block -blockdev driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null
> +    check_info_block -blockdev driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null,id=qdev_id
>  done
>  
>  echo
> @@ -97,7 +97,7 @@ echo
>  # This creates two BlockBackends that will show up in 'info block'!
>  # A monitor-owned one from -drive, and anonymous one from -device
>  for dev in $fixed $removable; do
> -    check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=null,id=qdev_id
> +    check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null,id=qdev_id
>  done
>  
>  echo
> @@ -105,8 +105,8 @@ echo "=== -drive if=none/-device=<bb-name> (with medium) ==="
>  echo
>  
>  for dev in $fixed $removable; do
> -    check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=none0
> -    check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=none0,id=qdev_id
> +    check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=none0
> +    check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=none0,id=qdev_id
>  done
>  
>  echo
> @@ -125,15 +125,15 @@ echo "=== -drive if=... ==="
>  echo
>  
>  check_info_block -drive if=floppy
> -check_info_block -drive if=floppy,driver=null-co
> +check_info_block -drive if=floppy,driver=null-co,read-zeroes=on
>  
> -check_info_block -drive if=ide,driver=null-co
> +check_info_block -drive if=ide,driver=null-co,read-zeroes=on
>  check_info_block -drive if=ide,media=cdrom
> -check_info_block -drive if=ide,driver=null-co,media=cdrom
> +check_info_block -drive if=ide,driver=null-co,read-zeroes=on,media=cdrom
>  
> -check_info_block -drive if=virtio,driver=null-co
> +check_info_block -drive if=virtio,driver=null-co,read-zeroes=on
>  
> -check_info_block -drive if=pflash,driver=null-co,size=1M
> +check_info_block -drive if=pflash,driver=null-co,read-zeroes=on,size=1M
>  
>  # success, all done
>  echo "*** done"
> diff --git a/tests/qemu-iotests/186.out b/tests/qemu-iotests/186.out
> index 716b01ac3d..5b3504042a 100644
> --- a/tests/qemu-iotests/186.out
> +++ b/tests/qemu-iotests/186.out
> @@ -54,103 +54,103 @@ qdev_id: [not inserted]
>  
>  === -blockdev/-device=<node-name> ===
>  
> -Testing: -blockdev driver=null-co,node-name=null -device ide-hd,drive=null
> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=null
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -null: null-co:// (null-co)
> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>      Attached to:      PATH
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -blockdev driver=null-co,node-name=null -device ide-hd,drive=null,id=qdev_id
> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=null,id=qdev_id
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -null: null-co:// (null-co)
> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>      Attached to:      qdev_id
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -blockdev driver=null-co,node-name=null -device scsi-hd,drive=null
> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=null
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -null: null-co:// (null-co)
> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>      Attached to:      PATH
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -blockdev driver=null-co,node-name=null -device scsi-hd,drive=null,id=qdev_id
> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=null,id=qdev_id
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -null: null-co:// (null-co)
> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>      Attached to:      qdev_id
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -blockdev driver=null-co,node-name=null -device virtio-blk-pci,drive=null
> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=null
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -null: null-co:// (null-co)
> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>      Attached to:      PATH
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -blockdev driver=null-co,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -null: null-co:// (null-co)
> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>      Attached to:      PATH
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -blockdev driver=null-co,node-name=null -device floppy,drive=null
> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=null
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -null: null-co:// (null-co)
> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>      Attached to:      PATH
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -blockdev driver=null-co,node-name=null -device floppy,drive=null,id=qdev_id
> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=null,id=qdev_id
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -null: null-co:// (null-co)
> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>      Attached to:      qdev_id
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -blockdev driver=null-co,node-name=null -device ide-cd,drive=null
> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=null
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -null: null-co:// (null-co)
> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>      Attached to:      PATH
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -blockdev driver=null-co,node-name=null -device ide-cd,drive=null,id=qdev_id
> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=null,id=qdev_id
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -null: null-co:// (null-co)
> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>      Attached to:      qdev_id
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -blockdev driver=null-co,node-name=null -device scsi-cd,drive=null
> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=null
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -null: null-co:// (null-co)
> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>      Attached to:      PATH
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -blockdev driver=null-co,node-name=null -device scsi-cd,drive=null,id=qdev_id
> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=null,id=qdev_id
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -null: null-co:// (null-co)
> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>      Attached to:      qdev_id
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
> @@ -159,76 +159,76 @@ null: null-co:// (null-co)
>  
>  === -drive if=none/-device=<node-name> ===
>  
> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-hd,drive=null,id=qdev_id
> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=null,id=qdev_id
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -none0 (null): null-co:// (null-co)
> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  
> -null: null-co:// (null-co)
> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      qdev_id
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-hd,drive=null,id=qdev_id
> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=null,id=qdev_id
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -none0 (null): null-co:// (null-co)
> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  
> -null: null-co:// (null-co)
> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      qdev_id
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -drive if=none,driver=null-co,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -none0 (null): null-co:// (null-co)
> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  
> -null: null-co:// (null-co)
> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      PATH
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -drive if=none,driver=null-co,node-name=null -device floppy,drive=null,id=qdev_id
> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=null,id=qdev_id
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -none0 (null): null-co:// (null-co)
> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  
> -null: null-co:// (null-co)
> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      qdev_id
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-cd,drive=null,id=qdev_id
> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=null,id=qdev_id
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -none0 (null): null-co:// (null-co)
> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  
> -null: null-co:// (null-co)
> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      qdev_id
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-cd,drive=null,id=qdev_id
> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=null,id=qdev_id
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -none0 (null): null-co:// (null-co)
> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  
> -null: null-co:// (null-co)
> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      qdev_id
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
> @@ -237,103 +237,103 @@ null: null-co:// (null-co)
>  
>  === -drive if=none/-device=<bb-name> (with medium) ===
>  
> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-hd,drive=none0
> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=none0
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -none0 (null): null-co:// (null-co)
> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      PATH
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-hd,drive=none0,id=qdev_id
> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=none0,id=qdev_id
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -none0 (null): null-co:// (null-co)
> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      qdev_id
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-hd,drive=none0
> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=none0
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -none0 (null): null-co:// (null-co)
> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      PATH
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-hd,drive=none0,id=qdev_id
> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=none0,id=qdev_id
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -none0 (null): null-co:// (null-co)
> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      qdev_id
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -drive if=none,driver=null-co,node-name=null -device virtio-blk-pci,drive=none0
> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=none0
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -none0 (null): null-co:// (null-co)
> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      PATH
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -drive if=none,driver=null-co,node-name=null -device virtio-blk-pci,drive=none0,id=qdev_id
> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=none0,id=qdev_id
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -none0 (null): null-co:// (null-co)
> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      PATH
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -drive if=none,driver=null-co,node-name=null -device floppy,drive=none0
> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=none0
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -none0 (null): null-co:// (null-co)
> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      PATH
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -drive if=none,driver=null-co,node-name=null -device floppy,drive=none0,id=qdev_id
> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=none0,id=qdev_id
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -none0 (null): null-co:// (null-co)
> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      qdev_id
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-cd,drive=none0
> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=none0
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -none0 (null): null-co:// (null-co)
> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      PATH
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-cd,drive=none0,id=qdev_id
> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=none0,id=qdev_id
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -none0 (null): null-co:// (null-co)
> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      qdev_id
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-cd,drive=none0
> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=none0
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -none0 (null): null-co:// (null-co)
> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      PATH
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-cd,drive=none0,id=qdev_id
> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=none0,id=qdev_id
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -none0 (null): null-co:// (null-co)
> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      qdev_id
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
> @@ -408,19 +408,19 @@ floppy0: [not inserted]
>      Removable device: not locked, tray closed
>  (qemu) quit
>  
> -Testing: -drive if=floppy,driver=null-co
> +Testing: -drive if=floppy,driver=null-co,read-zeroes=on
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -floppy0 (NODE_NAME): null-co:// (null-co)
> +floppy0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      PATH
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -drive if=ide,driver=null-co
> +Testing: -drive if=ide,driver=null-co,read-zeroes=on
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -ide0-hd0 (NODE_NAME): null-co:// (null-co)
> +ide0-hd0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      PATH
>      Cache mode:       writeback
>  (qemu) quit
> @@ -433,27 +433,27 @@ ide0-cd0: [not inserted]
>      Removable device: not locked, tray closed
>  (qemu) quit
>  
> -Testing: -drive if=ide,driver=null-co,media=cdrom
> +Testing: -drive if=ide,driver=null-co,read-zeroes=on,media=cdrom
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -ide0-cd0 (NODE_NAME): null-co:// (null-co, read-only)
> +ide0-cd0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co, read-only)
>      Attached to:      PATH
>      Removable device: not locked, tray closed
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -drive if=virtio,driver=null-co
> +Testing: -drive if=virtio,driver=null-co,read-zeroes=on
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -virtio0 (NODE_NAME): null-co:// (null-co)
> +virtio0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>      Attached to:      PATH
>      Cache mode:       writeback
>  (qemu) quit
>  
> -Testing: -drive if=pflash,driver=null-co,size=1M
> +Testing: -drive if=pflash,driver=null-co,read-zeroes=on,size=1M
>  QEMU X.Y.Z monitor - type 'help' for more information
>  (qemu) info block
> -pflash0 (NODE_NAME): json:{"driver": "null-co", "size": "1M"} (null-co)
> +pflash0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co", "size": "1M"} (null-co)
>      Attached to:      PATH
>      Cache mode:       writeback
>  (qemu) quit
> diff --git a/tests/qemu-iotests/227 b/tests/qemu-iotests/227
> index bdd727a721..637d7c3726 100755
> --- a/tests/qemu-iotests/227
> +++ b/tests/qemu-iotests/227
> @@ -57,7 +57,7 @@ echo
>  echo '=== blockstats with -drive if=virtio ==='
>  echo
>  
> -run_qemu -drive driver=null-co,if=virtio <<EOF
> +run_qemu -drive driver=null-co,read-zeroes=on,if=virtio <<EOF
>  { "execute": "qmp_capabilities" }
>  { "execute": "query-blockstats"}
>  { "execute": "quit" }
> @@ -87,7 +87,7 @@ echo
>  echo '=== blockstats with -blockdev and -device ==='
>  echo
>  
> -run_qemu -blockdev driver=null-co,node-name=null -device virtio-blk,drive=null,id=virtio0 <<EOF
> +run_qemu -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk,drive=null,id=virtio0 <<EOF
>  { "execute": "qmp_capabilities" }
>  { "execute": "query-blockstats"}
>  { "execute": "quit" }
> diff --git a/tests/qemu-iotests/227.out b/tests/qemu-iotests/227.out
> index e77efaf4cf..3dd3ca5708 100644
> --- a/tests/qemu-iotests/227.out
> +++ b/tests/qemu-iotests/227.out
> @@ -2,7 +2,7 @@ QA output created by 227
>  
>  === blockstats with -drive if=virtio ===
>  
> -Testing: -drive driver=null-co,if=virtio
> +Testing: -drive driver=null-co,read-zeroes=on,if=virtio
>  {
>      QMP_VERSION
>  }
> @@ -150,7 +150,7 @@ Testing: -blockdev driver=null-co,node-name=null
>  
>  === blockstats with -blockdev and -device ===
>  
> -Testing: -blockdev driver=null-co,node-name=null -device virtio-blk,drive=null,id=virtio0
> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk,drive=null,id=virtio0
>  {
>      QMP_VERSION
>  }
> diff --git a/tests/qemu-iotests/238 b/tests/qemu-iotests/238
> index 1c0a46fa90..08bc7e6b4b 100755
> --- a/tests/qemu-iotests/238
> +++ b/tests/qemu-iotests/238
> @@ -31,7 +31,7 @@ else:
>  vm = iotests.VM()
>  vm.launch()
>  
> -log(vm.qmp('blockdev-add', node_name='hd0', driver='null-co'))
> +log(vm.qmp('blockdev-add', node_name='hd0', driver='null-co', read_zeroes=True))
>  log(vm.qmp('object-add', qom_type='iothread', id='iothread0'))
>  log(vm.qmp('device_add', id='scsi0', driver=virtio_scsi_device, iothread='iothread0'))
>  log(vm.qmp('device_add', id='scsi-hd0', driver='scsi-hd', drive='hd0'))
> diff --git a/tests/qemu-iotests/240 b/tests/qemu-iotests/240
> index 5be6b9c0f7..f73bc07d80 100755
> --- a/tests/qemu-iotests/240
> +++ b/tests/qemu-iotests/240
> @@ -76,7 +76,7 @@ echo
>  
>  run_qemu <<EOF
>  { "execute": "qmp_capabilities" }
> -{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0"}}
> +{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0"}}
>  { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
>  { "execute": "device_add", "arguments": {"id": "scsi0", "driver": "${virtio_scsi}", "iothread": "iothread0"}}
>  { "execute": "device_add", "arguments": {"id": "scsi-hd0", "driver": "scsi-hd", "drive": "hd0"}}
> @@ -94,7 +94,7 @@ echo
>  
>  run_qemu <<EOF
>  { "execute": "qmp_capabilities" }
> -{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true}}
> +{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0", "read-only": true}}
>  { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
>  { "execute": "device_add", "arguments": {"id": "scsi0", "driver": "${virtio_scsi}", "iothread": "iothread0"}}
>  { "execute": "device_add", "arguments": {"id": "scsi-hd0", "driver": "scsi-hd", "drive": "hd0"}}
> @@ -112,7 +112,7 @@ echo
>  
>  run_qemu <<EOF
>  { "execute": "qmp_capabilities" }
> -{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true}}
> +{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0", "read-only": true}}
>  { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
>  { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread1"}}
>  { "execute": "device_add", "arguments": {"id": "scsi0", "driver": "${virtio_scsi}", "iothread": "iothread0"}}
> @@ -134,7 +134,7 @@ echo
>  
>  run_qemu <<EOF
>  { "execute": "qmp_capabilities" }
> -{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true}}
> +{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0", "read-only": true}}
>  { "execute": "nbd-server-start", "arguments": {"addr":{"type":"unix","data":{"path":"$TEST_DIR/nbd"}}}}
>  { "execute": "nbd-server-add", "arguments": {"device":"hd0"}}
>  { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
> 



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

* Re: [Qemu-devel] [PULL 01/13] iotests: Set read-zeroes on in null block driver for Valgrind
  2019-07-24  7:18   ` Christian Borntraeger
@ 2019-07-24  7:30     ` Andrey Shinkevich
  2019-07-24  7:33       ` Christian Borntraeger
  2019-07-24  7:38       ` Kevin Wolf
  0 siblings, 2 replies; 23+ messages in thread
From: Andrey Shinkevich @ 2019-07-24  7:30 UTC (permalink / raw)
  To: Christian Borntraeger, Kevin Wolf, qemu-block
  Cc: peter.maydell, qemu-s390x, qemu-devel



On 24/07/2019 10:18, Christian Borntraeger wrote:
> 
> On 19.07.19 15:43, Kevin Wolf wrote:
>> From: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
>>
>> The Valgrind tool reports about the uninitialised buffer 'buf'
>> instantiated on the stack of the function guess_disk_lchs().
>> Pass 'read-zeroes=on' to the null block driver to make it deterministic.
>> The output of the tests 051, 186 and 227 now includes the parameter
>> 'read-zeroes'. So, the benchmark output files are being changed too.
>>
>> Suggested-by: Kevin Wolf <kwolf@redhat.com>
>> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>> ---
>>   tests/qemu-iotests/051        |  10 +--
>>   tests/qemu-iotests/051.pc.out |  10 +--
>>   tests/qemu-iotests/093        |   9 +-
> [...9
> 
> 
> I now get the following on s390.
> Seems that you only fixed 051.pc.out but not 051.out
> 
>      051      ...        [09:01:49]             ...              051      ^[[1m^[[31mfail      ^[[0m [09:01:49] [09:01:50]                    output mismatch (see 051.out.bad)
>      --- tests/qemu-iotests/051.out	2019-07-09 18:34:26.734654933 +0200
>      +++ build/tests/qemu-iotests/051.out.bad	2019-07-24 09:01:50.015024901 +0200
>      @@ -149,23 +149,23 @@
>       
>       === Cache modes ===
>       
>      -Testing: -drive driver=null-co,cache=none
>      +Testing: -drive driver=null-co,read-zeroes=on,cache=none
>       QEMU X.Y.Z monitor - type 'help' for more information
>       (qemu) quit
>       
>      -Testing: -drive driver=null-co,cache=directsync
>      +Testing: -drive driver=null-co,read-zeroes=on,cache=directsync
>       QEMU X.Y.Z monitor - type 'help' for more information
>       (qemu) quit
>       
>      -Testing: -drive driver=null-co,cache=writeback
>      +Testing: -drive driver=null-co,read-zeroes=on,cache=writeback
>       QEMU X.Y.Z monitor - type 'help' for more information
>       (qemu) quit
>       
>      -Testing: -drive driver=null-co,cache=writethrough
>      +Testing: -drive driver=null-co,read-zeroes=on,cache=writethrough
>       QEMU X.Y.Z monitor - type 'help' for more information
>       (qemu) quit
>       
>      -Testing: -drive driver=null-co,cache=unsafe
>      +Testing: -drive driver=null-co,read-zeroes=on,cache=unsafe
>       QEMU X.Y.Z monitor - type 'help' for more information
>       (qemu) quit
>       
> 

Thank you Christian for your report.
Would you please send the command line you ran the 051 test with?

Kevin,
How do add the 051.out file to the patch? New version?

Andrey

>>
>> diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
>> index 200660f977..ce942a5444 100755
>> --- a/tests/qemu-iotests/051
>> +++ b/tests/qemu-iotests/051
>> @@ -251,11 +251,11 @@ echo
>>   # Cannot use the test image because cache=none might not work on the host FS
>>   # Use cdrom so that we won't get errors about missing media
>>   
>> -run_qemu -drive driver=null-co,cache=none
>> -run_qemu -drive driver=null-co,cache=directsync
>> -run_qemu -drive driver=null-co,cache=writeback
>> -run_qemu -drive driver=null-co,cache=writethrough
>> -run_qemu -drive driver=null-co,cache=unsafe
>> +run_qemu -drive driver=null-co,read-zeroes=on,cache=none
>> +run_qemu -drive driver=null-co,read-zeroes=on,cache=directsync
>> +run_qemu -drive driver=null-co,read-zeroes=on,cache=writeback
>> +run_qemu -drive driver=null-co,read-zeroes=on,cache=writethrough
>> +run_qemu -drive driver=null-co,read-zeroes=on,cache=unsafe
>>   run_qemu -drive driver=null-co,cache=invalid_value
>>   
>>   # Can't test direct=on here because O_DIRECT might not be supported on this FS
>> diff --git a/tests/qemu-iotests/051.pc.out b/tests/qemu-iotests/051.pc.out
>> index 2d811c166c..000557c7c8 100644
>> --- a/tests/qemu-iotests/051.pc.out
>> +++ b/tests/qemu-iotests/051.pc.out
>> @@ -245,23 +245,23 @@ QEMU X.Y.Z monitor - type 'help' for more information
>>   
>>   === Cache modes ===
>>   
>> -Testing: -drive driver=null-co,cache=none
>> +Testing: -drive driver=null-co,read-zeroes=on,cache=none
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) quit
>>   
>> -Testing: -drive driver=null-co,cache=directsync
>> +Testing: -drive driver=null-co,read-zeroes=on,cache=directsync
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) quit
>>   
>> -Testing: -drive driver=null-co,cache=writeback
>> +Testing: -drive driver=null-co,read-zeroes=on,cache=writeback
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) quit
>>   
>> -Testing: -drive driver=null-co,cache=writethrough
>> +Testing: -drive driver=null-co,read-zeroes=on,cache=writethrough
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) quit
>>   
>> -Testing: -drive driver=null-co,cache=unsafe
>> +Testing: -drive driver=null-co,read-zeroes=on,cache=unsafe
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) quit
>>   
>> diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093
>> index d88fbc182e..4b2cac1d0c 100755
>> --- a/tests/qemu-iotests/093
>> +++ b/tests/qemu-iotests/093
>> @@ -38,7 +38,7 @@ class ThrottleTestCase(iotests.QMPTestCase):
>>       def setUp(self):
>>           self.vm = iotests.VM()
>>           for i in range(0, self.max_drives):
>> -            self.vm.add_drive(self.test_img)
>> +            self.vm.add_drive(self.test_img, "file.read-zeroes=on")
>>           self.vm.launch()
>>   
>>       def tearDown(self):
>> @@ -273,7 +273,8 @@ class ThrottleTestGroupNames(iotests.QMPTestCase):
>>       def setUp(self):
>>           self.vm = iotests.VM()
>>           for i in range(0, self.max_drives):
>> -            self.vm.add_drive(self.test_img, "throttling.iops-total=100")
>> +            self.vm.add_drive(self.test_img,
>> +                              "throttling.iops-total=100,file.read-zeroes=on")
>>           self.vm.launch()
>>   
>>       def tearDown(self):
>> @@ -378,10 +379,10 @@ class ThrottleTestRemovableMedia(iotests.QMPTestCase):
>>       def test_removable_media(self):
>>           # Add a couple of dummy nodes named cd0 and cd1
>>           result = self.vm.qmp("blockdev-add", driver="null-aio",
>> -                             node_name="cd0")
>> +                             read_zeroes=True, node_name="cd0")
>>           self.assert_qmp(result, 'return', {})
>>           result = self.vm.qmp("blockdev-add", driver="null-aio",
>> -                             node_name="cd1")
>> +                             read_zeroes=True, node_name="cd1")
>>           self.assert_qmp(result, 'return', {})
>>   
>>           # Attach a CD drive with cd0 inserted
>> diff --git a/tests/qemu-iotests/136 b/tests/qemu-iotests/136
>> index af7ffa4540..a46a7b7630 100755
>> --- a/tests/qemu-iotests/136
>> +++ b/tests/qemu-iotests/136
>> @@ -74,6 +74,7 @@ sector = "%d"
>>                             (self.account_invalid and "on" or "off"))
>>           drive_args.append("stats-account-failed=%s" %
>>                             (self.account_failed and "on" or "off"))
>> +        drive_args.append("file.image.read-zeroes=on")
>>           self.create_blkdebug_file()
>>           self.vm = iotests.VM().add_drive('blkdebug:%s:%s' %
>>                                            (blkdebug_file, self.test_img),
>> diff --git a/tests/qemu-iotests/186 b/tests/qemu-iotests/186
>> index 7e7d45babc..5f6b18c150 100755
>> --- a/tests/qemu-iotests/186
>> +++ b/tests/qemu-iotests/186
>> @@ -86,8 +86,8 @@ echo "=== -blockdev/-device=<node-name> ==="
>>   echo
>>   
>>   for dev in $fixed $removable; do
>> -    check_info_block -blockdev driver=null-co,node-name=null -device $dev,drive=null
>> -    check_info_block -blockdev driver=null-co,node-name=null -device $dev,drive=null,id=qdev_id
>> +    check_info_block -blockdev driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null
>> +    check_info_block -blockdev driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null,id=qdev_id
>>   done
>>   
>>   echo
>> @@ -97,7 +97,7 @@ echo
>>   # This creates two BlockBackends that will show up in 'info block'!
>>   # A monitor-owned one from -drive, and anonymous one from -device
>>   for dev in $fixed $removable; do
>> -    check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=null,id=qdev_id
>> +    check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null,id=qdev_id
>>   done
>>   
>>   echo
>> @@ -105,8 +105,8 @@ echo "=== -drive if=none/-device=<bb-name> (with medium) ==="
>>   echo
>>   
>>   for dev in $fixed $removable; do
>> -    check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=none0
>> -    check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=none0,id=qdev_id
>> +    check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=none0
>> +    check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=none0,id=qdev_id
>>   done
>>   
>>   echo
>> @@ -125,15 +125,15 @@ echo "=== -drive if=... ==="
>>   echo
>>   
>>   check_info_block -drive if=floppy
>> -check_info_block -drive if=floppy,driver=null-co
>> +check_info_block -drive if=floppy,driver=null-co,read-zeroes=on
>>   
>> -check_info_block -drive if=ide,driver=null-co
>> +check_info_block -drive if=ide,driver=null-co,read-zeroes=on
>>   check_info_block -drive if=ide,media=cdrom
>> -check_info_block -drive if=ide,driver=null-co,media=cdrom
>> +check_info_block -drive if=ide,driver=null-co,read-zeroes=on,media=cdrom
>>   
>> -check_info_block -drive if=virtio,driver=null-co
>> +check_info_block -drive if=virtio,driver=null-co,read-zeroes=on
>>   
>> -check_info_block -drive if=pflash,driver=null-co,size=1M
>> +check_info_block -drive if=pflash,driver=null-co,read-zeroes=on,size=1M
>>   
>>   # success, all done
>>   echo "*** done"
>> diff --git a/tests/qemu-iotests/186.out b/tests/qemu-iotests/186.out
>> index 716b01ac3d..5b3504042a 100644
>> --- a/tests/qemu-iotests/186.out
>> +++ b/tests/qemu-iotests/186.out
>> @@ -54,103 +54,103 @@ qdev_id: [not inserted]
>>   
>>   === -blockdev/-device=<node-name> ===
>>   
>> -Testing: -blockdev driver=null-co,node-name=null -device ide-hd,drive=null
>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=null
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -null: null-co:// (null-co)
>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>       Attached to:      PATH
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -blockdev driver=null-co,node-name=null -device ide-hd,drive=null,id=qdev_id
>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=null,id=qdev_id
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -null: null-co:// (null-co)
>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>       Attached to:      qdev_id
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -blockdev driver=null-co,node-name=null -device scsi-hd,drive=null
>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=null
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -null: null-co:// (null-co)
>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>       Attached to:      PATH
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -blockdev driver=null-co,node-name=null -device scsi-hd,drive=null,id=qdev_id
>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=null,id=qdev_id
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -null: null-co:// (null-co)
>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>       Attached to:      qdev_id
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -blockdev driver=null-co,node-name=null -device virtio-blk-pci,drive=null
>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=null
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -null: null-co:// (null-co)
>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>       Attached to:      PATH
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -blockdev driver=null-co,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -null: null-co:// (null-co)
>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>       Attached to:      PATH
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -blockdev driver=null-co,node-name=null -device floppy,drive=null
>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=null
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -null: null-co:// (null-co)
>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>       Attached to:      PATH
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -blockdev driver=null-co,node-name=null -device floppy,drive=null,id=qdev_id
>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=null,id=qdev_id
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -null: null-co:// (null-co)
>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>       Attached to:      qdev_id
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -blockdev driver=null-co,node-name=null -device ide-cd,drive=null
>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=null
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -null: null-co:// (null-co)
>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>       Attached to:      PATH
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -blockdev driver=null-co,node-name=null -device ide-cd,drive=null,id=qdev_id
>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=null,id=qdev_id
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -null: null-co:// (null-co)
>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>       Attached to:      qdev_id
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -blockdev driver=null-co,node-name=null -device scsi-cd,drive=null
>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=null
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -null: null-co:// (null-co)
>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>       Attached to:      PATH
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -blockdev driver=null-co,node-name=null -device scsi-cd,drive=null,id=qdev_id
>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=null,id=qdev_id
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -null: null-co:// (null-co)
>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>       Attached to:      qdev_id
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>> @@ -159,76 +159,76 @@ null: null-co:// (null-co)
>>   
>>   === -drive if=none/-device=<node-name> ===
>>   
>> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-hd,drive=null,id=qdev_id
>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=null,id=qdev_id
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -none0 (null): null-co:// (null-co)
>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   
>> -null: null-co:// (null-co)
>> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      qdev_id
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-hd,drive=null,id=qdev_id
>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=null,id=qdev_id
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -none0 (null): null-co:// (null-co)
>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   
>> -null: null-co:// (null-co)
>> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      qdev_id
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -drive if=none,driver=null-co,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -none0 (null): null-co:// (null-co)
>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   
>> -null: null-co:// (null-co)
>> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      PATH
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -drive if=none,driver=null-co,node-name=null -device floppy,drive=null,id=qdev_id
>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=null,id=qdev_id
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -none0 (null): null-co:// (null-co)
>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   
>> -null: null-co:// (null-co)
>> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      qdev_id
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-cd,drive=null,id=qdev_id
>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=null,id=qdev_id
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -none0 (null): null-co:// (null-co)
>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   
>> -null: null-co:// (null-co)
>> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      qdev_id
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-cd,drive=null,id=qdev_id
>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=null,id=qdev_id
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -none0 (null): null-co:// (null-co)
>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   
>> -null: null-co:// (null-co)
>> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      qdev_id
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>> @@ -237,103 +237,103 @@ null: null-co:// (null-co)
>>   
>>   === -drive if=none/-device=<bb-name> (with medium) ===
>>   
>> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-hd,drive=none0
>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=none0
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -none0 (null): null-co:// (null-co)
>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      PATH
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-hd,drive=none0,id=qdev_id
>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=none0,id=qdev_id
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -none0 (null): null-co:// (null-co)
>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      qdev_id
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-hd,drive=none0
>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=none0
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -none0 (null): null-co:// (null-co)
>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      PATH
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-hd,drive=none0,id=qdev_id
>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=none0,id=qdev_id
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -none0 (null): null-co:// (null-co)
>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      qdev_id
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -drive if=none,driver=null-co,node-name=null -device virtio-blk-pci,drive=none0
>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=none0
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -none0 (null): null-co:// (null-co)
>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      PATH
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -drive if=none,driver=null-co,node-name=null -device virtio-blk-pci,drive=none0,id=qdev_id
>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=none0,id=qdev_id
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -none0 (null): null-co:// (null-co)
>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      PATH
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -drive if=none,driver=null-co,node-name=null -device floppy,drive=none0
>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=none0
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -none0 (null): null-co:// (null-co)
>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      PATH
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -drive if=none,driver=null-co,node-name=null -device floppy,drive=none0,id=qdev_id
>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=none0,id=qdev_id
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -none0 (null): null-co:// (null-co)
>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      qdev_id
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-cd,drive=none0
>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=none0
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -none0 (null): null-co:// (null-co)
>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      PATH
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-cd,drive=none0,id=qdev_id
>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=none0,id=qdev_id
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -none0 (null): null-co:// (null-co)
>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      qdev_id
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-cd,drive=none0
>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=none0
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -none0 (null): null-co:// (null-co)
>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      PATH
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-cd,drive=none0,id=qdev_id
>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=none0,id=qdev_id
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -none0 (null): null-co:// (null-co)
>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      qdev_id
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>> @@ -408,19 +408,19 @@ floppy0: [not inserted]
>>       Removable device: not locked, tray closed
>>   (qemu) quit
>>   
>> -Testing: -drive if=floppy,driver=null-co
>> +Testing: -drive if=floppy,driver=null-co,read-zeroes=on
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -floppy0 (NODE_NAME): null-co:// (null-co)
>> +floppy0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      PATH
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -drive if=ide,driver=null-co
>> +Testing: -drive if=ide,driver=null-co,read-zeroes=on
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -ide0-hd0 (NODE_NAME): null-co:// (null-co)
>> +ide0-hd0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      PATH
>>       Cache mode:       writeback
>>   (qemu) quit
>> @@ -433,27 +433,27 @@ ide0-cd0: [not inserted]
>>       Removable device: not locked, tray closed
>>   (qemu) quit
>>   
>> -Testing: -drive if=ide,driver=null-co,media=cdrom
>> +Testing: -drive if=ide,driver=null-co,read-zeroes=on,media=cdrom
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -ide0-cd0 (NODE_NAME): null-co:// (null-co, read-only)
>> +ide0-cd0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co, read-only)
>>       Attached to:      PATH
>>       Removable device: not locked, tray closed
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -drive if=virtio,driver=null-co
>> +Testing: -drive if=virtio,driver=null-co,read-zeroes=on
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -virtio0 (NODE_NAME): null-co:// (null-co)
>> +virtio0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>       Attached to:      PATH
>>       Cache mode:       writeback
>>   (qemu) quit
>>   
>> -Testing: -drive if=pflash,driver=null-co,size=1M
>> +Testing: -drive if=pflash,driver=null-co,read-zeroes=on,size=1M
>>   QEMU X.Y.Z monitor - type 'help' for more information
>>   (qemu) info block
>> -pflash0 (NODE_NAME): json:{"driver": "null-co", "size": "1M"} (null-co)
>> +pflash0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co", "size": "1M"} (null-co)
>>       Attached to:      PATH
>>       Cache mode:       writeback
>>   (qemu) quit
>> diff --git a/tests/qemu-iotests/227 b/tests/qemu-iotests/227
>> index bdd727a721..637d7c3726 100755
>> --- a/tests/qemu-iotests/227
>> +++ b/tests/qemu-iotests/227
>> @@ -57,7 +57,7 @@ echo
>>   echo '=== blockstats with -drive if=virtio ==='
>>   echo
>>   
>> -run_qemu -drive driver=null-co,if=virtio <<EOF
>> +run_qemu -drive driver=null-co,read-zeroes=on,if=virtio <<EOF
>>   { "execute": "qmp_capabilities" }
>>   { "execute": "query-blockstats"}
>>   { "execute": "quit" }
>> @@ -87,7 +87,7 @@ echo
>>   echo '=== blockstats with -blockdev and -device ==='
>>   echo
>>   
>> -run_qemu -blockdev driver=null-co,node-name=null -device virtio-blk,drive=null,id=virtio0 <<EOF
>> +run_qemu -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk,drive=null,id=virtio0 <<EOF
>>   { "execute": "qmp_capabilities" }
>>   { "execute": "query-blockstats"}
>>   { "execute": "quit" }
>> diff --git a/tests/qemu-iotests/227.out b/tests/qemu-iotests/227.out
>> index e77efaf4cf..3dd3ca5708 100644
>> --- a/tests/qemu-iotests/227.out
>> +++ b/tests/qemu-iotests/227.out
>> @@ -2,7 +2,7 @@ QA output created by 227
>>   
>>   === blockstats with -drive if=virtio ===
>>   
>> -Testing: -drive driver=null-co,if=virtio
>> +Testing: -drive driver=null-co,read-zeroes=on,if=virtio
>>   {
>>       QMP_VERSION
>>   }
>> @@ -150,7 +150,7 @@ Testing: -blockdev driver=null-co,node-name=null
>>   
>>   === blockstats with -blockdev and -device ===
>>   
>> -Testing: -blockdev driver=null-co,node-name=null -device virtio-blk,drive=null,id=virtio0
>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk,drive=null,id=virtio0
>>   {
>>       QMP_VERSION
>>   }
>> diff --git a/tests/qemu-iotests/238 b/tests/qemu-iotests/238
>> index 1c0a46fa90..08bc7e6b4b 100755
>> --- a/tests/qemu-iotests/238
>> +++ b/tests/qemu-iotests/238
>> @@ -31,7 +31,7 @@ else:
>>   vm = iotests.VM()
>>   vm.launch()
>>   
>> -log(vm.qmp('blockdev-add', node_name='hd0', driver='null-co'))
>> +log(vm.qmp('blockdev-add', node_name='hd0', driver='null-co', read_zeroes=True))
>>   log(vm.qmp('object-add', qom_type='iothread', id='iothread0'))
>>   log(vm.qmp('device_add', id='scsi0', driver=virtio_scsi_device, iothread='iothread0'))
>>   log(vm.qmp('device_add', id='scsi-hd0', driver='scsi-hd', drive='hd0'))
>> diff --git a/tests/qemu-iotests/240 b/tests/qemu-iotests/240
>> index 5be6b9c0f7..f73bc07d80 100755
>> --- a/tests/qemu-iotests/240
>> +++ b/tests/qemu-iotests/240
>> @@ -76,7 +76,7 @@ echo
>>   
>>   run_qemu <<EOF
>>   { "execute": "qmp_capabilities" }
>> -{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0"}}
>> +{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0"}}
>>   { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
>>   { "execute": "device_add", "arguments": {"id": "scsi0", "driver": "${virtio_scsi}", "iothread": "iothread0"}}
>>   { "execute": "device_add", "arguments": {"id": "scsi-hd0", "driver": "scsi-hd", "drive": "hd0"}}
>> @@ -94,7 +94,7 @@ echo
>>   
>>   run_qemu <<EOF
>>   { "execute": "qmp_capabilities" }
>> -{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true}}
>> +{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0", "read-only": true}}
>>   { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
>>   { "execute": "device_add", "arguments": {"id": "scsi0", "driver": "${virtio_scsi}", "iothread": "iothread0"}}
>>   { "execute": "device_add", "arguments": {"id": "scsi-hd0", "driver": "scsi-hd", "drive": "hd0"}}
>> @@ -112,7 +112,7 @@ echo
>>   
>>   run_qemu <<EOF
>>   { "execute": "qmp_capabilities" }
>> -{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true}}
>> +{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0", "read-only": true}}
>>   { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
>>   { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread1"}}
>>   { "execute": "device_add", "arguments": {"id": "scsi0", "driver": "${virtio_scsi}", "iothread": "iothread0"}}
>> @@ -134,7 +134,7 @@ echo
>>   
>>   run_qemu <<EOF
>>   { "execute": "qmp_capabilities" }
>> -{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true}}
>> +{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0", "read-only": true}}
>>   { "execute": "nbd-server-start", "arguments": {"addr":{"type":"unix","data":{"path":"$TEST_DIR/nbd"}}}}
>>   { "execute": "nbd-server-add", "arguments": {"device":"hd0"}}
>>   { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
>>
> 

-- 
With the best regards,
Andrey Shinkevich

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

* Re: [Qemu-devel] [PULL 01/13] iotests: Set read-zeroes on in null block driver for Valgrind
  2019-07-24  7:30     ` Andrey Shinkevich
@ 2019-07-24  7:33       ` Christian Borntraeger
  2019-07-24  7:37         ` Andrey Shinkevich
  2019-07-24  7:38       ` Kevin Wolf
  1 sibling, 1 reply; 23+ messages in thread
From: Christian Borntraeger @ 2019-07-24  7:33 UTC (permalink / raw)
  To: Andrey Shinkevich, Kevin Wolf, qemu-block
  Cc: peter.maydell, qemu-s390x, qemu-devel



On 24.07.19 09:30, Andrey Shinkevich wrote:
> 
> 
> On 24/07/2019 10:18, Christian Borntraeger wrote:
>>
>> On 19.07.19 15:43, Kevin Wolf wrote:
>>> From: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
>>>
>>> The Valgrind tool reports about the uninitialised buffer 'buf'
>>> instantiated on the stack of the function guess_disk_lchs().
>>> Pass 'read-zeroes=on' to the null block driver to make it deterministic.
>>> The output of the tests 051, 186 and 227 now includes the parameter
>>> 'read-zeroes'. So, the benchmark output files are being changed too.
>>>
>>> Suggested-by: Kevin Wolf <kwolf@redhat.com>
>>> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
>>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>>> ---
>>>   tests/qemu-iotests/051        |  10 +--
>>>   tests/qemu-iotests/051.pc.out |  10 +--
>>>   tests/qemu-iotests/093        |   9 +-
>> [...9
>>
>>
>> I now get the following on s390.
>> Seems that you only fixed 051.pc.out but not 051.out
>>
>>      051      ...        [09:01:49]             ...              051      ^[[1m^[[31mfail      ^[[0m [09:01:49] [09:01:50]                    output mismatch (see 051.out.bad)
>>      --- tests/qemu-iotests/051.out	2019-07-09 18:34:26.734654933 +0200
>>      +++ build/tests/qemu-iotests/051.out.bad	2019-07-24 09:01:50.015024901 +0200
>>      @@ -149,23 +149,23 @@
>>       
>>       === Cache modes ===
>>       
>>      -Testing: -drive driver=null-co,cache=none
>>      +Testing: -drive driver=null-co,read-zeroes=on,cache=none
>>       QEMU X.Y.Z monitor - type 'help' for more information
>>       (qemu) quit
>>       
>>      -Testing: -drive driver=null-co,cache=directsync
>>      +Testing: -drive driver=null-co,read-zeroes=on,cache=directsync
>>       QEMU X.Y.Z monitor - type 'help' for more information
>>       (qemu) quit
>>       
>>      -Testing: -drive driver=null-co,cache=writeback
>>      +Testing: -drive driver=null-co,read-zeroes=on,cache=writeback
>>       QEMU X.Y.Z monitor - type 'help' for more information
>>       (qemu) quit
>>       
>>      -Testing: -drive driver=null-co,cache=writethrough
>>      +Testing: -drive driver=null-co,read-zeroes=on,cache=writethrough
>>       QEMU X.Y.Z monitor - type 'help' for more information
>>       (qemu) quit
>>       
>>      -Testing: -drive driver=null-co,cache=unsafe
>>      +Testing: -drive driver=null-co,read-zeroes=on,cache=unsafe
>>       QEMU X.Y.Z monitor - type 'help' for more information
>>       (qemu) quit
>>       
>>
> 
> Thank you Christian for your report.
> Would you please send the command line you ran the 051 test with?

just calling check with -qcow2 and 051 on an s390 system:


 ./check -qcow2 051
QEMU          -- "/home/cborntra/REPOS/qemu/build/tests/qemu-iotests/../../s390x-softmmu/qemu-system-s390x" -nodefaults -machine accel=qtest
QEMU_IMG      -- "/home/cborntra/REPOS/qemu/build/tests/qemu-iotests/../../qemu-img" 
QEMU_IO       -- "/home/cborntra/REPOS/qemu/build/tests/qemu-iotests/../../qemu-io"  --cache writeback -f qcow2
QEMU_NBD      -- "/home/cborntra/REPOS/qemu/build/tests/qemu-iotests/../../qemu-nbd" 
IMGFMT        -- qcow2 (compat=1.1)
IMGPROTO      -- file
PLATFORM      -- Linux/s390x s38lp08 5.2.0+
TEST_DIR      -- /home/cborntra/REPOS/qemu/build/tests/qemu-iotests/scratch
SOCKET_SCM_HELPER -- /home/cborntra/REPOS/qemu/build/tests/qemu-iotests/socket_scm_helper

051      fail       [09:32:20] [09:32:30]                    output mismatch (see 051.out.bad)
--- /home/cborntra/REPOS/qemu/tests/qemu-iotests/051.out	2019-07-11 18:31:29.440732461 +0200
+++ /home/cborntra/REPOS/qemu/build/tests/qemu-iotests/051.out.bad	2019-07-24 09:32:30.390620548 +0200
@@ -149,23 +149,23 @@
 
 === Cache modes ===
 
-Testing: -drive driver=null-co,cache=none
+Testing: -drive driver=null-co,read-zeroes=on,cache=none
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) quit
 
-Testing: -drive driver=null-co,cache=directsync
+Testing: -drive driver=null-co,read-zeroes=on,cache=directsync
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) quit
 
-Testing: -drive driver=null-co,cache=writeback
+Testing: -drive driver=null-co,read-zeroes=on,cache=writeback
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) quit
 
-Testing: -drive driver=null-co,cache=writethrough
+Testing: -drive driver=null-co,read-zeroes=on,cache=writethrough
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) quit
 
-Testing: -drive driver=null-co,cache=unsafe
+Testing: -drive driver=null-co,read-zeroes=on,cache=unsafe
 QEMU X.Y.Z monitor - type 'help' for more information
 (qemu) quit
 
Failures: 051
Failed 1 of 1 tests


> 
> Kevin,
> How do add the 051.out file to the patch? New version?

You would need a fixup patch as the original patch is already merged.

> 
> Andrey
> 
>>>
>>> diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
>>> index 200660f977..ce942a5444 100755
>>> --- a/tests/qemu-iotests/051
>>> +++ b/tests/qemu-iotests/051
>>> @@ -251,11 +251,11 @@ echo
>>>   # Cannot use the test image because cache=none might not work on the host FS
>>>   # Use cdrom so that we won't get errors about missing media
>>>   
>>> -run_qemu -drive driver=null-co,cache=none
>>> -run_qemu -drive driver=null-co,cache=directsync
>>> -run_qemu -drive driver=null-co,cache=writeback
>>> -run_qemu -drive driver=null-co,cache=writethrough
>>> -run_qemu -drive driver=null-co,cache=unsafe
>>> +run_qemu -drive driver=null-co,read-zeroes=on,cache=none
>>> +run_qemu -drive driver=null-co,read-zeroes=on,cache=directsync
>>> +run_qemu -drive driver=null-co,read-zeroes=on,cache=writeback
>>> +run_qemu -drive driver=null-co,read-zeroes=on,cache=writethrough
>>> +run_qemu -drive driver=null-co,read-zeroes=on,cache=unsafe
>>>   run_qemu -drive driver=null-co,cache=invalid_value
>>>   
>>>   # Can't test direct=on here because O_DIRECT might not be supported on this FS
>>> diff --git a/tests/qemu-iotests/051.pc.out b/tests/qemu-iotests/051.pc.out
>>> index 2d811c166c..000557c7c8 100644
>>> --- a/tests/qemu-iotests/051.pc.out
>>> +++ b/tests/qemu-iotests/051.pc.out
>>> @@ -245,23 +245,23 @@ QEMU X.Y.Z monitor - type 'help' for more information
>>>   
>>>   === Cache modes ===
>>>   
>>> -Testing: -drive driver=null-co,cache=none
>>> +Testing: -drive driver=null-co,read-zeroes=on,cache=none
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) quit
>>>   
>>> -Testing: -drive driver=null-co,cache=directsync
>>> +Testing: -drive driver=null-co,read-zeroes=on,cache=directsync
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) quit
>>>   
>>> -Testing: -drive driver=null-co,cache=writeback
>>> +Testing: -drive driver=null-co,read-zeroes=on,cache=writeback
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) quit
>>>   
>>> -Testing: -drive driver=null-co,cache=writethrough
>>> +Testing: -drive driver=null-co,read-zeroes=on,cache=writethrough
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) quit
>>>   
>>> -Testing: -drive driver=null-co,cache=unsafe
>>> +Testing: -drive driver=null-co,read-zeroes=on,cache=unsafe
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) quit
>>>   
>>> diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093
>>> index d88fbc182e..4b2cac1d0c 100755
>>> --- a/tests/qemu-iotests/093
>>> +++ b/tests/qemu-iotests/093
>>> @@ -38,7 +38,7 @@ class ThrottleTestCase(iotests.QMPTestCase):
>>>       def setUp(self):
>>>           self.vm = iotests.VM()
>>>           for i in range(0, self.max_drives):
>>> -            self.vm.add_drive(self.test_img)
>>> +            self.vm.add_drive(self.test_img, "file.read-zeroes=on")
>>>           self.vm.launch()
>>>   
>>>       def tearDown(self):
>>> @@ -273,7 +273,8 @@ class ThrottleTestGroupNames(iotests.QMPTestCase):
>>>       def setUp(self):
>>>           self.vm = iotests.VM()
>>>           for i in range(0, self.max_drives):
>>> -            self.vm.add_drive(self.test_img, "throttling.iops-total=100")
>>> +            self.vm.add_drive(self.test_img,
>>> +                              "throttling.iops-total=100,file.read-zeroes=on")
>>>           self.vm.launch()
>>>   
>>>       def tearDown(self):
>>> @@ -378,10 +379,10 @@ class ThrottleTestRemovableMedia(iotests.QMPTestCase):
>>>       def test_removable_media(self):
>>>           # Add a couple of dummy nodes named cd0 and cd1
>>>           result = self.vm.qmp("blockdev-add", driver="null-aio",
>>> -                             node_name="cd0")
>>> +                             read_zeroes=True, node_name="cd0")
>>>           self.assert_qmp(result, 'return', {})
>>>           result = self.vm.qmp("blockdev-add", driver="null-aio",
>>> -                             node_name="cd1")
>>> +                             read_zeroes=True, node_name="cd1")
>>>           self.assert_qmp(result, 'return', {})
>>>   
>>>           # Attach a CD drive with cd0 inserted
>>> diff --git a/tests/qemu-iotests/136 b/tests/qemu-iotests/136
>>> index af7ffa4540..a46a7b7630 100755
>>> --- a/tests/qemu-iotests/136
>>> +++ b/tests/qemu-iotests/136
>>> @@ -74,6 +74,7 @@ sector = "%d"
>>>                             (self.account_invalid and "on" or "off"))
>>>           drive_args.append("stats-account-failed=%s" %
>>>                             (self.account_failed and "on" or "off"))
>>> +        drive_args.append("file.image.read-zeroes=on")
>>>           self.create_blkdebug_file()
>>>           self.vm = iotests.VM().add_drive('blkdebug:%s:%s' %
>>>                                            (blkdebug_file, self.test_img),
>>> diff --git a/tests/qemu-iotests/186 b/tests/qemu-iotests/186
>>> index 7e7d45babc..5f6b18c150 100755
>>> --- a/tests/qemu-iotests/186
>>> +++ b/tests/qemu-iotests/186
>>> @@ -86,8 +86,8 @@ echo "=== -blockdev/-device=<node-name> ==="
>>>   echo
>>>   
>>>   for dev in $fixed $removable; do
>>> -    check_info_block -blockdev driver=null-co,node-name=null -device $dev,drive=null
>>> -    check_info_block -blockdev driver=null-co,node-name=null -device $dev,drive=null,id=qdev_id
>>> +    check_info_block -blockdev driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null
>>> +    check_info_block -blockdev driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null,id=qdev_id
>>>   done
>>>   
>>>   echo
>>> @@ -97,7 +97,7 @@ echo
>>>   # This creates two BlockBackends that will show up in 'info block'!
>>>   # A monitor-owned one from -drive, and anonymous one from -device
>>>   for dev in $fixed $removable; do
>>> -    check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=null,id=qdev_id
>>> +    check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null,id=qdev_id
>>>   done
>>>   
>>>   echo
>>> @@ -105,8 +105,8 @@ echo "=== -drive if=none/-device=<bb-name> (with medium) ==="
>>>   echo
>>>   
>>>   for dev in $fixed $removable; do
>>> -    check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=none0
>>> -    check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=none0,id=qdev_id
>>> +    check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=none0
>>> +    check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=none0,id=qdev_id
>>>   done
>>>   
>>>   echo
>>> @@ -125,15 +125,15 @@ echo "=== -drive if=... ==="
>>>   echo
>>>   
>>>   check_info_block -drive if=floppy
>>> -check_info_block -drive if=floppy,driver=null-co
>>> +check_info_block -drive if=floppy,driver=null-co,read-zeroes=on
>>>   
>>> -check_info_block -drive if=ide,driver=null-co
>>> +check_info_block -drive if=ide,driver=null-co,read-zeroes=on
>>>   check_info_block -drive if=ide,media=cdrom
>>> -check_info_block -drive if=ide,driver=null-co,media=cdrom
>>> +check_info_block -drive if=ide,driver=null-co,read-zeroes=on,media=cdrom
>>>   
>>> -check_info_block -drive if=virtio,driver=null-co
>>> +check_info_block -drive if=virtio,driver=null-co,read-zeroes=on
>>>   
>>> -check_info_block -drive if=pflash,driver=null-co,size=1M
>>> +check_info_block -drive if=pflash,driver=null-co,read-zeroes=on,size=1M
>>>   
>>>   # success, all done
>>>   echo "*** done"
>>> diff --git a/tests/qemu-iotests/186.out b/tests/qemu-iotests/186.out
>>> index 716b01ac3d..5b3504042a 100644
>>> --- a/tests/qemu-iotests/186.out
>>> +++ b/tests/qemu-iotests/186.out
>>> @@ -54,103 +54,103 @@ qdev_id: [not inserted]
>>>   
>>>   === -blockdev/-device=<node-name> ===
>>>   
>>> -Testing: -blockdev driver=null-co,node-name=null -device ide-hd,drive=null
>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=null
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -null: null-co:// (null-co)
>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>       Attached to:      PATH
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -blockdev driver=null-co,node-name=null -device ide-hd,drive=null,id=qdev_id
>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=null,id=qdev_id
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -null: null-co:// (null-co)
>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>       Attached to:      qdev_id
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -blockdev driver=null-co,node-name=null -device scsi-hd,drive=null
>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=null
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -null: null-co:// (null-co)
>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>       Attached to:      PATH
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -blockdev driver=null-co,node-name=null -device scsi-hd,drive=null,id=qdev_id
>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=null,id=qdev_id
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -null: null-co:// (null-co)
>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>       Attached to:      qdev_id
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -blockdev driver=null-co,node-name=null -device virtio-blk-pci,drive=null
>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=null
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -null: null-co:// (null-co)
>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>       Attached to:      PATH
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -blockdev driver=null-co,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -null: null-co:// (null-co)
>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>       Attached to:      PATH
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -blockdev driver=null-co,node-name=null -device floppy,drive=null
>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=null
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -null: null-co:// (null-co)
>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>       Attached to:      PATH
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -blockdev driver=null-co,node-name=null -device floppy,drive=null,id=qdev_id
>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=null,id=qdev_id
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -null: null-co:// (null-co)
>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>       Attached to:      qdev_id
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -blockdev driver=null-co,node-name=null -device ide-cd,drive=null
>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=null
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -null: null-co:// (null-co)
>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>       Attached to:      PATH
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -blockdev driver=null-co,node-name=null -device ide-cd,drive=null,id=qdev_id
>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=null,id=qdev_id
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -null: null-co:// (null-co)
>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>       Attached to:      qdev_id
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -blockdev driver=null-co,node-name=null -device scsi-cd,drive=null
>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=null
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -null: null-co:// (null-co)
>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>       Attached to:      PATH
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -blockdev driver=null-co,node-name=null -device scsi-cd,drive=null,id=qdev_id
>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=null,id=qdev_id
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -null: null-co:// (null-co)
>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>       Attached to:      qdev_id
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>> @@ -159,76 +159,76 @@ null: null-co:// (null-co)
>>>   
>>>   === -drive if=none/-device=<node-name> ===
>>>   
>>> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-hd,drive=null,id=qdev_id
>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=null,id=qdev_id
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -none0 (null): null-co:// (null-co)
>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   
>>> -null: null-co:// (null-co)
>>> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      qdev_id
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-hd,drive=null,id=qdev_id
>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=null,id=qdev_id
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -none0 (null): null-co:// (null-co)
>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   
>>> -null: null-co:// (null-co)
>>> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      qdev_id
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=none,driver=null-co,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -none0 (null): null-co:// (null-co)
>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   
>>> -null: null-co:// (null-co)
>>> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      PATH
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=none,driver=null-co,node-name=null -device floppy,drive=null,id=qdev_id
>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=null,id=qdev_id
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -none0 (null): null-co:// (null-co)
>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   
>>> -null: null-co:// (null-co)
>>> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      qdev_id
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-cd,drive=null,id=qdev_id
>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=null,id=qdev_id
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -none0 (null): null-co:// (null-co)
>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   
>>> -null: null-co:// (null-co)
>>> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      qdev_id
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-cd,drive=null,id=qdev_id
>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=null,id=qdev_id
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -none0 (null): null-co:// (null-co)
>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   
>>> -null: null-co:// (null-co)
>>> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      qdev_id
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>> @@ -237,103 +237,103 @@ null: null-co:// (null-co)
>>>   
>>>   === -drive if=none/-device=<bb-name> (with medium) ===
>>>   
>>> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-hd,drive=none0
>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=none0
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -none0 (null): null-co:// (null-co)
>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      PATH
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-hd,drive=none0,id=qdev_id
>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=none0,id=qdev_id
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -none0 (null): null-co:// (null-co)
>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      qdev_id
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-hd,drive=none0
>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=none0
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -none0 (null): null-co:// (null-co)
>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      PATH
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-hd,drive=none0,id=qdev_id
>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=none0,id=qdev_id
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -none0 (null): null-co:// (null-co)
>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      qdev_id
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=none,driver=null-co,node-name=null -device virtio-blk-pci,drive=none0
>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=none0
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -none0 (null): null-co:// (null-co)
>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      PATH
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=none,driver=null-co,node-name=null -device virtio-blk-pci,drive=none0,id=qdev_id
>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=none0,id=qdev_id
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -none0 (null): null-co:// (null-co)
>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      PATH
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=none,driver=null-co,node-name=null -device floppy,drive=none0
>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=none0
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -none0 (null): null-co:// (null-co)
>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      PATH
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=none,driver=null-co,node-name=null -device floppy,drive=none0,id=qdev_id
>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=none0,id=qdev_id
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -none0 (null): null-co:// (null-co)
>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      qdev_id
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-cd,drive=none0
>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=none0
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -none0 (null): null-co:// (null-co)
>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      PATH
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-cd,drive=none0,id=qdev_id
>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=none0,id=qdev_id
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -none0 (null): null-co:// (null-co)
>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      qdev_id
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-cd,drive=none0
>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=none0
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -none0 (null): null-co:// (null-co)
>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      PATH
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-cd,drive=none0,id=qdev_id
>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=none0,id=qdev_id
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -none0 (null): null-co:// (null-co)
>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      qdev_id
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>> @@ -408,19 +408,19 @@ floppy0: [not inserted]
>>>       Removable device: not locked, tray closed
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=floppy,driver=null-co
>>> +Testing: -drive if=floppy,driver=null-co,read-zeroes=on
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -floppy0 (NODE_NAME): null-co:// (null-co)
>>> +floppy0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      PATH
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=ide,driver=null-co
>>> +Testing: -drive if=ide,driver=null-co,read-zeroes=on
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -ide0-hd0 (NODE_NAME): null-co:// (null-co)
>>> +ide0-hd0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      PATH
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>> @@ -433,27 +433,27 @@ ide0-cd0: [not inserted]
>>>       Removable device: not locked, tray closed
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=ide,driver=null-co,media=cdrom
>>> +Testing: -drive if=ide,driver=null-co,read-zeroes=on,media=cdrom
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -ide0-cd0 (NODE_NAME): null-co:// (null-co, read-only)
>>> +ide0-cd0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co, read-only)
>>>       Attached to:      PATH
>>>       Removable device: not locked, tray closed
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=virtio,driver=null-co
>>> +Testing: -drive if=virtio,driver=null-co,read-zeroes=on
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -virtio0 (NODE_NAME): null-co:// (null-co)
>>> +virtio0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>       Attached to:      PATH
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>>   
>>> -Testing: -drive if=pflash,driver=null-co,size=1M
>>> +Testing: -drive if=pflash,driver=null-co,read-zeroes=on,size=1M
>>>   QEMU X.Y.Z monitor - type 'help' for more information
>>>   (qemu) info block
>>> -pflash0 (NODE_NAME): json:{"driver": "null-co", "size": "1M"} (null-co)
>>> +pflash0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co", "size": "1M"} (null-co)
>>>       Attached to:      PATH
>>>       Cache mode:       writeback
>>>   (qemu) quit
>>> diff --git a/tests/qemu-iotests/227 b/tests/qemu-iotests/227
>>> index bdd727a721..637d7c3726 100755
>>> --- a/tests/qemu-iotests/227
>>> +++ b/tests/qemu-iotests/227
>>> @@ -57,7 +57,7 @@ echo
>>>   echo '=== blockstats with -drive if=virtio ==='
>>>   echo
>>>   
>>> -run_qemu -drive driver=null-co,if=virtio <<EOF
>>> +run_qemu -drive driver=null-co,read-zeroes=on,if=virtio <<EOF
>>>   { "execute": "qmp_capabilities" }
>>>   { "execute": "query-blockstats"}
>>>   { "execute": "quit" }
>>> @@ -87,7 +87,7 @@ echo
>>>   echo '=== blockstats with -blockdev and -device ==='
>>>   echo
>>>   
>>> -run_qemu -blockdev driver=null-co,node-name=null -device virtio-blk,drive=null,id=virtio0 <<EOF
>>> +run_qemu -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk,drive=null,id=virtio0 <<EOF
>>>   { "execute": "qmp_capabilities" }
>>>   { "execute": "query-blockstats"}
>>>   { "execute": "quit" }
>>> diff --git a/tests/qemu-iotests/227.out b/tests/qemu-iotests/227.out
>>> index e77efaf4cf..3dd3ca5708 100644
>>> --- a/tests/qemu-iotests/227.out
>>> +++ b/tests/qemu-iotests/227.out
>>> @@ -2,7 +2,7 @@ QA output created by 227
>>>   
>>>   === blockstats with -drive if=virtio ===
>>>   
>>> -Testing: -drive driver=null-co,if=virtio
>>> +Testing: -drive driver=null-co,read-zeroes=on,if=virtio
>>>   {
>>>       QMP_VERSION
>>>   }
>>> @@ -150,7 +150,7 @@ Testing: -blockdev driver=null-co,node-name=null
>>>   
>>>   === blockstats with -blockdev and -device ===
>>>   
>>> -Testing: -blockdev driver=null-co,node-name=null -device virtio-blk,drive=null,id=virtio0
>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk,drive=null,id=virtio0
>>>   {
>>>       QMP_VERSION
>>>   }
>>> diff --git a/tests/qemu-iotests/238 b/tests/qemu-iotests/238
>>> index 1c0a46fa90..08bc7e6b4b 100755
>>> --- a/tests/qemu-iotests/238
>>> +++ b/tests/qemu-iotests/238
>>> @@ -31,7 +31,7 @@ else:
>>>   vm = iotests.VM()
>>>   vm.launch()
>>>   
>>> -log(vm.qmp('blockdev-add', node_name='hd0', driver='null-co'))
>>> +log(vm.qmp('blockdev-add', node_name='hd0', driver='null-co', read_zeroes=True))
>>>   log(vm.qmp('object-add', qom_type='iothread', id='iothread0'))
>>>   log(vm.qmp('device_add', id='scsi0', driver=virtio_scsi_device, iothread='iothread0'))
>>>   log(vm.qmp('device_add', id='scsi-hd0', driver='scsi-hd', drive='hd0'))
>>> diff --git a/tests/qemu-iotests/240 b/tests/qemu-iotests/240
>>> index 5be6b9c0f7..f73bc07d80 100755
>>> --- a/tests/qemu-iotests/240
>>> +++ b/tests/qemu-iotests/240
>>> @@ -76,7 +76,7 @@ echo
>>>   
>>>   run_qemu <<EOF
>>>   { "execute": "qmp_capabilities" }
>>> -{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0"}}
>>> +{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0"}}
>>>   { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
>>>   { "execute": "device_add", "arguments": {"id": "scsi0", "driver": "${virtio_scsi}", "iothread": "iothread0"}}
>>>   { "execute": "device_add", "arguments": {"id": "scsi-hd0", "driver": "scsi-hd", "drive": "hd0"}}
>>> @@ -94,7 +94,7 @@ echo
>>>   
>>>   run_qemu <<EOF
>>>   { "execute": "qmp_capabilities" }
>>> -{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true}}
>>> +{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0", "read-only": true}}
>>>   { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
>>>   { "execute": "device_add", "arguments": {"id": "scsi0", "driver": "${virtio_scsi}", "iothread": "iothread0"}}
>>>   { "execute": "device_add", "arguments": {"id": "scsi-hd0", "driver": "scsi-hd", "drive": "hd0"}}
>>> @@ -112,7 +112,7 @@ echo
>>>   
>>>   run_qemu <<EOF
>>>   { "execute": "qmp_capabilities" }
>>> -{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true}}
>>> +{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0", "read-only": true}}
>>>   { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
>>>   { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread1"}}
>>>   { "execute": "device_add", "arguments": {"id": "scsi0", "driver": "${virtio_scsi}", "iothread": "iothread0"}}
>>> @@ -134,7 +134,7 @@ echo
>>>   
>>>   run_qemu <<EOF
>>>   { "execute": "qmp_capabilities" }
>>> -{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true}}
>>> +{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0", "read-only": true}}
>>>   { "execute": "nbd-server-start", "arguments": {"addr":{"type":"unix","data":{"path":"$TEST_DIR/nbd"}}}}
>>>   { "execute": "nbd-server-add", "arguments": {"device":"hd0"}}
>>>   { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
>>>
>>
> 



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

* Re: [Qemu-devel] [PULL 01/13] iotests: Set read-zeroes on in null block driver for Valgrind
  2019-07-24  7:33       ` Christian Borntraeger
@ 2019-07-24  7:37         ` Andrey Shinkevich
  0 siblings, 0 replies; 23+ messages in thread
From: Andrey Shinkevich @ 2019-07-24  7:37 UTC (permalink / raw)
  To: Christian Borntraeger, Kevin Wolf, qemu-block
  Cc: peter.maydell, qemu-s390x, qemu-devel



On 24/07/2019 10:33, Christian Borntraeger wrote:
> 
> 
> On 24.07.19 09:30, Andrey Shinkevich wrote:
>>
>>
>> On 24/07/2019 10:18, Christian Borntraeger wrote:
>>>
>>> On 19.07.19 15:43, Kevin Wolf wrote:
>>>> From: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
>>>>
>>>> The Valgrind tool reports about the uninitialised buffer 'buf'
>>>> instantiated on the stack of the function guess_disk_lchs().
>>>> Pass 'read-zeroes=on' to the null block driver to make it deterministic.
>>>> The output of the tests 051, 186 and 227 now includes the parameter
>>>> 'read-zeroes'. So, the benchmark output files are being changed too.
>>>>
>>>> Suggested-by: Kevin Wolf <kwolf@redhat.com>
>>>> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
>>>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>>>> ---
>>>>    tests/qemu-iotests/051        |  10 +--
>>>>    tests/qemu-iotests/051.pc.out |  10 +--
>>>>    tests/qemu-iotests/093        |   9 +-
>>> [...9
>>>
>>>
>>> I now get the following on s390.
>>> Seems that you only fixed 051.pc.out but not 051.out
>>>
>>>       051      ...        [09:01:49]             ...              051      ^[[1m^[[31mfail      ^[[0m [09:01:49] [09:01:50]                    output mismatch (see 051.out.bad)
>>>       --- tests/qemu-iotests/051.out	2019-07-09 18:34:26.734654933 +0200
>>>       +++ build/tests/qemu-iotests/051.out.bad	2019-07-24 09:01:50.015024901 +0200
>>>       @@ -149,23 +149,23 @@
>>>        
>>>        === Cache modes ===
>>>        
>>>       -Testing: -drive driver=null-co,cache=none
>>>       +Testing: -drive driver=null-co,read-zeroes=on,cache=none
>>>        QEMU X.Y.Z monitor - type 'help' for more information
>>>        (qemu) quit
>>>        
>>>       -Testing: -drive driver=null-co,cache=directsync
>>>       +Testing: -drive driver=null-co,read-zeroes=on,cache=directsync
>>>        QEMU X.Y.Z monitor - type 'help' for more information
>>>        (qemu) quit
>>>        
>>>       -Testing: -drive driver=null-co,cache=writeback
>>>       +Testing: -drive driver=null-co,read-zeroes=on,cache=writeback
>>>        QEMU X.Y.Z monitor - type 'help' for more information
>>>        (qemu) quit
>>>        
>>>       -Testing: -drive driver=null-co,cache=writethrough
>>>       +Testing: -drive driver=null-co,read-zeroes=on,cache=writethrough
>>>        QEMU X.Y.Z monitor - type 'help' for more information
>>>        (qemu) quit
>>>        
>>>       -Testing: -drive driver=null-co,cache=unsafe
>>>       +Testing: -drive driver=null-co,read-zeroes=on,cache=unsafe
>>>        QEMU X.Y.Z monitor - type 'help' for more information
>>>        (qemu) quit
>>>        
>>>
>>
>> Thank you Christian for your report.
>> Would you please send the command line you ran the 051 test with?
> 
> just calling check with -qcow2 and 051 on an s390 system:
> 
> 
>   ./check -qcow2 051
> QEMU          -- "/home/cborntra/REPOS/qemu/build/tests/qemu-iotests/../../s390x-softmmu/qemu-system-s390x" -nodefaults -machine accel=qtest
> QEMU_IMG      -- "/home/cborntra/REPOS/qemu/build/tests/qemu-iotests/../../qemu-img"
> QEMU_IO       -- "/home/cborntra/REPOS/qemu/build/tests/qemu-iotests/../../qemu-io"  --cache writeback -f qcow2
> QEMU_NBD      -- "/home/cborntra/REPOS/qemu/build/tests/qemu-iotests/../../qemu-nbd"
> IMGFMT        -- qcow2 (compat=1.1)
> IMGPROTO      -- file
> PLATFORM      -- Linux/s390x s38lp08 5.2.0+
> TEST_DIR      -- /home/cborntra/REPOS/qemu/build/tests/qemu-iotests/scratch
> SOCKET_SCM_HELPER -- /home/cborntra/REPOS/qemu/build/tests/qemu-iotests/socket_scm_helper
> 
> 051      fail       [09:32:20] [09:32:30]                    output mismatch (see 051.out.bad)
> --- /home/cborntra/REPOS/qemu/tests/qemu-iotests/051.out	2019-07-11 18:31:29.440732461 +0200
> +++ /home/cborntra/REPOS/qemu/build/tests/qemu-iotests/051.out.bad	2019-07-24 09:32:30.390620548 +0200
> @@ -149,23 +149,23 @@
>   
>   === Cache modes ===
>   
> -Testing: -drive driver=null-co,cache=none
> +Testing: -drive driver=null-co,read-zeroes=on,cache=none
>   QEMU X.Y.Z monitor - type 'help' for more information
>   (qemu) quit
>   
> -Testing: -drive driver=null-co,cache=directsync
> +Testing: -drive driver=null-co,read-zeroes=on,cache=directsync
>   QEMU X.Y.Z monitor - type 'help' for more information
>   (qemu) quit
>   
> -Testing: -drive driver=null-co,cache=writeback
> +Testing: -drive driver=null-co,read-zeroes=on,cache=writeback
>   QEMU X.Y.Z monitor - type 'help' for more information
>   (qemu) quit
>   
> -Testing: -drive driver=null-co,cache=writethrough
> +Testing: -drive driver=null-co,read-zeroes=on,cache=writethrough
>   QEMU X.Y.Z monitor - type 'help' for more information
>   (qemu) quit
>   
> -Testing: -drive driver=null-co,cache=unsafe
> +Testing: -drive driver=null-co,read-zeroes=on,cache=unsafe
>   QEMU X.Y.Z monitor - type 'help' for more information
>   (qemu) quit
>   
> Failures: 051
> Failed 1 of 1 tests
> 
> 

OK, thank you.
I can create a patch based on the output above because I do not have the 
s390 platform to test on.
Now, I am waiting for Kevin advice on how to add it to the existing patch...

Andrey

>>
>> Kevin,
>> How do add the 051.out file to the patch? New version?
> 
> You would need a fixup patch as the original patch is already merged.
> 
>>
>> Andrey
>>
>>>>
>>>> diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
>>>> index 200660f977..ce942a5444 100755
>>>> --- a/tests/qemu-iotests/051
>>>> +++ b/tests/qemu-iotests/051
>>>> @@ -251,11 +251,11 @@ echo
>>>>    # Cannot use the test image because cache=none might not work on the host FS
>>>>    # Use cdrom so that we won't get errors about missing media
>>>>    
>>>> -run_qemu -drive driver=null-co,cache=none
>>>> -run_qemu -drive driver=null-co,cache=directsync
>>>> -run_qemu -drive driver=null-co,cache=writeback
>>>> -run_qemu -drive driver=null-co,cache=writethrough
>>>> -run_qemu -drive driver=null-co,cache=unsafe
>>>> +run_qemu -drive driver=null-co,read-zeroes=on,cache=none
>>>> +run_qemu -drive driver=null-co,read-zeroes=on,cache=directsync
>>>> +run_qemu -drive driver=null-co,read-zeroes=on,cache=writeback
>>>> +run_qemu -drive driver=null-co,read-zeroes=on,cache=writethrough
>>>> +run_qemu -drive driver=null-co,read-zeroes=on,cache=unsafe
>>>>    run_qemu -drive driver=null-co,cache=invalid_value
>>>>    
>>>>    # Can't test direct=on here because O_DIRECT might not be supported on this FS
>>>> diff --git a/tests/qemu-iotests/051.pc.out b/tests/qemu-iotests/051.pc.out
>>>> index 2d811c166c..000557c7c8 100644
>>>> --- a/tests/qemu-iotests/051.pc.out
>>>> +++ b/tests/qemu-iotests/051.pc.out
>>>> @@ -245,23 +245,23 @@ QEMU X.Y.Z monitor - type 'help' for more information
>>>>    
>>>>    === Cache modes ===
>>>>    
>>>> -Testing: -drive driver=null-co,cache=none
>>>> +Testing: -drive driver=null-co,read-zeroes=on,cache=none
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive driver=null-co,cache=directsync
>>>> +Testing: -drive driver=null-co,read-zeroes=on,cache=directsync
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive driver=null-co,cache=writeback
>>>> +Testing: -drive driver=null-co,read-zeroes=on,cache=writeback
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive driver=null-co,cache=writethrough
>>>> +Testing: -drive driver=null-co,read-zeroes=on,cache=writethrough
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive driver=null-co,cache=unsafe
>>>> +Testing: -drive driver=null-co,read-zeroes=on,cache=unsafe
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) quit
>>>>    
>>>> diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093
>>>> index d88fbc182e..4b2cac1d0c 100755
>>>> --- a/tests/qemu-iotests/093
>>>> +++ b/tests/qemu-iotests/093
>>>> @@ -38,7 +38,7 @@ class ThrottleTestCase(iotests.QMPTestCase):
>>>>        def setUp(self):
>>>>            self.vm = iotests.VM()
>>>>            for i in range(0, self.max_drives):
>>>> -            self.vm.add_drive(self.test_img)
>>>> +            self.vm.add_drive(self.test_img, "file.read-zeroes=on")
>>>>            self.vm.launch()
>>>>    
>>>>        def tearDown(self):
>>>> @@ -273,7 +273,8 @@ class ThrottleTestGroupNames(iotests.QMPTestCase):
>>>>        def setUp(self):
>>>>            self.vm = iotests.VM()
>>>>            for i in range(0, self.max_drives):
>>>> -            self.vm.add_drive(self.test_img, "throttling.iops-total=100")
>>>> +            self.vm.add_drive(self.test_img,
>>>> +                              "throttling.iops-total=100,file.read-zeroes=on")
>>>>            self.vm.launch()
>>>>    
>>>>        def tearDown(self):
>>>> @@ -378,10 +379,10 @@ class ThrottleTestRemovableMedia(iotests.QMPTestCase):
>>>>        def test_removable_media(self):
>>>>            # Add a couple of dummy nodes named cd0 and cd1
>>>>            result = self.vm.qmp("blockdev-add", driver="null-aio",
>>>> -                             node_name="cd0")
>>>> +                             read_zeroes=True, node_name="cd0")
>>>>            self.assert_qmp(result, 'return', {})
>>>>            result = self.vm.qmp("blockdev-add", driver="null-aio",
>>>> -                             node_name="cd1")
>>>> +                             read_zeroes=True, node_name="cd1")
>>>>            self.assert_qmp(result, 'return', {})
>>>>    
>>>>            # Attach a CD drive with cd0 inserted
>>>> diff --git a/tests/qemu-iotests/136 b/tests/qemu-iotests/136
>>>> index af7ffa4540..a46a7b7630 100755
>>>> --- a/tests/qemu-iotests/136
>>>> +++ b/tests/qemu-iotests/136
>>>> @@ -74,6 +74,7 @@ sector = "%d"
>>>>                              (self.account_invalid and "on" or "off"))
>>>>            drive_args.append("stats-account-failed=%s" %
>>>>                              (self.account_failed and "on" or "off"))
>>>> +        drive_args.append("file.image.read-zeroes=on")
>>>>            self.create_blkdebug_file()
>>>>            self.vm = iotests.VM().add_drive('blkdebug:%s:%s' %
>>>>                                             (blkdebug_file, self.test_img),
>>>> diff --git a/tests/qemu-iotests/186 b/tests/qemu-iotests/186
>>>> index 7e7d45babc..5f6b18c150 100755
>>>> --- a/tests/qemu-iotests/186
>>>> +++ b/tests/qemu-iotests/186
>>>> @@ -86,8 +86,8 @@ echo "=== -blockdev/-device=<node-name> ==="
>>>>    echo
>>>>    
>>>>    for dev in $fixed $removable; do
>>>> -    check_info_block -blockdev driver=null-co,node-name=null -device $dev,drive=null
>>>> -    check_info_block -blockdev driver=null-co,node-name=null -device $dev,drive=null,id=qdev_id
>>>> +    check_info_block -blockdev driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null
>>>> +    check_info_block -blockdev driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null,id=qdev_id
>>>>    done
>>>>    
>>>>    echo
>>>> @@ -97,7 +97,7 @@ echo
>>>>    # This creates two BlockBackends that will show up in 'info block'!
>>>>    # A monitor-owned one from -drive, and anonymous one from -device
>>>>    for dev in $fixed $removable; do
>>>> -    check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=null,id=qdev_id
>>>> +    check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=null,id=qdev_id
>>>>    done
>>>>    
>>>>    echo
>>>> @@ -105,8 +105,8 @@ echo "=== -drive if=none/-device=<bb-name> (with medium) ==="
>>>>    echo
>>>>    
>>>>    for dev in $fixed $removable; do
>>>> -    check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=none0
>>>> -    check_info_block -drive if=none,driver=null-co,node-name=null -device $dev,drive=none0,id=qdev_id
>>>> +    check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=none0
>>>> +    check_info_block -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device $dev,drive=none0,id=qdev_id
>>>>    done
>>>>    
>>>>    echo
>>>> @@ -125,15 +125,15 @@ echo "=== -drive if=... ==="
>>>>    echo
>>>>    
>>>>    check_info_block -drive if=floppy
>>>> -check_info_block -drive if=floppy,driver=null-co
>>>> +check_info_block -drive if=floppy,driver=null-co,read-zeroes=on
>>>>    
>>>> -check_info_block -drive if=ide,driver=null-co
>>>> +check_info_block -drive if=ide,driver=null-co,read-zeroes=on
>>>>    check_info_block -drive if=ide,media=cdrom
>>>> -check_info_block -drive if=ide,driver=null-co,media=cdrom
>>>> +check_info_block -drive if=ide,driver=null-co,read-zeroes=on,media=cdrom
>>>>    
>>>> -check_info_block -drive if=virtio,driver=null-co
>>>> +check_info_block -drive if=virtio,driver=null-co,read-zeroes=on
>>>>    
>>>> -check_info_block -drive if=pflash,driver=null-co,size=1M
>>>> +check_info_block -drive if=pflash,driver=null-co,read-zeroes=on,size=1M
>>>>    
>>>>    # success, all done
>>>>    echo "*** done"
>>>> diff --git a/tests/qemu-iotests/186.out b/tests/qemu-iotests/186.out
>>>> index 716b01ac3d..5b3504042a 100644
>>>> --- a/tests/qemu-iotests/186.out
>>>> +++ b/tests/qemu-iotests/186.out
>>>> @@ -54,103 +54,103 @@ qdev_id: [not inserted]
>>>>    
>>>>    === -blockdev/-device=<node-name> ===
>>>>    
>>>> -Testing: -blockdev driver=null-co,node-name=null -device ide-hd,drive=null
>>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=null
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -null: null-co:// (null-co)
>>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>>        Attached to:      PATH
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -blockdev driver=null-co,node-name=null -device ide-hd,drive=null,id=qdev_id
>>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=null,id=qdev_id
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -null: null-co:// (null-co)
>>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>>        Attached to:      qdev_id
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -blockdev driver=null-co,node-name=null -device scsi-hd,drive=null
>>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=null
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -null: null-co:// (null-co)
>>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>>        Attached to:      PATH
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -blockdev driver=null-co,node-name=null -device scsi-hd,drive=null,id=qdev_id
>>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=null,id=qdev_id
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -null: null-co:// (null-co)
>>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>>        Attached to:      qdev_id
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -blockdev driver=null-co,node-name=null -device virtio-blk-pci,drive=null
>>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=null
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -null: null-co:// (null-co)
>>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>>        Attached to:      PATH
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -blockdev driver=null-co,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
>>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -null: null-co:// (null-co)
>>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>>        Attached to:      PATH
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -blockdev driver=null-co,node-name=null -device floppy,drive=null
>>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=null
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -null: null-co:// (null-co)
>>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>>        Attached to:      PATH
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -blockdev driver=null-co,node-name=null -device floppy,drive=null,id=qdev_id
>>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=null,id=qdev_id
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -null: null-co:// (null-co)
>>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>>        Attached to:      qdev_id
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -blockdev driver=null-co,node-name=null -device ide-cd,drive=null
>>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=null
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -null: null-co:// (null-co)
>>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>>        Attached to:      PATH
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -blockdev driver=null-co,node-name=null -device ide-cd,drive=null,id=qdev_id
>>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=null,id=qdev_id
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -null: null-co:// (null-co)
>>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>>        Attached to:      qdev_id
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -blockdev driver=null-co,node-name=null -device scsi-cd,drive=null
>>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=null
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -null: null-co:// (null-co)
>>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>>        Attached to:      PATH
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -blockdev driver=null-co,node-name=null -device scsi-cd,drive=null,id=qdev_id
>>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=null,id=qdev_id
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -null: null-co:// (null-co)
>>>> +null: json:{"read-zeroes": true, "driver": "null-co"} (null-co)
>>>>        Attached to:      qdev_id
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>> @@ -159,76 +159,76 @@ null: null-co:// (null-co)
>>>>    
>>>>    === -drive if=none/-device=<node-name> ===
>>>>    
>>>> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-hd,drive=null,id=qdev_id
>>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=null,id=qdev_id
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -none0 (null): null-co:// (null-co)
>>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    
>>>> -null: null-co:// (null-co)
>>>> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      qdev_id
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-hd,drive=null,id=qdev_id
>>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=null,id=qdev_id
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -none0 (null): null-co:// (null-co)
>>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    
>>>> -null: null-co:// (null-co)
>>>> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      qdev_id
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=none,driver=null-co,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
>>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=null,id=qdev_id
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -none0 (null): null-co:// (null-co)
>>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    
>>>> -null: null-co:// (null-co)
>>>> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      PATH
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=none,driver=null-co,node-name=null -device floppy,drive=null,id=qdev_id
>>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=null,id=qdev_id
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -none0 (null): null-co:// (null-co)
>>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    
>>>> -null: null-co:// (null-co)
>>>> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      qdev_id
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-cd,drive=null,id=qdev_id
>>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=null,id=qdev_id
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -none0 (null): null-co:// (null-co)
>>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    
>>>> -null: null-co:// (null-co)
>>>> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      qdev_id
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-cd,drive=null,id=qdev_id
>>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=null,id=qdev_id
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -none0 (null): null-co:// (null-co)
>>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    
>>>> -null: null-co:// (null-co)
>>>> +null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      qdev_id
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>> @@ -237,103 +237,103 @@ null: null-co:// (null-co)
>>>>    
>>>>    === -drive if=none/-device=<bb-name> (with medium) ===
>>>>    
>>>> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-hd,drive=none0
>>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=none0
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -none0 (null): null-co:// (null-co)
>>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      PATH
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-hd,drive=none0,id=qdev_id
>>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-hd,drive=none0,id=qdev_id
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -none0 (null): null-co:// (null-co)
>>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      qdev_id
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-hd,drive=none0
>>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=none0
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -none0 (null): null-co:// (null-co)
>>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      PATH
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-hd,drive=none0,id=qdev_id
>>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-hd,drive=none0,id=qdev_id
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -none0 (null): null-co:// (null-co)
>>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      qdev_id
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=none,driver=null-co,node-name=null -device virtio-blk-pci,drive=none0
>>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=none0
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -none0 (null): null-co:// (null-co)
>>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      PATH
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=none,driver=null-co,node-name=null -device virtio-blk-pci,drive=none0,id=qdev_id
>>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device virtio-blk-pci,drive=none0,id=qdev_id
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -none0 (null): null-co:// (null-co)
>>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      PATH
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=none,driver=null-co,node-name=null -device floppy,drive=none0
>>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=none0
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -none0 (null): null-co:// (null-co)
>>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      PATH
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=none,driver=null-co,node-name=null -device floppy,drive=none0,id=qdev_id
>>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device floppy,drive=none0,id=qdev_id
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -none0 (null): null-co:// (null-co)
>>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      qdev_id
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-cd,drive=none0
>>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=none0
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -none0 (null): null-co:// (null-co)
>>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      PATH
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=none,driver=null-co,node-name=null -device ide-cd,drive=none0,id=qdev_id
>>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device ide-cd,drive=none0,id=qdev_id
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -none0 (null): null-co:// (null-co)
>>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      qdev_id
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-cd,drive=none0
>>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=none0
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -none0 (null): null-co:// (null-co)
>>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      PATH
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=none,driver=null-co,node-name=null -device scsi-cd,drive=none0,id=qdev_id
>>>> +Testing: -drive if=none,driver=null-co,read-zeroes=on,node-name=null -device scsi-cd,drive=none0,id=qdev_id
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -none0 (null): null-co:// (null-co)
>>>> +none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      qdev_id
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>> @@ -408,19 +408,19 @@ floppy0: [not inserted]
>>>>        Removable device: not locked, tray closed
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=floppy,driver=null-co
>>>> +Testing: -drive if=floppy,driver=null-co,read-zeroes=on
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -floppy0 (NODE_NAME): null-co:// (null-co)
>>>> +floppy0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      PATH
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=ide,driver=null-co
>>>> +Testing: -drive if=ide,driver=null-co,read-zeroes=on
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -ide0-hd0 (NODE_NAME): null-co:// (null-co)
>>>> +ide0-hd0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      PATH
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>> @@ -433,27 +433,27 @@ ide0-cd0: [not inserted]
>>>>        Removable device: not locked, tray closed
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=ide,driver=null-co,media=cdrom
>>>> +Testing: -drive if=ide,driver=null-co,read-zeroes=on,media=cdrom
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -ide0-cd0 (NODE_NAME): null-co:// (null-co, read-only)
>>>> +ide0-cd0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co, read-only)
>>>>        Attached to:      PATH
>>>>        Removable device: not locked, tray closed
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=virtio,driver=null-co
>>>> +Testing: -drive if=virtio,driver=null-co,read-zeroes=on
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -virtio0 (NODE_NAME): null-co:// (null-co)
>>>> +virtio0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null-co)
>>>>        Attached to:      PATH
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>>    
>>>> -Testing: -drive if=pflash,driver=null-co,size=1M
>>>> +Testing: -drive if=pflash,driver=null-co,read-zeroes=on,size=1M
>>>>    QEMU X.Y.Z monitor - type 'help' for more information
>>>>    (qemu) info block
>>>> -pflash0 (NODE_NAME): json:{"driver": "null-co", "size": "1M"} (null-co)
>>>> +pflash0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co", "size": "1M"} (null-co)
>>>>        Attached to:      PATH
>>>>        Cache mode:       writeback
>>>>    (qemu) quit
>>>> diff --git a/tests/qemu-iotests/227 b/tests/qemu-iotests/227
>>>> index bdd727a721..637d7c3726 100755
>>>> --- a/tests/qemu-iotests/227
>>>> +++ b/tests/qemu-iotests/227
>>>> @@ -57,7 +57,7 @@ echo
>>>>    echo '=== blockstats with -drive if=virtio ==='
>>>>    echo
>>>>    
>>>> -run_qemu -drive driver=null-co,if=virtio <<EOF
>>>> +run_qemu -drive driver=null-co,read-zeroes=on,if=virtio <<EOF
>>>>    { "execute": "qmp_capabilities" }
>>>>    { "execute": "query-blockstats"}
>>>>    { "execute": "quit" }
>>>> @@ -87,7 +87,7 @@ echo
>>>>    echo '=== blockstats with -blockdev and -device ==='
>>>>    echo
>>>>    
>>>> -run_qemu -blockdev driver=null-co,node-name=null -device virtio-blk,drive=null,id=virtio0 <<EOF
>>>> +run_qemu -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk,drive=null,id=virtio0 <<EOF
>>>>    { "execute": "qmp_capabilities" }
>>>>    { "execute": "query-blockstats"}
>>>>    { "execute": "quit" }
>>>> diff --git a/tests/qemu-iotests/227.out b/tests/qemu-iotests/227.out
>>>> index e77efaf4cf..3dd3ca5708 100644
>>>> --- a/tests/qemu-iotests/227.out
>>>> +++ b/tests/qemu-iotests/227.out
>>>> @@ -2,7 +2,7 @@ QA output created by 227
>>>>    
>>>>    === blockstats with -drive if=virtio ===
>>>>    
>>>> -Testing: -drive driver=null-co,if=virtio
>>>> +Testing: -drive driver=null-co,read-zeroes=on,if=virtio
>>>>    {
>>>>        QMP_VERSION
>>>>    }
>>>> @@ -150,7 +150,7 @@ Testing: -blockdev driver=null-co,node-name=null
>>>>    
>>>>    === blockstats with -blockdev and -device ===
>>>>    
>>>> -Testing: -blockdev driver=null-co,node-name=null -device virtio-blk,drive=null,id=virtio0
>>>> +Testing: -blockdev driver=null-co,read-zeroes=on,node-name=null -device virtio-blk,drive=null,id=virtio0
>>>>    {
>>>>        QMP_VERSION
>>>>    }
>>>> diff --git a/tests/qemu-iotests/238 b/tests/qemu-iotests/238
>>>> index 1c0a46fa90..08bc7e6b4b 100755
>>>> --- a/tests/qemu-iotests/238
>>>> +++ b/tests/qemu-iotests/238
>>>> @@ -31,7 +31,7 @@ else:
>>>>    vm = iotests.VM()
>>>>    vm.launch()
>>>>    
>>>> -log(vm.qmp('blockdev-add', node_name='hd0', driver='null-co'))
>>>> +log(vm.qmp('blockdev-add', node_name='hd0', driver='null-co', read_zeroes=True))
>>>>    log(vm.qmp('object-add', qom_type='iothread', id='iothread0'))
>>>>    log(vm.qmp('device_add', id='scsi0', driver=virtio_scsi_device, iothread='iothread0'))
>>>>    log(vm.qmp('device_add', id='scsi-hd0', driver='scsi-hd', drive='hd0'))
>>>> diff --git a/tests/qemu-iotests/240 b/tests/qemu-iotests/240
>>>> index 5be6b9c0f7..f73bc07d80 100755
>>>> --- a/tests/qemu-iotests/240
>>>> +++ b/tests/qemu-iotests/240
>>>> @@ -76,7 +76,7 @@ echo
>>>>    
>>>>    run_qemu <<EOF
>>>>    { "execute": "qmp_capabilities" }
>>>> -{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0"}}
>>>> +{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0"}}
>>>>    { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
>>>>    { "execute": "device_add", "arguments": {"id": "scsi0", "driver": "${virtio_scsi}", "iothread": "iothread0"}}
>>>>    { "execute": "device_add", "arguments": {"id": "scsi-hd0", "driver": "scsi-hd", "drive": "hd0"}}
>>>> @@ -94,7 +94,7 @@ echo
>>>>    
>>>>    run_qemu <<EOF
>>>>    { "execute": "qmp_capabilities" }
>>>> -{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true}}
>>>> +{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0", "read-only": true}}
>>>>    { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
>>>>    { "execute": "device_add", "arguments": {"id": "scsi0", "driver": "${virtio_scsi}", "iothread": "iothread0"}}
>>>>    { "execute": "device_add", "arguments": {"id": "scsi-hd0", "driver": "scsi-hd", "drive": "hd0"}}
>>>> @@ -112,7 +112,7 @@ echo
>>>>    
>>>>    run_qemu <<EOF
>>>>    { "execute": "qmp_capabilities" }
>>>> -{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true}}
>>>> +{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0", "read-only": true}}
>>>>    { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
>>>>    { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread1"}}
>>>>    { "execute": "device_add", "arguments": {"id": "scsi0", "driver": "${virtio_scsi}", "iothread": "iothread0"}}
>>>> @@ -134,7 +134,7 @@ echo
>>>>    
>>>>    run_qemu <<EOF
>>>>    { "execute": "qmp_capabilities" }
>>>> -{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name": "hd0", "read-only": true}}
>>>> +{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "read-zeroes": true, "node-name": "hd0", "read-only": true}}
>>>>    { "execute": "nbd-server-start", "arguments": {"addr":{"type":"unix","data":{"path":"$TEST_DIR/nbd"}}}}
>>>>    { "execute": "nbd-server-add", "arguments": {"device":"hd0"}}
>>>>    { "execute": "object-add", "arguments": {"qom-type": "iothread", "id": "iothread0"}}
>>>>
>>>
>>
> 

-- 
With the best regards,
Andrey Shinkevich

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

* Re: [Qemu-devel] [PULL 01/13] iotests: Set read-zeroes on in null block driver for Valgrind
  2019-07-24  7:30     ` Andrey Shinkevich
  2019-07-24  7:33       ` Christian Borntraeger
@ 2019-07-24  7:38       ` Kevin Wolf
  2019-07-24  7:57         ` Andrey Shinkevich
  1 sibling, 1 reply; 23+ messages in thread
From: Kevin Wolf @ 2019-07-24  7:38 UTC (permalink / raw)
  To: Andrey Shinkevich
  Cc: Christian Borntraeger, qemu-s390x, qemu-devel, qemu-block, peter.maydell

Am 24.07.2019 um 09:30 hat Andrey Shinkevich geschrieben:
> 
> 
> On 24/07/2019 10:18, Christian Borntraeger wrote:
> > 
> > On 19.07.19 15:43, Kevin Wolf wrote:
> >> From: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
> >>
> >> The Valgrind tool reports about the uninitialised buffer 'buf'
> >> instantiated on the stack of the function guess_disk_lchs().
> >> Pass 'read-zeroes=on' to the null block driver to make it deterministic.
> >> The output of the tests 051, 186 and 227 now includes the parameter
> >> 'read-zeroes'. So, the benchmark output files are being changed too.
> >>
> >> Suggested-by: Kevin Wolf <kwolf@redhat.com>
> >> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
> >> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> >> ---
> >>   tests/qemu-iotests/051        |  10 +--
> >>   tests/qemu-iotests/051.pc.out |  10 +--
> >>   tests/qemu-iotests/093        |   9 +-
> > [...9
> > 
> > 
> > I now get the following on s390.
> > Seems that you only fixed 051.pc.out but not 051.out
> > 
> >      051      ...        [09:01:49]             ...              051      ^[[1m^[[31mfail      ^[[0m [09:01:49] [09:01:50]                    output mismatch (see 051.out.bad)
> >      --- tests/qemu-iotests/051.out	2019-07-09 18:34:26.734654933 +0200
> >      +++ build/tests/qemu-iotests/051.out.bad	2019-07-24 09:01:50.015024901 +0200
> >      @@ -149,23 +149,23 @@
> >       
> >       === Cache modes ===
> >       
> >      -Testing: -drive driver=null-co,cache=none
> >      +Testing: -drive driver=null-co,read-zeroes=on,cache=none
> >       QEMU X.Y.Z monitor - type 'help' for more information
> >       (qemu) quit
> >       
> >      -Testing: -drive driver=null-co,cache=directsync
> >      +Testing: -drive driver=null-co,read-zeroes=on,cache=directsync
> >       QEMU X.Y.Z monitor - type 'help' for more information
> >       (qemu) quit
> >       
> >      -Testing: -drive driver=null-co,cache=writeback
> >      +Testing: -drive driver=null-co,read-zeroes=on,cache=writeback
> >       QEMU X.Y.Z monitor - type 'help' for more information
> >       (qemu) quit
> >       
> >      -Testing: -drive driver=null-co,cache=writethrough
> >      +Testing: -drive driver=null-co,read-zeroes=on,cache=writethrough
> >       QEMU X.Y.Z monitor - type 'help' for more information
> >       (qemu) quit
> >       
> >      -Testing: -drive driver=null-co,cache=unsafe
> >      +Testing: -drive driver=null-co,read-zeroes=on,cache=unsafe
> >       QEMU X.Y.Z monitor - type 'help' for more information
> >       (qemu) quit
> >       
> > 
> 
> Thank you Christian for your report.
> Would you please send the command line you ran the 051 test with?
> 
> Kevin,
> How do add the 051.out file to the patch? New version?

No, we need a follow-up patch. This one is already merged, so we can't
change it any more.

Kevin


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

* Re: [Qemu-devel] [PULL 01/13] iotests: Set read-zeroes on in null block driver for Valgrind
  2019-07-24  7:38       ` Kevin Wolf
@ 2019-07-24  7:57         ` Andrey Shinkevich
  2019-07-24  8:05           ` Kevin Wolf
  0 siblings, 1 reply; 23+ messages in thread
From: Andrey Shinkevich @ 2019-07-24  7:57 UTC (permalink / raw)
  To: Kevin Wolf
  Cc: Christian Borntraeger, qemu-s390x, qemu-devel, qemu-block, peter.maydell



On 24/07/2019 10:38, Kevin Wolf wrote:
> Am 24.07.2019 um 09:30 hat Andrey Shinkevich geschrieben:
>>
>>
>> On 24/07/2019 10:18, Christian Borntraeger wrote:
>>>
>>> On 19.07.19 15:43, Kevin Wolf wrote:
>>>> From: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
>>>>
>>>> The Valgrind tool reports about the uninitialised buffer 'buf'
>>>> instantiated on the stack of the function guess_disk_lchs().
>>>> Pass 'read-zeroes=on' to the null block driver to make it deterministic.
>>>> The output of the tests 051, 186 and 227 now includes the parameter
>>>> 'read-zeroes'. So, the benchmark output files are being changed too.
>>>>
>>>> Suggested-by: Kevin Wolf <kwolf@redhat.com>
>>>> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
>>>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>>>> ---
>>>>    tests/qemu-iotests/051        |  10 +--
>>>>    tests/qemu-iotests/051.pc.out |  10 +--
>>>>    tests/qemu-iotests/093        |   9 +-
>>> [...9
>>>
>>>
>>> I now get the following on s390.
>>> Seems that you only fixed 051.pc.out but not 051.out
>>>
>>>       051      ...        [09:01:49]             ...              051      ^[[1m^[[31mfail      ^[[0m [09:01:49] [09:01:50]                    output mismatch (see 051.out.bad)
>>>       --- tests/qemu-iotests/051.out	2019-07-09 18:34:26.734654933 +0200
>>>       +++ build/tests/qemu-iotests/051.out.bad	2019-07-24 09:01:50.015024901 +0200
>>>       @@ -149,23 +149,23 @@
>>>        
>>>        === Cache modes ===
>>>        
>>>       -Testing: -drive driver=null-co,cache=none
>>>       +Testing: -drive driver=null-co,read-zeroes=on,cache=none
>>>        QEMU X.Y.Z monitor - type 'help' for more information
>>>        (qemu) quit
>>>        
>>>       -Testing: -drive driver=null-co,cache=directsync
>>>       +Testing: -drive driver=null-co,read-zeroes=on,cache=directsync
>>>        QEMU X.Y.Z monitor - type 'help' for more information
>>>        (qemu) quit
>>>        
>>>       -Testing: -drive driver=null-co,cache=writeback
>>>       +Testing: -drive driver=null-co,read-zeroes=on,cache=writeback
>>>        QEMU X.Y.Z monitor - type 'help' for more information
>>>        (qemu) quit
>>>        
>>>       -Testing: -drive driver=null-co,cache=writethrough
>>>       +Testing: -drive driver=null-co,read-zeroes=on,cache=writethrough
>>>        QEMU X.Y.Z monitor - type 'help' for more information
>>>        (qemu) quit
>>>        
>>>       -Testing: -drive driver=null-co,cache=unsafe
>>>       +Testing: -drive driver=null-co,read-zeroes=on,cache=unsafe
>>>        QEMU X.Y.Z monitor - type 'help' for more information
>>>        (qemu) quit
>>>        
>>>
>>
>> Thank you Christian for your report.
>> Would you please send the command line you ran the 051 test with?
>>
>> Kevin,
>> How do add the 051.out file to the patch? New version?
> 
> No, we need a follow-up patch. This one is already merged, so we can't
> change it any more.
> 
> Kevin
> 

Thank you and Christian both.
It is my first time I have been doing the fix patch.
Should it be named a specific way like "iotests: Fix for..."?

Andrey
-- 
With the best regards,
Andrey Shinkevich

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

* Re: [Qemu-devel] [PULL 01/13] iotests: Set read-zeroes on in null block driver for Valgrind
  2019-07-24  7:57         ` Andrey Shinkevich
@ 2019-07-24  8:05           ` Kevin Wolf
  2019-07-24  8:23             ` Andrey Shinkevich
  0 siblings, 1 reply; 23+ messages in thread
From: Kevin Wolf @ 2019-07-24  8:05 UTC (permalink / raw)
  To: Andrey Shinkevich
  Cc: Christian Borntraeger, qemu-s390x, qemu-devel, qemu-block, peter.maydell

Am 24.07.2019 um 09:57 hat Andrey Shinkevich geschrieben:
> 
> 
> On 24/07/2019 10:38, Kevin Wolf wrote:
> > Am 24.07.2019 um 09:30 hat Andrey Shinkevich geschrieben:
> >>
> >>
> >> On 24/07/2019 10:18, Christian Borntraeger wrote:
> >>>
> >>> On 19.07.19 15:43, Kevin Wolf wrote:
> >>>> From: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
> >>>>
> >>>> The Valgrind tool reports about the uninitialised buffer 'buf'
> >>>> instantiated on the stack of the function guess_disk_lchs().
> >>>> Pass 'read-zeroes=on' to the null block driver to make it deterministic.
> >>>> The output of the tests 051, 186 and 227 now includes the parameter
> >>>> 'read-zeroes'. So, the benchmark output files are being changed too.
> >>>>
> >>>> Suggested-by: Kevin Wolf <kwolf@redhat.com>
> >>>> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
> >>>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> >>>> ---
> >>>>    tests/qemu-iotests/051        |  10 +--
> >>>>    tests/qemu-iotests/051.pc.out |  10 +--
> >>>>    tests/qemu-iotests/093        |   9 +-
> >>> [...9
> >>>
> >>>
> >>> I now get the following on s390.
> >>> Seems that you only fixed 051.pc.out but not 051.out
> >>>
> >>>       051      ...        [09:01:49]             ...              051      ^[[1m^[[31mfail      ^[[0m [09:01:49] [09:01:50]                    output mismatch (see 051.out.bad)
> >>>       --- tests/qemu-iotests/051.out	2019-07-09 18:34:26.734654933 +0200
> >>>       +++ build/tests/qemu-iotests/051.out.bad	2019-07-24 09:01:50.015024901 +0200
> >>>       @@ -149,23 +149,23 @@
> >>>        
> >>>        === Cache modes ===
> >>>        
> >>>       -Testing: -drive driver=null-co,cache=none
> >>>       +Testing: -drive driver=null-co,read-zeroes=on,cache=none
> >>>        QEMU X.Y.Z monitor - type 'help' for more information
> >>>        (qemu) quit
> >>>        
> >>>       -Testing: -drive driver=null-co,cache=directsync
> >>>       +Testing: -drive driver=null-co,read-zeroes=on,cache=directsync
> >>>        QEMU X.Y.Z monitor - type 'help' for more information
> >>>        (qemu) quit
> >>>        
> >>>       -Testing: -drive driver=null-co,cache=writeback
> >>>       +Testing: -drive driver=null-co,read-zeroes=on,cache=writeback
> >>>        QEMU X.Y.Z monitor - type 'help' for more information
> >>>        (qemu) quit
> >>>        
> >>>       -Testing: -drive driver=null-co,cache=writethrough
> >>>       +Testing: -drive driver=null-co,read-zeroes=on,cache=writethrough
> >>>        QEMU X.Y.Z monitor - type 'help' for more information
> >>>        (qemu) quit
> >>>        
> >>>       -Testing: -drive driver=null-co,cache=unsafe
> >>>       +Testing: -drive driver=null-co,read-zeroes=on,cache=unsafe
> >>>        QEMU X.Y.Z monitor - type 'help' for more information
> >>>        (qemu) quit
> >>>        
> >>>
> >>
> >> Thank you Christian for your report.
> >> Would you please send the command line you ran the 051 test with?
> >>
> >> Kevin,
> >> How do add the 051.out file to the patch? New version?
> > 
> > No, we need a follow-up patch. This one is already merged, so we can't
> > change it any more.
> > 
> > Kevin
> > 
> 
> Thank you and Christian both.
> It is my first time I have been doing the fix patch.
> Should it be named a specific way like "iotests: Fix for..."?

People sometimes use a "Fixes: <commit number>" tag in the body of the
commit message, which is probably a good idea. The subject line just
describes the change as usual.

Kevin


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

* Re: [Qemu-devel] [PULL 01/13] iotests: Set read-zeroes on in null block driver for Valgrind
  2019-07-24  8:05           ` Kevin Wolf
@ 2019-07-24  8:23             ` Andrey Shinkevich
  0 siblings, 0 replies; 23+ messages in thread
From: Andrey Shinkevich @ 2019-07-24  8:23 UTC (permalink / raw)
  To: Kevin Wolf
  Cc: Christian Borntraeger, qemu-s390x, qemu-devel, qemu-block, peter.maydell



On 24/07/2019 11:05, Kevin Wolf wrote:
> Am 24.07.2019 um 09:57 hat Andrey Shinkevich geschrieben:
>>
>>
>> On 24/07/2019 10:38, Kevin Wolf wrote:
>>> Am 24.07.2019 um 09:30 hat Andrey Shinkevich geschrieben:
>>>>
>>>>
>>>> On 24/07/2019 10:18, Christian Borntraeger wrote:
>>>>>
>>>>> On 19.07.19 15:43, Kevin Wolf wrote:
>>>>>> From: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
>>>>>>
>>>>>> The Valgrind tool reports about the uninitialised buffer 'buf'
>>>>>> instantiated on the stack of the function guess_disk_lchs().
>>>>>> Pass 'read-zeroes=on' to the null block driver to make it deterministic.
>>>>>> The output of the tests 051, 186 and 227 now includes the parameter
>>>>>> 'read-zeroes'. So, the benchmark output files are being changed too.
>>>>>>
>>>>>> Suggested-by: Kevin Wolf <kwolf@redhat.com>
>>>>>> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
>>>>>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>>>>>> ---
>>>>>>     tests/qemu-iotests/051        |  10 +--
>>>>>>     tests/qemu-iotests/051.pc.out |  10 +--
>>>>>>     tests/qemu-iotests/093        |   9 +-
>>>>> [...9
>>>>>
>>>>>
>>>>> I now get the following on s390.
>>>>> Seems that you only fixed 051.pc.out but not 051.out
>>>>>
>>>>>        051      ...        [09:01:49]             ...              051      ^[[1m^[[31mfail      ^[[0m [09:01:49] [09:01:50]                    output mismatch (see 051.out.bad)
>>>>>        --- tests/qemu-iotests/051.out	2019-07-09 18:34:26.734654933 +0200
>>>>>        +++ build/tests/qemu-iotests/051.out.bad	2019-07-24 09:01:50.015024901 +0200
>>>>>        @@ -149,23 +149,23 @@
>>>>>         
>>>>>         === Cache modes ===
>>>>>         
>>>>>        -Testing: -drive driver=null-co,cache=none
>>>>>        +Testing: -drive driver=null-co,read-zeroes=on,cache=none
>>>>>         QEMU X.Y.Z monitor - type 'help' for more information
>>>>>         (qemu) quit
>>>>>         
>>>>>        -Testing: -drive driver=null-co,cache=directsync
>>>>>        +Testing: -drive driver=null-co,read-zeroes=on,cache=directsync
>>>>>         QEMU X.Y.Z monitor - type 'help' for more information
>>>>>         (qemu) quit
>>>>>         
>>>>>        -Testing: -drive driver=null-co,cache=writeback
>>>>>        +Testing: -drive driver=null-co,read-zeroes=on,cache=writeback
>>>>>         QEMU X.Y.Z monitor - type 'help' for more information
>>>>>         (qemu) quit
>>>>>         
>>>>>        -Testing: -drive driver=null-co,cache=writethrough
>>>>>        +Testing: -drive driver=null-co,read-zeroes=on,cache=writethrough
>>>>>         QEMU X.Y.Z monitor - type 'help' for more information
>>>>>         (qemu) quit
>>>>>         
>>>>>        -Testing: -drive driver=null-co,cache=unsafe
>>>>>        +Testing: -drive driver=null-co,read-zeroes=on,cache=unsafe
>>>>>         QEMU X.Y.Z monitor - type 'help' for more information
>>>>>         (qemu) quit
>>>>>         
>>>>>
>>>>
>>>> Thank you Christian for your report.
>>>> Would you please send the command line you ran the 051 test with?
>>>>
>>>> Kevin,
>>>> How do add the 051.out file to the patch? New version?
>>>
>>> No, we need a follow-up patch. This one is already merged, so we can't
>>> change it any more.
>>>
>>> Kevin
>>>
>>
>> Thank you and Christian both.
>> It is my first time I have been doing the fix patch.
>> Should it be named a specific way like "iotests: Fix for..."?
> 
> People sometimes use a "Fixes: <commit number>" tag in the body of the
> commit message, which is probably a good idea. The subject line just
> describes the change as usual.
> 
> Kevin
> 
Got it.
Thank you.
Andrey
-- 
With the best regards,
Andrey Shinkevich

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

end of thread, other threads:[~2019-07-24  8:23 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-19 13:43 [Qemu-devel] [PULL 00/13] Block layer patches Kevin Wolf
2019-07-19 13:43 ` [Qemu-devel] [PULL 01/13] iotests: Set read-zeroes on in null block driver for Valgrind Kevin Wolf
2019-07-24  7:18   ` Christian Borntraeger
2019-07-24  7:30     ` Andrey Shinkevich
2019-07-24  7:33       ` Christian Borntraeger
2019-07-24  7:37         ` Andrey Shinkevich
2019-07-24  7:38       ` Kevin Wolf
2019-07-24  7:57         ` Andrey Shinkevich
2019-07-24  8:05           ` Kevin Wolf
2019-07-24  8:23             ` Andrey Shinkevich
2019-07-19 13:43 ` [Qemu-devel] [PULL 02/13] block: Introduce BdrvChild.parent_quiesce_counter Kevin Wolf
2019-07-19 13:43 ` [Qemu-devel] [PULL 03/13] tests: Add job commit by drained_end test Kevin Wolf
2019-07-19 13:43 ` [Qemu-devel] [PULL 04/13] block: Add @drained_end_counter Kevin Wolf
2019-07-19 13:43 ` [Qemu-devel] [PULL 05/13] block: Make bdrv_parent_drained_[^_]*() static Kevin Wolf
2019-07-19 13:43 ` [Qemu-devel] [PULL 06/13] tests: Lock AioContexts in test-block-iothread Kevin Wolf
2019-07-19 13:43 ` [Qemu-devel] [PULL 07/13] block: Do not poll in bdrv_do_drained_end() Kevin Wolf
2019-07-19 13:43 ` [Qemu-devel] [PULL 08/13] tests: Extend commit by drained_end test Kevin Wolf
2019-07-19 13:43 ` [Qemu-devel] [PULL 09/13] block: Loop unsafely in bdrv*drained_end() Kevin Wolf
2019-07-19 13:43 ` [Qemu-devel] [PULL 10/13] iotests: Add @has_quit to vm.shutdown() Kevin Wolf
2019-07-19 13:43 ` [Qemu-devel] [PULL 11/13] iotests: Test commit with a filter on the chain Kevin Wolf
2019-07-19 13:43 ` [Qemu-devel] [PULL 12/13] vl: Drain before (block) job cancel when quitting Kevin Wolf
2019-07-19 13:43 ` [Qemu-devel] [PULL 13/13] iotests: Test quitting with job on throttled node Kevin Wolf
2019-07-22  9:11 ` [Qemu-devel] [PULL 00/13] Block layer patches Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).