{"id":2196349,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2196349/?format=json","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.0/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260213143225.161043-3-axboe@kernel.dk>","date":"2026-02-13T14:26:37","name":"[2/2] fdmon-io_uring: check CQ ring directly in gsource_check","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"4f23db7237a9ec78ee455197caccab5da17dd0e5","submitter":{"id":4515,"url":"http://patchwork.ozlabs.org/api/1.0/people/4515/?format=json","name":"Jens Axboe","email":"axboe@kernel.dk"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260213143225.161043-3-axboe@kernel.dk/mbox/","series":[{"id":492105,"url":"http://patchwork.ozlabs.org/api/1.0/series/492105/?format=json","date":"2026-02-13T14:26:37","name":"io_uring fixes","version":1,"mbox":"http://patchwork.ozlabs.org/series/492105/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2196349/checks/","tags":{},"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel-dk.20230601.gappssmtp.com\n header.i=@kernel-dk.20230601.gappssmtp.com header.a=rsa-sha256\n header.s=20230601 header.b=pqqp9zH/;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fCF521DdHz1xvQ\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 14 Feb 2026 01:32:54 +1100 (AEDT)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1vquDr-0003hj-KG; Fri, 13 Feb 2026 09:32:43 -0500","from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <axboe@kernel.dk>) id 1vquDj-0003gD-C3\n for qemu-devel@nongnu.org; Fri, 13 Feb 2026 09:32:35 -0500","from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <axboe@kernel.dk>) id 1vquDg-0006be-Us\n for qemu-devel@nongnu.org; Fri, 13 Feb 2026 09:32:35 -0500","by mail-ot1-x333.google.com with SMTP id\n 46e09a7af769-7d4be94eeacso849141a34.2\n for <qemu-devel@nongnu.org>; Fri, 13 Feb 2026 06:32:32 -0800 (PST)","from m2max ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id\n 46e09a7af769-7d4a733f033sm6564377a34.0.2026.02.13.06.32.30\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 13 Feb 2026 06:32:31 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1770993152; x=1771597952;\n darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=z7shjz985UmXwl4a6E+GGFbs4C1k6XgV3kTNLugeC3A=;\n b=pqqp9zH/QtSvHyzqgEdSUiDlqfqDlLJwvLdJglW/km7diIz1iBsFbSl6UMNOE6JrLx\n C7tgXFRU8AoUjax/OSLz/iyHX9kq8Cxa3Xql5MEEdCokvyVeVcMoGS/Jih2oSsZ35E7A\n tMKoV0ualnq2amrTSOoUe7VzCbmt3X9oNutXNJUeB6ijyKJq1wS4nWhE14c+uSSAxJM4\n tBd83mcnema3dt7mwv/PQtaBYJcfbLkv5P9wy2Wxtb6KqIYy5GGadgq7Lu4WARCny14k\n c+JUgFSku8xmXQXRejraevBOSwV6JRJMNRTlCAwwtx8BXru19LVo3nxGOTQFcHINxdae\n TiTQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1770993152; x=1771597952;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=z7shjz985UmXwl4a6E+GGFbs4C1k6XgV3kTNLugeC3A=;\n b=nEJKIuGLjVzi3Ob/9aqABGhU6f8Kjrx2V7iB7pYW83U6fjp9monRrPTj4HImOR/aPG\n dkJjLnJ1vI7AOwF5W6pjlgyjtFoeYnJeomxSXBZoWfqgsSnt0OASqUT1f1eAYkGqrL8h\n k4+yEIxivUcn1/KrylMl92/DTainpCDOAW+6yo1eHiO6jeC/IMZBE44VMgJriivz5XFd\n h39VK5PvGsxF/8WNChAPlDjFNvM0oD1E/NrNX2I1AuIQ9UXL7dKEk2J8elQZRtWEKBYi\n DSYm3h1zx9o8zQl/6L0kzWqp8lTBrfGquFKDuge5MPwl8d4jG7IqMOCqbXM4LP6kx6yF\n 7FeQ==","X-Gm-Message-State":"AOJu0YwNHodX7uO10+0+n3PXFfvruK1D+r0u3UOTNt47oaXg09OTdaLr\n lEReEYw22X2YcM9By4DW2jWWNWpT4vx2QqU4srg2ERTVhTC3EZvo6Aa83Vn9z/++PRA=","X-Gm-Gg":"AZuq6aKn8jmCohYcsVI6TPMOjAll/yXUgNb6kBuLls5CkSo4mUFlW2xg9mRP6Yk4wNc\n loab0FK8tf9PmquHJYueY95jSVvpi8XffL7YpQxm1PERQs+CjYzR+B8K+AYk2KdydhU9SfzebcL\n PQpXVrSKZFrzoJikGRpNFKGi6OqSmjlSSr+3Vj6hbIIckiAAyUIF5WD5BV/og1oeIpLp2lR9Ejh\n Zw6/txwvHZl7+jCyqlZfCS9LhbOl0lJK4CWmj3wQaAjLXyvk0VN2Bx41DibT/5ZSex8bdjI8iN7\n jIwxWWXx/qTwzraDZD6g8dcvfATTlR0cMw2D0iyCr+p9VJICvyPig9QqpUJHU5Z0gfugTRvGkwE\n WdsIy2A3sEWc9QadyzGnow4Ldy74N4+i6VEURWGgq2unhVB+A0TJrUtijUyJ2TeZjtz7ELZ8WZQ\n kJ0Xq4i5l94oNnU6zZwPK4e+Ep5UrDmELCa3zEGYPs4L1LWjF9If+YZenBpq/Tk/p+p5tJ","X-Received":"by 2002:a05:6830:67e9:b0:7d1:4d70:736e with SMTP id\n 46e09a7af769-7d4c4b67e2amr1048722a34.35.1770993151804;\n Fri, 13 Feb 2026 06:32:31 -0800 (PST)","From":"Jens Axboe <axboe@kernel.dk>","To":"qemu-block@nongnu.org","Cc":"qemu-devel@nongnu.org, fam@euphon.net, stefanha@redhat.com,\n Jens Axboe <axboe@kernel.dk>","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":"8bit","Received-SPF":"pass client-ip=2607:f8b0:4864:20::333;\n 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,\n DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n 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 <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"gsource_check() only looks at the ppoll revents for the io_uring fd,\nbut CQEs can be posted during gsource_prepare()'s io_uring_submit()\ncall via kernel task_work processing on syscall exit. These completions\nare already sitting in the CQ ring but the ring fd may not be signaled\nyet, causing gsource_check() to return false.\n\nAdd a fallback io_uring_cq_ready() check so completions that arrive\nduring submission are dispatched immediately rather than waiting for\nthe next ppoll() cycle.\n\nSigned-off-by: Jens Axboe <axboe@kernel.dk>\n---\n util/fdmon-io_uring.c | 14 +++++++++++++-\n 1 file changed, 13 insertions(+), 1 deletion(-)","diff":"diff --git a/util/fdmon-io_uring.c b/util/fdmon-io_uring.c\nindex 96392876b490..124e40594c17 100644\n--- a/util/fdmon-io_uring.c\n+++ b/util/fdmon-io_uring.c\n@@ -352,7 +352,19 @@ static void fdmon_io_uring_gsource_prepare(AioContext *ctx)\n static bool fdmon_io_uring_gsource_check(AioContext *ctx)\n {\n     gpointer tag = ctx->io_uring_fd_tag;\n-    return g_source_query_unix_fd(&ctx->source, tag) & G_IO_IN;\n+\n+    /* Check ppoll revents (normal path) */\n+    if (g_source_query_unix_fd(&ctx->source, tag) & G_IO_IN) {\n+        return true;\n+    }\n+\n+    /*\n+     * Also check for CQEs that may have been posted during prepare's\n+     * io_uring_submit() via task_work on syscall exit.  Without this,\n+     * the main loop can miss completions and sleep in ppoll() until the\n+     * next timer fires.\n+     */\n+    return io_uring_cq_ready(&ctx->fdmon_io_uring);\n }\n \n /* Dispatch CQE handlers that are ready */\n","prefixes":["2/2"]}