Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1131454pxb; Tue, 8 Feb 2022 09:57:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTF1XoytvwbJazornVvZ8Vc7PPWnDX+9BfadPi2+X1cOmB/ltfHN0RVFVIYp65HZ82eX39 X-Received: by 2002:aa7:c715:: with SMTP id i21mr5753735edq.117.1644343028311; Tue, 08 Feb 2022 09:57:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644343028; cv=none; d=google.com; s=arc-20160816; b=YyxD2T6FTr4qdsYr+EsscVQhoatTjd7XSOoHWBkxFGZLFZPwwUexJQJspEyyVtfY0A ZC/5PJbSQ9RyA0gBY9OTBkA+No/8HeEVixl9WYWR5NzcUVaDHQoKH0vEaHTfCduSTJtE 1pl7IPWvt+Tcq+1Aj2rM9HJ+7G+7/6R/FFsnWCnW/hFgcDGXBuvi3tAYe/r/D8d1Y6Kj 4W6rVuLjbp2MfmrbOKN5OqWWaE9kP1cSUJ1O7/qBHFhWXjL9a+xm/SQf87l7QVmOsvru X24Gt7IL3xuA0PUIcaMTJRm5vsoCdNQ645ezKuW/1sEsudoH6xiz4Z1vXMj36advjBdA r23A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=VPcGj79vup/xftEUTwDECNujdK5ZRlnSHT2lp1q2f9M=; b=MWCwrmTS2cR+7teVYdWZ4LziWMJlTBlAX9cnyJEW675rukQZKUJsicb6ImzxyMhkS7 N76g3bo6ELFjLvXfTk5/5qwAXRnFWC+TpwyaFG03dGPSW2lwri9X80reeix6V4RzAQVy lROuqDR8mcAulM5PnenR9NSnHwBn52ZeJhVKBA6II8ed8f2hS6qiTUxS8MJP8MSH90eL EoKeIgAceyng8mKT8hzJsESyJhL3NhlaZViJyLMHSE1ogYmYbnTDlD9ghQcecp2pfpoy ASme2aYDlvZqbxnqSe8NqTLLWb1UJr9zSTcM19gxuoZLJCRXuNIdBm3pQz8C6+xeZB5u 3WNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=14WdU8eC; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=J14NvFap; 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 27si7883668eja.324.2022.02.08.09.56.43; Tue, 08 Feb 2022 09:57:08 -0800 (PST) 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=@suse.cz header.s=susede2_rsa header.b=14WdU8eC; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=J14NvFap; 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 S1350911AbiBCNx4 (ORCPT + 99 others); Thu, 3 Feb 2022 08:53:56 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:59932 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240877AbiBCNxx (ORCPT ); Thu, 3 Feb 2022 08:53:53 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id A187F1F3AF; Thu, 3 Feb 2022 13:53:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1643896432; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VPcGj79vup/xftEUTwDECNujdK5ZRlnSHT2lp1q2f9M=; b=14WdU8eCrNFqgKv2TI0sjyolRoRpgevK923gOQnPYL6/lZ1M1/ySFE4j/sy1fu/aXUhxBG j15kJa5Kgh/XM2Gn4vwtFcwBg1Zq+589YyRJkZ3s/fSziAbl0e/2vq19ZHtwUTu2bzCq0e a/WF6SJw7LLOwNsu7w20LdRR194iWqU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1643896432; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VPcGj79vup/xftEUTwDECNujdK5ZRlnSHT2lp1q2f9M=; b=J14NvFaplAkr+hhdnT45sk/xOh2p+jXRGapbEmn5XpIiTRt57pPiktXxBRd63Hbu0XiGme sG30JcQwr/UTkhCw== Received: from quack3.suse.cz (unknown [10.100.200.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 7B376A3B81; Thu, 3 Feb 2022 13:53:52 +0000 (UTC) Received: by quack3.suse.cz (Postfix, from userid 1000) id 31CF2A05B6; Thu, 3 Feb 2022 14:53:52 +0100 (CET) Date: Thu, 3 Feb 2022 14:53:52 +0100 From: Jan Kara To: John Hubbard Cc: Andrew Morton , Peter Xu , Jason Gunthorpe , David Hildenbrand , Lukas Bulwahn , Jan Kara , Claudio Imbrenda , "Kirill A . Shutemov" , Alex Williamson , Andrea Arcangeli , LKML , linux-mm@kvack.org, Jason Gunthorpe Subject: Re: [PATCH v3 2/4] mm/gup: clean up follow_pfn_pte() slightly Message-ID: <20220203135352.55f35pztwmdx2rhk@quack3.lan> References: <20220203093232.572380-1-jhubbard@nvidia.com> <20220203093232.572380-3-jhubbard@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220203093232.572380-3-jhubbard@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 03-02-22 01:32:30, John Hubbard wrote: > Regardless of any FOLL_* flags, get_user_pages() and its variants should > handle PFN-only entries by stopping early, if the caller expected > **pages to be filled in. > > This makes for a more reliable API, as compared to the previous approach > of skipping over such entries (and thus leaving them silently > unwritten). > > Cc: Peter Xu > Cc: Lukas Bulwahn > Suggested-by: Jason Gunthorpe > Reviewed-by: Jason Gunthorpe > Signed-off-by: John Hubbard > --- > mm/gup.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/mm/gup.c b/mm/gup.c > index 65575ae3602f..cad3f28492e3 100644 > --- a/mm/gup.c > +++ b/mm/gup.c > @@ -439,10 +439,6 @@ static struct page *no_page_table(struct vm_area_struct *vma, > static int follow_pfn_pte(struct vm_area_struct *vma, unsigned long address, > pte_t *pte, unsigned int flags) > { > - /* No page to get reference */ > - if (flags & (FOLL_GET | FOLL_PIN)) > - return -EFAULT; > - > if (flags & FOLL_TOUCH) { > pte_t entry = *pte; > This will also modify the error code returned from follow_page(). A quick audit shows that at least the user in mm/migrate.c will propagate this error code to userspace and I'm not sure the change in error code will not break something... EEXIST is a bit strange error code to get from move_pages(2). Honza -- Jan Kara SUSE Labs, CR