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 DCBADEB64D9 for ; Mon, 19 Jun 2023 14:10:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231288AbjFSOKC (ORCPT ); Mon, 19 Jun 2023 10:10:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbjFSOKB (ORCPT ); Mon, 19 Jun 2023 10:10:01 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF7A0B8 for ; Mon, 19 Jun 2023 07:09:58 -0700 (PDT) Received: from epcas5p2.samsung.com (unknown [182.195.41.40]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20230619140956epoutp027d04184f3ad640d5c202d75b18362854~qFLkv1rMc1440114401epoutp02H for ; Mon, 19 Jun 2023 14:09:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20230619140956epoutp027d04184f3ad640d5c202d75b18362854~qFLkv1rMc1440114401epoutp02H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1687183796; bh=YvsgVpaZfpGJkiQI2ColLEmDJpDQ+dd1lzxFWfaUAjo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=IMn1GN4jxMKbYipCzZnSt0/8tIXopbFS6xM3FEG+0eKocB+bfU8PSv0vV7C6cy9bc 7VyzxmWGkHkeYDPdNeNz8fK7i9QtOjSRuFgNusIotUMtBG64CgvKXufTRip2v71uu9 zGYrKH/vONGlfENfoKPSPv/j0T3fwRORjs4KIy+E= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20230619140955epcas5p3159e71a65610a46d52c23f10880066ca~qFLkBn4Lm0209302093epcas5p3b; Mon, 19 Jun 2023 14:09:55 +0000 (GMT) Received: from epsmges5p1new.samsung.com (unknown [182.195.38.174]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4QlBV94Bvlz4x9Pw; Mon, 19 Jun 2023 14:09:53 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 05.B5.55522.1B160946; Mon, 19 Jun 2023 23:09:53 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20230619140952epcas5p2048459ecb5f40666fd5903986647174f~qFLhzlgkM0305803058epcas5p2f; Mon, 19 Jun 2023 14:09:52 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230619140952epsmtrp1ebd83c83652cefe3607b1d2db2cbad3f~qFLhxWGiZ1636116361epsmtrp1d; Mon, 19 Jun 2023 14:09:52 +0000 (GMT) X-AuditID: b6c32a49-67ffa7000000d8e2-95-649061b19265 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id F4.85.34491.0B160946; Mon, 19 Jun 2023 23:09:52 +0900 (KST) Received: from green245 (unknown [107.99.41.245]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230619140947epsmtip2dd41727cf0f3c85379f785461b80a3cf~qFLcjFnLR1393313933epsmtip2S; Mon, 19 Jun 2023 14:09:47 +0000 (GMT) Date: Mon, 19 Jun 2023 19:36:35 +0530 From: Kanchan Joshi To: Pavel Begunkov Cc: David Ahern , Breno Leitao , io-uring@vger.kernel.org, axboe@kernel.dk, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, Matthieu Baerts , Mat Martineau , Marcelo Ricardo Leitner , Xin Long , leit@fb.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, dccp@vger.kernel.org, mptcp@lists.linux.dev, linux-sctp@vger.kernel.org, ast@kernel.org, kuniyu@amazon.com, martin.lau@kernel.org, Jason Xing , Joanne Koong , Greg Kroah-Hartman , "Jason A. Donenfeld" , Willem de Bruijn , Guillaume Nault , Andrea Righi Subject: Re: [RFC PATCH v2 1/4] net: wire up support for file_operations->uring_cmd() Message-ID: <20230619140635.GA4046@green245> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Brightmail-Tracker: H4sIAAAAAAAAA02TfzBcVxTHc9/bfW+ls+Z1CTdbVFYzGQS7yuZKaNOSeKEaTdvRkWlkx75Y xdruD01MO6M0UhrxIxFhaFfSQf2IEKERJERWs1UMIYMyqpYQQVUlZWh3s9tO/vucc7/fOeee M4eD86pJPidWrmaUckm8gNjKarzr6upRJ8mRCmfTHNHsd2MsVFzZCNDK36MkqhrLJlBx71cs tPHwGwJdbT6NIYNukkSXlutIlHallkALp3tYaGKQj5629+Goa/g+C/U1nmOjsrM1BKosGsfQ k5wGgAaaiwlk0D5mo8naRQytVXSx0UbmAol6sv7BUUX3NIa6a1NJpNPaodWf5wFaaOgk9zvS FX2ZbLooJYugG34Yxui19BKczk1bIOmbRWMkra3X0AO/aOj6ygyCvl1STdKPrhcCerFtkKC/ zB8i6F9TC3D6z3on+vyGAQ+nIuP8ZYxEyiidGXl0ojRWHhMgCH0/KjDKVywUeYj80B6Bs1yS wAQIgt4J9zgYG2+ck8A5SRKvMabCJSqVwOsNf2WiRs04yxJV6gABo5DGK3wUnipJgkojj/GU M+q9IqHQ29coPB4nS8mcZysm+Cerc4UpIMsuE3A4kPKBNU2HM8FWDo+6BWBp3SOWOVgG8Gpq oTGwMgarAOry3U1sMtycTQVmUSuAYyN5Fsc0gB1lM8CkY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i6Gn pXaA7rSaSDRqfiJADxoDGApaXAI0bfBTqLfoNY4s3Y8w1N1YQCGneQH676YPIL/9GvVFLGtx GwQsry0iWXvtIMYGC6tx9me9n2JbeA/Fmm0a9k6PhrVZj5Nse3U9xY5fqAJs4HIfyeoq+kl2 uKASZ1/YFrHl06P4JmabcLWCy9r9I6da/nmGcBc/YaRyy2Ce6cptgRYMRhlABA2ZVbDFWwAM QEhHMm0A9lkCglkghvr+/6nZOwrWzoxRs9JDAP3HekAIEIwUdgXrMAOgaZJZCt3lmlA8j/kY PhnoCPs485SEUw49EQJRTCq8HjDjIV/ExMHH1Smzm2cwOO31YiFHxMyFnVUPwz7OJMJTF+6H fZxZCH+boUNxBLMGljVVhvX5zIfwisOFlYK5/Htt/r02/65tBrgVRHO5amWmUi3LlWVz++PV cqVak50ZvzNHaQPhF1m29CJotv4T3wEwGnQASOOSeaLNl4oVkSKF/MBBTpWTrtJkceoOsJAm JGKReLxIEclkyvdxezkul1O9pRgdEaPFir8fkqbA4eR2obf+gzHx3wt6DFfHnZVHkmNfX5yK vSx8ue4H9GrM9UyxNmd12zffpS0ZjM7/KOJVM0DcYeXKhMmV/47ofF3lztoa6xzbihO/puYl Oc5t3d5WoxIPDCe573kq0n9Cwr82rnEdmOzvLs7v/8ypmLze3tK5PbWzcPmiM/Tt5A1ld7fJ LEVjXwW+pge+fBx3yPhIShyyT2CW001KXXTQWPIsI5F/PiSVTRTqtKWfmrb40vjxPXhFQ8Li Kar12x1xvvmNDUnrz1JzDpek5Qm7PBn5KaZ0WlN3PnVz754NB0e064/nGO1/lFyzvajXpe/1 XdpfcCOzO6g3HmuWEOpdctkyXKWWvwGYOeVpkQMAAA== X-CMS-MailID: 20230619140952epcas5p2048459ecb5f40666fd5903986647174f X-Msg-Generator: CA Content-Type: multipart/mixed; boundary="----PcSJ1RlEyPKfjXIiTsweH-7MCPtMf9v3nlMrb72LWO-fIHxy=_7a99d_" CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230619092935epcas5p26ad065e6c9d339687802b9c26a4f0fbc References: <20230614110757.3689731-1-leitao@debian.org> <20230614110757.3689731-2-leitao@debian.org> <6b5e5988-3dc7-f5d6-e447-397696c0d533@kernel.org> Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org ------PcSJ1RlEyPKfjXIiTsweH-7MCPtMf9v3nlMrb72LWO-fIHxy=_7a99d_ Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Disposition: inline On Mon, Jun 19, 2023 at 10:28:30AM +0100, Pavel Begunkov wrote: >On 6/14/23 16:15, David Ahern wrote: >>On 6/14/23 5:07 AM, Breno Leitao wrote: >>>diff --git a/include/linux/net.h b/include/linux/net.h >>>index 8defc8f1d82e..58dea87077af 100644 >>>--- a/include/linux/net.h >>>+++ b/include/linux/net.h >>>@@ -182,6 +182,8 @@ struct proto_ops { >>> int (*compat_ioctl) (struct socket *sock, unsigned int cmd, >>> unsigned long arg); >>> #endif >>>+ int (*uring_cmd)(struct socket *sock, struct io_uring_cmd *cmd, >>>+ unsigned int issue_flags); >>> int (*gettstamp) (struct socket *sock, void __user *userstamp, >>> bool timeval, bool time32); >>> int (*listen) (struct socket *sock, int len); >>>diff --git a/include/net/sock.h b/include/net/sock.h >>>index 62a1b99da349..a49b8b19292b 100644 >>>--- a/include/net/sock.h >>>+++ b/include/net/sock.h >>>@@ -111,6 +111,7 @@ typedef struct { >>> struct sock; >>> struct proto; >>> struct net; >>>+struct io_uring_cmd; >>> typedef __u32 __bitwise __portpair; >>> typedef __u64 __bitwise __addrpair; >>>@@ -1259,6 +1260,9 @@ struct proto { >>> int (*ioctl)(struct sock *sk, int cmd, >>> int *karg); >>>+ int (*uring_cmd)(struct sock *sk, >>>+ struct io_uring_cmd *cmd, >>>+ unsigned int issue_flags); >>> int (*init)(struct sock *sk); >>> void (*destroy)(struct sock *sk); >>> void (*shutdown)(struct sock *sk, int how); >>>@@ -1934,6 +1938,8 @@ int sock_common_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, >>> int flags); >>> int sock_common_setsockopt(struct socket *sock, int level, int optname, >>> sockptr_t optval, unsigned int optlen); >>>+int sock_common_uring_cmd(struct socket *sock, struct io_uring_cmd *cmd, >>>+ unsigned int issue_flags); >>> void sk_common_release(struct sock *sk); >>>diff --git a/net/core/sock.c b/net/core/sock.c >>>index 1df7e432fec5..339fa74db60f 100644 >>>--- a/net/core/sock.c >>>+++ b/net/core/sock.c >>>@@ -3668,6 +3668,18 @@ int sock_common_setsockopt(struct socket *sock, int level, int optname, >>> } >>> EXPORT_SYMBOL(sock_common_setsockopt); >>>+int sock_common_uring_cmd(struct socket *sock, struct io_uring_cmd *cmd, >>>+ unsigned int issue_flags) >>>+{ >>>+ struct sock *sk = sock->sk; >>>+ >>>+ if (!sk->sk_prot || !sk->sk_prot->uring_cmd) >>>+ return -EOPNOTSUPP; >>>+ >>>+ return sk->sk_prot->uring_cmd(sk, cmd, issue_flags); >>>+} >>>+EXPORT_SYMBOL(sock_common_uring_cmd); >>>+ >> >> >>io_uring is just another in-kernel user of sockets. There is no reason >>for io_uring references to be in core net code. It should be using >>exposed in-kernel APIs and doing any translation of its op codes in >>io_uring/ code. > >That callback is all about file dependent operations, just like ioctl. >And as the patch in question is doing socket specific stuff, I think >architecturally it fits well. I also feel that it fits well. Other users of uring-cmd (nvme, ublk) follow the same model. ------PcSJ1RlEyPKfjXIiTsweH-7MCPtMf9v3nlMrb72LWO-fIHxy=_7a99d_ Content-Type: text/plain; charset="utf-8" ------PcSJ1RlEyPKfjXIiTsweH-7MCPtMf9v3nlMrb72LWO-fIHxy=_7a99d_--