From: "Michael S. Tsirkin" <mst@redhat.com>
To: Thibaut Collet <thibaut.collet@6wind.com>
Cc: pbonzini@redhat.com, jasowang@redhat.com,
marcandre.lureau@gmail.com, qemu-devel@nongnu.org,
haifeng.lin@huawei.com
Subject: Re: [Qemu-devel] [PATCH 1/1] vhost: set the correct queue index in case of migration with multiqueue
Date: Mon, 19 Oct 2015 18:41:50 +0300 [thread overview]
Message-ID: <20151019183948-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <1445259567-28516-2-git-send-email-thibaut.collet@6wind.com>
On Mon, Oct 19, 2015 at 02:59:27PM +0200, Thibaut Collet wrote:
> When a live migration is started the log address to mark dirty pages is provided
> to the vhost backend through the vhost_dev_set_log function.
> This function is called for each queue pairs but the queue index is wrongly set:
> always set to the first queue pair. Then vhost backend lost descriptor addresses
> of the queue pairs greater than 1 and behaviour of the vhost backend is
> unpredictable.
>
> The queue index is computed by taking account of the vq_index (to retrieve the
> queue pair index) and calling the vhost_get_vq_index method of the backend.
>
> Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
This needs some thought to make sure we don't break the kernel vhost.
I queued this temporarily to enable your testing but I think it would be
preferable to make vhost_virtqueue_set_addr for vhost_user call
vhost_get_vq_index internally.
> ---
> hw/virtio/vhost.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index feeaaa4..de29968 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -656,13 +656,14 @@ static int vhost_dev_set_features(struct vhost_dev *dev, bool enable_log)
>
> static int vhost_dev_set_log(struct vhost_dev *dev, bool enable_log)
> {
> - int r, t, i;
> + int r, t, i, idx;
> r = vhost_dev_set_features(dev, enable_log);
> if (r < 0) {
> goto err_features;
> }
> for (i = 0; i < dev->nvqs; ++i) {
> - r = vhost_virtqueue_set_addr(dev, dev->vqs + i, i,
> + idx = dev->vhost_ops->vhost_get_vq_index(dev, dev->vq_index + i);
> + r = vhost_virtqueue_set_addr(dev, dev->vqs + i, idx,
> enable_log);
> if (r < 0) {
> goto err_vq;
> @@ -671,7 +672,8 @@ static int vhost_dev_set_log(struct vhost_dev *dev, bool enable_log)
> return 0;
> err_vq:
> for (; i >= 0; --i) {
> - t = vhost_virtqueue_set_addr(dev, dev->vqs + i, i,
> + idx = dev->vhost_ops->vhost_get_vq_index(dev, dev->vq_index + i);
> + t = vhost_virtqueue_set_addr(dev, dev->vqs + i, idx,
> dev->log_enabled);
> assert(t >= 0);
> }
> --
> 2.1.4
next prev parent reply other threads:[~2015-10-19 15:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-19 12:59 [Qemu-devel] [PATCH 0/1] vhost-user: support of live migration with multiqueue Thibaut Collet
2015-10-19 12:59 ` [Qemu-devel] [PATCH 1/1] vhost: set the correct queue index in case of " Thibaut Collet
2015-10-19 15:41 ` Michael S. Tsirkin [this message]
2015-10-19 16:41 ` Thibaut Collet
2015-10-20 13:25 ` Michael S. Tsirkin
2015-10-20 13:33 ` Michael S. Tsirkin
2015-10-21 3:03 ` Jason Wang
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=20151019183948-mutt-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=haifeng.lin@huawei.com \
--cc=jasowang@redhat.com \
--cc=marcandre.lureau@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thibaut.collet@6wind.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.