Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4635995ybp; Mon, 7 Oct 2019 11:23:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqxyThtcTfzPMtfYoh6E3+wWqfyhae7YWxlifpAuWUTVTY8e/0uNsDeCP3H6yKjJQsnGmC7G X-Received: by 2002:aa7:c40c:: with SMTP id j12mr30819255edq.284.1570472583604; Mon, 07 Oct 2019 11:23:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570472583; cv=none; d=google.com; s=arc-20160816; b=YgT+tzGG90kfAXbClEzi9RxpOFKc7Fgvrm0p1XeIyro6DkeRn8JKUf/N9hRcnaM7GG hGeFSLkfRHbn/5+1qyJqDuA33YFN+IYdSNJQ3Vq/a67YCc3r5L4vsPtMVy8ybxp8MrM9 v9oIHF7LZg5xh3jtAAgQXRUaxwQGB5WieqjvEzPw/F/nNLl0X42FxNBaCgONS/Pemlv2 RJOqtWn5hIsH3+qi81lnRPsI0tvuYyQD/xsCJzB6azEb9/y6GrvJf4/6JOjCd+kcB/Fz 3qr/cL2cdzitpFHd3PdIrkHy4zWO36m3UcQpVaC4SUuupVQtdU/17b6BgmjIi7rqwfdv A3CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=9Q9pFX5gJD+lnJUOdgSxgK205qBe7cCXgMnhuLRd26c=; b=lxlO0DhAQ1USZC9L2X5/Ve1LyuVPuBJdMnPx3W32CUb1L/DLw2vU3K8sIGvSKXAX21 GGo2+wJYxa/OBoHMKzSIZqKUJ2IxIZD43XVOhzYIttZ0vfY2J8HMLPWsTo9nokK6kDpM jRVrciMkHoHH+xz13xzzInJrqBMDE2PHXPYR/41TFCIsJURUhDm0wOhJ3bmUBQvXzjIc O4pZBoGWtcAQgYJuPSVR3H4kSS4QY/QK/XoP1NoNCRdshRRFiTHXJ8OFA9EBIfGnB1zP fpWeXw8m3Ny1TtnZGqpN7dUoJKZWBT9VdVGYjaKwhLrWKXCwn1GG98T3898dxMjD8EJD 4f6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g38si9555894edg.127.2019.10.07.11.22.39; Mon, 07 Oct 2019 11:23:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728440AbfJGSWc (ORCPT + 99 others); Mon, 7 Oct 2019 14:22:32 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:43790 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728079AbfJGSWc (ORCPT ); Mon, 7 Oct 2019 14:22:32 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.2 #3 (Red Hat Linux)) id 1iHXeQ-0003FE-G8; Mon, 07 Oct 2019 18:22:30 +0000 Date: Mon, 7 Oct 2019 19:22:30 +0100 From: Al Viro To: Linus Torvalds Cc: Guenter Roeck , Linux Kernel Mailing List , linux-fsdevel Subject: Re: [PATCH] Convert filldir[64]() from __put_user() to unsafe_put_user() Message-ID: <20191007182230.GN26530@ZenIV.linux.org.uk> References: <5f06c138-d59a-d811-c886-9e73ce51924c@roeck-us.net> <20191007012437.GK26530@ZenIV.linux.org.uk> <20191007025046.GL26530@ZenIV.linux.org.uk> <20191007173432.GM26530@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 07, 2019 at 11:13:27AM -0700, Linus Torvalds wrote: > On Mon, Oct 7, 2019 at 10:34 AM Al Viro wrote: > > > > Tangentially related: copy_regster_to_user() and copy_regset_from_user(). > > Not a worry. It's not performance-critical code, and if it ever is, it > needs to be rewritten anyway. > > > The former variant tends to lead to few calls > > of __copy_{to,from}_user(); the latter... On x86 it ends up doing > > this: > > Just replace the __put_user() with a put_user() and be done with it. > That code isn't acceptable, and if somebody ever complains about > performance it's not the lack of __put_user that is the problem. I wonder if it would be better off switching to several "copy in bulk" like e.g. ppc does. That boilerplate with parallel "to/from kernel" and "to/from userland" loops is asking for bugs - the calling conventions like "pass kbuf and ubuf; exactly one must be NULL" tend to be trouble, IME; I'm not saying we should just pass struct iov_iter * instead of count+pos+kbuf+ubuf to ->get() and ->set(), but it might clean the things up nicely. Let me look into that zoo a bit more...