From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: linux-kernel@vger.kernel.org,
"Alexander Duyck" <alexander.h.duyck@linux.intel.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"David Hildenbrand" <david@redhat.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
virtualization@lists.linux.dev
Subject: Re: [PATCH 1/2] virtio_balloon: add work around for out of spec QEMU
Date: Wed, 10 Jul 2024 02:16:04 -0400 [thread overview]
Message-ID: <20240710021441-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CACGkMEtszy1YNB1KAtXVdYFkythWDfrYR+w6CSBAQWV1NCc3hA@mail.gmail.com>
On Wed, Jul 10, 2024 at 11:23:20AM +0800, Jason Wang wrote:
> On Fri, Jul 5, 2024 at 6:09 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > QEMU implemented the configuration
> > VIRTIO_BALLOON_F_REPORTING && ! VIRTIO_BALLOON_F_FREE_PAGE_HINT
> > incorrectly: it then uses vq3 for reporting, spec says it is always 4.
> >
> > This is masked by a corresponding bug in driver:
> > add a work around as I'm going to try and fix the driver bug.
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > drivers/virtio/virtio_balloon.c | 19 +++++++++++++++++--
> > 1 file changed, 17 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> > index 9a61febbd2f7..7dc3fcd56238 100644
> > --- a/drivers/virtio/virtio_balloon.c
> > +++ b/drivers/virtio/virtio_balloon.c
> > @@ -597,8 +597,23 @@ static int init_vqs(struct virtio_balloon *vb)
> >
> > err = virtio_find_vqs(vb->vdev, VIRTIO_BALLOON_VQ_MAX, vqs,
> > callbacks, names, NULL);
> > - if (err)
> > - return err;
> > + if (err) {
> > + /*
> > + * Try to work around QEMU bug which since 2020 confused vq numbers
> > + * when VIRTIO_BALLOON_F_REPORTING but not
> > + * VIRTIO_BALLOON_F_FREE_PAGE_HINT are offered.
> > + */
> > + if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_REPORTING) &&
> > + !virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) {
> > + names[VIRTIO_BALLOON_VQ_FREE_PAGE] = "reporting_vq";
> > + callbacks[VIRTIO_BALLOON_VQ_FREE_PAGE] = balloon_ack;
> > + err = virtio_find_vqs(vb->vdev,
> > + VIRTIO_BALLOON_VQ_REPORTING, vqs, callbacks, names, NULL);
> > + }
> > +
> > + if (err)
> > + return err;
> > + }
> >
> > vb->inflate_vq = vqs[VIRTIO_BALLOON_VQ_INFLATE];
> > vb->deflate_vq = vqs[VIRTIO_BALLOON_VQ_DEFLATE];
> > --
> > MST
> >
>
> Acked-by: Jason Wang <jasowang@redhat.com>
>
> Do we need a spec to say this is something that needs to be considered
> by the driver?
>
> Thanks
I'd say it's a temporary situation that we won't need to bother
about in several years.
--
MST
next prev parent reply other threads:[~2024-07-10 6:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-05 10:08 [PATCH 0/2] virtio-balloon: make it spec compliant Michael S. Tsirkin
2024-07-05 10:08 ` [PATCH 1/2] virtio_balloon: add work around for out of spec QEMU Michael S. Tsirkin
2024-07-10 3:11 ` David Hildenbrand
2024-07-10 3:23 ` Jason Wang
2024-07-10 6:16 ` Michael S. Tsirkin [this message]
2024-07-10 7:37 ` Jason Wang
2024-07-10 11:36 ` Michael S. Tsirkin
2024-07-05 10:09 ` [PATCH 2/2] virtio: fix vq # when vq skipped Michael S. Tsirkin
2024-07-10 3:11 ` David Hildenbrand
2024-07-10 3:25 ` Jason Wang
2024-07-05 10:15 ` [PATCH 0/2] virtio-balloon: make it spec compliant David Hildenbrand
2024-07-05 10:19 ` Michael S. Tsirkin
2024-07-05 11:00 ` David Hildenbrand
2024-07-05 11:38 ` Michael S. Tsirkin
2024-07-10 3:09 ` David Hildenbrand
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=20240710021441-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.h.duyck@linux.intel.com \
--cc=david@redhat.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.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.