From: Tiwei Bie <tiwei.bie@intel.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
qemu-devel@nongnu.org, "Johannes Berg" <johannes.berg@intel.com>,
"Michael S . Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2] libvhost-user: fix SLAVE_SEND_FD handling
Date: Wed, 4 Sep 2019 10:06:55 +0800 [thread overview]
Message-ID: <20190904020655.GA30746@___> (raw)
In-Reply-To: <20190903200422.11693-1-johannes@sipsolutions.net>
On Tue, Sep 03, 2019 at 11:04:22PM +0300, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> It doesn't look like this could possibly work properly since
> VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD is defined to 10, but the
> dev->protocol_features has a bitmap. I suppose the peer this
> was tested with also supported VHOST_USER_PROTOCOL_F_LOG_SHMFD,
> in which case the test would always be false, but nevertheless
> the code seems wrong.
Ooops.. I tested `tests/vhost-user-bridge -H`. But as you
said it worked because VHOST_USER_PROTOCOL_F_LOG_SHMFD has
been negotiated. Thanks for spotting this!
>
> Use has_feature() to fix this.
>
> Fixes: d84599f56c82 ("libvhost-user: support host notifier")
Cc: qemu-stable@nongnu.org
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
> contrib/libvhost-user/libvhost-user.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c
> index 6a02eaffc672..fcf4a8a00ed2 100644
> --- a/contrib/libvhost-user/libvhost-user.c
> +++ b/contrib/libvhost-user/libvhost-user.c
> @@ -1097,7 +1097,8 @@ bool vu_set_queue_host_notifier(VuDev *dev, VuVirtq *vq, int fd,
>
> vmsg.fd_num = fd_num;
>
> - if ((dev->protocol_features & VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD) == 0) {
> + if (!has_feature(dev->protocol_features,
> + VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD)) {
We have both of has_feature() and vu_has_feature() called by
other code in this file directly. Not sure which one is preferred..
Personally, I think vu_has_feature() might be better.
Thanks!
Tiwei
> return false;
> }
>
> --
> 2.23.0
>
next prev parent reply other threads:[~2019-09-04 2:10 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-04 12:00 [Qemu-devel] [PULL 0/6] virtio,vhost: fixes, features, cleanups Michael S. Tsirkin
2019-08-20 16:30 ` [Qemu-devel] [PATCH v2] virtio-pci: Add Function Level Reset support Julia Suvorova
2019-09-04 12:01 ` [Qemu-devel] [PULL 4/6] " Michael S. Tsirkin
2019-09-03 20:04 ` [Qemu-devel] [PATCH v2] libvhost-user: fix SLAVE_SEND_FD handling Johannes Berg
2019-09-04 2:06 ` Tiwei Bie [this message]
2019-09-04 9:01 ` Tiwei Bie
2019-09-04 12:01 ` [Qemu-devel] [PULL 5/6] " Michael S. Tsirkin
2019-09-04 6:50 ` [Qemu-devel] [PATCH] libvhost-user: introduce and use vu_has_protocol_feature() Johannes Berg
2019-09-04 9:22 ` Tiwei Bie
2019-09-04 12:01 ` [Qemu-devel] [PULL 6/6] " Michael S. Tsirkin
2019-09-04 17:16 ` [Qemu-devel] [PULL 0/6] virtio, vhost: fixes, features, cleanups Peter Maydell
-- strict thread matches above, loose matches on Subject: below --
2019-08-20 16:06 [Qemu-devel] [PATCH v8 0/3] rng-builtin: add an RNG backend that uses qemu_guest_getrandom() Laurent Vivier
2019-08-20 16:06 ` [Qemu-devel] [PATCH v8 1/3] " Laurent Vivier
2019-09-04 12:00 ` [Qemu-devel] [PULL 1/6] " Michael S. Tsirkin
2019-08-20 16:06 ` [Qemu-devel] [PATCH v8 2/3] virtio-rng: Keep the default backend out of VirtIORNGConf Laurent Vivier
2019-09-04 12:00 ` [Qemu-devel] [PULL 2/6] " Michael S. Tsirkin
2019-08-20 16:06 ` [Qemu-devel] [PATCH v8 3/3] virtio-rng: change default backend to rng-builtin Laurent Vivier
2019-09-04 12:00 ` [Qemu-devel] [PULL 3/6] " Michael S. Tsirkin
2019-09-04 10:26 ` [Qemu-devel] [PATCH v8 0/3] rng-builtin: add an RNG backend that uses qemu_guest_getrandom() Michael S. Tsirkin
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=20190904020655.GA30746@___ \
--to=tiwei.bie@intel.com \
--cc=johannes.berg@intel.com \
--cc=johannes@sipsolutions.net \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).