qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/12] QOM: container_get() removal
@ 2024-11-20 21:56 Peter Xu
  2024-11-20 21:56 ` [PATCH 01/12] qom: Add TYPE_CONTAINER macro Peter Xu
                   ` (12 more replies)
  0 siblings, 13 replies; 51+ messages in thread
From: Peter Xu @ 2024-11-20 21:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Peter Maydell, Markus Armbruster, peterx,
	Daniel P . Berrangé, Juraj Marcin,
	Philippe Mathieu-Daudé, Cédric Le Goater, Paolo Bonzini,
	Fabiano Rosas

This series is not for 9.2, but for 10.0.  It is intended to replace this
previous patchset:

  [PATCH 0/5] QOM: Enforce container_get() to operate on containers only
  https://lore.kernel.org/r/20241118221330.3480246-1-peterx@redhat.com

Since it's a different patchset, the versioning starts from v1.

The series is about container_get() and its removal.  Meanwhile after the
whole series applied, all the containers will be created explicitly.  No
lookup code will implicitly create container anymore.

In general, container_get() is a flaky interface in a few things.  Firstly,
some of the users use it without getting a container object.  Secondly, it
can implicitly create containers on the fly.

As Dan (mostly) pointed out, we don't have a super complicated container
layout.  It looks like this:

  /objects
  /chardevs
  /backend         (conditional, ui/ only)
  /dr-connector    (conditional, ppc/ only)
  /machine
    /peripheral
    /peripheral-anon
    /unattached

This series create these containers explicitly.

There's a side benefit of dropping container_get(), which is to avoid
complicated string operations, as container_get() is never used in more
than one depth.  It means switching to object_resolve_path_component()
should make existing code even tiny little faster.

To achieve this, some test needs to be fixed first.  For that, "tests: Fix
test-qdev-global-props on anonymous qdev realize()".

Comments welcomed, thanks.

Peter Xu (12):
  qom: Add TYPE_CONTAINER macro
  qom: New container_create()
  tests: Fix test-qdev-global-props on anonymous qdev realize()
  tests: Explicitly create containers in test_qom_partial_path()
  ui/console: Explicitly create "/backend" container
  hw/ppc: Explicitly create the drc container
  ppc/e500: Avoid abuse of container_get()
  qdev: Make qdev_get_machine() not use container_get()
  qdev: Add machine_get_container()
  qom: Create system containers explicitly
  qom: Add object_get_container()
  qom: Drop container_get()

 include/hw/qdev-core.h              | 10 ++++++++
 include/qom/object.h                | 25 +++++++++++++-----
 backends/cryptodev.c                |  4 +--
 chardev/char.c                      |  2 +-
 hw/arm/stellaris.c                  |  2 +-
 hw/core/gpio.c                      |  3 +--
 hw/core/machine.c                   | 19 +++++++++++---
 hw/core/qdev.c                      | 28 +++++++++++++++++---
 hw/core/sysbus.c                    |  4 +--
 hw/i386/pc.c                        |  4 +--
 hw/pci-host/ppce500.c               |  4 +--
 hw/ppc/spapr_drc.c                  | 40 +++++++++++++++++++++--------
 qom/container.c                     | 31 ++++++++--------------
 qom/object.c                        | 30 +++++++++++++++++++---
 scsi/pr-manager.c                   |  4 +--
 system/ioport.c                     |  2 +-
 system/memory.c                     |  2 +-
 system/qdev-monitor.c               |  6 ++---
 system/vl.c                         |  3 +--
 tests/unit/check-qom-proplist.c     |  2 +-
 tests/unit/test-qdev-global-props.c | 21 +++++++++++++++
 ui/console.c                        |  4 +--
 ui/dbus-chardev.c                   |  2 +-
 23 files changed, 180 insertions(+), 72 deletions(-)

-- 
2.45.0



^ permalink raw reply	[flat|nested] 51+ messages in thread

