qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Eugenio Perez Martin <eperezma@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>, qemu-level <qemu-devel@nongnu.org>
Subject: Re: [PATCH] vhost: Fix last queue index of devices with no cvq
Date: Mon, 1 Nov 2021 05:12:28 -0400	[thread overview]
Message-ID: <20211101051219-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAJaqyWcbTLXqgOgRkwVF6rgZrLhejfXh+GLePaBS61R4HYQWDg@mail.gmail.com>

On Mon, Nov 01, 2021 at 10:03:19AM +0100, Eugenio Perez Martin wrote:
> On Sun, Oct 31, 2021 at 10:47 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Fri, Oct 29, 2021 at 04:16:08PM +0200, Eugenio Pérez wrote:
> > > The -1 assumes that all devices with no cvq have an spare vq allocated
> > > for them, but with no offer of VIRTIO_NET_F_CTRL_VQ. This may not be the
> > > case, and the device may have a pair number of queues.
> > >
> > > To fix this, just resort to the lower even number of queues.
> > >
> > > Fixes: 049eb15b5fc9 ("vhost: record the last virtqueue index for the virtio device")
> > > Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> > > ---
> > >  hw/net/vhost_net.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
> > > index 0d888f29a6..edf56a597f 100644
> > > --- a/hw/net/vhost_net.c
> > > +++ b/hw/net/vhost_net.c
> > > @@ -330,7 +330,7 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
> > >      NetClientState *peer;
> > >
> > >      if (!cvq) {
> > > -        last_index -= 1;
> > > +        last_index &= ~1ULL;
> > >      }
> > >
> > >      if (!k->set_guest_notifiers) {
> >
> > could this code be made clearer?
> >
> 
> I can expand both for sure, but do you mean clearer because the
> operation is obscure (to remove the last bit to make last_index even)
> or because the need of that operation is not clear enough?
> 
> Thanks!

I'm not sure ... both?

> > > --
> > > 2.27.0
> >



  reply	other threads:[~2021-11-01  9:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-29 14:16 [PATCH] vhost: Fix last queue index of devices with no cvq Eugenio Pérez
2021-10-31 21:47 ` Michael S. Tsirkin
2021-11-01  9:03   ` Eugenio Perez Martin
2021-11-01  9:12     ` Michael S. Tsirkin [this message]
2021-11-01  3:33 ` Jason Wang
2021-11-01  8:58   ` Eugenio Perez Martin
2021-11-01 15:42     ` Eugenio Perez Martin
2021-11-01 20:48       ` Michael S. Tsirkin
2021-11-02  6:54         ` Eugenio Perez Martin
2021-11-02  4:08     ` Jason Wang
2021-11-02  6:58       ` Eugenio Perez Martin
2021-11-02  7:04         ` Jason Wang
2021-11-02 10:23           ` Eugenio Perez Martin

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=20211101051219-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@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).