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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85BF7C4338F for ; Mon, 23 Aug 2021 19:13:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D16A613D3 for ; Mon, 23 Aug 2021 19:13:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231773AbhHWTOd (ORCPT ); Mon, 23 Aug 2021 15:14:33 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:54073 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231747AbhHWTOd (ORCPT ); Mon, 23 Aug 2021 15:14:33 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 785645C01EB; Mon, 23 Aug 2021 15:13:49 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 23 Aug 2021 15:13:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= joshtriplett.org; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:in-reply-to; s=fm1; bh=C4Y iITZLwd1FjTu1OcR03tOrxxe1bILHAoD/r95KPyA=; b=bowK4U65RhRyDD0/6nz kkN88O9v7TSy2myiNzHU11aMTem0HyXom+u0ipoGEusFSLlBimTIbDGU69oKL9tN Ro1E+tnbkAPiGy5Hw3yh5ZfZf4qRqxTvcT2AzzUlL2BBNn4t6twIRd3sYz5RYD/4 7+UJe3fz4s66SDBWrKWg1E3mPQDljiswMRO+zkVzJq8IYtcfpO9wvdqOfvblUKK4 rlf9+Wl+NUS+MxDhATWfExbhHrOEmIWyEBQ60astJhobGiLqf2XmjzbkOHcnf+mi FMM45gqNwJmn5eVR3SNMsreGCxSnOZGjWvFuh8bFIQkk30Gn4KfnaDSTiwEqhc1n WoA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=C4YiIT ZLwd1FjTu1OcR03tOrxxe1bILHAoD/r95KPyA=; b=RpNw4RGCsz9BUChMAYN8IO FKq4cX04tbcC9Ua/JM3uZ/7TxGRRAxC7/QyuXJY5jdDsIAh6t36IudXAHYlhVxBs Xq2UZD2xkt5BHFAqSFIvygdyNGUVTJaETKRjMC4eKsemRuG71o3tpT83hgeNiTw0 4fWsDcrEMPpMHzt8oc+J0D7AO+ojHTsndmNNLLVIImYgSkHo9FbFJl+bjtkSlO/j o/5fMDfP1F377RiWO7fwpwSCH8D/llZwTfxTND9UDVkRvWNxCZjh+TyG6C5jMnhS DOmaVmFqx/qebxJ2YlQXJF+MHFY5j2QGWwJ3xrcCjCJ705UPAfT0U/hn0SrTLRdA == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddthedgudefiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomheplfhoshhh ucfvrhhiphhlvghtthcuoehjohhshhesjhhoshhhthhrihhplhgvthhtrdhorhhgqeenuc ggtffrrghtthgvrhhnpeegtdfgfeeghfevgeelgfefieegudeuheekkedtueeutefgheff veegueeiteehteenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehjohhshhesjhhoshhhthhrihhplhgvthhtrdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 23 Aug 2021 15:13:46 -0400 (EDT) Date: Mon, 23 Aug 2021 12:13:45 -0700 From: Josh Triplett To: Jens Axboe Cc: Pavel Begunkov , io-uring@vger.kernel.org, "David S . Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Stefan Metzmacher Subject: Re: [PATCH v3 0/4] open/accept directly into io_uring fixed file table Message-ID: References: <7fa72eec-9222-60eb-9ec6-e4b6efbfc5fb@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7fa72eec-9222-60eb-9ec6-e4b6efbfc5fb@kernel.dk> Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On Sat, Aug 21, 2021 at 08:18:12PM -0600, Jens Axboe wrote: > On 8/21/21 9:52 AM, Pavel Begunkov wrote: > > Add an optional feature to open/accept directly into io_uring's fixed > > file table bypassing the normal file table. Same behaviour if as the > > snippet below, but in one operation: > > > > sqe = prep_[open,accept](...); > > cqe = submit_and_wait(sqe); > > io_uring_register_files_update(uring_idx, (fd = cqe->res)); > > close((fd = cqe->res)); > > > > The idea in pretty old, and was brough up and implemented a year ago > > by Josh Triplett, though haven't sought the light for some reasons. > > > > The behaviour is controlled by setting sqe->file_index, where 0 implies > > the old behaviour. If non-zero value is specified, then it will behave > > as described and place the file into a fixed file slot > > sqe->file_index - 1. A file table should be already created, the slot > > should be valid and empty, otherwise the operation will fail. > > > > we can't use IOSQE_FIXED_FILE to switch between modes, because accept > > takes a file, and it already uses the flag with a different meaning. > > > > since RFC: > > - added attribution > > - updated descriptions > > - rebased > > > > since v1: > > - EBADF if slot is already used (Josh Triplett) > > - alias index with splice_fd_in (Josh Triplett) > > - fix a bound check bug > > With the prep series, this looks good to me now. Josh, what do you > think? I would still like to see this using a union with the `nofile` field in io_open and io_accept, rather than overloading the 16-bit buf_index field. That would avoid truncating to 16 bits, and make less work for expansion to more than 16 bits of fixed file indexes. (I'd also like that to actually use a union, rather than overloading the meaning of buf_index/nofile.) I personally still feel that using non-zero to signify index-plus-one is both error-prone and not as future-compatible. I think we could do better with no additional overhead. But I think the final call on that interface is up to you, Jens. Do you think it'd be worth spending a flag bit or using a different opcode, to get a cleaner interface? If you don't, then I'd be fine with seeing this go in with just the io_open and io_accept change. - Josh Triplett