From nobody Fri Feb 20 14:35:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1770993186; cv=none; d=zohomail.com; s=zohoarc; b=bN3gFRG/8fob7ZkZAJkoQ94csemyDFF8KBJs5UFslCKz9RrTpRrZt/sWrJT30usfBKBWNOnVtREnvS+qGs4NtbvysYYLpuaWUoAVGvkeEr/jALLL0o4ZhIeyf6oj2/BX7+zw3pNYEsju+6oJQawEO6DasZEvh5XxAm3iBWkAuns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770993186; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hqBOMzl28DKqqn/5ITt53IZh3OcJ6ZgKOh+W57xkrRk=; b=UU7lriiY5SKkFfUKCROQsvTrmMnFcQiPgTskpoL/KBWgMu5MehYccXX4F6qlE01jUoADMNbVgCgNBndMYvk8+5cDSqNm97/84a70z0rJkrG+KkE54tbWBYLKsEyjL41diuRJOOncJlA+LaGma4G2qOcWtqzlo0Pa2Qq0ulXpkX4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770993186456543.3639342775106; Fri, 13 Feb 2026 06:33:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vquDv-0003iq-Lz; Fri, 13 Feb 2026 09:32:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vquDj-0003gW-H9 for qemu-devel@nongnu.org; Fri, 13 Feb 2026 09:32:35 -0500 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vquDg-0006bX-2x for qemu-devel@nongnu.org; Fri, 13 Feb 2026 09:32:35 -0500 Received: by mail-ot1-x335.google.com with SMTP id 46e09a7af769-7d18c654458so392564a34.3 for ; Fri, 13 Feb 2026 06:32:31 -0800 (PST) Received: from m2max ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7d4a733f033sm6564377a34.0.2026.02.13.06.32.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Feb 2026 06:32:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1770993151; x=1771597951; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hqBOMzl28DKqqn/5ITt53IZh3OcJ6ZgKOh+W57xkrRk=; b=rb/06dDg0/hiXFvkdOelzBvz49TIY9xnimWOU2EtOwkML7YbqYyvrUWuVn/TAXnvuh WdiQep9Mpggf00OqULtW7G9rXGcpgb9U5PU4TDpZiTEKjiFXCn5VRq3vkYA/2temCkQ+ PtGoDB+AplNsgbrtCF49sC8nXNeMDUDUbLjRjlMVnaHYI3PulOaRD/fjHH5sAj8BkZ5f 4+HQ5Nb4e2ohNr17l9qBEPEu2DWCuqym24EGXF6/w6i7JOd1/Fd8nYfW4a88l06dKtsA RpxyqG1FRmfpadnJQmruJhCmpxlGwYHopZQhLWhKpe5QETydxJ786OPxlVZpAhFzhns6 zo2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770993151; x=1771597951; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=hqBOMzl28DKqqn/5ITt53IZh3OcJ6ZgKOh+W57xkrRk=; b=BKRzbQ+aBvAPZGlTaEvzFqJdkLVBbj6H8peTuB4cKma/eZ0gaDtBN6ipUb6oE+d4Up Zz39n+CInM3uNb4AYk2dM7M7PmhFcbALZKIG96fj3bhtLHd/pah5yM0TPp0zaRviAtS2 oyDmduHfbxY5vCSuP1Wn1PoTlrWsI3Jr/C2qa5lNwupppxoefzqa6R3stj2b0nM+wtoA Azk8QgWccQe5aSgYauHDKdkSiqnrnKEqdANEkG1DrVkMTVO1YGu5bV6D4NYdmtl4soQo IgHLEE34VwoApQ2J63WJMqrktLaodjfGbSt3P3mXwAyAQxY8/+KLVIynQYxEA2fFq6js DzeQ== X-Gm-Message-State: AOJu0YzGL016uq6FFc1djJqnWy4LS03R7fsuroj73qf+ws/Jp6SUpMox gN88qLAn+nTOi9i+xMnoYrbWuHUBdY7FLWuKMXZWhpdehGQFCqrOAPlyBJD+aOo5vtk= X-Gm-Gg: AZuq6aKzsNYvrSGM6eraHxBwCzMKDedT4jFr8Comr7+ZAK1gQgOLCiGiQ9aFfPJPHkp ocGcgUfc7ZFAEeUfnt9q98KPNkPwswaLVOP97UQYKrUD/jGBSAtC0MfkRO0vyBBROSK1QXOzeSL QHax5wg2so9YFHxIwfLrleTXG7FYYPNthtE+1Egbj+Le4Vc1uSr6ECVstxbpYuDx9ItfG9l1q7u lU+PImqImUMqTRsIdDaK3gk5hOEseIt2jlPfGowd5d6pXq30Ls2wyOkeH6S+5ICtNG7bKNc9O6z PUuw7qaSxxkIdQPtpU2knN4Fc1F0+EXaQTUV8PBrPgPxAkjNdbOa93OEiRITUjS2O4IgAla7KN0 C6tTibM6NeYdgUQr5q6JNi1wMrTu5hN5NF6CM6Ei8JJEnVIkMpMtrrVd/bsLA6hNwHTNh4eU5WS PMb+fjxnOWNq00rQnpSI0xR79wf/WGlngTVUyvwN/aX8VI5AbrGVD7yPCtkIg5LMc+Hh7s X-Received: by 2002:a05:6830:648a:b0:7c7:6d15:6ac2 with SMTP id 46e09a7af769-7d4c4a0b773mr1094809a34.3.1770993150635; Fri, 13 Feb 2026 06:32:30 -0800 (PST) From: Jens Axboe To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, fam@euphon.net, stefanha@redhat.com, Jens Axboe Subject: [PATCH 1/2] fdmon-io_uring: notify main loop when SQEs are queued Date: Fri, 13 Feb 2026 07:26:36 -0700 Message-ID: <20260213143225.161043-2-axboe@kernel.dk> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260213143225.161043-1-axboe@kernel.dk> References: <20260213143225.161043-1-axboe@kernel.dk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::335; envelope-from=axboe@kernel.dk; helo=mail-ot1-x335.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel-dk.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1770993188515154100 Content-Type: text/plain; charset="utf-8" When a vCPU thread handles MMIO (holding BQL), aio_co_enter() runs the block I/O coroutine inline on the vCPU thread because qemu_get_current_aio_context() returns the main AioContext when BQL is held. The coroutine calls luring_co_submit() which queues an SQE via fdmon_io_uring_add_sqe(), but the actual io_uring_submit() only happens in gsource_prepare() on the main loop thread. Since the coroutine ran inline (not via aio_co_schedule()), no BH is scheduled and aio_notify() is never called. The main loop remains asleep in ppoll() with up to a 499ms timeout, leaving the SQE unsubmitted until the next timer fires. Fix this by calling aio_notify() after queuing the SQE. This wakes the main loop via the eventfd so it can run gsource_prepare() and submit the pending SQE promptly. This is a generic fix that benefits all devices using aio=3Dio_uring. Without it, AHCI/SATA devices see MUCH worse I/O latency since they use MMIO (not ioeventfd like virtio) and have no other mechanism to wake the main loop after queuing block I/O. This is usually a bit hard to detect, as it also relies on the ppoll loop not waking up for other activity, and micro benchmarks tend not to see it because they don't have any real processing time. With a synthetic test case that has a few usleep() to simulate processing of read data, it's very noticeable. The below example reads 128MB with O_DIRECT in 128KB chunks in batches of 16, and has a 1ms delay before each batch submit, and a 1ms delay after processing each completion. Running it on /dev/sda yields: time sudo ./iotest /dev/sda ________________________________________________________ Executed in 25.76 secs fish external usr time 6.19 millis 783.00 micros 5.41 millis sys time 12.43 millis 642.00 micros 11.79 millis while on a virtio-blk or NVMe device we get: time sudo ./iotest /dev/vdb ________________________________________________________ Executed in 1.25 secs fish external usr time 1.40 millis 0.30 millis 1.10 millis sys time 17.61 millis 1.43 millis 16.18 millis time sudo ./iotest /dev/nvme0n1 ________________________________________________________ Executed in 1.26 secs fish external usr time 6.11 millis 0.52 millis 5.59 millis sys time 13.94 millis 1.50 millis 12.43 millis where the latter are consistent. If we run the same test but keep the socket for the ssh connection active by having activity there, then the sda test looks as follows: time sudo ./iotest /dev/sda ________________________________________________________ Executed in 1.23 secs fish external usr time 2.70 millis 39.00 micros 2.66 millis sys time 4.97 millis 977.00 micros 3.99 millis as now the ppoll loop is woken all the time anyway. After this fix, on an idle system: time sudo ./iotest /dev/sda ________________________________________________________ Executed in 1.30 secs fish external usr time 2.14 millis 0.14 millis 2.00 millis sys time 16.93 millis 1.16 millis 15.76 millis Signed-off-by: Jens Axboe Reviewed-by: Fiona Ebner Tested-by: Fiona Ebner --- util/fdmon-io_uring.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/util/fdmon-io_uring.c b/util/fdmon-io_uring.c index d0b56127c670..96392876b490 100644 --- a/util/fdmon-io_uring.c +++ b/util/fdmon-io_uring.c @@ -181,6 +181,14 @@ static void fdmon_io_uring_add_sqe(AioContext *ctx, =20 trace_fdmon_io_uring_add_sqe(ctx, opaque, sqe->opcode, sqe->fd, sqe->o= ff, cqe_handler); + + /* + * Wake the main loop if it is sleeping in ppoll(). When a vCPU thread + * runs a coroutine inline (holding BQL), it queues SQEs here but the + * actual io_uring_submit() only happens in gsource_prepare(). Without + * this notify, ppoll() can sleep up to 499ms before submitting. + */ + aio_notify(ctx); } =20 static void fdmon_special_cqe_handler(CqeHandler *cqe_handler) --=20 2.51.0 From nobody Fri Feb 20 14:35:32 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1770993174; cv=none; d=zohomail.com; s=zohoarc; b=H7mzCh/K3RtEoyshm141TnUP6VnL4rcL4Rg9k3LVa+PXCrOtrZDudZfXO9QkezsGgUjspVWpHFb/Xc/2q9wMyb62j/XFj+eoKMVX8pDu/k2eAWHOilHr07P6ajz+Xg23ayfnMtAQBvNmK+griXBXxnnZ4z5vWCeSxAJDhIuOAFQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770993174; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=z7shjz985UmXwl4a6E+GGFbs4C1k6XgV3kTNLugeC3A=; b=IpwDdfWUBdvW4WHFH22AvAbch7upPVYx7NNCZAgxiXD620Vrkfs/YSHcnVpAugkvI/sNxt8h3+qVPugG73BDL4BmXnpaL1AKESkd1YLfxXnLAMIno6+jp1+UYuQcbyv4yUVSeWp9pbOKHpVV1RqEFJ6NrLz5irXls1uPAQfz72I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770993173943382.3077617593149; Fri, 13 Feb 2026 06:32:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vquDr-0003hj-KG; Fri, 13 Feb 2026 09:32:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vquDj-0003gD-C3 for qemu-devel@nongnu.org; Fri, 13 Feb 2026 09:32:35 -0500 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vquDg-0006be-Us for qemu-devel@nongnu.org; Fri, 13 Feb 2026 09:32:35 -0500 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-7d4be94eeacso849141a34.2 for ; Fri, 13 Feb 2026 06:32:32 -0800 (PST) Received: from m2max ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7d4a733f033sm6564377a34.0.2026.02.13.06.32.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Feb 2026 06:32:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1770993152; x=1771597952; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z7shjz985UmXwl4a6E+GGFbs4C1k6XgV3kTNLugeC3A=; b=pqqp9zH/QtSvHyzqgEdSUiDlqfqDlLJwvLdJglW/km7diIz1iBsFbSl6UMNOE6JrLx C7tgXFRU8AoUjax/OSLz/iyHX9kq8Cxa3Xql5MEEdCokvyVeVcMoGS/Jih2oSsZ35E7A tMKoV0ualnq2amrTSOoUe7VzCbmt3X9oNutXNJUeB6ijyKJq1wS4nWhE14c+uSSAxJM4 tBd83mcnema3dt7mwv/PQtaBYJcfbLkv5P9wy2Wxtb6KqIYy5GGadgq7Lu4WARCny14k c+JUgFSku8xmXQXRejraevBOSwV6JRJMNRTlCAwwtx8BXru19LVo3nxGOTQFcHINxdae TiTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770993152; x=1771597952; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=z7shjz985UmXwl4a6E+GGFbs4C1k6XgV3kTNLugeC3A=; b=nEJKIuGLjVzi3Ob/9aqABGhU6f8Kjrx2V7iB7pYW83U6fjp9monRrPTj4HImOR/aPG dkJjLnJ1vI7AOwF5W6pjlgyjtFoeYnJeomxSXBZoWfqgsSnt0OASqUT1f1eAYkGqrL8h k4+yEIxivUcn1/KrylMl92/DTainpCDOAW+6yo1eHiO6jeC/IMZBE44VMgJriivz5XFd h39VK5PvGsxF/8WNChAPlDjFNvM0oD1E/NrNX2I1AuIQ9UXL7dKEk2J8elQZRtWEKBYi DSYm3h1zx9o8zQl/6L0kzWqp8lTBrfGquFKDuge5MPwl8d4jG7IqMOCqbXM4LP6kx6yF 7FeQ== X-Gm-Message-State: AOJu0YwNHodX7uO10+0+n3PXFfvruK1D+r0u3UOTNt47oaXg09OTdaLr lEReEYw22X2YcM9By4DW2jWWNWpT4vx2QqU4srg2ERTVhTC3EZvo6Aa83Vn9z/++PRA= X-Gm-Gg: AZuq6aKn8jmCohYcsVI6TPMOjAll/yXUgNb6kBuLls5CkSo4mUFlW2xg9mRP6Yk4wNc loab0FK8tf9PmquHJYueY95jSVvpi8XffL7YpQxm1PERQs+CjYzR+B8K+AYk2KdydhU9SfzebcL PQpXVrSKZFrzoJikGRpNFKGi6OqSmjlSSr+3Vj6hbIIckiAAyUIF5WD5BV/og1oeIpLp2lR9Ejh Zw6/txwvHZl7+jCyqlZfCS9LhbOl0lJK4CWmj3wQaAjLXyvk0VN2Bx41DibT/5ZSex8bdjI8iN7 jIwxWWXx/qTwzraDZD6g8dcvfATTlR0cMw2D0iyCr+p9VJICvyPig9QqpUJHU5Z0gfugTRvGkwE WdsIy2A3sEWc9QadyzGnow4Ldy74N4+i6VEURWGgq2unhVB+A0TJrUtijUyJ2TeZjtz7ELZ8WZQ kJ0Xq4i5l94oNnU6zZwPK4e+Ep5UrDmELCa3zEGYPs4L1LWjF9If+YZenBpq/Tk/p+p5tJ X-Received: by 2002:a05:6830:67e9:b0:7d1:4d70:736e with SMTP id 46e09a7af769-7d4c4b67e2amr1048722a34.35.1770993151804; Fri, 13 Feb 2026 06:32:31 -0800 (PST) From: Jens Axboe To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, fam@euphon.net, stefanha@redhat.com, Jens Axboe Subject: [PATCH 2/2] fdmon-io_uring: check CQ ring directly in gsource_check Date: Fri, 13 Feb 2026 07:26:37 -0700 Message-ID: <20260213143225.161043-3-axboe@kernel.dk> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260213143225.161043-1-axboe@kernel.dk> References: <20260213143225.161043-1-axboe@kernel.dk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::333; envelope-from=axboe@kernel.dk; helo=mail-ot1-x333.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel-dk.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1770993175681158500 Content-Type: text/plain; charset="utf-8" gsource_check() only looks at the ppoll revents for the io_uring fd, but CQEs can be posted during gsource_prepare()'s io_uring_submit() call via kernel task_work processing on syscall exit. These completions are already sitting in the CQ ring but the ring fd may not be signaled yet, causing gsource_check() to return false. Add a fallback io_uring_cq_ready() check so completions that arrive during submission are dispatched immediately rather than waiting for the next ppoll() cycle. Signed-off-by: Jens Axboe Reviewed-by: Fiona Ebner Reviewed-by: Kevin Wolf Reviewed-by: Stefan Hajnoczi Tested-by: Fiona Ebner --- util/fdmon-io_uring.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/util/fdmon-io_uring.c b/util/fdmon-io_uring.c index 96392876b490..124e40594c17 100644 --- a/util/fdmon-io_uring.c +++ b/util/fdmon-io_uring.c @@ -352,7 +352,19 @@ static void fdmon_io_uring_gsource_prepare(AioContext = *ctx) static bool fdmon_io_uring_gsource_check(AioContext *ctx) { gpointer tag =3D 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); } =20 /* Dispatch CQE handlers that are ready */ --=20 2.51.0