[PULL,01/13] iotests: Set read-zeroes on in null block driver for Valgrind
diff mbox series

Message ID 20190719134345.23526-2-kwolf@redhat.com
State New
Headers show
Series
  • [PULL,01/13] iotests: Set read-zeroes on in null block driver for Valgrind
Related show

Commit Message

Kevin Wolf July 19, 2019, 1:43 p.m. UTC
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(-)

Comments

Christian Borntraeger July 24, 2019, 7:18 a.m. UTC | #1
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      fail       [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"}}
>
Andrey Shinkevich July 24, 2019, 7:30 a.m. UTC | #2
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      fail       [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"}}
>>
>
Christian Borntraeger July 24, 2019, 7:33 a.m. UTC | #3
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      fail       [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"}}
>>>
>>
>
Andrey Shinkevich July 24, 2019, 7:37 a.m. UTC | #4
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      fail       [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"}}
>>>>
>>>
>>
>
Kevin Wolf July 24, 2019, 7:38 a.m. UTC | #5
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      fail       [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
Andrey Shinkevich July 24, 2019, 7:57 a.m. UTC | #6
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      fail       [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
Kevin Wolf July 24, 2019, 8:05 a.m. UTC | #7
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      fail       [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
Andrey Shinkevich July 24, 2019, 8:23 a.m. UTC | #8
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      fail       [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

Patch
diff mbox series

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"}}