virtio: fix IO request length in virtio SCSI/block
v2 cover virtio: fix IO request length in virtio SCSI/block
v2:
* the standalone patch to make seg_max virtqueue size dependent
* other patches are postponed
v1:
the initial series
Denis Plotnikov (1):
virtio: make seg_max virtqueue size dependent
hw/block/virtio-blk.c | 2 +- hw/scsi/virtio-scsi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.17.0
PATCH v2 1/1 virtio: make seg_max virtqueue size dependent
seg_max has a restriction to be less or equal to virtqueue size according to Virtio 1.0 specification
Although seg_max can't be set directly, it's worth to express this dependancy directly in the code for sanity purpose.
--- hw/block/virtio-blk.c | 2 +- hw/scsi/virtio-scsi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
hw/block/virtio-blk.c +1 -1
@@ -903,7 +903,7 @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config)blk_get_geometry (s->blk, &capacity);memset (&blkcfg,0 ,sizeof (blkcfg));virtio_stq_p (vdev, &blkcfg.capacity, capacity); -virtio_stl_p (vdev, &blkcfg.seg_max,128 -2 ); +virtio_stl_p (vdev, &blkcfg.seg_max, s->conf.queue_size -2 );virtio_stw_p (vdev, &blkcfg.geometry.cylinders, conf->cyls);virtio_stl_p (vdev, &blkcfg.blk_size, blk_size);virtio_stw_p (vdev, &blkcfg.min_io_size, conf->min_io_size / blk_size);
hw/scsi/virtio-scsi.c +1 -1
@@ -650,7 +650,7 @@ static void virtio_scsi_get_config(VirtIODevice *vdev,VirtIOSCSICommon *s =VIRTIO_SCSI_COMMON (vdev);virtio_stl_p (vdev, &scsiconf->num_queues, s->conf.num_queues); -virtio_stl_p (vdev, &scsiconf->seg_max,128 -2 ); +virtio_stl_p (vdev, &scsiconf->seg_max, s->conf.virtqueue_size -2 );virtio_stl_p (vdev, &scsiconf->max_sectors, s->conf.max_sectors);virtio_stl_p (vdev, &scsiconf->cmd_per_lun, s->conf.cmd_per_lun);virtio_stl_p (vdev, &scsiconf->event_info_size,sizeof (VirtIOSCSIEvent));
Signature · 1 line
2.17.0
Re: [PATCH v2 1/1] virtio: make seg_max virtqueue size dependent
Quoted 7 lines · Denis Plotnikov
seg_maxhas a restriction to be less or equal to virtqueue size according to Virtio 1.0 specificationAlthough
seg_maxcan't be set directly, it's worth to express this dependancy directly in the code for sanity purpose.Signed-off-by Denis Plotnikov <[email protected]>
Guest visible so please make this depend on machine type.
Quoted 33 lines
--- hw/block/virtio-blk.c | 2 +- hw/scsi/virtio-scsi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)hw/block/virtio-blk.c +1
-1@@ -903,7 +903,7 @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config)blk_get_geometry (s->blk, &capacity);memset (&blkcfg,0 ,sizeof (blkcfg));virtio_stq_p (vdev, &blkcfg.capacity, capacity); -virtio_stl_p (vdev, &blkcfg.seg_max,128 -2 ); +virtio_stl_p (vdev, &blkcfg.seg_max, s->conf.queue_size -2 );virtio_stw_p (vdev, &blkcfg.geometry.cylinders, conf->cyls);virtio_stl_p (vdev, &blkcfg.blk_size, blk_size);virtio_stw_p (vdev, &blkcfg.min_io_size, conf->min_io_size / blk_size);hw/scsi/virtio-scsi.c +1
-1@@ -650,7 +650,7 @@ static void virtio_scsi_get_config(VirtIODevice *vdev,VirtIOSCSICommon *s =VIRTIO_SCSI_COMMON (vdev);virtio_stl_p (vdev, &scsiconf->num_queues, s->conf.num_queues); -virtio_stl_p (vdev, &scsiconf->seg_max,128 -2 ); +virtio_stl_p (vdev, &scsiconf->seg_max, s->conf.virtqueue_size -2 );virtio_stl_p (vdev, &scsiconf->max_sectors, s->conf.max_sectors);virtio_stl_p (vdev, &scsiconf->cmd_per_lun, s->conf.cmd_per_lun);virtio_stl_p (vdev, &scsiconf->event_info_size,sizeof (VirtIOSCSIEvent));Signature · 1 line
2.17.0
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series failed the docker-quick@centos7 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
make docker-image-centos7 V=1 NETWORK=1
time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1 === TEST SCRIPT END ===
TEST check-qtest-x86_64: tests/ahci-test
TEST check-unit: tests/test-aio-multithread
test-aio-multithread: /tmp/qemu-test/src/util/async.c:279: aio_ctx_finalize: Assertion `((&ctx->scheduled_coroutines)->slh_first == ((void *)0))' failed.
ERROR - too few tests run (expected 6, got 2)
make: *** [check-unit] Error 1
make: *** Waiting for unfinished jobs....
TEST iotest-qcow2: 013
TEST iotest-qcow2: 017
---
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=66f67685ef3547788ddbfca43e0e9250', '-u', '1001', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=1', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-oc5hqlfd/src/docker-src.2019-11-08-14.32.14.21571:/var/tmp/qemu:z,ro', 'qemu:centos7', '/var/tmp/qemu/run', 'test-quick']' returned non-zero exit status 2. filter=--filter=label=com.qemu.instance.uuid=66f67685ef3547788ddbfca43e0e9250
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-oc5hqlfd/src'
make: *** [docker-run-test-quick@centos7] Error 2
real 11m1.820s
user 0m8.507s
The full log is available at
http://patchew.org/logs/[email protected]/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Re: [PATCH v2 1/1] virtio: make seg_max virtqueue size dependent
In reply to Denis PlotnikovQuoted 1 line · Denis Plotnikov
+
virtio_stl_p(vdev, &blkcfg.seg_max, s->conf.queue_size - 2);
[...]
Quoted 1 line
+
virtio_stl_p(vdev, &scsiconf->seg_max, s->conf.virtqueue_size - 2);
Please extend the queue_size checks to report an error when queue_size <= 2.
Stefan
Re: [PATCH v2 1/1] virtio: make seg_max virtqueue size dependent
Quoted 6 lines · Stefan Hajnoczi
Quoted 1 line · Denis Plotnikov
+
virtio_stl_p(vdev, &blkcfg.seg_max, s->conf.queue_size - 2);[...]
Quoted 1 line
+
virtio_stl_p(vdev, &scsiconf->seg_max, s->conf.virtqueue_size - 2);Please extend the
queue_sizechecks to report an error whenqueue_size<= 2.
Ok.
Denis
Quoted 2 lines
Stefan