Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5695608rwl; Tue, 11 Apr 2023 08:46:46 -0700 (PDT) X-Google-Smtp-Source: AKy350YZbMxnsdEi3h6XMNm89UyRZAHZdAjAlReke3nbUMQKfcpNxE/ye9Z3Bl1Z0jZE/iue2cev X-Received: by 2002:a05:6402:ce:b0:4fb:7ccf:3b33 with SMTP id i14-20020a05640200ce00b004fb7ccf3b33mr13725030edu.31.1681228006567; Tue, 11 Apr 2023 08:46:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681228006; cv=none; d=google.com; s=arc-20160816; b=rNwe6IYmBMSLi15uOdpRdrcMcVwjf4mzaTbIznBurijF3LGAyDqA61HtAkU8z8qmFj SyxbNbj0ls2bDRNtyrIXVHf0fdO7YBVHby8rK9gB/jA+u8n7i4PxwRWtFUdHiiACHkSv fJTMah/SDSpwaK+YpcyLuz7KsHArFufxQ03RDgTvcbeMN9K+jkBV2nURzayFCD8E26gk c2Cb3LcNMnfjBasopQvlHgC0HkK+/7+PqaGYdUC9L1WTzXbBKt8PogFjzLABb2G/feFF mOa3SQbAoATKLQ3C+IXyf5kS5OJ9Nwe5zXGRRE5SbgY2W480Ike60TmyfKb/ezN9Tp44 uPuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=avUeuwpzPDLmh7q6KyhD3z/3GxLA2d1SOJIQRmXe534=; b=SWBrvYYK0mrCt6iYsc9Dh6Csy5KnvDiNQ0hli/Kt+9OltcCAi1YlH5fXPt1XdFHYdt g5BxLMXqYCM1ox3KegLJFdG3grQR3e+obL/ooKshWf5rGPyZnvVb1dHWY754aMHi1hSn Xht0mofPm6VL+Zorz3uUa6qB0pySX0c5FAwPy+tPz7wqHuPc/La1JV2SfxtpILRv9YCm hlhdQbEFtI6A8XbWFE6sgF1fKz3RBL+7dDc0UuA8sAc9wzjDIg8ccMYT0ERdkz87MgCs oOinnDSVfbJjMAy41eNm9C4ros8vnPPw0ZZDmHO6b2++ONW18fT8mjIPH3qtJ9kR5aiD rV5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b="g/ckIo1X"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c19-20020a056402121300b00504b639e5d2si2550740edw.555.2023.04.11.08.46.21; Tue, 11 Apr 2023 08:46:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b="g/ckIo1X"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229866AbjDKP2w (ORCPT + 99 others); Tue, 11 Apr 2023 11:28:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229804AbjDKP2t (ORCPT ); Tue, 11 Apr 2023 11:28:49 -0400 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1A6F59F0 for ; Tue, 11 Apr 2023 08:28:31 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id ca18e2360f4ac-7607a12cfd3so2923039f.1 for ; Tue, 11 Apr 2023 08:28:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20210112.gappssmtp.com; s=20210112; t=1681226911; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=avUeuwpzPDLmh7q6KyhD3z/3GxLA2d1SOJIQRmXe534=; b=g/ckIo1Xl3s3ii/SXTvKWq4+VEpFHO8ZWzGghwcXEfKKHdYCF7FryYczAS0bsZPMSz PSFW1p2ZCfMF2AnGCmGKcmmoRBmZJtK1yeGh4B1ZZNHHuTpzv8vHWwA9g0Oq495904CN 8i4zpaw/Z1/ebEpo0/5bWly+QvIG/ioURmD3rDEz/eo4wI7GK/dlcJCWScbSP30D0JPn L7kSxyZbBxTe3JctKQb3F79B5cn6awo7++d6HcqNmiUVo7Mre5jTY5xZbFmwLPnJ6kiE /7HS2a69csnvOfC9D2xrJ2FoIWhlgz2vxwlKohFiSjtYft0ols5Ta+ZMhVvwDhso50eB d1Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681226911; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=avUeuwpzPDLmh7q6KyhD3z/3GxLA2d1SOJIQRmXe534=; b=wbOISqt8Gwwtjze8QEQwVGv8/GbM1iMWjZOaTYgdDAf3d2lzwzr1MG74/M/zKe4Gy1 p442394VAm5njLB7sSkHUJ4gzRgl9gAG1gWWB0CRy5R9b/5pzZgw7F5Gq6g+aoZ/vOI4 4oJkJvQ5ALSKCK2NpMiXRfRp6vtUF6fB66NuEPjfLIoJK6CH2lcKFI1J358q8/fU2QGb LNVJjLTQjjmhME6PsAK+qkolVKer6tWCSwyY58tG2Rws3ZO8UBiphXgwhEL96OcFE31u +CaE4J+vDJ4k404fKlj6jDqaF5prjZyN6aam/lkqhUdn5CbiQnb8gQjVk6hbOTKwF+XL uXYw== X-Gm-Message-State: AAQBX9fa4SFV9JqiHi+qO2DL3NT0/OEFZE2tde8oYruZAg8reCBgZd9f IXFyqX2ATapBuZftJ5D5o9OjhA== X-Received: by 2002:a05:6602:2b91:b0:75c:f48c:2075 with SMTP id r17-20020a0566022b9100b0075cf48c2075mr7044533iov.2.1681226911077; Tue, 11 Apr 2023 08:28:31 -0700 (PDT) Received: from [192.168.1.94] ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id a3-20020a029403000000b0040bc0a9e711sm2136630jai.88.2023.04.11.08.28.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Apr 2023 08:28:30 -0700 (PDT) Message-ID: <20cb4641-c765-e5ef-41cb-252be7721ce5@kernel.dk> Date: Tue, 11 Apr 2023 09:28:29 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH 0/5] add initial io_uring_cmd support for sockets Content-Language: en-US To: Willem de Bruijn , David Ahern , Breno Leitao Cc: Willem de Bruijn , io-uring@vger.kernel.org, netdev@vger.kernel.org, kuba@kernel.org, asml.silence@gmail.com, leit@fb.com, edumazet@google.com, pabeni@redhat.com, davem@davemloft.net, dccp@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, matthieu.baerts@tessares.net, marcelo.leitner@gmail.com References: <20230406144330.1932798-1-leitao@debian.org> <75e3c434-eb8b-66e5-5768-ca0f906979a1@kernel.org> <67831406-8d2f-feff-f56b-d0f002a95d96@kernel.dk> <643573df81e20_11117c2942@willemb.c.googlers.com.notmuch> <036c80e5-4844-5c84-304c-7e553fe17a9b@kernel.dk> <64357608c396d_113ebd294ba@willemb.c.googlers.com.notmuch> <19c69021-dce3-1a4a-00eb-920d1f404cfc@kernel.dk> <64357bb97fb19_114b22294c4@willemb.c.googlers.com.notmuch> From: Jens Axboe In-Reply-To: <64357bb97fb19_114b22294c4@willemb.c.googlers.com.notmuch> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/11/23 9:24?AM, Willem de Bruijn wrote: > Jens Axboe wrote: >> On 4/11/23 9:00?AM, Willem de Bruijn wrote: >>> Jens Axboe wrote: >>>> On 4/11/23 8:51?AM, Willem de Bruijn wrote: >>>>> Jens Axboe wrote: >>>>>> On 4/11/23 8:36?AM, David Ahern wrote: >>>>>>> On 4/11/23 6:00 AM, Breno Leitao wrote: >>>>>>>> I am not sure if avoiding io_uring details in network code is possible. >>>>>>>> >>>>>>>> The "struct proto"->uring_cmd callback implementation (tcp_uring_cmd() >>>>>>>> in the TCP case) could be somewhere else, such as in the io_uring/ >>>>>>>> directory, but, I think it might be cleaner if these implementations are >>>>>>>> closer to function assignment (in the network subsystem). >>>>>>>> >>>>>>>> And this function (tcp_uring_cmd() for instance) is the one that I am >>>>>>>> planning to map io_uring CMDs to ioctls. Such as SOCKET_URING_OP_SIOCINQ >>>>>>>> -> SIOCINQ. >>>>>>>> >>>>>>>> Please let me know if you have any other idea in mind. >>>>>>> >>>>>>> I am not convinced that this io_uring_cmd is needed. This is one >>>>>>> in-kernel subsystem calling into another, and there are APIs for that. >>>>>>> All of this set is ioctl based and as Willem noted a little refactoring >>>>>>> separates the get_user/put_user out so that in-kernel can call can be >>>>>>> made with existing ops. >>>>>> >>>>>> How do you want to wire it up then? We can't use fops->unlocked_ioctl() >>>>>> obviously, and we already have ->uring_cmd() for this purpose. >>>>> >>>>> Does this suggestion not work? >>>> >>>> Not sure I follow, what suggestion? >>>> >>> >>> This quote from earlier in the thread: >>> >>> I was thinking just having sock_uring_cmd call sock->ops->ioctl, like >>> sock_do_ioctl. >> >> But that doesn't work, because sock->ops->ioctl() assumes the arg is >> memory in userspace. Or do you mean change all of the sock->ops->ioctl() >> to pass in on-stack memory (or similar) and have it work with a kernel >> address? > > That was what I suggested indeed. > > It's about as much code change as this patch series. But it avoids > the code duplication. Breno, want to tackle that as a prep patch first? Should make the functional changes afterwards much more straightforward, and will allow support for anything really. -- Jens Axboe