From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Yonggang Luo <luoyonggang@gmail.com>,
Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>,
qemu-devel@nongnu.org, anjo@rev.ng,
Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>,
philmd@oss.qualcomm.com, Peter Maydell <peter.maydell@linaro.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>
Subject: Re: [PATCH 00/47] single-binary: implement dynamic filtering for QOM types
Date: Fri, 4 Sep 2026 12:36:42 +0100 [thread overview]
Message-ID: <apqtSjY4MLwRIcJq@redhat.com> (raw)
In-Reply-To: <878q5h8di4.fsf@pond.sub.org>
On Fri, Sep 04, 2026 at 01:25:23PM +0200, Markus Armbruster wrote:
> Daniel P. Berrangé <berrange@redhat.com> writes:
>
> > On Fri, Sep 04, 2026 at 04:58:10PM +0800, Yonggang Luo wrote:
> >> Device filtering would be complicated, I guess, as there is so much
> >> CONFIG_* for devices. Another approach is to just place devices under an
> >> meson "enable_modules " (in *.so/*.dll/*.dylib), so it won't be
> >> listed(memory consumption will also be reduced when it's not needed).
> >
> > While modules are important for reducing memory consumption, I don't think
> > they need to be a blocker - making more things into modules can be done
> > in the backaround as & when people want to work on it.
>
> I fear modules need serious work to before we can use them more widely.
> I described issues in
>
> Subject: Dynamic & heterogeneous machines, initial configuration: problems
> Date: Wed, 31 Jan 2024 21:14:21 +0100
> Message-ID: <87o7d1i7ky.fsf@pond.sub.org>
> https://lore.kernel.org/qemu-devel/87o7d1i7ky.fsf@pond.sub.org/
>
> Copy of relevant part:
>
> = Problem 3: Loadable modules =
>
> QOM wasn't designed for loadable modules. Support for them was grafted
> on, and there are serious deficiencies.
>
> Building a loadable module results in a DSO. Additionally, module
> meta-data necessary to load it is compiled into the executables that can
> load modules. Actually loading a module can fail, e.g. when the module
> was not deployed.
>
> Loadable modules are designed to be transparent, i.e. users don't need
> to know whether a module is compiled in or loadable.
>
> QOM types don't exist until the module is initialized. Compiled-in
> modules are initialized early in startup. Loadable modules are
> initialized on load.
>
> QMP command qom-list-types returns all QOM types. To be able to find
> them all, it needs to load all modules. Modules that cannot be found
> (or have dependencies that cannot be found) are silently ignored. Any
> other loading errors are reported to stderr with error_report_err(),
> which is inappropriate. In either case, the types provided by the
> unloadable modules are not returned by the command.
>
> We have two functions to look up an object class by name:
> object_class_by_name() and module_object_class_by_name(). The latter
> attempts to load a module when the type doesn't exist. Again, modules
> that cannot be found are silently ignored, and other loading errors are
> reported with error_report_err(), which is inappropriate in certain
> contexts.
>
> When to use which of the two functions is unclear. Existing usage may
> well be wrong.
>
> The QOM functions to create objects in-place (object_initialize(), ...)
> or on the heap (object_new(), ...) cannot fail. This is just fine in
> QOM's original design. It is not fine when a loadable module fails to
> load. Since the functions can't fail, they exit(1) then.
>
> This means things like a hot plugging a device provided by a loadable
> module can crash a VM immediately.
The object_new() side effect is unpleasant, but we're not all that
far away from avoiding the crash on device hotplug AFAICT.
qdev_device_add_from_qdict() will call qdev_get_device_class() and
if that returns NULL will gracefully return the error to the client.
qdev_get_device_class() will call module_object_class_by_name()
which triggers module loading and can return NULL if loading
fails. Unfortnuately it throws away the error message, and
qdev_get_device_class() doesn't appear to handle NULL correctly
in all scenarios. It is not that far away from being able to
handle module load failures correctly though AFAICS.
The unpleasant bit is that we would need to audit other QMP entry
points that can trigger module loading, and ensure they all trigger
module loading prior to object_new(), and perhaps most importantly
have a way to test this in functional tests. Without the latter
we'll surely bit-rot this subtle edgecase.
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 :|
prev parent reply other threads:[~2026-09-04 11:37 UTC|newest]
Thread overview: 99+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 22:58 [PATCH 00/47] single-binary: implement dynamic filtering for QOM types Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 01/47] target/arm: Move -cpu max stuff out of cpu32.c Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 02/47] target/arm: Build cpu32.c once in system mode Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 03/47] target/arm: Rename and adjust aarch32_max_v8_tcg_initfn Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 04/47] target/arm: Introduce cpu types max-v8 and max-v9 Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 05/47] target/arm: Use -cpu max-v8 with aarch64=off Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 06/47] target/arm: Separate cpu types max-v8 and max-v9 Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 07/47] hw/remote/machine: remove unsupported arm target Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 09/47] qom/object: add is_available callback to TypeInfo Pierrick Bouvier
2026-08-31 6:37 ` Philippe Mathieu-Daudé
2026-08-28 22:58 ` [PATCH 10/47] hw/arm: filter minimal set of machines Pierrick Bouvier
2026-08-31 6:38 ` Philippe Mathieu-Daudé
2026-08-28 22:58 ` [PATCH 11/47] system: query machines using TYPE_MACHINE Pierrick Bouvier
2026-08-31 6:40 ` Philippe Mathieu-Daudé
2026-08-28 22:58 ` [PATCH 12/47] target-info: remove machine_typename Pierrick Bouvier
2026-08-31 6:40 ` Philippe Mathieu-Daudé
2026-08-28 22:58 ` [PATCH 13/47] configs/targets: remove target info definitions Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 14/47] target-info: rename target-info-stub.c in target-info-def.c Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 15/47] hw/arm: remove TYPE_TARGET_{AARCH64,ARM}_MACHINE Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 16/47] hw/arm: remove {arm, arm_aarch64, aarch64}_machine_interfaces Pierrick Bouvier via qemu development
2026-08-28 22:58 ` [PATCH 17/47] hw/arm: remove DEFINE_MACHINE_{AARCH64,ARM} Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 18/47] hw/arm: remove machines-qom.h Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 19/47] hw/riscv: remove TYPE_TARGET_{RISCV32,RISCV64}_MACHINE Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 20/47] hw/riscv: remove {riscv32, riscv32_64, riscv64}_machine_interfaces Pierrick Bouvier via qemu development
2026-08-28 22:58 ` [PATCH 21/47] hw/riscv: remove DEFINE_MACHINE_{RISCV32,RISCV64} Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 22/47] hw/riscv: remove machines-qom.h Pierrick Bouvier
2026-08-31 12:36 ` Yonggang Luo
2026-08-31 17:58 ` Pierrick Bouvier
2026-08-31 18:28 ` Yonggang Luo
2026-08-28 22:58 ` [PATCH 23/47] target-info: add target_config_multiprocess Pierrick Bouvier
2026-08-31 14:48 ` Philippe Mathieu-Daudé
2026-08-31 14:57 ` Yonggang Luo
2026-08-31 18:00 ` Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 24/47] hw/remote/machine: filter from CONFIG_MULTIPROCESS Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 25/47] target-info: add target_config_nitro Pierrick Bouvier
2026-08-31 7:15 ` Philippe Mathieu-Daudé
2026-08-31 14:33 ` Philippe Mathieu-Daudé
2026-08-31 18:05 ` Pierrick Bouvier
2026-08-31 18:03 ` Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 26/47] hw/nitro/machine: filter from CONFIG_NITRO Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 27/47] hw/arm: filter aarch64 only machines Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 28/47] target-info: add target_config_dpcd Pierrick Bouvier
2026-08-31 7:04 ` Philippe Mathieu-Daudé
2026-08-31 10:15 ` Philippe Mathieu-Daudé
2026-08-31 18:07 ` Pierrick Bouvier
2026-08-31 18:08 ` Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 29/47] hw/display/dpcd: filter from CONFIG_DPCD Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 30/47] hw/nitro: filter from CONFIG_NITRO Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 31/47] hw/remote/proxy: filter from CONFIG_MULTIPROCESS Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 32/47] target/arm: filter cpus from target Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 33/47] system/vl: add new option -target Pierrick Bouvier
2026-08-31 12:39 ` Yonggang Luo
2026-08-31 18:10 ` Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 34/47] system/vl: fallback to detect target from argv[0] Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 35/47] meson: build single binary for arm+aarch64 targets Pierrick Bouvier
2026-08-31 14:50 ` Philippe Mathieu-Daudé
2026-08-31 15:21 ` Yonggang Luo
2026-08-31 18:12 ` Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 36/47] scripts: add single-binary-compare-cmdline.sh Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 37/47] hw/core/boards.h: add available callback to DEFINE_MACHINE_EXTENDED Pierrick Bouvier
2026-08-31 12:43 ` Yonggang Luo
2026-08-31 18:13 ` Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 38/47] hw/core/boards.h: remove unused DEFINE_MACHINE_WITH_INTERFACE* Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 39/47] hw/core/boards.h: add available callback to DEFINE_MACHINE Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 40/47] hw/arm: filter arm machines Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 41/47] target-info: add target_microblaze Pierrick Bouvier
2026-08-31 7:16 ` Philippe Mathieu-Daudé
2026-08-31 15:01 ` Philippe Mathieu-Daudé
2026-08-28 22:58 ` [PATCH 42/47] hw/microblaze: filter microblaze machines Pierrick Bouvier
2026-08-31 7:17 ` Philippe Mathieu-Daudé
2026-08-28 22:58 ` [PATCH 43/47] target/microblaze/cpu: filter microblaze cpu Pierrick Bouvier
2026-08-31 7:17 ` Philippe Mathieu-Daudé
2026-08-28 22:58 ` [PATCH 44/47] hw: filter arm devices Pierrick Bouvier
2026-08-28 22:58 ` [PATCH 45/47] target-info: add target_config_cxl Pierrick Bouvier
2026-08-28 22:59 ` [PATCH 46/47] hw/pci-bridge: filter from CONFIG_CXL Pierrick Bouvier
2026-08-28 22:59 ` [PATCH 47/47] meson: add microblaze to single-binary Pierrick Bouvier
2026-08-28 23:13 ` [PATCH 00/47] single-binary: implement dynamic filtering for QOM types Pierrick Bouvier
2026-08-28 23:17 ` Pierrick Bouvier
2026-09-04 8:19 ` Daniel P. Berrangé
2026-09-04 8:58 ` Yonggang Luo
2026-09-04 9:13 ` Peter Maydell
2026-09-04 9:34 ` Yonggang Luo
2026-09-04 9:41 ` Peter Maydell
2026-09-04 13:02 ` Philippe Mathieu-Daudé
2026-09-04 9:55 ` Daniel P. Berrangé
2026-09-04 10:04 ` Yonggang Luo
2026-09-04 10:11 ` Daniel P. Berrangé
2026-09-04 13:08 ` Philippe Mathieu-Daudé
2026-09-04 10:23 ` Peter Maydell
2026-09-04 10:33 ` Daniel P. Berrangé
2026-09-04 11:19 ` Markus Armbruster
2026-09-04 11:27 ` Daniel P. Berrangé
2026-09-04 11:55 ` Markus Armbruster
2026-09-04 13:05 ` Philippe Mathieu-Daudé
2026-09-04 11:01 ` Markus Armbruster
2026-09-04 11:06 ` Daniel P. Berrangé
2026-09-04 9:45 ` Daniel P. Berrangé
2026-09-04 11:25 ` Markus Armbruster
2026-09-04 11:36 ` Daniel P. Berrangé [this message]
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=apqtSjY4MLwRIcJq@redhat.com \
--to=berrange@redhat.com \
--cc=anjo@rev.ng \
--cc=armbru@redhat.com \
--cc=daniel.barboza@oss.qualcomm.com \
--cc=luoyonggang@gmail.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@oss.qualcomm.com \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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.