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=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 69041C433E0 for ; Wed, 24 Jun 2020 18:32:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4C8AB20738 for ; Wed, 24 Jun 2020 18:32:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406116AbgFXSb6 (ORCPT ); Wed, 24 Jun 2020 14:31:58 -0400 Received: from verein.lst.de ([213.95.11.211]:45566 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405832AbgFXSb6 (ORCPT ); Wed, 24 Jun 2020 14:31:58 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 4DA0E68B05; Wed, 24 Jun 2020 20:31:55 +0200 (CEST) Date: Wed, 24 Jun 2020 20:31:54 +0200 From: Christoph Hellwig To: Matthew Wilcox Cc: Christoph Hellwig , Linus Torvalds , Al Viro , Luis Chamberlain , Kees Cook , Iurii Zaikin , Linux Kernel Mailing List , linux-fsdevel Subject: Re: [PATCH 03/11] fs: add new read_uptr and write_uptr file operations Message-ID: <20200624183154.GA26685@lst.de> References: <20200624162901.1814136-1-hch@lst.de> <20200624162901.1814136-4-hch@lst.de> <20200624175548.GA25939@lst.de> <20200624181437.GA26277@lst.de> <20200624182437.GB26405@lst.de> <20200624182944.GT21350@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200624182944.GT21350@casper.infradead.org> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Wed, Jun 24, 2020 at 07:29:44PM +0100, Matthew Wilcox wrote: > On Wed, Jun 24, 2020 at 08:24:37PM +0200, Christoph Hellwig wrote: > > On Wed, Jun 24, 2020 at 11:20:26AM -0700, Linus Torvalds wrote: > > > On Wed, Jun 24, 2020 at 11:14 AM Christoph Hellwig wrote: > > > > > > > > So we'd need new user copy functions for just those cases > > > > > > No. We'd open-code them. They'd look at "oh, I'm supposed to use a > > > kernel pointer" and just use those. > > > > > > IOW, basically IN THE CODE that cares (and the whole argument is that > > > this code is one or two special cases) you do > > > > > > /* This has not been converted to the new world order */ > > > if (get_fs() == KERNEL_DS) memcpy(..) else copy_from_user(); > > > > > > You're overdesigning things. You're making them more complex than they > > > need to be. > > > > I wish it was so simple. I really don't like overdesigns, trust me. > > > > But please take a look at setsockopt and all the different instances > > (count 90 .setsockopt wireups, and they then branch out into > > various subroutines as well). I really don't want to open code that > > there, but we could do helper specific to setsockopt. > > Can we do a setsockopt_iter() which replaces optval/optlen with an iov_iter? We could. The only downside is int-sized sockopts are common, and used in the fast path of networking applications (e.g. cork,uncork) and this might introduce enough overhead to be noticable.