From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E88B4ECAAD3 for ; Thu, 1 Sep 2022 09:34:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234159AbiIAJeC (ORCPT ); Thu, 1 Sep 2022 05:34:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234157AbiIAJdr (ORCPT ); Thu, 1 Sep 2022 05:33:47 -0400 Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CE26133F2F for ; Thu, 1 Sep 2022 02:33:44 -0700 (PDT) Received: from pps.filterd (m0109332.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2819Wnjw003109 for ; Thu, 1 Sep 2022 02:33:42 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=facebook; bh=TPzIUCvI+bEJwioztEWjiUFsQfWSFij/MhONrauDgfM=; b=UEgQkWf2HsDu1C0KCbXJyeFueJOPHFppWJryFq3zssUXYHwDU2KvyKrbWZEQOEAdUkSo VdqDM2yL57xHTveNKvqZaWYXHMrLQ/VM23t6KH6M1tmZyWoSIct9xlK6Gfs/QeOkleHG dLTU8n7jFwi40AyyQA8+kq8RML5Q1eSVcNE= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3jat6s005c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 01 Sep 2022 02:33:42 -0700 Received: from twshared8288.05.ash9.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 1 Sep 2022 02:33:33 -0700 Received: by devbig038.lla2.facebook.com (Postfix, from userid 572232) id CF6085769402; Thu, 1 Sep 2022 02:33:06 -0700 (PDT) From: Dylan Yudaken To: Jens Axboe , Pavel Begunkov , CC: , Dylan Yudaken Subject: [PATCH liburing v2 09/12] expose CQ ring overflow state Date: Thu, 1 Sep 2022 02:33:00 -0700 Message-ID: <20220901093303.1974274-10-dylany@fb.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220901093303.1974274-1-dylany@fb.com> References: <20220901093303.1974274-1-dylany@fb.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-GUID: Yty35S0fBUaACgEmQMExvpSs12WX9bTD X-Proofpoint-ORIG-GUID: Yty35S0fBUaACgEmQMExvpSs12WX9bTD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-09-01_06,2022-08-31_03,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Allow the application to easily view if the CQ ring is in overflow state = in case it would like to explicitly flush using io_uring_get_events. Explicit flushing can be useful for applications that prefer to have reduced latency on CQs than to process as many as possible. Signed-off-by: Dylan Yudaken --- src/include/liburing.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/include/liburing.h b/src/include/liburing.h index 3c5097b255de..ca8fbd608901 100644 --- a/src/include/liburing.h +++ b/src/include/liburing.h @@ -1086,6 +1086,15 @@ static inline unsigned io_uring_cq_ready(const str= uct io_uring *ring) return io_uring_smp_load_acquire(ring->cq.ktail) - *ring->cq.khead; } =20 +/* + * Returns true if there are overflow entries waiting to be flushed onto + * the CQ ring + */ +static inline bool io_uring_cq_has_overflow(const struct io_uring *ring) +{ + return IO_URING_READ_ONCE(*ring->sq.kflags) & IORING_SQ_CQ_OVERFLOW; +} + /* * Returns true if the eventfd notification is currently enabled */ --=20 2.30.2