end of thread, other threads:[~2024-11-21 19:04 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-20 21:56 [PATCH 00/12] QOM: container_get() removal Peter Xu
2024-11-20 21:56 ` [PATCH 01/12] qom: Add TYPE_CONTAINER macro Peter Xu
2024-11-21  9:20   ` Philippe Mathieu-Daudé
2024-11-21 10:04   ` Daniel P. Berrangé
2024-11-20 21:56 ` [PATCH 02/12] qom: New container_create() Peter Xu
2024-11-21 10:05   ` Daniel P. Berrangé
2024-11-21 13:20   ` Markus Armbruster
2024-11-21 16:18     ` Peter Xu
2024-11-20 21:56 ` [PATCH 03/12] tests: Fix test-qdev-global-props on anonymous qdev realize() Peter Xu
2024-11-21  9:20   ` Philippe Mathieu-Daudé
2024-11-21 10:16   ` Daniel P. Berrangé
2024-11-20 21:56 ` [PATCH 04/12] tests: Explicitly create containers in test_qom_partial_path() Peter Xu
2024-11-21  9:19   ` Philippe Mathieu-Daudé
2024-11-21 10:16   ` Daniel P. Berrangé
2024-11-20 21:56 ` [PATCH 05/12] ui/console: Explicitly create "/backend" container Peter Xu
2024-11-21  9:19   ` Philippe Mathieu-Daudé
2024-11-21 10:26   ` Daniel P. Berrangé
2024-11-21 16:27     ` Peter Xu
2024-11-20 21:56 ` [PATCH 06/12] hw/ppc: Explicitly create the drc container Peter Xu
2024-11-21  9:35   ` Philippe Mathieu-Daudé
2024-11-21 16:36     ` Peter Xu
2024-11-21 17:14       ` Philippe Mathieu-Daudé
2024-11-20 21:56 ` [PATCH 07/12] ppc/e500: Avoid abuse of container_get() Peter Xu
2024-11-21  9:38   ` Cédric Le Goater
2024-11-21  9:48     ` Cédric Le Goater
2024-11-21 16:41       ` Peter Xu
2024-11-21 17:17         ` Philippe Mathieu-Daudé
2024-11-21 10:28   ` Daniel P. Berrangé
2024-11-20 21:56 ` [PATCH 08/12] qdev: Make qdev_get_machine() not use container_get() Peter Xu
2024-11-21 10:21   ` Daniel P. Berrangé
2024-11-21 16:48     ` Peter Xu
2024-11-20 21:57 ` [PATCH 09/12] qdev: Add machine_get_container() Peter Xu
2024-11-21  9:23   ` Philippe Mathieu-Daudé
2024-11-21 10:23   ` Daniel P. Berrangé
2024-11-21 13:23   ` Markus Armbruster
2024-11-20 21:57 ` [PATCH 10/12] qom: Create system containers explicitly Peter Xu
2024-11-21  9:13   ` Philippe Mathieu-Daudé
2024-11-21 10:30   ` Daniel P. Berrangé
2024-11-21 13:01     ` Philippe Mathieu-Daudé
2024-11-21 17:17       ` Peter Xu
2024-11-21 17:29         ` Philippe Mathieu-Daudé
2024-11-21 18:03           ` Peter Xu
2024-11-21 19:03             ` Philippe Mathieu-Daudé
2024-11-21 13:31   ` Markus Armbruster
2024-11-21 17:24     ` Peter Xu
2024-11-20 21:57 ` [PATCH 11/12] qom: Add object_get_container() Peter Xu
2024-11-21  9:23   ` Philippe Mathieu-Daudé
2024-11-21 10:30   ` Daniel P. Berrangé
2024-11-20 21:57 ` [PATCH 12/12] qom: Drop container_get() Peter Xu
2024-11-21 10:32   ` Daniel P. Berrangé
2024-11-21  9:18 ` [PATCH 00/12] QOM: container_get() removal Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).