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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87AAAC07E9D for ; Mon, 26 Sep 2022 22:57:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8D5018E008B; Mon, 26 Sep 2022 18:57:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 883E88E0066; Mon, 26 Sep 2022 18:57:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 724D48E008B; Mon, 26 Sep 2022 18:57:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 60ACD8E0066 for ; Mon, 26 Sep 2022 18:57:17 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 29DA41A0696 for ; Mon, 26 Sep 2022 22:57:17 +0000 (UTC) X-FDA: 79955749314.03.213A40D Received: from mail-qv1-f45.google.com (mail-qv1-f45.google.com [209.85.219.45]) by imf04.hostedemail.com (Postfix) with ESMTP id A183F4000A for ; Mon, 26 Sep 2022 22:57:16 +0000 (UTC) Received: by mail-qv1-f45.google.com with SMTP id mi14so5213083qvb.12 for ; Mon, 26 Sep 2022 15:57:16 -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=0oTmPF8OXz/CvwH1nuIdtQazTpalf2fsvzakYLiefMI=; b=AAuidSESOdluh22iHoNdq1ialZQHJi8DlKeQnNqP8tWtqZ0iWgOxeNjSwkyHl3UQlo EaRAzbnIRBWMdo4nhZwbRFS3a20sJ7mYxHKh7Vc0kXen7QbCUiBzmJEMG/gKmdGxQQt9 TcfjCa/9U+Ha5Bc3h5TKe+CKna/iYXcCMoCb91DUARCakDg6wnUiVm7MGAuLY0BDZYCN J3kDV6FsQud562i1x9eaKHSC/ucw6t+++AJcg8A+pKvW/vp+3q1yUpu1sszuNx3oK8VA mZZiklHsIKm1548z2J486iqmDSDhDgGH+oWZ8C1MmRSEkFMnzH98qm2RbCK7u9yUeYB7 6hrw== 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=0oTmPF8OXz/CvwH1nuIdtQazTpalf2fsvzakYLiefMI=; b=Pb+OtJY9WRdF6mg42JK7HKafszvhR/y1VJLpkZ4mtJosaqhEvr7VvLc7ffZlsIQzCo ymfHkW7LMyKVvaeFKaeEh0YJDcnadRRhuv+VeqtaeR6SuhZhzjki5YqzMYL2dZnfTEIH 8MX6SnM6/pDYHaGI4Rnh1rTHDSYREYlTLEjlAw1JhknrTe269s8J1+TB1wLWd77CLfzM GZlq/EIJxZF9YeLQ1f1/t+dS3a9EZQIFfNOVSGZ3tp//SjSgtKKc1m1jLsgcsvRqXxzB vfX/ovdSA5UVkK8QWWESEGQNidC9r7Nj+mnd74v5mnEanpULXN0WWV1E84ArzWll4Pj3 NrxQ== X-Gm-Message-State: ACrzQf3kfI0JYFccLhfsMU0GH7kWzdG0h8L5m9Tp3dy+gyaGgUpwbopk tD9sQb8P7f+MIL1u1/G4wXMyCA== X-Google-Smtp-Source: AMsMyM7Fh0JEmgnwt37ZJHit80EZ1xpj8o5VJC2kJp3X5teg4vJeS+eiVLIo84JzglXvNOHGcfPCZQ== X-Received: by 2002:a05:6214:2686:b0:4af:630c:78f2 with SMTP id gm6-20020a056214268600b004af630c78f2mr9100014qvb.52.1664233035861; Mon, 26 Sep 2022 15:57:15 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-47-55-122-23.dhcp-dynamic.fibreop.ns.bellaliant.net. [47.55.122.23]) by smtp.gmail.com with ESMTPSA id az35-20020a05620a172300b0069fe1dfbeffsm12946809qkb.92.2022.09.26.15.57.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 15:57:14 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1ocx2I-000O97-1t; Mon, 26 Sep 2022 19:57:14 -0300 Date: Mon, 26 Sep 2022 19:57:14 -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: <64f8da81-7803-4db4-73da-a158295cbc9c@deltatee.com> <2327d393-af5c-3f4c-b9b9-6852b9d72f90@deltatee.com> <3840c1c6-3a5c-2286-e577-949f0d4ea7a6@deltatee.com> <980899e1-532a-772b-2f6d-6fb017def50b@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <980899e1-532a-772b-2f6d-6fb017def50b@deltatee.com> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664233036; a=rsa-sha256; cv=none; b=Scm+nQGrcLqM20BKaekpYkRLG2SEpHccpr9fPkKaEUZq1S3k7+vpRrb0EVzEicjCB3YPZh eRuT/nnOWR9AqwLaie0KFxeXjDNDzE0TR2Mk2tc1MOdtC223Z4QHZbayUGh/LUP1RfRLtL kX+2sAEcs3q2PuKfhO77V/zcqRBPhI4= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=ziepe.ca header.s=google header.b=AAuidSES; dmarc=none; spf=pass (imf04.hostedemail.com: domain of jgg@ziepe.ca designates 209.85.219.45 as permitted sender) smtp.mailfrom=jgg@ziepe.ca ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664233036; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=0oTmPF8OXz/CvwH1nuIdtQazTpalf2fsvzakYLiefMI=; b=eCxYL2h2Mkuc09rjno+JQYhQKwmbjvIiVIlRGOBxYx3Ot94AYPfulYDMDXxBqLsynyLaD/ nbAZtMjqeQ0crDwj2NIIWx3tlT5D5C+ivvX1Q7oY4FkRQ65TOJzCjwb7HxMiZ5zx1RShny mCKEJrDyXfkf5N5tiKe+ukiyFnPUlCo= X-Stat-Signature: non3uzga5p9uxnkr9rh9o6w5hk357gwc X-Rspam-User: X-Rspamd-Server: rspam04 Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=ziepe.ca header.s=google header.b=AAuidSES; dmarc=none; spf=pass (imf04.hostedemail.com: domain of jgg@ziepe.ca designates 209.85.219.45 as permitted sender) smtp.mailfrom=jgg@ziepe.ca X-Rspamd-Queue-Id: A183F4000A X-HE-Tag: 1664233036-424835 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Sep 23, 2022 at 05:51:49PM -0600, Logan Gunthorpe wrote: > And on further consideration I really think the correct error return is > important here. This will be a user facing error that'll be easy enough > to hit: think code that might be run on any file and if the file is > hosted on a block device that doesn't support P2PDMA then the user > will see the very uninformative "Cannot allocate memory" error. > > Userspace code that's written for purpose can look at the EREMOTEIO error > and tell the user something useful, if we return the correct error. > If we return ENOMEM in this case, that is not possible because > lots of things might have caused that error. That is reasonable, but I'd still prefer to see it done more centrally. >> If we know PIN/GET is not set then we don't even need to call the >> function because it is a NOP. > That's not what the documentation for the function says: > "Either FOLL_PIN or FOLL_GET (or neither) may be set... Return: true for success, > or if no action was required (if neither FOLL_PIN nor FOLL_GET was set, nothing > is done)." I mean the way the code is structured is at the top of the call chain the PIN/GET/0 is decided and then the callchain is run. All the callsites of try_grab_page() must be safe to call under FOLL_PIN because their caller is making the decision what flag to use. Jason