From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org,
"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>,
"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: Re: [RFC 2/7] qom: deprecated embedding object structs within other objects
Date: Tue, 16 Jun 2026 17:43:29 +0100 [thread overview]
Message-ID: <ajF9MZzIyil8_OVY@redhat.com> (raw)
In-Reply-To: <CAFEAcA8twCjEdr6R=JPEuWzf2+Gvuznro290ZZW8Eb0zubLpew@mail.gmail.com>
On Tue, Jun 16, 2026 at 05:15:22PM +0100, Peter Maydell wrote:
> On Tue, 16 Jun 2026 at 16:56, Daniel P. Berrangé <berrange@redhat.com> wrote:
> >
> > The QOM APIs currently allow objects to be either allocated directly
> > on the heap, or statically embedded inside the struct of another object.
> >
> > For the latter QOM has logic to avoid calling 'free' on the object when
> > finalizers complete, however, this is not sufficient to make the
> > practice safe.
> >
> > Users of QOM expect that if they call "object_ref" to acquire their own
> > reference, then object will never be freed as long as they hold it.
> >
> > This expectation is broken when an instance is embedded, as the "owner"
> > object's may be finalized, which frees the memory that is storing the
> > embedded QOM instance, even if its ref-count is still live.
> >
> > Worse still is that a user of a QOM object cannot easily tell if the
> > instance they're using is embedded or directly heap allocated.
> >
> > Mark the APIs for embedding objects as deprecated as the first step
> > towards removal of this flawed design concept. All objects must now
> > be directly heap allocated going forward, and existing usage must be
> > incrementally converted.
>
> I think if you mark an API that we call in 800+ places and 150+ files
> as deprecated, mostly what will happen is nobody ever turns on the
> --enable-deprecated option because the output will be full of noise...
That is a challenge. The baseline is that developers have no visibility
of use of deprecated APIs at all, and we barely even document them.
My thought is that even if --enable-deprecated is rarely enabled, at
least having QEMU_DEPRECATED visible in the header files is a red flag
for developers to look elsewhere for their solution.
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
next prev parent reply other threads:[~2026-06-16 16:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 15:55 [RFC 0/7] qom: deprecate embedded objects and instance properties Daniel P. Berrangé
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é [this message]
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=ajF9MZzIyil8_OVY@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=peter.maydell@linaro.org \
--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.