From: Peter Xu <peterx@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: qemu-devel@nongnu.org, "Gerd Hoffmann" <kraxel@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Fabiano Rosas" <farosas@suse.de>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Yanan Wang" <wangyanan55@huawei.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Eduardo Habkost" <eduardo@habkost.net>
Subject: Re: [PATCH v2 3/4] virtio-gpu: add x-vmstate-version
Date: Tue, 14 May 2024 07:06:02 -0600 [thread overview]
Message-ID: <ZkNhuvPcxTLalF69@x1n> (raw)
In-Reply-To: <CAMxuvayd5X04dOSRMHYQr-NbHrwNeZLTD6wvNb2bq6c+-qU-9w@mail.gmail.com>
On Tue, May 14, 2024 at 11:25:26AM +0400, Marc-André Lureau wrote:
> Hi
>
> On Tue, May 14, 2024 at 8:35 AM Peter Xu <peterx@redhat.com> wrote:
> >
> > Hey, Marc-Andre,
> >
> > On Mon, May 13, 2024 at 11:19:04AM +0400, marcandre.lureau@redhat.com wrote:
> > > diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> > > index ae831b6b3e..7f9fb5eacc 100644
> > > --- a/hw/display/virtio-gpu.c
> > > +++ b/hw/display/virtio-gpu.c
> > > @@ -1234,7 +1234,8 @@ static int virtio_gpu_save(QEMUFile *f, void *opaque, size_t size,
> > > }
> > > qemu_put_be32(f, 0); /* end of list */
> > >
> > > - return vmstate_save_state(f, &vmstate_virtio_gpu_scanouts, g, NULL);
> > > + return vmstate_save_state_v(f, &vmstate_virtio_gpu_scanouts, g,
> > > + NULL, g->vmstate_version, NULL);
> > > }
> > >
> > > static bool virtio_gpu_load_restore_mapping(VirtIOGPU *g,
> > > @@ -1339,7 +1340,7 @@ static int virtio_gpu_load(QEMUFile *f, void *opaque, size_t size,
> > > }
> > >
> > > /* load & apply scanout state */
> > > - vmstate_load_state(f, &vmstate_virtio_gpu_scanouts, g, 1);
> > > + vmstate_load_state(f, &vmstate_virtio_gpu_scanouts, g, g->vmstate_version);
> >
> > [sorry for a late response; attending a conf, and will reply to the v1
> > thread later for the other discussions..]
> >
> > These two changes shouldn't be needed if we go with the .field_exists()
> > approach, am I right? IIUC in that case we can keep the version 1 here and
> > don't boost anything, because we relied on the machine versions.
> >
> > IIUC this might be the reason why we found 9.0 mahines are broken on
> > migration. E.g, IIUC my original patch should work for 9.0<->9.0 too.
> >
>
> Indeed, but for consistency, shouldn't it use the x-vmstate-version
> value for the top-level VMSD save/load ?
>
> Otherwise, it feels a bit odd that this x-vmstate-version is only used
> for the nested "virtio-gpu-one-scanout" version.
>
> Or perhaps we should rename it to x-scanout-vmstate-version ? wdyt
Makes sense to me. In another place I used to have a field called
preempt_pre_7_2.. which is pretty wierd but it would be more accurate I
suppose if the field name reflects how that was defined, especially
differenciate that v.s. VMSD versioning as they're confusing indeed when
used together.
So if a rename I suppose we can even "vmstate-version". I just wished VMSD
versioning could work with bi-directional migration already then we save
all the fuss... we used to have the chance before introducing
field_exists() (I suppose this one came later), but we didn't care or
notice at that time, sign. We'll just need a handshake between src/dst so
that when src sees dst uses VMSD v1 it sends v1-only fields even if it
knows as far as v2.
For the long run we may be able to have some small helper so we fetch the
machine type globally, then maybe we can in the future pass in the test
function as:
bool test_function (void *opaque)
{
return MACHINE_TYPE_BEFORE(8, 2);
}
Then it'll also avoid even introducing a variable. Maybe we can provide
this test_function() directly too, one for each release.
Thanks,
>
>
> > Thanks,
> >
> > >
> > > return 0;
> > > }
> > > @@ -1659,6 +1660,7 @@ static Property virtio_gpu_properties[] = {
> > > DEFINE_PROP_BIT("blob", VirtIOGPU, parent_obj.conf.flags,
> > > VIRTIO_GPU_FLAG_BLOB_ENABLED, false),
> > > DEFINE_PROP_SIZE("hostmem", VirtIOGPU, parent_obj.conf.hostmem, 0),
> > > + DEFINE_PROP_UINT8("x-vmstate-version", VirtIOGPU, vmstate_version, 1),
> > > DEFINE_PROP_END_OF_LIST(),
> > > };
> > >
> > > --
> > > 2.41.0.28.gd7d8841f67
> > >
> >
> > --
> > Peter Xu
> >
>
--
Peter Xu
next prev parent reply other threads:[~2024-05-14 13:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-13 7:19 [PATCH v2 0/4] Fix "virtio-gpu: fix scanout migration post-load" marcandre.lureau
2024-05-13 7:19 ` [PATCH v2 1/4] migration: add "exists" info to load-state-field trace marcandre.lureau
2024-05-13 7:19 ` [PATCH v2 2/4] migration: fix a typo marcandre.lureau
2024-05-13 22:27 ` Fabiano Rosas
2024-05-14 4:29 ` Peter Xu
2024-05-13 7:19 ` [PATCH v2 3/4] virtio-gpu: add x-vmstate-version marcandre.lureau
2024-05-14 4:29 ` Peter Xu
2024-05-14 7:25 ` Marc-André Lureau
2024-05-14 13:06 ` Peter Xu [this message]
2024-05-13 7:19 ` [PATCH v2 4/4] virtio-gpu: fix v2 migration marcandre.lureau
2024-05-13 12:55 ` [PATCH v2 0/4] Fix "virtio-gpu: fix scanout migration post-load" Fiona Ebner
2024-05-13 13:21 ` Marc-André Lureau
2024-05-13 13:44 ` Fiona Ebner
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=ZkNhuvPcxTLalF69@x1n \
--to=peterx@redhat.com \
--cc=eduardo@habkost.net \
--cc=farosas@suse.de \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=wangyanan55@huawei.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).