]> git.ipfire.org Git - thirdparty/qemu.git/commit
migration: Dump correct JSON format for nullptr replacement
authorPeter Xu <peterx@redhat.com>
Thu, 9 Jan 2025 18:52:47 +0000 (15:52 -0300)
committerFabiano Rosas <farosas@suse.de>
Thu, 9 Jan 2025 20:39:46 +0000 (17:39 -0300)
commit9867c3a7ced12dd7519155c047eb2c0098a11c5f
tree55042d91f3b2f1f68602e871ccabd999f1bb077a
parentf52965bf0eeee28e89933264f1a9dbdcdaa76a7e
migration: Dump correct JSON format for nullptr replacement

QEMU plays a trick with null pointers inside an array of pointers in a VMSD
field.  See 07d4e69147 ("migration/vmstate: fix array of ptr with
nullptrs") for more details on why.  The idea makes sense in general, but
it may overlooked the JSON writer where it could write nothing in a
"struct" in the JSON hints section.

We hit some analyze-migration.py issues on s390 recently, showing that some
of the struct field contains nothing, like:

{"name": "css", "array_len": 256, "type": "struct", "struct": {}, "size": 1}

As described in details by Fabiano:

https://lore.kernel.org/r/87pll37cin.fsf@suse.de

It could be that we hit some null pointers there, and JSON was gone when
they're null pointers.

To fix it, instead of hacking around only at VMStateInfo level, do that
from VMStateField level, so that JSON writer can also be involved.  In this
case, JSON writer will replace the pointer array (which used to be a
"struct") to be the real representation of the nullptr field.

Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20250109185249.23952-6-farosas@suse.de>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
migration/vmstate.c