From patchwork Tue Jun 14 16:51:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 12881308 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 E9347CCA47F for ; Tue, 14 Jun 2022 16:52:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350547AbiFNQwd (ORCPT ); Tue, 14 Jun 2022 12:52:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347101AbiFNQv4 (ORCPT ); Tue, 14 Jun 2022 12:51:56 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B92A744A39 for ; Tue, 14 Jun 2022 09:51:54 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id a15so12086094wrh.2 for ; Tue, 14 Jun 2022 09:51:54 -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=Bpz2H2uL6fwUuLZIR0Rv8LzJ0bYssJU2SnKsu8OMW0E=; b=U5niuB8SCrmkEV+lIWf3w/7IGjTwJmBkxz54KLIc/9ihYDFIwBkUbg/Bagij+ySLBA 9Io2j9tTAHvlzDgRaVk4hfmb7K4Z9TRQJVx2At8Dlwk0DleNCP0VYqi4ZeZ8wjlkqgID dzUDf1QmsmnAMMbz6Fty+yD1nnVXdrJidMSpusqI04cj3wjPChhkc7kG+vTvOeIuqtYx 46hJju56pas/pjLvffIUukwSp9f2tYF+50OmZI4Puk9+jCZiKSVCn4jYifx9dNl7hPp4 1JLFVcun3t6nUM8PEPjejQo+G9qjYz31/CmCdn3d+zEqf01zKQHaKrOhcs/Kq7zF8m4N okCg== 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=Bpz2H2uL6fwUuLZIR0Rv8LzJ0bYssJU2SnKsu8OMW0E=; b=x57mRTTwO4hPm7T6dCBp9g/Ztbnrdu5nqTSx7JZArpEaLiEwgMykZZyC9M+OmutIC7 bUaYPQbRmsf1ZZEmpGgVpZ1KDM9ZyYSsyQ43Ec04FkV99ReA7UdzSs7NcLD91T3RkXrO rlS89KhIa6dUrn0Lvyqd0qZwAKkHTwtBvDTqcyNB1+gnHV/wsqi8UDwPQJdmELaTGIMO e9Kd/UF93qKZyGxRDy6XgGn2egMias0LIJrvcsaxBvbxGq14+XAWrI6O3r+7LIwV77vd VtkloTQHOdNEiF8lqsrxn5Mj0BSt15Lo2FbQGTBlchkc/yOaLLF2rSTpNB6uNXQf6v4e tuIw== X-Gm-Message-State: AJIora8MirEJBSHSArbpspILrL9zkLsE2yBM0gg6VYAEabCvZCfjumjC jJxUEYqh5ICwLV4m5U31t/LsOBztFA7jhg== X-Google-Smtp-Source: AGRyM1uUAgpXLf3DS9HKH/Xbh6NvvaiwLl85m4XXMDZ2v9bTG57sgmQaM+s7Gi88hs2DX4XvGZKv0w== X-Received: by 2002:a05:6000:1686:b0:219:b932:ffba with SMTP id y6-20020a056000168600b00219b932ffbamr5933704wrd.227.1655225513058; Tue, 14 Jun 2022 09:51:53 -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 z16-20020adfec90000000b0020cff559b1dsm12648966wrn.47.2022.06.14.09.51.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 09:51:52 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com Subject: [PATCH 5.19 1/3] Revert "io_uring: support CQE32 for nop operation" Date: Tue, 14 Jun 2022 17:51:16 +0100 Message-Id: <5ff623d84ccb4b3f3b92a3ea41cdcfa612f3d96f.1655224415.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 This reverts commit 2bb04df7c2af9dad5d28771c723bc39b01cf7df4. CQE32 nops were used for debugging and benchmarking but it doesn't target any real use case. Revert it, we can return it back if someone finds a good way to use it. Signed-off-by: Pavel Begunkov --- fs/io_uring.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index ca6170a66e62..bf556f77d4ab 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -784,12 +784,6 @@ struct io_msg { u32 len; }; -struct io_nop { - struct file *file; - u64 extra1; - u64 extra2; -}; - struct io_async_connect { struct sockaddr_storage address; }; @@ -994,7 +988,6 @@ struct io_kiocb { struct io_msg msg; struct io_xattr xattr; struct io_socket sock; - struct io_nop nop; struct io_uring_cmd uring_cmd; }; @@ -5268,14 +5261,6 @@ static int io_splice(struct io_kiocb *req, unsigned int issue_flags) static int io_nop_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) { - /* - * If the ring is setup with CQE32, relay back addr/addr - */ - if (req->ctx->flags & IORING_SETUP_CQE32) { - req->nop.extra1 = READ_ONCE(sqe->addr); - req->nop.extra2 = READ_ONCE(sqe->addr2); - } - return 0; } @@ -5296,11 +5281,7 @@ static int io_nop(struct io_kiocb *req, unsigned int issue_flags) } cflags = io_put_kbuf(req, issue_flags); - if (!(req->ctx->flags & IORING_SETUP_CQE32)) - __io_req_complete(req, issue_flags, 0, cflags); - else - __io_req_complete32(req, issue_flags, 0, cflags, - req->nop.extra1, req->nop.extra2); + __io_req_complete(req, issue_flags, 0, cflags); return 0; } From patchwork Tue Jun 14 16:51:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 12881307 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 D801ACCA480 for ; Tue, 14 Jun 2022 16:52:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349778AbiFNQwb (ORCPT ); Tue, 14 Jun 2022 12:52:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348588AbiFNQwR (ORCPT ); Tue, 14 Jun 2022 12:52:17 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE25145509 for ; Tue, 14 Jun 2022 09:51:55 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id c130-20020a1c3588000000b0039c6fd897b4so3524614wma.4 for ; Tue, 14 Jun 2022 09:51:55 -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=6Sdy9W1dqpA8hBtiizeFNtMvJps3otHcP3u3saZQJiQ=; b=caYp88TJqH6K3y6uqREhVbzqymFvwQriURoXXk4/+Ne16HqA+gdVfD0AaIOPYNLKRf foVfuEfoGaXnmx69YsXl432DZnt1xVS7UmJc/FWx6CQRnbT8xUeKTvM1T5oPBwuNGiPw 5mTlm2zn36Q/BQhKl8PRhpoW2nTIvS6swW5f2/pahDUFpxe8ExKQdMhnX57PZJbU95xw P8MDu+cQjYgY3wt4I+Px/Q9LUkVk4iT8pWWVCJznuQ6uwdYIeanbcdm/cH9s9b6mfYne Hu5Xll4ExTDrkq68vAIe4kqBou5ltWBdjc4t3HC1KLlbxct1NNK+Cm7isMHf+xhbNMer kNbw== 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=6Sdy9W1dqpA8hBtiizeFNtMvJps3otHcP3u3saZQJiQ=; b=6dDhXN70SvgDTf0yGqfVMNWfSkF/4aKBlWyRJwMdltney2w3fIftgVJHvQmat1JVzs Zd7M5cedBerne0sTprZfqXfe8/5IAbmpCU2mH4UUDmihHOp6KG107RQrun5gJdT6BxOD VYgn2GsyUnMf2uFJoqka4v3sytBXA/k/AAiJYnM5arDLT2dML85XYFIs9MRwwb8OGc39 QsILQabpYTLterAQO6h48GuDuC1Y8j8/vBapI315MhwjZMoJUXcuCTotThcYu6ptGTFJ hoHdrAduyD0P/ANY75IMsU6MOfYJOMPz7xyQt2b+zWKwwShgtiWljs6uf83NGBXAKXJm bxPg== X-Gm-Message-State: AOAM533bnisORn0HVdbJPoomZJpK9YhOgwPC/tbsQgnVGy61/RPcmyvc JrraMOyymx4K4DIc8BMmKVD5XYDKQ80qCA== X-Google-Smtp-Source: ABdhPJyMfTgPp4EadIGsSU3zeR/ljcSe5xjL/ixHceF8NClfhN4FJirt3Me1umrU/rRT6S1uGeLFlw== X-Received: by 2002:a05:600c:3d8e:b0:39c:573b:3079 with SMTP id bi14-20020a05600c3d8e00b0039c573b3079mr5276062wmb.131.1655225514239; Tue, 14 Jun 2022 09:51:54 -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 z16-20020adfec90000000b0020cff559b1dsm12648966wrn.47.2022.06.14.09.51.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 09:51:53 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com Subject: [PATCH 5.19 2/3] Revert "io_uring: add buffer selection support to IORING_OP_NOP" Date: Tue, 14 Jun 2022 17:51:17 +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 This reverts commit 3d200242a6c968af321913b635fc4014b238cba4. Buffer selection with nops was used for debugging and benchmarking but is useless in real life. Let's revert it before it's released. Signed-off-by: Pavel Begunkov --- fs/io_uring.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index bf556f77d4ab..1b95c6750a81 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1114,7 +1114,6 @@ static const struct io_op_def io_op_defs[] = { [IORING_OP_NOP] = { .audit_skip = 1, .iopoll = 1, - .buffer_select = 1, }, [IORING_OP_READV] = { .needs_file = 1, @@ -5269,19 +5268,7 @@ static int io_nop_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) */ static int io_nop(struct io_kiocb *req, unsigned int issue_flags) { - unsigned int cflags; - void __user *buf; - - if (req->flags & REQ_F_BUFFER_SELECT) { - size_t len = 1; - - buf = io_buffer_select(req, &len, issue_flags); - if (!buf) - return -ENOBUFS; - } - - cflags = io_put_kbuf(req, issue_flags); - __io_req_complete(req, issue_flags, 0, cflags); + __io_req_complete(req, issue_flags, 0, 0); return 0; } From patchwork Tue Jun 14 16:51:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Begunkov X-Patchwork-Id: 12881309 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 053F8CCA481 for ; Tue, 14 Jun 2022 16:52:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347101AbiFNQwf (ORCPT ); Tue, 14 Jun 2022 12:52:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349615AbiFNQwR (ORCPT ); Tue, 14 Jun 2022 12:52:17 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8061E457A9 for ; Tue, 14 Jun 2022 09:51:57 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id h19so8844249wrc.12 for ; Tue, 14 Jun 2022 09:51:57 -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=bdzE6kD1GBFl1XGKjpswHYcRidedSz5ejhHaeditgVk=; b=jtzm1EkDYZIU1R+0PhqXYiBpuNwYpKmeN566VoYnPk7CGxBOiDRdyLKfdzR4/gnA/f VBKSUYqw6B7NPnvesCG8yj2NMoRUF5NOIA0S9byxJQDfNm63pTd0/FrMpnluQPpCdySE LUKwUYaTv47FviqDofz8Ia1kmEGGMxgbI11k3l2wTRJY0bricmOggAyNjwf8wlGIzV0t RmpyVYAT1Ch4kKnzm1MIUQQA+6r0hnKMvDGi3u8PyqQsmIere7Kd8Yl+Q8q8W9eXhRuX zF6e0lhj2NLfuQrgED1LaUehZH4SZ/8fdUxOgYpidpCNahwgt2AVMqK/jJoByzGwxweS +SYA== 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=bdzE6kD1GBFl1XGKjpswHYcRidedSz5ejhHaeditgVk=; b=YKIlyfxg22kucEeYYisY5gOMbWvEELDpUc7POkFPwrc7gbFIvqvoNGTBswaz+aHEcX ZREqUhHug6OQnATkem7UK45hrzPLLF8RjSYzbjaZAq+6b924lRfiWB5HFSimqeeFfckH FBUULgjS//50XnNcmisGH2bnXGlufBcaSqYV1uwu7EwZ+HUtQhRSJTYaFn7AskiPXxYW SZPs4oADrpWTSKjdJLYAzPIT6rnD1Fu9D2NkY1u8nLX0Uwgjcy7rApZWEmHktpTHfPFQ IWU3tRggXxshdOgHh6tztKvo+I8izfU+RiFreEQljDDEapzquOQQrTcIGv09zsy8s2Ik GSqA== X-Gm-Message-State: AJIora98EPuc7Xf3fKhiAhP6C3meQC98zunY3e1qM/wpHS51RFe/g0FG aSlgVNh9ahSr+Hpiwe9mb0wVPbavnJFozg== X-Google-Smtp-Source: AGRyM1sXMVxSRs/zDzigCIDe9va6XkkMZd6qNwhHFx3HtwY4RngXQqV4Vj8tvccaqWE1oSqHQVWFuA== X-Received: by 2002:a05:6000:2cd:b0:216:2dc5:f454 with SMTP id o13-20020a05600002cd00b002162dc5f454mr5768403wry.626.1655225515720; Tue, 14 Jun 2022 09:51:55 -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 z16-20020adfec90000000b0020cff559b1dsm12648966wrn.47.2022.06.14.09.51.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jun 2022 09:51:55 -0700 (PDT) From: Pavel Begunkov To: io-uring@vger.kernel.org Cc: Jens Axboe , asml.silence@gmail.com Subject: [PATCH 5.19 3/3] io_uring: remove IORING_CLOSE_FD_AND_FILE_SLOT Date: Tue, 14 Jun 2022 17:51:18 +0100 Message-Id: <837c745019b3795941eee4fcfd7de697886d645b.1655224415.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 This partially reverts a7c41b4687f5902af70cd559806990930c8a307b Even though IORING_CLOSE_FD_AND_FILE_SLOT might save cycles for some users, but it tries to do two things at a time and it's not clear how to handle errors and what to return in a single result field when one part fails and another completes well. Kill it for now. Signed-off-by: Pavel Begunkov --- fs/io_uring.c | 12 +++--------- include/uapi/linux/io_uring.h | 6 ------ 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 1b95c6750a81..1b0b6099e717 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -576,7 +576,6 @@ struct io_close { struct file *file; int fd; u32 file_slot; - u32 flags; }; struct io_timeout_data { @@ -5966,18 +5965,14 @@ static int io_statx(struct io_kiocb *req, unsigned int issue_flags) static int io_close_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) { - if (sqe->off || sqe->addr || sqe->len || sqe->buf_index) + if (sqe->off || sqe->addr || sqe->len || sqe->rw_flags || sqe->buf_index) return -EINVAL; if (req->flags & REQ_F_FIXED_FILE) return -EBADF; req->close.fd = READ_ONCE(sqe->fd); req->close.file_slot = READ_ONCE(sqe->file_index); - req->close.flags = READ_ONCE(sqe->close_flags); - if (req->close.flags & ~IORING_CLOSE_FD_AND_FILE_SLOT) - return -EINVAL; - if (!(req->close.flags & IORING_CLOSE_FD_AND_FILE_SLOT) && - req->close.file_slot && req->close.fd) + if (req->close.file_slot && req->close.fd) return -EINVAL; return 0; @@ -5993,8 +5988,7 @@ static int io_close(struct io_kiocb *req, unsigned int issue_flags) if (req->close.file_slot) { ret = io_close_fixed(req, issue_flags); - if (ret || !(req->close.flags & IORING_CLOSE_FD_AND_FILE_SLOT)) - goto err; + goto err; } spin_lock(&files->file_lock); diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h index 776e0278f9dd..53e7dae92e42 100644 --- a/include/uapi/linux/io_uring.h +++ b/include/uapi/linux/io_uring.h @@ -47,7 +47,6 @@ struct io_uring_sqe { __u32 unlink_flags; __u32 hardlink_flags; __u32 xattr_flags; - __u32 close_flags; }; __u64 user_data; /* data to be passed back at completion time */ /* pack this to avoid bogus arm OABI complaints */ @@ -259,11 +258,6 @@ enum io_uring_op { */ #define IORING_ACCEPT_MULTISHOT (1U << 0) -/* - * close flags, store in sqe->close_flags - */ -#define IORING_CLOSE_FD_AND_FILE_SLOT (1U << 0) - /* * IO completion data structure (Completion Queue Entry) */