qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	Raphael Norwitz <raphael.norwitz@nutanix.com>
Subject: Re: [PATCH] libvhost-user: advertise vring features
Date: Fri, 29 May 2020 22:10:26 +0200	[thread overview]
Message-ID: <CAMxuvayP6D5D39r8qh2_1arqQ6ybG4EDO6BrfLZ=tGTijR==KA@mail.gmail.com> (raw)
In-Reply-To: <20200529161338.456017-1-stefanha@redhat.com>

Hi

On Fri, May 29, 2020 at 6:13 PM Stefan Hajnoczi <stefanha@redhat.com> wrote:
>
> libvhost-user implements several vring features without advertising
> them. There is no way for the vhost-user master to detect support for
> these features.
>
> Things more or less work today because QEMU assumes the vhost-user
> backend always implements certain feature bits like
> VIRTIO_RING_F_EVENT_IDX. This is not documented anywhere.
>
> This patch explicitly advertises features implemented in libvhost-user
> so that the vhost-user master does not need to make undocumented
> assumptions.
>
> Feature bits that libvhost-user now advertises can be removed from
> vhost-user-blk.c. Devices should not be responsible for advertising
> vring feature bits, that is libvhost-user's job.
>
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
> I have tested make check and virtiofsd.
> ---
>  contrib/libvhost-user/libvhost-user.c   | 10 ++++++++++
>  contrib/vhost-user-blk/vhost-user-blk.c |  4 +---
>  2 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
> index 3bca996c62..b43874ba12 100644
> --- a/contrib/libvhost-user/libvhost-user.c
> +++ b/contrib/libvhost-user/libvhost-user.c
> @@ -495,6 +495,16 @@ static bool
>  vu_get_features_exec(VuDev *dev, VhostUserMsg *vmsg)
>  {
>      vmsg->payload.u64 =
> +        /*
> +         * The following VIRTIO feature bits are supported by our virtqueue
> +         * implementation:
> +         */
> +        1ULL << VIRTIO_F_NOTIFY_ON_EMPTY |
> +        1ULL << VIRTIO_RING_F_INDIRECT_DESC |
> +        1ULL << VIRTIO_RING_F_EVENT_IDX |
> +        1ULL << VIRTIO_F_VERSION_1 |
> +
> +        /* vhost-user feature bits */
>          1ULL << VHOST_F_LOG_ALL |
>          1ULL << VHOST_USER_F_PROTOCOL_FEATURES;
>
> diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c
> index 6fd91c7e99..25eccd02b5 100644
> --- a/contrib/vhost-user-blk/vhost-user-blk.c
> +++ b/contrib/vhost-user-blk/vhost-user-blk.c
> @@ -382,9 +382,7 @@ vub_get_features(VuDev *dev)
>                 1ull << VIRTIO_BLK_F_DISCARD |
>                 1ull << VIRTIO_BLK_F_WRITE_ZEROES |
>                 #endif
> -               1ull << VIRTIO_BLK_F_CONFIG_WCE |
> -               1ull << VIRTIO_F_VERSION_1 |
> -               1ull << VHOST_USER_F_PROTOCOL_FEATURES;
> +               1ull << VIRTIO_BLK_F_CONFIG_WCE;
>
>      if (vdev_blk->enable_ro) {
>          features |= 1ull << VIRTIO_BLK_F_RO;
> --
> 2.25.4
>



      reply	other threads:[~2020-05-29 20:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29 16:13 [PATCH] libvhost-user: advertise vring features Stefan Hajnoczi
2020-05-29 20:10 ` Marc-André Lureau [this message]

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='CAMxuvayP6D5D39r8qh2_1arqQ6ybG4EDO6BrfLZ=tGTijR==KA@mail.gmail.com' \
    --to=marcandre.lureau@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=raphael.norwitz@nutanix.com \
    --cc=stefanha@redhat.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).