All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eugenio Perez Martin <eperezma@redhat.com>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: Si-Wei Liu <si-wei.liu@oracle.com>,
	Jason Wang <jasowang@redhat.com>,
	Michael Tsirkin <mst@redhat.com>,
	qemu-level <qemu-devel@nongnu.org>, Eli Cohen <eli@mellanox.com>
Subject: Re: [PATCH 7/7] vhost-vdpa: backend feature should set only once
Date: Wed, 30 Mar 2022 20:27:04 +0200	[thread overview]
Message-ID: <CAJaqyWdm5PwZVQX2g+VRVYEkgkzRHfGdEO0fnr_uPFbG0J2i5Q@mail.gmail.com> (raw)
In-Reply-To: <20220330173209.2rj43622nfa46s7p@sgarzare-redhat>

On Wed, Mar 30, 2022 at 7:32 PM Stefano Garzarella <sgarzare@redhat.com> wrote:
>
> On Wed, Mar 30, 2022 at 10:12:42AM -0700, Si-Wei Liu wrote:
> >
> >
> >On 3/30/2022 9:24 AM, Stefano Garzarella wrote:
> >>On Tue, Mar 29, 2022 at 11:33:17PM -0700, Si-Wei Liu wrote:
> >>>The vhost_vdpa_one_time_request() branch in
> >>>vhost_vdpa_set_backend_cap() incorrectly sends down
> >>>iotls on vhost_dev with non-zero index. This may
> >>
> >>Little typo s/iotls/ioctls
> >Thanks! Will correct it in v2.
> >
> >>
> >>>end up with multiple VHOST_SET_BACKEND_FEATURES
> >>>ioctl calls sent down on the vhost-vdpa fd that is
> >>>shared between all these vhost_dev's.
> >>>
> >>>To fix it, send down ioctl only once via the first
> >>>vhost_dev with index 0. Toggle the polarity of the
> >>>vhost_vdpa_one_time_request() test would do the trick.
> >>>
> >>>Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
> >>>---
> >>>hw/virtio/vhost-vdpa.c | 2 +-
> >>>1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>>diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
> >>>index c5ed7a3..27ea706 100644
> >>>--- a/hw/virtio/vhost-vdpa.c
> >>>+++ b/hw/virtio/vhost-vdpa.c
> >>>@@ -665,7 +665,7 @@ static int vhost_vdpa_set_backend_cap(struct
> >>>vhost_dev *dev)
> >>>
> >>>    features &= f;
> >>>
> >>>-    if (vhost_vdpa_one_time_request(dev)) {
> >>>+    if (!vhost_vdpa_one_time_request(dev)) {
> >>>        r = vhost_vdpa_call(dev, VHOST_SET_BACKEND_FEATURES, &features);
> >>>        if (r) {
> >>>            return -EFAULT;
> >>>--
> >>>1.8.3.1
> >>>
> >>>
> >>
> >>With that:
> >>
> >>Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
> >>
> >>
> >>
> >>Unrelated to this patch, but the name vhost_vdpa_one_time_request()
> >>is confusing IMHO.
> >Coincidentally I got the same feeling and wanted to rename it to
> >something else, too.
> >
> >>
> >>Not that I'm good with names, but how about we change it to
> >>vhost_vdpa_skip_one_time_request()?
> >How about vhost_vdpa_request_already_applied()? seems to be more
> >readable in the context.
>
> That's fine too, except you can't discern that it's a single request per
> device, so maybe I'd add "dev," but I don't know if it gets too long:
>
> vhost_vdpa_dev_request_already_applied()
>
> And I would also add a comment to the function to explain that we use
> that function for requests that only need to be applied once, regardless
> of the number of queues.
>

In my opinion it should express what it checks: vhost_vdpa_first, or
vhost_vdpa_first_dev, vhost_vdpa_first_queue... and to add a comment
like the one you propose. I think the context of the caller gives
enough information.

I would add that the use is for requests that only need / must be
applied once *and before setting up queues*, *at the beginning of
operation*, or similar, because we do a similar check with
dev->vq_index_end and these are not exchangeable.

Thanks!

> Thanks,
> Stefano
>



  reply	other threads:[~2022-03-30 18:57 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-30  6:33 [PATCH 0/7] vhost-vdpa multiqueue fixes Si-Wei Liu
2022-03-30  6:33 ` [PATCH 1/7] virtio-net: align ctrl_vq index for non-mq guest for vhost_vdpa Si-Wei Liu
2022-03-30  9:00   ` Jason Wang
2022-03-30 15:47     ` Si-Wei Liu
2022-03-31  8:39       ` Jason Wang
2022-04-01 22:32         ` Si-Wei Liu
2022-04-02  2:10           ` Jason Wang
2022-04-05 23:26             ` Si-Wei Liu
2022-03-30  6:33 ` [PATCH 2/7] virtio-net: Fix indentation Si-Wei Liu
2022-03-30  9:01   ` Jason Wang
2022-03-30  6:33 ` [PATCH 3/7] virtio-net: Only enable userland vq if using tap backend Si-Wei Liu
2022-03-30  9:07   ` Jason Wang
2022-03-30  6:33 ` [PATCH 4/7] virtio: don't read pending event on host notifier if disabled Si-Wei Liu
2022-03-30  9:14   ` Jason Wang
2022-03-30 16:40     ` Si-Wei Liu
2022-03-31  8:36       ` Jason Wang
2022-04-01 20:37         ` Si-Wei Liu
2022-04-02  2:00           ` Jason Wang
2022-04-05 19:18             ` Si-Wei Liu
2022-04-07  7:05               ` Jason Wang
2022-04-08  1:02                 ` Si-Wei Liu
2022-04-11  8:49                   ` Jason Wang
2022-03-30  6:33 ` [PATCH 5/7] vhost-vdpa: fix improper cleanup in net_init_vhost_vdpa Si-Wei Liu
2022-03-30  9:15   ` Jason Wang
2022-03-30  6:33 ` [PATCH 6/7] vhost-net: fix improper cleanup in vhost_net_start Si-Wei Liu
2022-03-30  9:30   ` Jason Wang
2022-03-30  6:33 ` [PATCH 7/7] vhost-vdpa: backend feature should set only once Si-Wei Liu
2022-03-30  9:28   ` Jason Wang
2022-03-30 16:24   ` Stefano Garzarella
2022-03-30 17:12     ` Si-Wei Liu
2022-03-30 17:32       ` Stefano Garzarella
2022-03-30 18:27         ` Eugenio Perez Martin [this message]
2022-03-30 22:44           ` Si-Wei Liu
2022-03-30 19:01   ` Eugenio Perez Martin
2022-03-30 23:03     ` Si-Wei Liu
2022-03-31  8:02       ` Eugenio Perez Martin
2022-03-31  8:54         ` Jason Wang
2022-03-31  9:19           ` Eugenio Perez Martin
2022-04-01  2:39             ` Jason Wang
2022-04-01  4:18               ` Si-Wei Liu
2022-04-02  1:33                 ` Jason Wang
2022-03-31 21:15         ` Si-Wei Liu
2022-04-01  8:21           ` Eugenio Perez Martin
2022-04-27  4:28 ` [PATCH 0/7] vhost-vdpa multiqueue fixes Jason Wang
2022-04-27  8:29   ` Si-Wei Liu
2022-04-27  8:38     ` Jason Wang
2022-04-27  9:09       ` Si-Wei Liu
2022-04-29  2:30         ` Jason Wang
2022-04-30  2:07           ` Si-Wei Liu
2022-05-05  8:40             ` 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=CAJaqyWdm5PwZVQX2g+VRVYEkgkzRHfGdEO0fnr_uPFbG0J2i5Q@mail.gmail.com \
    --to=eperezma@redhat.com \
    --cc=eli@mellanox.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    --cc=si-wei.liu@oracle.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.