Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1640616rwb; Fri, 23 Sep 2022 16:19:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5IDZ8pQDdNl6djEvfEj37nXJ9d/GnEzuIl4AXy8MK0+q66f7MeKz8x/SOMLedveoevpBA+ X-Received: by 2002:a05:6402:1014:b0:451:d2a1:236e with SMTP id c20-20020a056402101400b00451d2a1236emr10887008edu.212.1663975152306; Fri, 23 Sep 2022 16:19:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663975152; cv=none; d=google.com; s=arc-20160816; b=P906l8xdn/ZLXcdilI/6Fh86tm3boL0SEqCWp8NfPP64C8i+H2+dc3KitBJHZZNI8X xGqN1gt1v8aVcNVpOVPeexxu7zmtMbUdSRkTbuJFZLO/yhn0xYD9iYRCvJKEPSRc5rUg eKKuFrx3oDqRSEuXG6IHKYqKSUNAKbw8uKN3XK72ijC+RGM8oSFHYAgAOdB/AKNdip6d Al2wMF6rGR67AwYO6ly1zMqpOrv7GRNWPne9LwQ5qRXCJjHmJzNDc9UEiTAO087q+dv8 PY3H5NLr54Bl0Rrnbm8dSKduG1mPePI0cilWExynzrHxELRszbZ8t9R+NO5JhFaUR+KV JTVA== 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; bh=EIl/nh29zH96tBjnO04+Za75Ipkt6sGk6uA16GsQuRo=; b=kvCDT2DebOeH4O45kFAlGvyDQvoWxJSlkqrcprXKCLg12BJKsjjO3FLpFThtXkdz2s yweOiCFeVZMAuc5sDFhW+g7MXxbxl9OSuIobAfC7ciGUWIDGcK+Sf04Binc55rUFogZc 8avbbMyJC5I6wBmWhwfaUwJKO6etzCJyrRhOO/vGf6kwgJ8mx1emB5GCCOWZZWEhWbT4 TEWkHLBCrOmfor1IG4E0AwTUwrhap9LQcHHtTLQOxqqBrcIorTwKyg5f88h7fAZA8whH tED7AnZhpEMTXXACpM4jRZrWYVhZdU9pSmkrTj9J2c0TevhYDUSIAgm0KtGnifaJaR0f yK2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=N+P38VAw; 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 dt4-20020a170907728400b0078072e1a877si9403395ejc.744.2022.09.23.16.18.45; Fri, 23 Sep 2022 16:19:12 -0700 (PDT) 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=@ziepe.ca header.s=google header.b=N+P38VAw; 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 S232834AbiIWXHO (ORCPT + 99 others); Fri, 23 Sep 2022 19:07:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232828AbiIWXHM (ORCPT ); Fri, 23 Sep 2022 19:07:12 -0400 Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23140146614 for ; Fri, 23 Sep 2022 16:07:07 -0700 (PDT) Received: by mail-qv1-xf2f.google.com with SMTP id l1so854264qvu.11 for ; Fri, 23 Sep 2022 16:07:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=EIl/nh29zH96tBjnO04+Za75Ipkt6sGk6uA16GsQuRo=; b=N+P38VAwzWrwNueTpnqYlcaO4Wwnh/yvGq5CrXQr+MEOIhsLJzkhHRaRGlZLxg+iey DYr2P/LNZNK9n8+I1zZMzIFj51vuzJpoC/m6kBz0D1tYPDZ6pEQe8GzyI442cqFVxiHs wgixALrJy9vDVOcBb3BWDjBnsAdri1GFyNtMW7PTfPV/gW7darPtzbWpjT5+YijAFkh2 sYZcC248zBfiR8rnutPUSujZoc23CLex/qcIRD66Y3nxp7dTNL45L/IGXi6TOqDyE6yp clE87f/yyT0iJMg+J2x0ANJoOmOZGBzm4thw9YJeTmp1I8o7NCi4TQmNWzW+JQtcekVG cktQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=EIl/nh29zH96tBjnO04+Za75Ipkt6sGk6uA16GsQuRo=; b=q4C8aVmBrOvTlLbvKdwa56jEqW+UGFFfc0PIHHR5x9R/4ogGpu7Hu+su/XS84LM5Hb qJUyFz8MX5QcJS0q/33lgLa47yLPlKlM34FKu1GFpAgR1kqHvGv5i5FM1kstD7T8zIdl aKGywq0uTZWHUi60CvLp7y2HZkd2yUKPE4ZhPvBMUjypco0WMLRRwF8mC126fnuFZj6V eLxL/cg6seHXMf5ZaMjN07UsQ1iZpZjpDcidqXJLn/MG9pRSUmptwUYRGW6A55+ZQVMi EpeWka4aXjZfKGmTirBqlINKLlvCp5SU72V8rKNuhaYolwzzSLDlK18IhMQVpPN0u5yW AABQ== X-Gm-Message-State: ACrzQf0IyZmlZ2HLSJqigw8mBSoS/HPerz8E5h5gGPKfmJyaTAMCr7kR RakvFOf1iZ074WeBhZTSMIlchg== X-Received: by 2002:a05:6214:2467:b0:4a2:e191:46b7 with SMTP id im7-20020a056214246700b004a2e19146b7mr9012870qvb.112.1663974426313; Fri, 23 Sep 2022 16:07:06 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-162-113-129.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.113.129]) by smtp.gmail.com with ESMTPSA id b13-20020a05622a020d00b0035a6f14b3cesm6656906qtx.27.2022.09.23.16.07.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Sep 2022 16:07:05 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1obrlA-0035kF-QP; Fri, 23 Sep 2022 20:07:04 -0300 Date: Fri, 23 Sep 2022 20:07:04 -0300 From: Jason Gunthorpe To: Logan Gunthorpe Cc: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-pci@vger.kernel.org, linux-mm@kvack.org, Christoph Hellwig , Greg Kroah-Hartman , Dan Williams , Christian =?utf-8?B?S8O2bmln?= , John Hubbard , Don Dutile , Matthew Wilcox , Daniel Vetter , Minturn Dave B , Jason Ekstrand , Dave Hansen , Xiong Jianxin , Bjorn Helgaas , Ira Weiny , Robin Murphy , Martin Oliveira , Chaitanya Kulkarni , Ralph Campbell , Stephen Bates Subject: Re: [PATCH v10 1/8] mm: introduce FOLL_PCI_P2PDMA to gate getting PCI P2PDMA pages Message-ID: References: <20220922163926.7077-1-logang@deltatee.com> <20220922163926.7077-2-logang@deltatee.com> <64f8da81-7803-4db4-73da-a158295cbc9c@deltatee.com> <2327d393-af5c-3f4c-b9b9-6852b9d72f90@deltatee.com> <3840c1c6-3a5c-2286-e577-949f0d4ea7a6@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3840c1c6-3a5c-2286-e577-949f0d4ea7a6@deltatee.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 23, 2022 at 05:01:26PM -0600, Logan Gunthorpe wrote: > > > > On 2022-09-23 16:58, Jason Gunthorpe wrote: > > On Fri, Sep 23, 2022 at 02:11:03PM -0600, Logan Gunthorpe wrote: > >> > >> > >> On 2022-09-23 13:53, Jason Gunthorpe wrote: > >>> On Fri, Sep 23, 2022 at 01:08:31PM -0600, Logan Gunthorpe wrote: > >>> I'm encouraging Dan to work on better infrastructure in pgmap core > >>> because every pgmap implementation has this issue currently. > >>> > >>> For that reason it is probably not so relavent to this series. > >>> > >>> Perhaps just clarify in the commit message that the FOLL_LONGTERM > >>> restriction is to copy DAX until the pgmap page refcounts are fixed. > >> > >> Ok, I'll add that note. > >> > >> Per the fix for the try_grab_page(), to me it doesn't fit well in > >> try_grab_page() without doing a bunch of cleanup to change the > >> error handling, and the same would have to be added to try_grab_folio(). > >> So I think it's better to leave it where it was, but move it below the > >> respective grab calls. Does the incremental patch below look correct? > > > > Oh? I was thinking of just a very simple thing: > > Really would like it to return -EREMOTEIO instead of -ENOMEM as that's the > error used for bad P2PDMA page everywhere. I'd rather not see GUP made more fragile just for that.. > Plus the concern that some of the callsites of try_grab_page() might not have > a get or a pin and thus it's not safe which was the whole point of the change > anyway. try_grab_page() calls folio_ref_inc(), that is only legal if it knows the page is already a valid pointer under the PTLs, so it is safe to check the pgmap as well. Jason