Skip to content

ui: better console hotplug support

Marc-André Lureau qemu-devel 4 versions – In review

Get series with b4
b4 am [email protected] change-id 20260529-b4-ui-909bfa695735

Versions newest first

  1. v4 Latest34 patches 3 repliesIn review
  2. v335 patches 6 repliesSuperseded
  3. v233 patches 21 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v132 patches6 repliesSuperseded

Changes in v4 from the cover letter

- call vfio_display_exit() in vfio_pci_realize() error path
- drop resetting gl ctxt to NULL on dbus console dispose (incorrect)
- add mdpy doc suggestions from Cédric
- rebased
- Link to v3: https://lore.kernel.org/qemu-devel/[email protected]

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/34ui/gtk: fix bad widget realize on non-GFX VCui/gtk.c+3 -10 replies
2/34build-sys: build with -fno-omit-frame-pointer with ASANmeson.build+2 -00 replies
3/34irq: add per-IRQ observer to fix qemu_irq_intercept_in leakhw/core/irq.c include/hw/core/irq.h scripts/lsan_suppressions.txt +1 more+10 -210 replies
4/34scripts/lsan_suppressions: suppress fontconfig leaksscripts/lsan_suppressions.txt+4 -00 replies
5/34vfio/pci: close display console during unrealize, not finalizeMAINTAINERS hw/vfio/display.c hw/vfio/pci.c +1 more+21 -120 replies
6/34docs: add mdpy mdev vfio display testing guidedocs/devel/index-internals.rst docs/devel/vfio-mdpy.rst+91 -01 reply
7/34glib-compat: add fallback for g_clear_fd/g_autofdinclude/glib-compat.h+29 -00 replies
8/34util: make notifer_remove() saferutil/notify.c+1 -10 replies
9/34ui/dbus: remove mouse handler on disposeui/dbus-console.c+1 -00 replies
10/34ui/qmp: keep a reference of console across yieldui/ui-qmp-cmds.c+3 -00 replies
11/34ui: stop ui timer when closingui/console.c+1 -00 replies
12/34ui/console: init gl_unblock_timer in qemu_console_initui/console.c+2 -20 replies
13/34ui/spice: remove dead spice_displaysinclude/ui/qemu-spice.h+0 -70 replies
14/34ui/spice: add cleanup on shutdowninclude/ui/qemu-spice-module.h include/ui/qemu-spice.h scripts/lsan_suppressions.txt +6 more+129 -220 replies
15/34ui: add display cleanup infrastructureinclude/ui/console.h system/runstate.c ui/console.c+22 -80 replies
16/34ui/curses: implement display cleanupui/curses.c+12 -50 replies
17/34ui/sdl2: implement display cleanupui/sdl2.c+19 -40 replies
18/34ui/spice-app: implement display cleanupui/spice-app.c+5 -50 replies
19/34ui/egl: implement display and EGL cleanupinclude/ui/egl-helpers.h ui/egl-headless.c ui/egl-helpers.c+51 -00 replies
20/34ui/cocoa: implement display cleanupui/cocoa.m+17 -21 reply
21/34ui/dbus: implement display cleanupui/dbus.c+13 -00 replies
22/34ui/gtk: implement display cleanupinclude/ui/gtk.h ui/gtk-clipboard.c ui/gtk.c+36 -10 replies
23/34ui/console: add console event notifier infrastructureinclude/ui/console.h ui/console.c+41 -00 replies
24/34ui/console: fire console ADDED/REMOVED notificationsui/console.c+2 -00 replies
25/34ui/console-vc: fire ADDED/REMOVED notificationsui/console-vc.c+13 -00 replies
26/34ui/gtk: convert VirtualConsole storage from fixed array to GPtrArrayinclude/ui/gtk.h ui/gtk.c+87 -240 replies
27/34ui/gtk: move global display settings out of per-console initui/gtk.c+23 -230 replies
28/34ui/gtk: fix tab re-insertion order on window closeui/gtk.c+24 -30 replies
29/34ui/gtk: centralize console menu and shortcut managementinclude/ui/gtk.h ui/gtk.c+85 -430 replies
30/34ui/gtk: handle console hotplug/unplug eventsinclude/ui/gtk.h ui/gtk.c+75 -10 replies
31/34ui/console: register console in QOM tree dynamicallyui/console.c+17 -60 replies
32/34ui/console: unregister console from QOM tree on closeui/console.c+4 -00 replies
33/34ui/dbus: handle console hotplug/unplug eventsui/dbus-console.c ui/dbus.c ui/dbus.h+84 -170 replies
34/34tests/qtest: add D-Bus display hotplug testtests/qtest/dbus-display-test.c+99 -20 replies

Reviews trailers per patch

15 of 34 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchDaniel P. BerrangéFabiano RosasPhilippe Mathieu-DaudéCédric Le GoaterAkihiko Odaki
SeriesR-b
1/34R-b
2/34R-b
3/34R-b R-b
4/34R-b
5/34A-b
6/34R-b
7/34R-b
8/34
9/34R-b
10/34R-b
11/34R-b
12/34R-b
13/34R-b
14/34R-b
15/34
16/34
17/34
18/34
19/34
20/34T-b
21/34
22/34
23/34
24/34
25/34
26/34
27/34
28/34R-b
29/34
30/34
31/34
32/34
33/34
34/34R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v4 thread

Cover letter [PATCH v4 00/34] ui: better console hotplug support

Hi,

This series improves handling of dynamic consoles in ui/ (commit 9588d67e72 "console: minimal hotplug suport" added basic unplug & replug). It allows for better hotplug of vfio-pci display devices or bochs-display (the other device supporting hotplug today), with GTK and D-Bus backends.

