Skip to content

qom: fix setting of qdev array properties

Daniel P. Berrangé qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 15 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1qom: fix setting of array propertiesqom/object_interfaces.c+30 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/1] qom: fix setting of qdev array properties

By the time of the 8.2.0 release, it will have been 2 years and 6 releases since we accidentally broke setting of array properties for user creatable devices:

https://gitlab.com/qemu-project/qemu/-/issues/1090

Some context:

* Initial identification / report on the mailing list

https://lists.gnu.org/archive/html/qemu-devel/2022-07/msg00111.html

* Sub-thread of that exploring the background on need/use of array properties:

https://lists.gnu.org/archive/html/qemu-devel/2022-07/msg01531.html

* Markus' initial PoC for an order preserving QDict impl

https://lists.gnu.org/archive/html/qemu-devel/2022-07/msg00758.html

* A later (unrelated?) patch for order preserving QDict impl

https://lists.gnu.org/archive/html/qemu-devel/2023-05/msg03229.html

* A re-posting of the new patch

https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg00292.html

Personally I'm not a fan of the introducing the order preserving QDict impl, because I feel that the need to preserve QDict ordering is a design bug. Not that I think the current ordering when iterating over QDict is in any way special. I just rather see the ordering left as "undefined" and any callers that need a specific ordering should apply what they need.

Since setting device array properties requires that 'len-XXX' be processed first, so the following patch does exactly that. We iterate over the properties twice, first setting the 'len-XXX' properties, then setting everything else.

I still think for user creatable devices we'd be better off just mandating the use of JSON syntax for -device and thus leveraging the native JSON array type. This patch was the quick fix for the existing array property syntax though.

Daniel P. Berrangé (1):
qom: fix setting of array properties

 qom/object_interfaces.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
Signature · 1 line
2.41.0