mbox series

[v3,0/6] virtio-blk: add DISCARD and WRITE_ZEROES features

Message ID 20190206112729.37761-1-sgarzare@redhat.com (mailing list archive)
Headers show
Series virtio-blk: add DISCARD and WRITE_ZEROES features | expand

Message

Stefano Garzarella Feb. 6, 2019, 11:27 a.m. UTC
This series adds the support of DISCARD and WRITE_ZEROES commands
and extends the virtio-blk-test to test WRITE_ZEROES command when
the feature is enabled.

v3:
- rebased on master (I removed Based-on tag since the new virtio headers from
  linux v5.0-rc1 are merged)
- added patch 2 to add host_features field (as in virtio-net) [Michael]
- fixed patch 3 (previously 2/5) using the new host_features field
- fixed patch 4 (previously 3/5) following the Stefan's comments:
                - fixed name of functions and fields
                - used vdev and s pointers
                - removed "wz-may-unmap" property
                - split "dwz-max-sectors" in two properties

v2:
- added patch 1 to use virtio_blk_handle_rw_error() with discard operation
- added patch 2 to make those new features machine-type dependent (thanks David)
- fixed patch 3 (previously patch 1/2) adding more checks, block_acct_start()
                for WRITE_ZEROES requests, and configurable parameters to
                initialize the limits (max_sectors, wzeroes_may_unmap).
                (thanks Stefan)
                I moved in a new function the code to handle a single segment,
                in order to simplify the support of multiple segments in the
                future.
- added patch 4 to change the assert on data_size following the discussion with
                Thomas, Changpeng, Michael, and Stefan (thanks all)
- fixed patch 5 (previously patch 2/2) using local dwz_hdr variable instead of
                dynamic allocation (thanks Thomas)

Thanks,
Stefano

Stefano Garzarella (6):
  virtio-blk: add acct_failed param to virtio_blk_handle_rw_error()
  virtio-blk: add host_features field in VirtIOBlock
  virtio-blk: add "discard" and "write-zeroes" properties
  virtio-blk: add DISCARD and WRITE_ZEROES features
  tests/virtio-blk: change assert on data_size in virtio_blk_request()
  tests/virtio-blk: add test for WRITE_ZEROES command

 hw/block/virtio-blk.c          | 213 +++++++++++++++++++++++++++++++--
 hw/core/machine.c              |   2 +
 include/hw/virtio/virtio-blk.h |   5 +-
 tests/virtio-blk-test.c        |  75 +++++++++++-
 4 files changed, 281 insertions(+), 14 deletions(-)

Comments

no-reply@patchew.org Feb. 7, 2019, 7:21 p.m. UTC | #1
Patchew URL: https://patchew.org/QEMU/20190206112729.37761-1-sgarzare@redhat.com/



Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-mingw@fedora SHOW_ENV=1 J=14
=== TEST SCRIPT END ===

  CC      aarch64-softmmu/hw/arm/smmuv3.o
In file included from /tmp/qemu-test/src/hw/block/virtio-blk.c:15:
/tmp/qemu-test/src/hw/block/virtio-blk.c: In function 'virtio_blk_device_realize':
/tmp/qemu-test/src/include/qapi/error.h:166:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'long long unsigned int' [-Werror=format=]
                         (fmt), ## __VA_ARGS__)
                         ^~~~~
