Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging

Pull request

Jens Axboe's fixes for fdmon-io_uring.

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmmcYhEACgkQnKSrs4Gr
# c8i4BAgAgI7UlEbQs0iLV0N4qUJ7pc8p/bgRNP9/TkjFYtFIcmRZtNeRvlkIVdgD
# F2QAMJAP0KzP3T2mo3a9f5kcvKIqLFsOpwKmMiUa98aA4dDhkT6TNOqLjgKmaXmR
# muEv7TKjBPzZqNBWDyEMIcnIzxSGjnbATN1BdvEy+7awJJDqaYZEkxTT6u+Vv/2l
# MlaYwnNbfye7nFM/xCBt/wH07XLZMC3pezHQxJGq7CGGTG0JFFeXIhm0HrTjlAt/
# EBVf41zsAtYqBj9egl5Y570NXkTirBbY+Niv/rqtavknC/tAxN+PQTBoobHm2Wna
# yU7+L+lidtIcdwhbzeZar0KdoDhsEQ==
# =zdFX
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon Feb 23 14:20:01 2026 GMT
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* tag 'block-pull-request' of https://gitlab.com/stefanha/qemu:
  fdmon-io_uring: check CQ ring directly in gsource_check
  aio-posix: notify main loop when SQEs are queued

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell
2026-02-24 11:32:35 +00:00
2 changed files with 22 additions and 1 deletions

View File

@@ -23,6 +23,7 @@
#include "qemu/rcu_queue.h"
#include "qemu/sockets.h"
#include "qemu/cutils.h"
#include "system/iothread.h"
#include "trace.h"
#include "aio-posix.h"
@@ -813,5 +814,13 @@ void aio_add_sqe(void (*prep_sqe)(struct io_uring_sqe *sqe, void *opaque),
{
AioContext *ctx = qemu_get_current_aio_context();
ctx->fdmon_ops->add_sqe(ctx, prep_sqe, opaque, cqe_handler);
/*
* Wake the main loop if it is sleeping in ppoll(). When a vCPU thread
* queues SQEs, the actual io_uring_submit() only happens in
* gsource_prepare() in the main loop thread. Without this notify, the
* main loop thread's ppoll() can sleep up to 499ms before submitting.
*/
aio_notify(ctx);
}
#endif /* CONFIG_LINUX_IO_URING */

View File

@@ -344,7 +344,19 @@ static void fdmon_io_uring_gsource_prepare(AioContext *ctx)
static bool fdmon_io_uring_gsource_check(AioContext *ctx)
{
gpointer tag = ctx->io_uring_fd_tag;
return g_source_query_unix_fd(&ctx->source, tag) & G_IO_IN;
/* Check ppoll revents (normal path) */
if (g_source_query_unix_fd(&ctx->source, tag) & G_IO_IN) {
return true;
}
/*
* Also check for CQEs that may have been posted during prepare's
* io_uring_submit() via task_work on syscall exit. Without this,
* the main loop can miss completions and sleep in ppoll() until the
* next timer fires.
*/
return io_uring_cq_ready(&ctx->fdmon_io_uring);
}
/* Dispatch CQE handlers that are ready */