Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1464165imw; Tue, 5 Jul 2022 09:56:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1twg7XzrxzEqlJVUwbN0LZqGYIig/r1Z6yl5GIIprd3Sd/2R3D7IIA0gpE9vLJmpBM7i994 X-Received: by 2002:a05:6402:42c3:b0:43a:46f6:ebd2 with SMTP id i3-20020a05640242c300b0043a46f6ebd2mr17761037edc.213.1657040182022; Tue, 05 Jul 2022 09:56:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657040182; cv=none; d=google.com; s=arc-20160816; b=0JKn/sVu8F4esyWGcSaB06qqIBT7txNg7cTTRhDJTwmOthYpK/HnD+hnGtzu+kNtEF 8CsvFSKzuIyiGju7WpSmVu/3HCG1qxrZYlKhp7+RmN22YYWZQZaeyoNBxydvW6nXc9eA oNQzmowLU+7+hcsrOij5+0LvDf1gFI/vV+i3EberJ5WNGhR9DuC1vin6zJajPqeXsB0H eS/bxB9NDe4lG9HdQ9IR+RlCb1H0LaNRbNDWVLi7uwRWDuIpgBhROSrSwO+Aaqx0wVtD 1njXdhmr11ItRLgWbZ9U+2kYYvnc2/yzbs71E9B+FSQyP005jFWSb3u+abwrqEwJapU0 WH9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=sFsbJ4epJMwkYc2xyu1PJg9yy50djpcLaopJr7Ogu38=; b=m0DdfTT6a0eqa0WQC1qPBUMx+vcSR58KCiO1pd5+IplCvGU/QH0e0w4joGz1j2cCFf DP9w2tC/+JQwincxUBnG7orqsjwZ98UelsyUvin0YvSVra4MjbzYMyLy6PrxnIp9oU6p mHkqFvkIKcF6KUrOhsWP0EfiiOOcqVj0uLtdYfBt4iGezXqzH4NtQ101bSLUqc5eHHvX 4axVsYQsuseCI7W5ntLvugCvo5ey0UOfYKgIXBk/EOyf+5B4f2gddPfE0+MPQL6vwJL+ kS5ERCfAOY98zMv61YTeUXVS1cAEJ132+CskWBAtvjmkCgdQm/YijCZcOjUKgR+IRkxo tGdQ== ARC-Authentication-Results: i=1; mx.google.com; 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 gt35-20020a1709072da300b00726b031a475si34284904ejc.758.2022.07.05.09.55.55; Tue, 05 Jul 2022 09:56:22 -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; 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 S229739AbiGEQkh (ORCPT + 99 others); Tue, 5 Jul 2022 12:40:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229658AbiGEQk2 (ORCPT ); Tue, 5 Jul 2022 12:40:28 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 573351BEA6; Tue, 5 Jul 2022 09:40:27 -0700 (PDT) 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) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 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.