[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 2/7] vhost: check queue state in the vhost_dev_set_log rou
From: |
Raphael Norwitz |
Subject: |
Re: [PATCH v4 2/7] vhost: check queue state in the vhost_dev_set_log routine |
Date: |
Tue, 8 Sep 2020 22:57:01 -0400 |
On Fri, Sep 4, 2020 at 5:32 AM Dima Stepanov <dimastep@yandex-team.ru> wrote:
>
> If the vhost-user-blk daemon provides only one virtqueue, but device was
> added with several queues, then QEMU will send more VHOST-USER command
> than expected by daemon side. The vhost_virtqueue_start() routine
> handles such case by checking the return value from the
> virtio_queue_get_desc_addr() function call. Add the same check to the
> vhost_dev_set_log() routine.
>
> Signed-off-by: Dima Stepanov <dimastep@yandex-team.ru>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
> ---
> hw/virtio/vhost.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index ffef7ab..a08b7d8 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -825,12 +825,24 @@ static int vhost_dev_set_features(struct vhost_dev *dev,
> static int vhost_dev_set_log(struct vhost_dev *dev, bool enable_log)
> {
> int r, i, idx;
> + hwaddr addr;
> +
> r = vhost_dev_set_features(dev, enable_log);
> if (r < 0) {
> goto err_features;
> }
> for (i = 0; i < dev->nvqs; ++i) {
> idx = dev->vhost_ops->vhost_get_vq_index(dev, dev->vq_index + i);
> + addr = virtio_queue_get_desc_addr(dev->vdev, idx);
> + if (!addr) {
> + /*
> + * The queue might not be ready for start. If this
> + * is the case there is no reason to continue the process.
> + * The similar logic is used by the vhost_virtqueue_start()
> + * routine.
> + */
> + continue;
> + }
> r = vhost_virtqueue_set_addr(dev, dev->vqs + i, idx,
> enable_log);
> if (r < 0) {
> --
> 2.7.4
>
>
- [PATCH v4 0/7] vhost-user-blk: fix the migration issue and enhance qtests, Dima Stepanov, 2020/09/04
- [PATCH v4 2/7] vhost: check queue state in the vhost_dev_set_log routine, Dima Stepanov, 2020/09/04
- Re: [PATCH v4 2/7] vhost: check queue state in the vhost_dev_set_log routine,
Raphael Norwitz <=
- [PATCH v4 1/7] vhost: recheck dev state in the vhost_migration_log routine, Dima Stepanov, 2020/09/04
- [PATCH v4 3/7] tests/qtest/vhost-user-test: prepare the tests for adding new dev class, Dima Stepanov, 2020/09/04
- [PATCH v4 5/7] tests/qtest/vhost-user-test: add support for the vhost-user-blk device, Dima Stepanov, 2020/09/04
- [PATCH v4 7/7] tests/qtest/vhost-user-test: enable the reconnect tests, Dima Stepanov, 2020/09/04