qemu-cr16/include
Stefan Hajnoczi ded29e64c6 aio-posix: integrate fdmon into glib event loop
AioContext's glib integration only supports ppoll(2) file descriptor
monitoring. epoll(7) and io_uring(7) disable themselves and switch back
to ppoll(2) when the glib event loop is used. The main loop thread
cannot use epoll(7) or io_uring(7) because it always uses the glib event
loop.

Future QEMU features may require io_uring(7). One example is uring_cmd
support in FUSE exports. Each feature could create its own io_uring(7)
context and integrate it into the event loop, but this is inefficient
due to extra syscalls. It would be more efficient to reuse the
AioContext's existing fdmon-io_uring.c io_uring(7) context because
fdmon-io_uring.c will already be active on systems where Linux io_uring
is available.

In order to keep fdmon-io_uring.c's AioContext operational even when the
glib event loop is used, extend FDMonOps with an API similar to
GSourceFuncs so that file descriptor monitoring can integrate into the
glib event loop.

A quick summary of the GSourceFuncs API:
- prepare() is called each event loop iteration before waiting for file
  descriptors and timers.
- check() is called to determine whether events are ready to be
  dispatched after waiting.
- dispatch() is called to process events.

More details here: https://docs.gtk.org/glib/struct.SourceFuncs.html

Move the ppoll(2)-specific code from aio-posix.c into fdmon-poll.c and
also implement epoll(7)- and io_uring(7)-specific file descriptor
monitoring code for glib event loops.

Note that it's still faster to use aio_poll() rather than the glib event
loop since glib waits for file descriptor activity with ppoll(2) and
does not support adaptive polling. But at least epoll(7) and io_uring(7)
now work in glib event loops.

Splitting this into multiple commits without temporarily breaking
AioContext proved difficult so this commit makes all the changes. The
next commit will remove the aio_context_use_g_source() API because it is
no longer needed.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-ID: <20251104022933.618123-7-stefanha@redhat.com>
[kwolf: Build fixes; fix AioContext.list_lock use after destroy]
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2025-11-11 22:04:53 +01:00
..
accel accel/tcg: Add cpu_atomic_*_mmu for 16-byte xchg, fetch_and, fetch_or 2025-08-30 16:37:23 +01:00
authz
block aio-posix: integrate fdmon into glib event loop 2025-11-11 22:04:53 +01:00
chardev char: rename CharBackend->CharFrontend 2025-10-28 14:49:52 +01:00
crypto crypto: support upto 5 parallel certificate identities 2025-11-03 10:45:55 +00:00
disas disas: Fix build against Capstone v6 (again) 2024-11-05 10:09:59 +00:00
exec exec/cpu: Declare cpu_memory_rw_debug() in 'hw/core/cpu.h' and document 2025-11-03 11:59:32 +01:00
fpu fpu: Move m68k_denormal fmt flag into floatx80_behaviour 2025-02-25 15:32:57 +00:00
gdbstub gdbstub/helpers: Replace TARGET_BIG_ENDIAN -> target_big_endian() 2025-07-15 02:56:39 -04:00
hw intel_iommu: Handle PASID cache invalidation 2025-11-09 08:23:48 -05:00
io mem + migration pull for 10.2 2025-11-04 16:19:35 +01:00
libdecnumber include/libdecnumber: replace FSF postal address with licenses URL 2025-06-26 00:42:37 +02:00
migration migration: vmsd errp handlers: return bool 2025-11-03 16:04:10 -05:00
monitor qdev: add qdev_find_default_bus() 2025-10-29 22:53:41 +04:00
net qom: remove redundant typedef when use OBJECT_DECLARE_SIMPLE_TYPE 2025-10-28 08:08:04 +01:00
qapi error: Kill @error_warn 2025-10-01 08:33:24 +02:00
qemu Merge crypto and other misc fixes / features 2025-11-04 15:17:31 +01:00
qobject qobject: make refcount atomic 2025-10-28 13:02:26 +01:00
qom qom: reverse order of instance_post_init calls 2025-05-20 08:18:53 +02:00
scsi
semihosting include/semihosting/common-semi: extract common_semi API 2025-09-26 09:55:19 +01:00
standard-headers linux-headers: Update to Linux v6.18-rc3 2025-10-30 10:33:55 +08:00
system igvm: add support for initial register state load in native mode 2025-11-03 07:38:53 +01:00
tcg tcg: Add tcg_gen_atomic_{xchg,fetch_and,fetch_or}_i128 2025-08-30 16:37:24 +01:00
ui ui/gtk: Add scale option 2025-07-15 10:22:33 +04:00
user accel/tcg: Add clear_flags argument to page_set_flags 2025-10-14 07:30:39 -07:00
elf.h elf: Add EF_MIPS_ARCH_ASE definitions 2025-09-02 17:57:05 +02:00
glib-compat.h include/glib-compat.h: Poison g_list_sort and g_slist_sort 2025-05-06 16:02:04 +02:00
qemu-io.h
qemu-main.h ui & main loop: Redesign of system-specific main thread event handling 2024-12-31 21:21:34 +01:00