Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp2436797pxv; Sat, 24 Jul 2021 16:46:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+kGEib0tE9pv/IaAjcvJcy199wB5/hK2xnO6g1NriivJnJAxxy9seMPF75ENk59sxP3Om X-Received: by 2002:a02:2a88:: with SMTP id w130mr10120247jaw.60.1627170360345; Sat, 24 Jul 2021 16:46:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627170360; cv=none; d=google.com; s=arc-20160816; b=V3QJc6lyxwq1cZocZ1X2fLuonY6F1Ltv22xiae3+f9QzlIk03bMbYkBd9UQWQP1gum G1uyk2xeRTQ35oQBWuW/NbUvTD8r04k9Xc7JLEMT+g0CwMCPfyPhG/tNF6q+OJEJRGqR 49umBMPWB6oRFhrZJ8UjhNR9tMVpPyQGlpUARykwuDbNmqs7yPzphgwzDm9NNT01RhS2 +/85+jU+g7yu/6gmVldth7iySeGGe3KIfY0SQ+9rt+HQQ1lOPghTv3gU6vqzncvuUAlA RLwQm7UqdYz2gwx0QNDEF9WYRCOZeZGnd6+k6Y6NLA+/10LH30Rboh6vYts1E7MmaQ2U 18Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=6DX1YX0FIe+EOVN5uX64Sr30UVp0sIOHjwJaHcbSSXg=; b=appXMkfqz/bwpIYw7nXY7ysTkq/RAoSwiHLg+PeRMtYdkNJXg2AnxgPzrjIhtJxMlR OU8IjoukdtKD5OkpSAk5ng8YylQkNG5zaJsg03uuAKZl6gcg7Jsa25Y5FxKvlqIZpuB7 0FMn7KaIrKhQSqb+8TEfAHtLP225SWtfZoScRqznogSTBQNavjoLfCkJJL/swTj3TnVC 0Bz3weKxE4WmikUrQKzQ2O4jcxYQ3S7TdPDxJiMpVtxjK1jIFr/VPgyfPLVreGOfV6QP JbacWSBRHapoAVkPGjqk58Ts84MEmnyhN4bijYt3WRgrfC9rqeiQmLLEhzUUx+XAIX+G 3jiA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d12si37706427ilg.4.2021.07.24.16.45.15; Sat, 24 Jul 2021 16:46:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229964AbhGXW7K (ORCPT + 99 others); Sat, 24 Jul 2021 18:59:10 -0400 Received: from zeniv-ca.linux.org.uk ([142.44.231.140]:55380 "EHLO zeniv-ca.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229665AbhGXW7J (ORCPT ); Sat, 24 Jul 2021 18:59:09 -0400 Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m7REv-003hHv-87; Sat, 24 Jul 2021 23:39:29 +0000 Date: Sat, 24 Jul 2021 23:39:29 +0000 From: Al Viro To: Andreas Gruenbacher Cc: Linus Torvalds , Christoph Hellwig , "Darrick J. Wong" , Jan Kara , Matthew Wilcox , cluster-devel , linux-fsdevel , Linux Kernel Mailing List , ocfs2-devel@oss.oracle.com Subject: Re: [PATCH v4 1/8] iov_iter: Introduce iov_iter_fault_in_writeable helper Message-ID: References: <20210724193449.361667-1-agruenba@redhat.com> <20210724193449.361667-2-agruenba@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 25, 2021 at 12:06:41AM +0200, Andreas Gruenbacher wrote: > On Sat, Jul 24, 2021 at 11:57 PM Al Viro wrote: > > On Sat, Jul 24, 2021 at 11:38:20PM +0200, Andreas Gruenbacher wrote: > > > > > Hmm, how could we have sub-page failure areas when this is about if > > > and how pages are mapped? If we return the number of bytes that are > > > accessible, then users will know if they got nothing, something, or > > > everything, and they can act accordingly. > > > > What I'm saying is that in situation when you have cacheline-sized > > poisoned areas, there's no way to get an accurate count of readable > > area other than try and copy it out. > > > > What's more, "something" is essentially useless information - the > > pages might get unmapped right as your function returns; the caller > > still needs to deal with partial copies. And that's a slow path > > by definition, so informing them of a partial fault-in is not > > going to be useful. > > > > As far as callers are concerned, it's "nothing suitable in the > > beginning of the area" vs. "something might be accessible". > > Yes, and the third case would be "something might be accessible, but > not all of it". There probably are callers that give up when they > don't have it all. Who cares? Again, 1) those callers *still* have to cope with copyin/copyout failures halfway through. Fully successful fault-in does not guarantee anything whatsoever. IOW, you won't get rid of any complexity that way. 2) earlier bailout in rare error case is not worth bothering with. If you'd been given an iov_iter spanning an unmapped/unreadable/unwritable area of user memory, it's either a fucking rare race with truncate() of an mmapped file or a pilot error. Neither case is worth optimizing for. The difference between partially accessible and completely accessible at the fault-in time is useless for callers. Really.