/tmp/qemu-test/src/hw/block/virtio-blk.c:1121:9: note: in expansion of macro 'error_setg'
         error_setg(errp, "invalid max-discard-sectors property (%" PRIu32 ")"
         ^~~~~~~~~~
/tmp/qemu-test/src/include/qapi/error.h:166:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'long long unsigned int' [-Werror=format=]
                         (fmt), ## __VA_ARGS__)
                         ^~~~~
/tmp/qemu-test/src/hw/block/virtio-blk.c:1130:9: note: in expansion of macro 'error_setg'
---
  CC      aarch64-softmmu/target/arm/translate-sve.o
In file included from /tmp/qemu-test/src/hw/block/virtio-blk.c:15:
/tmp/qemu-test/src/hw/block/virtio-blk.c: In function 'virtio_blk_device_realize':
/tmp/qemu-test/src/include/qapi/error.h:166:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'long long unsigned int' [-Werror=format=]
                         (fmt), ## __VA_ARGS__)
                         ^~~~~
/tmp/qemu-test/src/hw/block/virtio-blk.c:1121:9: note: in expansion of macro 'error_setg'
         error_setg(errp, "invalid max-discard-sectors property (%" PRIu32 ")"
         ^~~~~~~~~~
/tmp/qemu-test/src/include/qapi/error.h:166:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'long long unsigned int' [-Werror=format=]
                         (fmt), ## __VA_ARGS__)
                         ^~~~~
/tmp/qemu-test/src/hw/block/virtio-blk.c:1130:9: note: in expansion of macro 'error_setg'


The full log is available at
http://patchew.org/logs/20190206112729.37761-1-sgarzare@redhat.com/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Michael S. Tsirkin Feb. 7, 2019, 7:30 p.m. UTC | #2
On Wed, Feb 06, 2019 at 12:27:23PM +0100, Stefano Garzarella wrote:
> This series adds the support of DISCARD and WRITE_ZEROES commands
> and extends the virtio-blk-test to test WRITE_ZEROES command when
> the feature is enabled.

pls note and fix patchew errors:

https://patchew.org/QEMU/20190206112729.37761-1-sgarzare@redhat.com/

> v3:
> - rebased on master (I removed Based-on tag since the new virtio headers from
>   linux v5.0-rc1 are merged)
> - added patch 2 to add host_features field (as in virtio-net) [Michael]
> - fixed patch 3 (previously 2/5) using the new host_features field
> - fixed patch 4 (previously 3/5) following the Stefan's comments:
>                 - fixed name of functions and fields
>                 - used vdev and s pointers
>                 - removed "wz-may-unmap" property
>                 - split "dwz-max-sectors" in two properties
> 
> v2:
> - added patch 1 to use virtio_blk_handle_rw_error() with discard operation
> - added patch 2 to make those new features machine-type dependent (thanks David)
> - fixed patch 3 (previously patch 1/2) adding more checks, block_acct_start()
>                 for WRITE_ZEROES requests, and configurable parameters to
>                 initialize the limits (max_sectors, wzeroes_may_unmap).
>                 (thanks Stefan)
>                 I moved in a new function the code to handle a single segment,
>                 in order to simplify the support of multiple segments in the
>                 future.
> - added patch 4 to change the assert on data_size following the discussion with
>                 Thomas, Changpeng, Michael, and Stefan (thanks all)
> - fixed patch 5 (previously patch 2/2) using local dwz_hdr variable instead of
>                 dynamic allocation (thanks Thomas)
> 
> Thanks,
> Stefano
> 
> Stefano Garzarella (6):
>   virtio-blk: add acct_failed param to virtio_blk_handle_rw_error()
>   virtio-blk: add host_features field in VirtIOBlock
>   virtio-blk: add "discard" and "write-zeroes" properties
>   virtio-blk: add DISCARD and WRITE_ZEROES features
>   tests/virtio-blk: change assert on data_size in virtio_blk_request()
>   tests/virtio-blk: add test for WRITE_ZEROES command
> 
>  hw/block/virtio-blk.c          | 213 +++++++++++++++++++++++++++++++--
>  hw/core/machine.c              |   2 +
>  include/hw/virtio/virtio-blk.h |   5 +-
>  tests/virtio-blk-test.c        |  75 +++++++++++-
>  4 files changed, 281 insertions(+), 14 deletions(-)
> 
> -- 
> 2.20.1
Stefano Garzarella Feb. 7, 2019, 8:17 p.m. UTC | #3
On Thu, Feb 7, 2019 at 8:30 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Wed, Feb 06, 2019 at 12:27:23PM +0100, Stefano Garzarella wrote:
> > This series adds the support of DISCARD and WRITE_ZEROES commands
> > and extends the virtio-blk-test to test WRITE_ZEROES command when
> > the feature is enabled.
>
> pls note and fix patchew errors:
>
> https://patchew.org/QEMU/20190206112729.37761-1-sgarzare@redhat.com/

Oh, thanks! I'll fix on v4.

Stefano
no-reply@patchew.org Feb. 8, 2019, 12:28 a.m. UTC | #4
Patchew URL: https://patchew.org/QEMU/20190206112729.37761-1-sgarzare@redhat.com/



Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-mingw@fedora SHOW_ENV=1 J=14
=== TEST SCRIPT END ===

  CC      x86_64-softmmu/target/i386/gdbstub.o
In file included from /tmp/qemu-test/src/hw/block/virtio-blk.c:15:
/tmp/qemu-test/src/hw/block/virtio-blk.c: In function 'virtio_blk_device_realize':
/tmp/qemu-test/src/include/qapi/error.h:166:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'long long unsigned int' [-Werror=format=]
                         (fmt), ## __VA_ARGS__)
                         ^~~~~
/tmp/qemu-test/src/hw/block/virtio-blk.c:1121:9: note: in expansion of macro 'error_setg'
         error_setg(errp, "invalid max-discard-sectors property (%" PRIu32 ")"
         ^~~~~~~~~~
/tmp/qemu-test/src/include/qapi/error.h:166:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'long long unsigned int' [-Werror=format=]
                         (fmt), ## __VA_ARGS__)
                         ^~~~~
/tmp/qemu-test/src/hw/block/virtio-blk.c:1130:9: note: in expansion of macro 'error_setg'
---
  CC      aarch64-softmmu/hw/misc/omap_l4.o
In file included from /tmp/qemu-test/src/hw/block/virtio-blk.c:15:
/tmp/qemu-test/src/hw/block/virtio-blk.c: In function 'virtio_blk_device_realize':
/tmp/qemu-test/src/include/qapi/error.h:166:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'long long unsigned int' [-Werror=format=]
                         (fmt), ## __VA_ARGS__)
                         ^~~~~
/tmp/qemu-test/src/hw/block/virtio-blk.c:1121:9: note: in expansion of macro 'error_setg'
         error_setg(errp, "invalid max-discard-sectors property (%" PRIu32 ")"
         ^~~~~~~~~~
/tmp/qemu-test/src/include/qapi/error.h:166:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'long long unsigned int' [-Werror=format=]
                         (fmt), ## __VA_ARGS__)
                         ^~~~~
/tmp/qemu-test/src/hw/block/virtio-blk.c:1130:9: note: in expansion of macro 'error_setg'


The full log is available at
http://patchew.org/logs/20190206112729.37761-1-sgarzare@redhat.com/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
no-reply@patchew.org Feb. 8, 2019, 1:18 a.m. UTC | #5
Patchew URL: https://patchew.org/QEMU/20190206112729.37761-1-sgarzare@redhat.com/



Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-mingw@fedora SHOW_ENV=1 J=14
=== TEST SCRIPT END ===

  CC      aarch64-softmmu/hw/misc/tz-msc.o
In file included from /tmp/qemu-test/src/hw/block/virtio-blk.c:15:
/tmp/qemu-test/src/hw/block/virtio-blk.c: In function 'virtio_blk_device_realize':
/tmp/qemu-test/src/include/qapi/error.h:166:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'long long unsigned int' [-Werror=format=]
                         (fmt), ## __VA_ARGS__)
                         ^~~~~
/tmp/qemu-test/src/hw/block/virtio-blk.c:1121:9: note: in expansion of macro 'error_setg'
         error_setg(errp, "invalid max-discard-sectors property (%" PRIu32 ")"
         ^~~~~~~~~~
/tmp/qemu-test/src/include/qapi/error.h:166:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'long long unsigned int' [-Werror=format=]
                         (fmt), ## __VA_ARGS__)
                         ^~~~~
/tmp/qemu-test/src/hw/block/virtio-blk.c:1130:9: note: in expansion of macro 'error_setg'
---
  CC      aarch64-softmmu/hw/misc/aspeed_scu.o
In file included from /tmp/qemu-test/src/hw/block/virtio-blk.c:15:
/tmp/qemu-test/src/hw/block/virtio-blk.c: In function 'virtio_blk_device_realize':
/tmp/qemu-test/src/include/qapi/error.h:166:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'long long unsigned int' [-Werror=format=]
                         (fmt), ## __VA_ARGS__)
                         ^~~~~
/tmp/qemu-test/src/hw/block/virtio-blk.c:1121:9: note: in expansion of macro 'error_setg'
         error_setg(errp, "invalid max-discard-sectors property (%" PRIu32 ")"
         ^~~~~~~~~~
/tmp/qemu-test/src/include/qapi/error.h:166:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'long long unsigned int' [-Werror=format=]
                         (fmt), ## __VA_ARGS__)
                         ^~~~~
/tmp/qemu-test/src/hw/block/virtio-blk.c:1130:9: note: in expansion of macro 'error_setg'


The full log is available at
http://patchew.org/logs/20190206112729.37761-1-sgarzare@redhat.com/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
no-reply@patchew.org Feb. 8, 2019, 1:34 a.m. UTC | #6
Patchew URL: https://patchew.org/QEMU/20190206112729.37761-1-sgarzare@redhat.com/



Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-mingw@fedora SHOW_ENV=1 J=14
=== TEST SCRIPT END ===

  CC      x86_64-softmmu/target/i386/int_helper.o
In file included from /tmp/qemu-test/src/hw/block/virtio-blk.c:15:
/tmp/qemu-test/src/hw/block/virtio-blk.c: In function 'virtio_blk_device_realize':
/tmp/qemu-test/src/include/qapi/error.h:166:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'long long unsigned int' [-Werror=format=]
                         (fmt), ## __VA_ARGS__)
                         ^~~~~
/tmp/qemu-test/src/hw/block/virtio-blk.c:1121:9: note: in expansion of macro 'error_setg'
         error_setg(errp, "invalid max-discard-sectors property (%" PRIu32 ")"
         ^~~~~~~~~~
/tmp/qemu-test/src/include/qapi/error.h:166:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'long long unsigned int' [-Werror=format=]
                         (fmt), ## __VA_ARGS__)
                         ^~~~~
/tmp/qemu-test/src/hw/block/virtio-blk.c:1130:9: note: in expansion of macro 'error_setg'
---
  CC      aarch64-softmmu/hw/misc/auxbus.o
In file included from /tmp/qemu-test/src/hw/block/virtio-blk.c:15:
/tmp/qemu-test/src/hw/block/virtio-blk.c: In function 'virtio_blk_device_realize':
/tmp/qemu-test/src/include/qapi/error.h:166:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'long long unsigned int' [-Werror=format=]
                         (fmt), ## __VA_ARGS__)
                         ^~~~~
/tmp/qemu-test/src/hw/block/virtio-blk.c:1121:9: note: in expansion of macro 'error_setg'
         error_setg(errp, "invalid max-discard-sectors property (%" PRIu32 ")"
         ^~~~~~~~~~
/tmp/qemu-test/src/include/qapi/error.h:166:25: error: format '%lu' expects argument of type 'long unsigned int', but argument 7 has type 'long long unsigned int' [-Werror=format=]
                         (fmt), ## __VA_ARGS__)
                         ^~~~~
/tmp/qemu-test/src/hw/block/virtio-blk.c:1130:9: note: in expansion of macro 'error_setg'


The full log is available at
http://patchew.org/logs/20190206112729.37761-1-sgarzare@redhat.com/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Stefan Hajnoczi Feb. 8, 2019, 6:06 a.m. UTC | #7
On Wed, Feb 06, 2019 at 12:27:23PM +0100, Stefano Garzarella wrote:
> This series adds the support of DISCARD and WRITE_ZEROES commands
> and extends the virtio-blk-test to test WRITE_ZEROES command when
> the feature is enabled.
> 
> v3:
> - rebased on master (I removed Based-on tag since the new virtio headers from
>   linux v5.0-rc1 are merged)
> - added patch 2 to add host_features field (as in virtio-net) [Michael]
> - fixed patch 3 (previously 2/5) using the new host_features field
> - fixed patch 4 (previously 3/5) following the Stefan's comments:
>                 - fixed name of functions and fields
>                 - used vdev and s pointers
>                 - removed "wz-may-unmap" property
>                 - split "dwz-max-sectors" in two properties
> 
> v2:
> - added patch 1 to use virtio_blk_handle_rw_error() with discard operation
> - added patch 2 to make those new features machine-type dependent (thanks David)
> - fixed patch 3 (previously patch 1/2) adding more checks, block_acct_start()
>                 for WRITE_ZEROES requests, and configurable parameters to
>                 initialize the limits (max_sectors, wzeroes_may_unmap).
>                 (thanks Stefan)
>                 I moved in a new function the code to handle a single segment,
>                 in order to simplify the support of multiple segments in the
>                 future.
> - added patch 4 to change the assert on data_size following the discussion with
>                 Thomas, Changpeng, Michael, and Stefan (thanks all)
> - fixed patch 5 (previously patch 2/2) using local dwz_hdr variable instead of
>                 dynamic allocation (thanks Thomas)
> 
> Thanks,
> Stefano
> 
> Stefano Garzarella (6):
>   virtio-blk: add acct_failed param to virtio_blk_handle_rw_error()
>   virtio-blk: add host_features field in VirtIOBlock
>   virtio-blk: add "discard" and "write-zeroes" properties
>   virtio-blk: add DISCARD and WRITE_ZEROES features
>   tests/virtio-blk: change assert on data_size in virtio_blk_request()
>   tests/virtio-blk: add test for WRITE_ZEROES command
> 
>  hw/block/virtio-blk.c          | 213 +++++++++++++++++++++++++++++++--
>  hw/core/machine.c              |   2 +
>  include/hw/virtio/virtio-blk.h |   5 +-
>  tests/virtio-blk-test.c        |  75 +++++++++++-
>  4 files changed, 281 insertions(+), 14 deletions(-)
> 
> -- 
> 2.20.1
> 

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Stefano Garzarella Feb. 8, 2019, 8:04 a.m. UTC | #8
On Fri, Feb 08, 2019 at 02:06:18PM +0800, Stefan Hajnoczi wrote:
> On Wed, Feb 06, 2019 at 12:27:23PM +0100, Stefano Garzarella wrote:
> > This series adds the support of DISCARD and WRITE_ZEROES commands
> > and extends the virtio-blk-test to test WRITE_ZEROES command when
> > the feature is enabled.
> > 
> 
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

Thanks Stefan!

I'll send a v4 to fix the error with mingw compiler.

Cheers,
Stefano