From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@mailo.com>,
"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
"Peter Xu" <peterx@redhat.com>,
"Hervé Poussineau" <hpoussin@reactos.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Akihiko Odaki" <odaki@rsg.ci.i.u-tokyo.ac.jp>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Fabiano Rosas" <farosas@suse.de>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"BALATON Zoltan" <balaton@eik.bme.hu>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [RFC 0/7] qom: deprecate embedded objects and instance properties
Date: Tue, 16 Jun 2026 16:55:47 +0100 [thread overview]
Message-ID: <20260616155554.264412-1-berrange@redhat.com> (raw)
QOM has two rather unusual / surprising features historicall
* The ability to embed a QOM instance's memory inside another
struct
* The ability to register properties against the instnce
instead of struct
While they both look convenient on the surface, they also
have significant undesirable side effects (see the commit
message for each patch for details).
The premise of this series is that their convenience does
not outweigh their downsides, and we would be better off
long term by eliminating their usage, rather than trying
to add more hacks on top to mitigate their downsides.
This comes out of two separate conversations this week
* Migration series where Peter proposed changes that
make use of instance properties. When I commented,
Peter rightly pointed out that our docs do not
discourage use of instance properties:
https://lists.gnu.org/archive/html/qemu-devel/2026-06/msg02368.html
* QOM series where Akihiko proposed some funky hacks
to reference counting to better track object lifecycle
when embedding structs. We had a short discussion about
discouraging QOM embedding, so this is a real world
proposal:
https://lists.gnu.org/archive/html/qemu-devel/2026-06/msg03459.html
This is not likely to be a quick task, so this series
starts small
* Adds a "QEMU_DEPRECATIONS" annotation for internal APIs
* Deprecate the QOM instance embedding
* Deprecate the QOM instance properties
* Deprecate the memory region embedding APIs
* Deprecate the IRQ embedding APIs
* Convert PIIX to eliminate embedding as a
demonstration.
The QEMU_DEPRECATIONS idea is an effect to improve our our
historic practice where we introduce a new preferred API
and never really tell anyone the old APIs is bad to use.
If --enable-deprecations is given to configure, every use
of a deprecated API emits a compiler warning. This is not
enabled by default in this series, since we have -Werror
by default.
Note that the proposal to stop embedding memory regions has
been made by Zoltan earlier this year and was rejected by Paolo:
https://lists.nongnu.org/archive/html/qemu-devel/2026-01/msg05435.html
https://lists.nongnu.org/archive/html/qemu-devel/2026-05/msg06665.html
I don't really agree with the analysis there. IMHO, the
concept of embedding objects is to horrendous to allow to
live any longer. Yes, that's a big job, but long term it
is worth it.
Daniel P. Berrangé (7):
meson: add --enable-deprecations configure flag
qom: deprecated embedding object structs within other objects
qom: deprecate use of instance properties
system: add memory_region_new / memory_region_new_io
system: add qemu_irq_new / qemu_irq_new_child / qemu_irq_new_array
hw/isa: convert PIIX embedded QOM objects to heap allocated
qom: improve error message for invalid ID values
hw/core/irq.c | 35 +++++++++++++
hw/isa/piix.c | 65 ++++++++++++++---------
include/hw/core/irq.h | 75 +++++++++++++++++++++++++--
include/hw/southbridge/piix.h | 12 ++---
include/qemu/osdep.h | 19 +++++++
include/qom/object.h | 98 ++++++++++++++++++++++++++++++-----
include/system/memory.h | 76 +++++++++++++++++++++++----
meson.build | 1 +
meson_options.txt | 2 +
qom/object.c | 36 ++++++++++++-
scripts/meson-buildoptions.sh | 3 ++
system/memory.c | 85 +++++++++++++++++++++++++-----
12 files changed, 433 insertions(+), 74 deletions(-)
--
2.54.0
next reply other threads:[~2026-06-16 15:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 15:55 Daniel P. Berrangé [this message]
2026-06-16 15:55 ` [RFC 1/7] meson: add --enable-deprecations configure flag Daniel P. Berrangé
2026-06-16 15:55 ` [RFC 2/7] qom: deprecated embedding object structs within other objects Daniel P. Berrangé
2026-06-16 16:15 ` Peter Maydell
2026-06-16 16:43 ` Daniel P. Berrangé
2026-06-16 15:55 ` [RFC 3/7] qom: deprecate use of instance properties Daniel P. Berrangé
2026-06-16 15:55 ` [RFC 4/7] system: add memory_region_new / memory_region_new_io Daniel P. Berrangé
2026-06-16 15:55 ` [RFC 5/7] system: add qemu_irq_new / qemu_irq_new_child / qemu_irq_new_array Daniel P. Berrangé
2026-06-16 16:22 ` Peter Maydell
2026-06-16 16:36 ` Daniel P. Berrangé
2026-06-16 15:55 ` [RFC 6/7] hw/isa: convert PIIX embedded QOM objects to heap allocated Daniel P. Berrangé
2026-06-16 15:55 ` [RFC 7/7] qom: improve error message for invalid ID values Daniel P. Berrangé
2026-06-16 16:12 ` [RFC 0/7] qom: deprecate embedded objects and instance properties Peter Maydell
2026-06-16 16:40 ` Daniel P. Berrangé
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=20260616155554.264412-1-berrange@redhat.com \
--to=berrange@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=aurelien@aurel32.net \
--cc=balaton@eik.bme.hu \
--cc=farosas@suse.de \
--cc=hpoussin@reactos.org \
--cc=marcandre.lureau@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mst@redhat.com \
--cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@mailo.com \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
/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.