As usual, the first patches are various preliminary cleanups and fixes I hit while developping the rest, they could be merged earlier. I improved the display cleanup to replace the scattered atexit() handler, making leaks more visible to sanitizers.

Then console ADDED/REMOVED notifications are added, so display backends can react to hotplug. The GTK code is rework a bit to allow easier hotplug events handling. Finally, D-Bus supports is implemented with a qtest to exercise it.

thanks

---
Changes in v4:
- call vfio_display_exit() in vfio_pci_realize() error path
- drop resetting gl ctxt to NULL on dbus console dispose (incorrect)
- add mdpy doc suggestions from Cédric
- rebased
- Link to v3: https://lore.kernel.org/qemu-devel/[email protected]

Changes in v3:
- added "docs: start a vfio-pci document" patch
- gtk: some cleanup order fixes in gd_vc_free()
- gtk: drop unwanted show-tabs on console-add
- added "util: make notifer_remove() safer"
- made dbus led handler removal idempotent
- vfio: close dmabufs before closing console
- vfio: removed bad set_display_gl_ctx(NULL) call
- vfio: fixed dpy->region exit/finalize with pre-check
- fix console registration after x-exit-preconfig
- rebased & collected patch trailers
- Link to v2: https://lore.kernel.org/qemu-devel/[email protected]

Changes in v2:
- add "ui/dbus: remove led handler", suggested by Akihiko
- fix compilation with -Dvte=disabled
- rebased, collect trailers
- Link to v1: https://lore.kernel.org/qemu-devel/[email protected]

To: [email protected]
Cc: Marc-André Lureau <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: "Daniel P. Berrangé" <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Cc: Pierrick Bouvier <[email protected]>
Cc: Fabiano Rosas <[email protected]>
Cc: Laurent Vivier <[email protected]>
Cc: Alex Williamson <[email protected]>
Cc: Cédric Le Goater <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: Akihiko Odaki <[email protected]>

---
Marc-André Lureau (34):
ui/gtk: fix bad widget realize on non-GFX VC
build-sys: build with -fno-omit-frame-pointer with ASAN
irq: add per-IRQ observer to fix qemu_irq_intercept_in leak scripts/lsan_suppressions: suppress fontconfig leaks vfio/pci: close display console during unrealize, not finalize
docs: add mdpy mdev vfio display testing guide
glib-compat: add fallback for g_clear_fd/g_autofd
util: make notifer_remove() safer
ui/dbus: remove mouse handler on dispose
ui/qmp: keep a reference of console across yield
ui: stop ui timer when closing
ui/console: init gl_unblock_timer in qemu_console_init ui/spice: remove dead spice_displays
ui/spice: add cleanup on shutdown
ui: add display cleanup infrastructure
ui/curses: implement display cleanup
ui/sdl2: implement display cleanup
ui/spice-app: implement display cleanup
ui/egl: implement display and EGL cleanup
ui/cocoa: implement display cleanup
ui/dbus: implement display cleanup
ui/gtk: implement display cleanup
ui/console: add console event notifier infrastructure ui/console: fire console ADDED/REMOVED notifications ui/console-vc: fire ADDED/REMOVED notifications
ui/gtk: convert VirtualConsole storage from fixed array to GPtrArray ui/gtk: move global display settings out of per-console init ui/gtk: fix tab re-insertion order on window close ui/gtk: centralize console menu and shortcut management ui/gtk: handle console hotplug/unplug events
ui/console: register console in QOM tree dynamically ui/console: unregister console from QOM tree on close ui/dbus: handle console hotplug/unplug events tests/qtest: add D-Bus display hotplug test

 MAINTAINERS                     |   1 +
 docs/devel/index-internals.rst  |   1 +
 docs/devel/vfio-mdpy.rst        |  90 ++++++++++
 meson.build                     |   2 +
 hw/vfio/pci.h                   |   1 +
 include/glib-compat.h           |  29 ++++
 include/hw/core/irq.h           |   6 +-
 include/ui/console.h            |  20 +++
 include/ui/egl-helpers.h        |   1 +
 include/ui/gtk.h                |   7 +-
 include/ui/qemu-spice-module.h  |   1 +
 include/ui/qemu-spice.h         |   9 +-
 ui/dbus.h                       |   3 +
 hw/core/irq.c                   |  12 +-
 hw/vfio/display.c               |  29 ++--
 hw/vfio/pci.c                   |   2 +
 system/qtest.c                  |   5 +-
 system/runstate.c               |   4 +-
 tests/qtest/dbus-display-test.c | 101 ++++++++++-
 ui/console-vc.c                 |  13 ++
 ui/console.c                    |  77 ++++++++-
 ui/curses.c                     |  17 +-
 ui/dbus-console.c               |   6 +
 ui/dbus.c                       | 106 ++++++++++--
 ui/egl-headless.c               |  31 ++++
 ui/egl-helpers.c                |  19 ++
 ui/gtk-clipboard.c              |  15 ++
 ui/gtk.c                        | 375 +++++++++++++++++++++++++++++++---------
 ui/sdl2.c                       |  23 ++-
 ui/spice-app.c                  |  10 +-
 ui/spice-core.c                 |  25 ++-
 ui/spice-display.c              |  52 ++++++
 ui/spice-input.c                |  53 ++++--
 ui/spice-module.c               |   5 +
 ui/ui-qmp-cmds.c                |   3 +
 util/notify.c                   |   2 +-
 scripts/lsan_suppressions.txt   |  15 +-
 ui/cocoa.m                      |  19 +-
 ui/meson.build                  |   4 +-
 39 files changed, 1005 insertions(+), 189 deletions(-)

---
base-commit: b83371668192a705b878e909c5ae9c1233cbd5fb
change-id: 20260529-b4-ui-909bfa695735

Best regards,

Signature · 1 line
Marc-André Lureau <[email protected]>