All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Alexandr Moshkov <dtalexundeer@yandex-team.ru>,
	qemu-devel@nongnu.org,
	"yc-core@yandex-team.ru" <yc-core@yandex-team.ru>,
	Fabiano Rosas <farosas@suse.de>
Subject: Re: [PATCH v2] vmstate: fix subsection load name check
Date: Tue, 10 Mar 2026 14:00:23 -0400	[thread overview]
Message-ID: <abBcN2B4QNBT_Oh9@x1.local> (raw)
In-Reply-To: <CAFEAcA-m+CZPUchGsh6QU4gm1dO-FP0m1w5gu6sn56wUXBbRAQ@mail.gmail.com>

On Tue, Mar 10, 2026 at 01:39:04PM +0000, Peter Maydell wrote:
> On Tue, 10 Mar 2026 at 13:28, Alexandr Moshkov
> <dtalexundeer@yandex-team.ru> wrote:
> > Hi, this breaks migration for s390x and ppc64:
> >
> > qemu-system-s390x: Missing section footer for qemu-s390-flic
> >
> > Thanks for reply! It happens because "qemu-s390-flic" vmsd has "qemu-s390-flic-full" subsection. I'm not sure if we can change the names of the existing subsections. Peter, what do you think?
> >
> > It seems to be a bigger problem that the migration framework does not document the names for subsections in any way. At the same time, the code implies that at least the names should be a substring with its parent. There is even such a code comment `subsection name has to be "section_name/a"`, that seems to imply the presence of /.
> >
> > Also I tried to put together a list of devices whose separator in subsections is not /:
> 
> > or-irq
> 
> This one and probably some of the others are my mistake, I think.
> I think this is because:
>  * the migration code imposes a constraint on the subsection names
>  * the migration documentation does not mention this constraint
>  * the migration code does not effectively enforce this constraint
>    (e.g. by asserting when the vmstate with a bad name is registered)
> 
> My assumption when writing that code was very likely that the
> name of the subsection didn't have to have any relation to
> the name of its parent subsection (after all, the migration
> code knows it is a subsection, so if it needed to have the
> name on the wire be "parentname/subsectionname" it could construct
> that itself), and since it all just worked I never noticed the
> mistake...

Indeed, we can do better on the 2nd/3rd bullets.. so we should document it
in struct VMStateDescription definition, and enforce it when registering
new VMSDs.

One thing to double check with Alexandr on this one:

> They using `_`, `-` or `.` as separator

Does it mean we also can't simply whitelist all these characters (including
"/"), because it won't always work?

For example in your case, it's "virtio-blk" being the parent VMSD, "virtio"
being the child VMSD, followed with a subsection belongs to virtio-blk.
We want to make that subsection be recognizable as virtio-blk's.

Then if we treat "-" also to be a separator, then "virtio" will still
mis-recognize virtio-blk's as its own (because its name is "virtio-blk/..."
hence it also satisfies the "virtio" check)?

Thanks,

-- 
Peter Xu



  reply	other threads:[~2026-03-10 18:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-02  7:06 [PATCH v2] vmstate: fix subsection load name check Alexandr Moshkov
2026-03-02 17:36 ` Peter Xu
2026-03-06 13:46 ` Fabiano Rosas
2026-03-10  5:32   ` Alexandr Moshkov
2026-03-10 13:27     ` Alexandr Moshkov
2026-03-10 13:39       ` Peter Maydell
2026-03-10 18:00         ` Peter Xu [this message]
2026-03-11  6:53           ` Vladimir Sementsov-Ogievskiy
2026-03-11 15:05             ` Peter Xu
2026-03-12  6:30               ` Vladimir Sementsov-Ogievskiy
2026-03-12 15:34                 ` Peter Xu
2026-03-12 16:34                   ` Vladimir Sementsov-Ogievskiy
2026-03-12 18:13                     ` Peter Xu
2026-03-12 18:27                       ` Peter Maydell
2026-03-12 19:25                         ` Peter Xu

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=abBcN2B4QNBT_Oh9@x1.local \
    --to=peterx@redhat.com \
    --cc=dtalexundeer@yandex-team.ru \
    --cc=farosas@suse.de \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=yc-core@yandex-team.ru \
    /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.