From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Alexander Duyck <alexander.duyck@gmail.com>,
mst@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com,
David Hildenbrand <david@redhat.com>
Subject: Re: [PATCH] virtio-balloon: Fix page-poison subsection name
Date: Tue, 14 Sep 2021 14:58:56 +0100 [thread overview]
Message-ID: <YUCqoJzt8VjkcNin@redhat.com> (raw)
In-Reply-To: <YUCj3i2BK1HzuztT@work-vm>
On Tue, Sep 14, 2021 at 02:30:06PM +0100, Dr. David Alan Gilbert wrote:
> * David Hildenbrand (david@redhat.com) wrote:
> > On 14.09.21 15:17, Dr. David Alan Gilbert (git) wrote:
> > > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> > >
> > > The subsection name for page-poison was typo'd as:
> > >
> > > vitio-balloon-device/page-poison
> > >
> > > Note the missing 'r' in virtio.
> > >
> > > When we have a machine type that enables page poison, and the guest
> > > enables it (which needs a new kernel), things fail rather unpredictably.
> > >
> > > The fallout from this is that most of the other subsections fail to
> > > load, including things like the feature bits in the device, one
> > > possible fallout is that the physical addresses of the queues
> > > then get aligned differently and we fail with an error about
> > > last_avail_idx being wrong.
> > > It's not obvious to me why this doesn't produce a more obvious failure,
> > > but virtio's vmstate loading is a bit open-coded.
> > >
> > > Fixes: 7483cbbaf82 ("virtio-balloon: Implement support for page poison reporting feature")
> > > bz: https://bugzilla.redhat.com/show_bug.cgi?id=1984401
> > > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > > ---
> > > hw/virtio/virtio-balloon.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
> > > index 5a69dce35d..c6962fcbfe 100644
> > > --- a/hw/virtio/virtio-balloon.c
> > > +++ b/hw/virtio/virtio-balloon.c
> > > @@ -852,7 +852,7 @@ static const VMStateDescription vmstate_virtio_balloon_free_page_hint = {
> > > };
> > > static const VMStateDescription vmstate_virtio_balloon_page_poison = {
> > > - .name = "vitio-balloon-device/page-poison",
> > > + .name = "virtio-balloon-device/page-poison",
> > > .version_id = 1,
> > > .minimum_version_id = 1,
> > > .needed = virtio_balloon_page_poison_support,
> > >
> >
> > Oh, that's very subtle. I wasn't even aware that the prefix really has to
> > match the actual device ... I thought the whole idea of the prefix here was
> > just to make the string unique ...
>
> Subsection naming is *very* critical; the logic is something like:
> 'we're loading the X device'
> a subsection arrives for 'N/P'
> if 'X==N' then it looks in X for subsection P.
> If 'X!=N' then it assumes we've finished loading X
> and P is really for an outer device that X is part of.
> This is horrible.
Is there value in making this more explicit via a code convention
for .name field initializers. eg instead of
.name = "virtio-balloon-device/page-poison",
Prefer
.name = TYPE_VIRTIO_BALLOON "/page-poison"
?
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2021-09-14 14:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-14 13:17 [PATCH] virtio-balloon: Fix page-poison subsection name Dr. David Alan Gilbert (git)
2021-09-14 13:21 ` David Hildenbrand
2021-09-14 13:30 ` Dr. David Alan Gilbert
2021-09-14 13:58 ` Daniel P. Berrangé [this message]
2021-09-14 14:16 ` Dr. David Alan Gilbert
2021-09-14 14:58 ` Philippe Mathieu-Daudé
2021-09-15 8:36 ` Dr. David Alan Gilbert
2021-09-14 13:47 ` Philippe Mathieu-Daudé
2021-09-14 13:51 ` 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=YUCqoJzt8VjkcNin@redhat.com \
--to=berrange@redhat.com \
--cc=alexander.duyck@gmail.com \
--cc=david@redhat.com \
--cc=dgilbert@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--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).