From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Zheng Xiang <zhengxiang9@huawei.com>, qemu-devel@nongnu.org
Cc: lersek@redhat.com, pbonzini@redhat.com, zhaoshenglong@huawei.com,
christoffer.dall@linaro.org,
"Michael S . Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] vhost: fix corrupting GPA 0 when using uninitialized queues
Date: Fri, 12 Jan 2018 11:39:36 +0100 [thread overview]
Message-ID: <0d69f912-4370-f227-7b59-cfc9caa39f9b@redhat.com> (raw)
In-Reply-To: <20180112101356.27044-1-zhengxiang9@huawei.com>
On 01/12/2018 11:13 AM, Zheng Xiang wrote:
> When guest driver only setup part of queues declared in QEMU, it
> would corrupt guest's physical address 0 when using uninitialized
> queues in vhost_virtqueue_start.
>
> In AARCH64 virtual machines, the address of system memory starts at
> 0x40000000 and the address of rom starts at 0. So, when using qemu
> with vhost-scsi, it will fail with below error:
> qemu-kvm: Error start vhost dev
> qemu-kvm: unable to start vhost-scsi: Cannot allocate memory
>
> This patch fix this issue by skipping calling vhost_virtqueue_start
> for uninitialized queues.
>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Zheng Xiang <zhengxiang9@huawei.com>
> ---
> hw/virtio/vhost.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index e4290ce..ac79ffd 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -1532,6 +1532,8 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
> goto fail_mem;
> }
> for (i = 0; i < hdev->nvqs; ++i) {
> + if (virtio_queue_get_desc_addr(vdev, hdev->vq_index + i) == 0)
> + continue;
> r = vhost_virtqueue_start(hdev,
> vdev,
> hdev->vqs + i,
>
Thanks, it fixes the silent corruption that happens with vhost-user net
backend and Windows guests, when the number of queues pairs declared in
Qemu is higher than the number of vcpus.
Tested-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Maxime
next prev parent reply other threads:[~2018-01-12 10:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-12 10:13 [Qemu-devel] [PATCH] vhost: fix corrupting GPA 0 when using uninitialized queues Zheng Xiang
2018-01-12 10:39 ` Maxime Coquelin [this message]
2018-01-12 11:36 ` no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0d69f912-4370-f227-7b59-cfc9caa39f9b@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=christoffer.dall@linaro.org \
--cc=lersek@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=zhaoshenglong@huawei.com \
--cc=zhengxiang9@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).