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 2EC80C43334 for ; Tue, 5 Jul 2022 16:40:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 773E26B0071; Tue, 5 Jul 2022 12:40:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7239A6B0073; Tue, 5 Jul 2022 12:40:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 612AE6B0074; Tue, 5 Jul 2022 12:40:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 4F0BA6B0071 for ; Tue, 5 Jul 2022 12:40:27 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 19BF99D4 for ; Tue, 5 Jul 2022 16:40:27 +0000 (UTC) X-FDA: 79653609294.15.3D11026 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf07.hostedemail.com (Postfix) with ESMTP id 58C1040016 for ; Tue, 5 Jul 2022 16:40:26 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 3BC8567373; Tue, 5 Jul 2022 18:40:19 +0200 (CEST) Date: Tue, 5 Jul 2022 18:40:19 +0200 From: Christoph Hellwig To: Jason Gunthorpe Cc: Christoph Hellwig , Logan Gunthorpe , linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-pci@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, Stephen Bates , Dan Williams , Christian =?iso-8859-1?Q?K=F6nig?= , 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 , Bjorn Helgaas Subject: Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem() Message-ID: <20220705164019.GB14215@lst.de> References: <20220615161233.17527-1-logang@deltatee.com> <20220615161233.17527-21-logang@deltatee.com> <20220629064854.GD17576@lst.de> <99242789-66a6-bbd2-b56a-e47891f4522e@deltatee.com> <20220629175906.GU23621@ziepe.ca> <20220705075108.GB17451@lst.de> <20220705135102.GE23621@ziepe.ca> <20220705161240.GB13721@lst.de> <20220705162959.GH23621@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220705162959.GH23621@ziepe.ca> User-Agent: Mutt/1.5.17 (2007-11-01) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657039226; 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; bh=sFsbJ4epJMwkYc2xyu1PJg9yy50djpcLaopJr7Ogu38=; b=MN08SKUHeZKwAKT6vGDIFkWGEoPCVJb35TL/KKgGBzcsQTzuPjksPLTcFvuFQS/dRx/VtR 72qwCy3IgxTXvFJgeXH5hgRZPWG12lko9u3ljqeaxB/4q43GgJsGgrw0KSm67dnMkJO64e mkpD+H8MPrRrwDUpR9TXrHLiGHh02oE= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; dmarc=none; spf=none (imf07.hostedemail.com: domain of hch@lst.de has no SPF policy when checking 213.95.11.211) smtp.mailfrom=hch@lst.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657039226; a=rsa-sha256; cv=none; b=fIbMfBwaatMY4TGPt3w4DzcJ3+B2BcUnqD2LOHmYF7dRgAi2HRwriafjoAEhxpp9H+pNsz x8mYjhBOq96Y/Dv/R52ro6HY09XOF2a6AsbaUw0e6b2HwF7KA6HBp5Kf440LQ5a8GMKMr6 SqXiN82N/E6cHKgxRV2HazcykhfnyIc= X-Rspam-User: X-Rspamd-Queue-Id: 58C1040016 Authentication-Results: imf07.hostedemail.com; dkim=none; dmarc=none; spf=none (imf07.hostedemail.com: domain of hch@lst.de has no SPF policy when checking 213.95.11.211) smtp.mailfrom=hch@lst.de X-Stat-Signature: totxkf6t39fum1hrn61uggijt5z3ztmx X-Rspamd-Server: rspam08 X-HE-Tag: 1657039226-476348 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 Tue, Jul 05, 2022 at 01:29:59PM -0300, Jason Gunthorpe wrote: > > Making the entire area given by the device to the p2p allocator available > > to user space seems sensible to me. That is what the current series does, > > and what a sysfs interface would do as well. > > That makes openning the mmap exclusive with the in-kernel allocator - > so it means opening the mmap fails if something else is using a P2P > page and once the mmap is open all kernel side P2P allocations will > fail? No. Just as in the current patchset you can mmap the file and will get len / PAGE_SIZE pages from the per-device p2pdma pool, or the mmap will fail if none are available. A kernel consumer (or multiple) can use other pages in the pool at the same time.