From patchwork Tue Jun 14 15:27:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 12881257 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 6F906C433EF for ; Tue, 14 Jun 2022 15:28:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356689AbiFNP2J (ORCPT ); Tue, 14 Jun 2022 11:28:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356878AbiFNP2I (ORCPT ); Tue, 14 Jun 2022 11:28:08 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE61613D50 for ; Tue, 14 Jun 2022 08:28:05 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id p6-20020a05600c1d8600b0039c630b8d96so930307wms.1 for ; Tue, 14 Jun 2022 08:28:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FtwqEhPzT3nHMQBDGkRoV01F2A3n7O/yvr9Y5995Vdg=; b=SHTdE/B1anm+KTXgFUlR9XtmyEn8Z7y1lh0952BAvsNurbLIU/sod4Cf9Wdyusvs5K Lf1fhv3XfFwEzHGXYB9pQBCE3AKV2A6AC7jLGMzFqnefhVSd+QpyADNCUqroIw/onYRh XSuJoYmjowrTlElIuBlLek9Oz9G8BJGBL+4y4NqGjBJnBn1YvTHv2QCytYfyKbY8kUa+ jYEZtzF0SpLPLuxizwdMFReim/d/iA/VUgdsP2G7wZ153ObPtVuJ1w/dSxk13B3aLOLo iqdpnoJtL5wb+i5pQQiTWbcI3hN+KfM/Ap4L+Tog6vskKlT3AKx65SFNw1Ma5utFDZ4Z HiUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FtwqEhPzT3nHMQBDGkRoV01F2A3n7O/yvr9Y5995Vdg=; b=gjjcgSZWP85qyt85uWqupzlaQ1bPGyrFfWF3sa79yKfT3z9AKhfK7l5UN5gD2LAuYc MrRS1diRSfp/ROJgn0rJ4yGImXggDr0nIyWQMwmkINSyYiDB4LKoITePzz/hpxhl59Wu Ldn7DpOCAq7pC4418avs+Txattp5Fy0G3ZUlNA5RcTZ7VaYeXw+8VN96saxR5vo+9DVa i1t3rXOyJh27fTEUN+mUe+8SEG71g8f4kg+AJltEfUGhNJqP/BDoiHDha0tFbqTg1MXG DRRk54K7O8q8PYUnm26ttVpiqLS+Y1IgoYm9lRI6z74lXlpxInpKDEaeNXZWooYc9eL1 T8fA== X-Gm-Message-State: AOAM533ieqhZesx+gGmBtHdzGYyhfpdACzLOe8zV9GMNp+O/MWdk3erX 2kv/0U/KSloSd3Y0VeN98qEh0x7JfH4rYw== X-Google-Smtp-Source: ABdhPJzdXh3HIqbgLATKviHT276OYBtneNVKe8P9rRbvzoIglVazn8Fz8b0Ud5O53SnGllOpeigf0g== X-Received: by 2002:a7b:c758:0:b0:39c:44ce:f00f with SMTP id w24-20020a7bc758000000b0039c44cef00fmr4756849wmk.167.1655220483638; Tue, 14 Jun 2022 08:28:03 -0700 (PDT) Received: from 127.0.0.1localhost (188.28.125.106.threembb.co.uk. [188.28.125.106]) by smtp.gmail.com with ESMTPSA id v22-20020a7bcb56000000b0039482d95ab7sm13313529wmj.24.2022.06.14.08.28.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 08:28:03 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com Subject: [PATCH liburing v2 1/3] io_uring: update headers with IORING_SETUP_SINGLE_ISSUER Date: Tue, 14 Jun 2022 16:27:34 +0100 Message-Id: X-Mailer: git-send-email 2.36.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Signed-off-by: Pavel Begunkov --- src/include/liburing/io_uring.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h index 15d9fbd..ee6ccc9 100644 --- a/src/include/liburing/io_uring.h +++ b/src/include/liburing/io_uring.h @@ -137,9 +137,12 @@ enum { * IORING_SQ_TASKRUN in the sq ring flags. Not valid with COOP_TASKRUN. */ #define IORING_SETUP_TASKRUN_FLAG (1U << 9) - #define IORING_SETUP_SQE128 (1U << 10) /* SQEs are 128 byte */ #define IORING_SETUP_CQE32 (1U << 11) /* CQEs are 32 byte */ +/* + * Only one task is allowed to submit requests + */ +#define IORING_SETUP_SINGLE_ISSUER (1U << 12) enum io_uring_op { IORING_OP_NOP, From patchwork Tue Jun 14 15:27:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 12881258 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 368D7C43334 for ; Tue, 14 Jun 2022 15:28:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356817AbiFNP2K (ORCPT ); Tue, 14 Jun 2022 11:28:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356877AbiFNP2I (ORCPT ); Tue, 14 Jun 2022 11:28:08 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE58BE0B0 for ; Tue, 14 Jun 2022 08:28:06 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id x17so11776608wrg.6 for ; Tue, 14 Jun 2022 08:28:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=akrZeuaOrBnQ/mu5huCLm/5pstUHaMxePvISJ2J0CQI=; b=BTM0uhYUP4jRytg9mCnVSqGVrNOP4nvWLA/FErE5tcVm/99gVY+Df4zr8ngzllazAG BlZnUsmN1awlIp0j0bpWGrnchDUPXEPn16pRklFDOWBCFRbN+RlpYHvtsO41m1S654wy xNXBw1AMnLxTMYA1o0QWeFvIC9ieSFcQtDfUZSA7n17Rm/oyuoL5ZWBfcG3H3CcIqyHw KKCqOLzyAJESTp1VprzLcN3nvYxikCgjenSU5925J3rfMDD/soF22H/7EfrAeLGWWEfr Z2p8xekM0mU9hJ61UQn1N5KZGlySgIC9COOlTKOQun7eqmL6NNSeDXf47N44ALT2NbkY gK+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=akrZeuaOrBnQ/mu5huCLm/5pstUHaMxePvISJ2J0CQI=; b=IB/GLj4pY8AiHeH4wYucb5JwUrwn7mtog6yx7xwcrRBz+vM4QlIy5otkm/KCzNM7Al mxHNfUPSu9xNnhOjQbXfflDXKqxPs4Kc1XE4QOrDdtzUeY7NJ6Uz74qSLVCUWC2NSf9S pgnRs6IHBHBqLM8saDlez5BzyYBT8Vl4HjYATrncAvxAfk3NzbExQU5BH6KrZjlg+JuP RL67HA4KoxMTghpQqVcSwZzCvJtaIT3u2AkIn9xFuBZR/VeIbJ6edRMqv9OfRjIOeg7+ 1T797TgrP5SzWx/QsaHnePT++eV8KfUIE1l90MY55MFTSHzZU7r6ifIDNWKOH2Ynryx9 KFIg== X-Gm-Message-State: AJIora+G81N5VWgStXqRUyzGaa4Yx0vphbIUL11KbPa1z1gkAKnBodd/ jaPZU14sJjBzqbjIKiBhAERV9geI9ers5w== X-Google-Smtp-Source: AGRyM1ugoQPGqbGGVBBMHLr4xnaHuc6LMU1EYpAzlWjwpBPQcR6uIDYX/0wxUYdIuJc1qqXPhYotXA== X-Received: by 2002:a05:6000:1b03:b0:216:43b4:82f1 with SMTP id f3-20020a0560001b0300b0021643b482f1mr5424732wrz.232.1655220484776; Tue, 14 Jun 2022 08:28:04 -0700 (PDT) Received: from 127.0.0.1localhost (188.28.125.106.threembb.co.uk. [188.28.125.106]) by smtp.gmail.com with ESMTPSA id v22-20020a7bcb56000000b0039482d95ab7sm13313529wmj.24.2022.06.14.08.28.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 08:28:04 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com Subject: [PATCH liburing v2 2/3] examples: add a simple single-shot poll benchmark Date: Tue, 14 Jun 2022 16:27:35 +0100 Message-Id: <4125f93afbaa8125190ebf5d0afad6aba008f542.1655219150.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Signed-off-by: Pavel Begunkov --- examples/Makefile | 3 +- examples/poll-bench.c | 101 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 examples/poll-bench.c diff --git a/examples/Makefile b/examples/Makefile index 95a45f9..8e7067f 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -13,7 +13,8 @@ endif example_srcs := \ io_uring-cp.c \ io_uring-test.c \ - link-cp.c + link-cp.c \ + poll-bench.c all_targets := diff --git a/examples/poll-bench.c b/examples/poll-bench.c new file mode 100644 index 0000000..66fd9e3 --- /dev/null +++ b/examples/poll-bench.c @@ -0,0 +1,101 @@ +/* SPDX-License-Identifier: MIT */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "liburing.h" + +static char buf[4096]; +static unsigned long runtime_ms = 30000; + +static unsigned long gettimeofday_ms(void) +{ + struct timeval tv; + + gettimeofday(&tv, NULL); + return (tv.tv_sec * 1000) + (tv.tv_usec / 1000); +} + +int main(void) +{ + unsigned long tstop; + unsigned long nr_reqs = 0; + struct io_uring_cqe *cqe; + struct io_uring_sqe *sqe; + struct io_uring ring; + int pipe1[2]; + int ret, i, qd = 32; + + if (pipe(pipe1) != 0) { + perror("pipe"); + return 1; + } + + ret = io_uring_queue_init(1024, &ring, IORING_SETUP_SINGLE_ISSUER); + if (ret == -EINVAL) { + fprintf(stderr, "can't single\n"); + ret = io_uring_queue_init(1024, &ring, 0); + } + if (ret) { + fprintf(stderr, "child: ring setup failed: %d\n", ret); + return 1; + } + + ret = io_uring_register_files(&ring, pipe1, 2); + if (ret < 0) { + fprintf(stderr, "io_uring_register_files failed\n"); + return 1; + } + + ret = io_uring_register_ring_fd(&ring); + if (ret < 0) { + fprintf(stderr, "io_uring_register_ring_fd failed\n"); + return 1; + } + + tstop = gettimeofday_ms() + runtime_ms; + do { + for (i = 0; i < qd; i++) { + sqe = io_uring_get_sqe(&ring); + io_uring_prep_poll_add(sqe, 0, POLLIN); + sqe->flags |= IOSQE_FIXED_FILE; + sqe->user_data = 1; + } + + ret = io_uring_submit(&ring); + if (ret != qd) { + fprintf(stderr, "child: sqe submit failed: %d\n", ret); + return 1; + } + + ret = write(pipe1[1], buf, 1); + if (ret != 1) { + fprintf(stderr, "write failed %i\n", errno); + return 1; + } + ret = read(pipe1[0], buf, 1); + if (ret != 1) { + fprintf(stderr, "read failed %i\n", errno); + return 1; + } + + for (i = 0; i < qd; i++) { + ret = io_uring_wait_cqe(&ring, &cqe); + if (ret < 0) { + fprintf(stderr, "child: wait completion %d\n", ret); + break; + } + io_uring_cqe_seen(&ring, cqe); + nr_reqs++; + } + } while (gettimeofday_ms() < tstop); + + fprintf(stderr, "requests/s: %lu\n", nr_reqs * 1000UL / runtime_ms); + return 0; +} From patchwork Tue Jun 14 15:27:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 12881260 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 2154FC43334 for ; Tue, 14 Jun 2022 15:28:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238119AbiFNP2L (ORCPT ); Tue, 14 Jun 2022 11:28:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343886AbiFNP2I (ORCPT ); Tue, 14 Jun 2022 11:28:08 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DE065F7D for ; Tue, 14 Jun 2022 08:28:07 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id w17so4272084wrg.7 for ; Tue, 14 Jun 2022 08:28:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=d7ne3EAgdkQwIczj3Nj+DYkC6JJy/tsTnIBTH4t39sI=; b=UkV39mamzx319GRPMEjAh65kdMk2k14wGtmQNlrSBNx2gblEx6M/gbFxrVb093FM+7 CwZfKNr6/I/Qm3HYyxwl1vfCUbYRQlDD8PEaoz1uUY2ydsLtlhMuzEsRll1WxDwwDWlH u5y5II1xTtEFooO52aJVrXh0+E9kTOv5Oq0Xg+KgLEx0fmq7wzthAHxn060Z/5P0fC/Z q9gj5ASgW8B+ISkSLb8DyVl5wQQ4bcoPSIMVWEjS4FTUrsWufy5hb5kVqSQBwUADqSRr q8RIcUR6btfJmRTQblpSb5l+maQBzTVW6ZAWlcjakmf/dKskUFxshSN/3MP4zB1oL+8D /OJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d7ne3EAgdkQwIczj3Nj+DYkC6JJy/tsTnIBTH4t39sI=; b=D/f3EbPWkP/Pcg+5X5AU1OrfJdu6np1fJpVsTWnDOXQCYEMMyhejlFYUBWgN/pCcNr fTHSCD+Zc6+N0kIjvnfWF+BUSPAZ/pGmWCaLNieohK2dNwn5PtQX3GGjCETPGttsOmCj x1u9fQf5UHFdjAg8g0AWKXq0V3NemUmrVV+MH5zc8yqicHAUwPz8zRFupoiRghCBebBq BEuCz8rWb0kPN4ivmAegbUzoCAxvOEY8XQ+7vLJtWftdinxjqf1kYlb7/EoWNeMOIzpS Y4hv4t7b4yPilxdm5VPgGxUv0N/35bdgX+QS+Xdl9kRTRpyGtHS8F403QvVs/TC47w+L /SkQ== X-Gm-Message-State: AJIora/7u5MOtVnGHfE7oSQK1S+sG30qKf8muakyXRKp00rruhML8Mhk zSnOIPRIzs5GyS3YwTpld0HrQEsZI9fo+w== X-Google-Smtp-Source: AGRyM1uoeiK6ceqvrynqYGBWB7SMJf3EJgZRis3La/Bo/3DUZaggBLV7aiA2CWBqJsxoCQ9LWXx9dQ== X-Received: by 2002:a5d:504d:0:b0:210:24fd:add1 with SMTP id h13-20020a5d504d000000b0021024fdadd1mr5410113wrt.630.1655220485929; Tue, 14 Jun 2022 08:28:05 -0700 (PDT) Received: from 127.0.0.1localhost (188.28.125.106.threembb.co.uk. [188.28.125.106]) by smtp.gmail.com with ESMTPSA id v22-20020a7bcb56000000b0039482d95ab7sm13313529wmj.24.2022.06.14.08.28.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 08:28:05 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com Subject: [PATCH liburing v2 3/3] tests: test IORING_SETUP_SINGLE_ISSUER Date: Tue, 14 Jun 2022 16:27:36 +0100 Message-Id: X-Mailer: git-send-email 2.36.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Signed-off-by: Pavel Begunkov --- test/Makefile | 1 + test/single-issuer.c | 169 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 170 insertions(+) create mode 100644 test/single-issuer.c diff --git a/test/Makefile b/test/Makefile index ab031e0..0750996 100644 --- a/test/Makefile +++ b/test/Makefile @@ -169,6 +169,7 @@ test_srcs := \ wakeup-hang.c \ xattr.c \ skip-cqe.c \ + single-issuer.c \ # EOL diff --git a/test/single-issuer.c b/test/single-issuer.c new file mode 100644 index 0000000..a688626 --- /dev/null +++ b/test/single-issuer.c @@ -0,0 +1,169 @@ +/* SPDX-License-Identifier: MIT */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "liburing.h" +#include "test.h" + +static pid_t pid; + +static pid_t fork_t(void) +{ + pid = fork(); + if (pid == -1) { + fprintf(stderr, "fork failed\n"); + exit(1); + } + return pid; +} + +static int wait_child_t(void) +{ + int wstatus; + + if (waitpid(pid, &wstatus, 0) == (pid_t)-1) { + perror("waitpid()"); + exit(1); + } + if (!WIFEXITED(wstatus)) { + fprintf(stderr, "child failed %i\n", WEXITSTATUS(wstatus)); + exit(1); + } + + return WEXITSTATUS(wstatus); +} + +static int try_submit(struct io_uring *ring) +{ + struct io_uring_cqe *cqe; + struct io_uring_sqe *sqe; + int ret; + + sqe = io_uring_get_sqe(ring); + io_uring_prep_nop(sqe); + sqe->user_data = 42; + + ret = io_uring_submit(ring); + if (ret < 0) + return ret; + + if (ret != 1) + error(1, ret, "submit %i", ret); + ret = io_uring_wait_cqe(ring, &cqe); + if (ret) + error(1, ret, "wait fail %i", ret); + + if (cqe->res || cqe->user_data != 42) + error(1, ret, "invalid cqe"); + + io_uring_cqe_seen(ring, cqe); + return 0; +} + +int main(int argc, char *argv[]) +{ + struct io_uring ring; + int ret; + + if (argc > 1) + return 0; + + ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER); + if (ret == -EINVAL) { + fprintf(stderr, "SETUP_SINGLE_ISSUER is not supported, skip\n"); + return 0; + } else if (ret) { + error(1, ret, "ring init (1) %i", ret); + } + + /* test that the creator iw allowed to submit */ + ret = try_submit(&ring); + if (ret) { + fprintf(stderr, "the creater can't submit %i\n", ret); + return 1; + } + + /* test that a second submitter doesn't succeed */ + if (!fork_t()) { + ret = try_submit(&ring); + if (ret != -EEXIST) { + fprintf(stderr, "not owner child could submit %i\n", ret); + exit(1); + } + exit(0); + } else { + if (wait_child_t()) + return 1; + } + io_uring_queue_exit(&ring); + + + /* test that the first submitter but not creator can submit */ + ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER); + if (ret) + error(1, ret, "ring init (2) %i", ret); + + if (!fork_t()) { + ret = try_submit(&ring); + if (ret) { + fprintf(stderr, "not owner child could submit %i\n", ret); + exit(1); + } + exit(0); + } else { + if (wait_child_t()) + return 1; + } + io_uring_queue_exit(&ring); + + /* test that anyone can submit to a SQPOLL|SINGLE_ISSUER ring */ + ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER|IORING_SETUP_SQPOLL); + if (ret) + error(1, ret, "ring init (3) %i", ret); + + ret = try_submit(&ring); + if (ret) { + fprintf(stderr, "SQPOLL submit failed (creator) %i\n", ret); + exit(1); + } + + if (!fork_t()) { + ret = try_submit(&ring); + if (ret) { + fprintf(stderr, "SQPOLL submit failed (child) %i\n", ret); + exit(1); + } + exit(0); + } else { + if (wait_child_t()) + return 1; + } + io_uring_queue_exit(&ring); + + /* test that IORING_ENTER_REGISTERED_RING doesn't break anything */ + ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER); + if (ret) + error(1, ret, "ring init (4) %i", ret); + + if (!fork_t()) { + ret = try_submit(&ring); + if (ret) { + fprintf(stderr, "not owner child could submit %i\n", ret); + exit(1); + } + exit(0); + } else { + if (wait_child_t()) + return 1; + } + io_uring_queue_exit(&ring); + + return 0; +}