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 C352EC43334 for ; Tue, 5 Jul 2022 17:32:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 49E6E6B0071; Tue, 5 Jul 2022 13:32:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 44E396B0073; Tue, 5 Jul 2022 13:32:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3162E8E0001; Tue, 5 Jul 2022 13:32:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 236A66B0071 for ; Tue, 5 Jul 2022 13:32:36 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id F35E6393 for ; Tue, 5 Jul 2022 17:32:35 +0000 (UTC) X-FDA: 79653740670.05.CF3C495 Received: from ale.deltatee.com (ale.deltatee.com [204.191.154.188]) by imf22.hostedemail.com (Postfix) with ESMTP id 66DA7C005C for ; Tue, 5 Jul 2022 17:32:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:In-Reply-To:From:References:Cc:To: MIME-Version:Date:Message-ID:content-disposition; bh=uw6gGeGeVAosjqurSltbkcsr3JSl4V4C90uMFqh7wdw=; b=q0CuZBkFqjIKH3ps9CaMMTOQEI AFNBedKVu35Vl4VPdplPnwqDUonHv29pmmMXiYOLj70GrX4iOmi3UXGiDff/GrP/Jb2a9QSqSrbgj bgm6bBW0bkaIxcnhNc05TklxboL8CrZNcceGFN221zzztTfy3Lw1LCUm51Eyd9n7s5pJSQaRV9qAY F7GTINtcABmprfbWzFkUmDJmRES5weK1ozWd1yJ5ge7F+pmEj4FqLSILhjgO8SZRh1c21eAqLy11s TBYbDHVnG7okSa3WCKZUKMagr1svRYzqSdjS5IuMpapCL/+NesKI5miI0vUl7Q8AE297h6dsLOS+r 3LTy9KaQ==; Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1o8mPS-007Tma-Ab; Tue, 05 Jul 2022 11:32:27 -0600 Message-ID: <1bd43ef7-0403-bd25-087c-d54d5af677e4@deltatee.com> Date: Tue, 5 Jul 2022 11:32:23 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Content-Language: en-CA To: Greg Kroah-Hartman , Christoph Hellwig Cc: Jason 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 , =?UTF-8?Q?Christian_K=c3=b6nig?= , 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 References: <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> <20220705164315.GB14484@lst.de> <20220705165039.GB14566@lst.de> From: Logan Gunthorpe In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: gregkh@linuxfoundation.org, hch@lst.de, jgg@ziepe.ca, 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, sbates@raithlin.com, dan.j.williams@intel.com, christian.koenig@amd.com, jhubbard@nvidia.com, ddutile@redhat.com, willy@infradead.org, daniel.vetter@ffwll.ch, dave.b.minturn@intel.com, jason@jlekstrand.net, dave.hansen@linux.intel.com, jianxin.xiong@intel.com, helgaas@kernel.org, ira.weiny@intel.com, robin.murphy@arm.com, martin.oliveira@eideticom.com, ckulkarnilinux@gmail.com, rcampbell@nvidia.com, bhelgaas@google.com X-SA-Exim-Mail-From: logang@deltatee.com Subject: Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem() X-SA-Exim-Version: 4.2.1 (built Sat, 13 Feb 2021 17:57:42 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657042355; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=uw6gGeGeVAosjqurSltbkcsr3JSl4V4C90uMFqh7wdw=; b=mLS1CJNMf+feW5il4BBibm5WoDOqPUl4Fb0ZE4RThZ5A97nDz+Rzu/nVq+gPsL8yANOyoW fjmDywq5cFu2Zym/xcdIE42P+ZNdGzFLu1fWB9FliyBdyqiLDGI2mQ5RN/yQPDjsL++mzO KFCXgyqbwIicsuLnKpcfUFEAfYjMsMw= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=deltatee.com header.s=20200525 header.b=q0CuZBkF; dmarc=pass (policy=none) header.from=deltatee.com; spf=pass (imf22.hostedemail.com: domain of logang@deltatee.com designates 204.191.154.188 as permitted sender) smtp.mailfrom=logang@deltatee.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657042355; a=rsa-sha256; cv=none; b=g+u4yaGa/U5ckp2VgXjmIBF7+Gbm96LzxW8fpoZ2w1uLF4G++N9T1YqzdWb0mI+4pKy9TM 5xVf+j04DcwHxRPKLgambxHFZFcYcPmK0IYuxlsS+e4lUr/Di2MMQbrustvqKacTCIq8o/ k4nVLnpCgPn5swHZYDrGdxrWHZcMF7w= X-Rspam-User: X-Rspamd-Queue-Id: 66DA7C005C Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=deltatee.com header.s=20200525 header.b=q0CuZBkF; dmarc=pass (policy=none) header.from=deltatee.com; spf=pass (imf22.hostedemail.com: domain of logang@deltatee.com designates 204.191.154.188 as permitted sender) smtp.mailfrom=logang@deltatee.com X-Stat-Signature: h9ieo9t8icjimssc4q73hjhree5dgdhj X-Rspamd-Server: rspam08 X-HE-Tag: 1657042352-437916 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 2022-07-05 11:21, Greg Kroah-Hartman wrote: > On Tue, Jul 05, 2022 at 06:50:39PM +0200, Christoph Hellwig wrote: >> [note for the newcomers, this is about allowing mmap()ing the PCIe >> P2P memory from the generic PCI P2P code through sysfs, and more >> importantly how to revoke it on device removal] > > We allow mmap on PCIe config space today, right? Why is this different > from what pci_create_legacy_files() does today? > >> On Tue, Jul 05, 2022 at 10:44:49AM -0600, Logan Gunthorpe wrote: >>> We might be able to. I'm not sure. I'll have to figure out how to find >>> that inode from the p2pdma code. I haven't found an obvious interface to >>> do that. >> >> I think the right way to approach this would be a new sysfs API >> that internally calls unmap_mapping_range internally instead of >> exposing the inode. I suspect that might actually be the right thing >> to do for iomem_inode as well. > > Why do we need something new and how is this any different from the PCI > binary files I mention above? We have supported PCI hotplug for a very > long time, do the current PCI binary sysfs files not work properly with > mmap and removing a device? The P2PDMA code allocates and hands out struct pages to userspace that are backed with ZONE_DEVICE memory from a device's BAR. This is quite different from the existing binary files mentioned above which neither support struct pages nor allocation. Logan