All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 5/5] vhost: send VHOST_USER_SET_VRING_ENABLE at start/stop
Date: Wed, 21 Oct 2015 13:39:11 +0300	[thread overview]
Message-ID: <20151021133634-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <1445418438-24244-5-git-send-email-yuanhan.liu@linux.intel.com>

On Wed, Oct 21, 2015 at 05:07:18PM +0800, Yuanhan Liu wrote:
> Send VHOST_USER_SET_VRING_ENABLE at start/stop when multiple queue
> is negotiated, to inform the backend that we are ready or not.

OK but that's only if MQ is set. If now, we need to do
RESET_OWNER followed by SET_OWNER.

> And exclude VHOST_USER_GET_QUEUE_NUM as one time request, as we need
> to get max_queues for each vhost_dev.

Pls split this part out.

> Suggested-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> ---
>  hw/virtio/vhost-user.c |  1 -
>  hw/virtio/vhost.c      | 18 ++++++++++++++++++
>  2 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> index 12a9104..6532a73 100644
> --- a/hw/virtio/vhost-user.c
> +++ b/hw/virtio/vhost-user.c
> @@ -194,7 +194,6 @@ static bool vhost_user_one_time_request(VhostUserRequest request)
>      case VHOST_USER_SET_OWNER:
>      case VHOST_USER_RESET_OWNER:
>      case VHOST_USER_SET_MEM_TABLE:
> -    case VHOST_USER_GET_QUEUE_NUM:
>          return true;
>      default:
>          return false;
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index c0ed5b2..54a4633 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -1146,6 +1146,19 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
>          }
>      }
>  
> +    /*
> +     * Send VHOST_USER_SET_VRING_ENABLE message when multiple queue
> +     * is negotiated to inform the back end that we are ready.
> +     *
> +     * Only set enable to 1 for first queue pair, as we enable one
> +     * queue pair by default.
> +     */
> +    if (hdev->max_queues > 1 &&

this makes no sense in the generic code.
This is a work around for a protocol bug - belongs in
vhost user internally.
And that's not the way to test this. MQ could be negotiated
even if there is a single pair of queues.

> +        hdev->vhost_ops->vhost_backend_set_vring_enable) {
> +        hdev->vhost_ops->vhost_backend_set_vring_enable(hdev,
> +                                                        hdev->vq_index == 0);
> +    }
> +
>      return 0;
>  fail_log:
>      vhost_log_put(hdev, false);
> @@ -1180,5 +1193,10 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev)
>      hdev->started = false;
>      hdev->log = NULL;
>      hdev->log_size = 0;
> +
> +    if (hdev->max_queues > 1 &&
> +        hdev->vhost_ops->vhost_backend_set_vring_enable) {
> +        hdev->vhost_ops->vhost_backend_set_vring_enable(hdev, 0);
> +    }
>  }
>  
> -- 
> 1.9.0
> 

  reply	other threads:[~2015-10-21 10:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-21  9:07 [Qemu-devel] [PATCH v2 1/5] Revert "vhost: rename VHOST_RESET_OWNER to VHOST_RESET_DEVICE" Yuanhan Liu
2015-10-21  9:07 ` [Qemu-devel] [PATCH v2 2/5] doc: vhost-user: request naming fix Yuanhan Liu
2015-10-21  9:07 ` [Qemu-devel] [PATCH v2 3/5] vhost-user-test: add multiple queue test Yuanhan Liu
2015-10-21 10:34   ` Michael S. Tsirkin
2015-10-21  9:07 ` [Qemu-devel] [PATCH v2 4/5] Revert "vhost-user: Send VHOST_RESET_OWNER on vhost stop" Yuanhan Liu
2015-10-21 10:35   ` Michael S. Tsirkin
2015-10-21 10:39   ` Michael S. Tsirkin
2015-10-21  9:07 ` [Qemu-devel] [PATCH v2 5/5] vhost: send VHOST_USER_SET_VRING_ENABLE at start/stop Yuanhan Liu
2015-10-21 10:39   ` Michael S. Tsirkin [this message]
2015-10-21 13:43     ` Yuanhan Liu
2015-10-21 14:11       ` Michael S. Tsirkin
2015-10-21 14:55         ` Yuanhan Liu
2015-10-21 14:59           ` Michael S. Tsirkin
2015-10-21 10:40 ` [Qemu-devel] [PATCH v2 1/5] Revert "vhost: rename VHOST_RESET_OWNER to VHOST_RESET_DEVICE" Michael S. Tsirkin
2015-10-21 13:04   ` Yuanhan Liu
2015-10-21 14:13     ` Michael S. Tsirkin
2015-10-21 14:18       ` Yuanhan Liu

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=20151021133634-mutt-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yuanhan.liu@linux.intel.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.