mirror of https://gitlab.com/qemu-project/qemu
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
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> |
3 days ago | |
|---|---|---|
| .. | ||
| check-block-qdict.c | 9 months ago | |
| check-qdict.c | 9 months ago | |
| check-qjson.c | 9 months ago | |
| check-qlist.c | 9 months ago | |
| check-qlit.c | 9 months ago | |
| check-qnull.c | 9 months ago | |
| check-qnum.c | 9 months ago | |
| check-qobject.c | 9 months ago | |
| check-qom-interface.c | 7 months ago | |
| check-qom-proplist.c | 7 months ago | |
| check-qstring.c | 9 months ago | |
| crypto-tls-psk-helpers.c | 1 year ago | |
| crypto-tls-psk-helpers.h | ||
| crypto-tls-x509-helpers.c | 1 year ago | |
| crypto-tls-x509-helpers.h | 3 weeks ago | |
| io-channel-helpers.c | 2 months ago | |
| io-channel-helpers.h | ||
| iothread.c | ||
| iothread.h | ||
| meson.build | 2 weeks ago | |
| pkix_asn1_tab.c.inc | 1 year ago | |
| ptimer-test-stubs.c | ||
| ptimer-test.c | 1 year ago | |
| ptimer-test.h | ||
| rcutorture.c | ||
| socket-helpers.c | 2 months ago | |
| socket-helpers.h | ||
| test-aio-multithread.c | 2 weeks ago | |
| test-aio.c | 3 days ago | |
| test-authz-list.c | ||
| test-authz-listfile.c | ||
| test-authz-pam.c | ||
| test-authz-simple.c | ||
| test-base64.c | ||
| test-bdrv-drain.c | 4 months ago | |
| test-bdrv-graph-mod.c | 4 months ago | |
| test-bitcnt.c | ||
| test-bitmap.c | ||
| test-bitops.c | ||
| test-block-backend.c | 11 months ago | |
| test-block-iothread.c | 6 months ago | |
| test-blockjob-txn.c | 9 months ago | |
| test-blockjob.c | 9 months ago | |
| test-bufferiszero.c | ||
| test-char.c | 2 weeks ago | |
| test-clone-visitor.c | ||
| test-coroutine.c | ||
| test-crypto-afsplit.c | 1 year ago | |
| test-crypto-akcipher.c | 1 year ago | |
| test-crypto-block.c | 2 weeks ago | |
| test-crypto-cipher.c | 6 months ago | |
| test-crypto-der.c | ||
| test-crypto-hash.c | 1 year ago | |
| test-crypto-hmac.c | 1 year ago | |
| test-crypto-ivgen.c | 1 year ago | |
| test-crypto-pbkdf.c | 1 year ago | |
| test-crypto-secret.c | 6 months ago | |
| test-crypto-tlscredsx509.c | 2 weeks ago | |
| test-crypto-tlssession.c | 2 weeks ago | |
| test-cutils.c | ||
| test-div128.c | ||
| test-error-report.c | 1 month ago | |
| test-fifo.c | 1 year ago | |
| test-forward-visitor.c | 9 months ago | |
| test-hbitmap.c | ||
| test-image-locking.c | 9 months ago | |
| test-int128.c | ||
| test-interval-tree.c | ||
| test-io-channel-buffer.c | ||
| test-io-channel-command.c | ||
| test-io-channel-file.c | ||
| test-io-channel-null.c | ||
| test-io-channel-socket.c | 1 year ago | |
| test-io-channel-tls.c | 3 weeks ago | |
| test-io-task.c | ||
| test-iov.c | 2 months ago | |
| test-keyval.c | 9 months ago | |
| test-logging.c | ||
| test-mul64.c | ||
| test-nested-aio-poll.c | 3 days ago | |
| test-opts-visitor.c | ||
| test-qapi-util.c | ||
| test-qdev-global-props.c | 7 months ago | |
| test-qdist.c | ||
| test-qemu-opts.c | 9 months ago | |
| test-qga.c | 5 months ago | |
| test-qgraph.c | 7 months ago | |
| test-qht.c | ||
| test-qmp-cmds.c | 9 months ago | |
| test-qmp-event.c | 9 months ago | |
| test-qobject-input-visitor.c | 9 months ago | |
| test-qobject-output-visitor.c | 9 months ago | |
| test-qtree.c | ||
| test-rcu-list.c | ||
| test-rcu-simpleq.c | ||
| test-rcu-slist.c | ||
| test-rcu-tailq.c | ||
| test-replication.c | 9 months ago | |
| test-resv-mem.c | 7 months ago | |
| test-seccomp.c | 11 months ago | |
| test-shift128.c | ||
| test-smp-parse.c | 7 months ago | |
| test-string-input-visitor.c | ||
| test-string-output-visitor.c | ||
| test-thread-pool.c | 8 months ago | |
| test-throttle.c | 11 months ago | |
| test-timed-average.c | 11 months ago | |
| test-util-filemonitor.c | ||
| test-util-sockets.c | 6 months ago | |
| test-uuid.c | ||
| test-virtio-dmabuf.c | ||
| test-visitor-serialization.c | 9 months ago | |
| test-vmstate.c | 1 month ago | |
| test-write-threshold.c | ||
| test-x86-topo.c | 2 years ago | |
| test-xbzrle.c | ||
| test-xs-node.c | 1 year ago | |
| test-yank.c | 2 weeks ago | |