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 CBE9ECCA47C for ; Wed, 29 Jun 2022 16:00:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 630368E0010; Wed, 29 Jun 2022 12:00:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5DE098E0009; Wed, 29 Jun 2022 12:00:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A5B48E0010; Wed, 29 Jun 2022 12:00:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 3B80E8E0009 for ; Wed, 29 Jun 2022 12:00:16 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 0B5151209DE for ; Wed, 29 Jun 2022 16:00:16 +0000 (UTC) X-FDA: 79631735232.04.1943595 Received: from ale.deltatee.com (ale.deltatee.com [204.191.154.188]) by imf15.hostedemail.com (Postfix) with ESMTP id 9FDAFA0026 for ; Wed, 29 Jun 2022 16:00:15 +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=DB/o3OL3a8p7Pc5UauzdC49YqSJaVUxyZzB2ozvl7YI=; b=iZsQhnlbpW9sXN/GJaS3jAMw+w 8mn6izIwy085ybj1EKwF9DeEsOt9qyrlLxTvp+P9EVdEEjbQUwL5dVFTMDhjOaBp5PaGks7Gp0vTL Pz4wv3iQN06W33bmzngimPEHWIwXW/s9XuLr428TJq/t9Jpay97zThl6gUaoJoo9UCQ2zqUNOyzir HCs15GX4eR/A0kDWtJ7SaGXsATfCWkaQvG0flWXjWzNvEQkpGnbcu6afAc4ry10M/XvkH8tpuj6H7 pV0F7DMjJNZAL9ALRpJtO4Tl1f8+YWZ+iaFmr74pOp+DJyj7fvd7YDPPvJ3gnFshVDAC+8VlO6cQM jCOY9fhQ==; Received: from s0106a84e3fe8c3f3.cg.shawcable.net ([24.64.144.200] helo=[192.168.0.10]) by ale.deltatee.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1o6a6s-002RzJ-UG; Wed, 29 Jun 2022 10:00:11 -0600 Message-ID: <99242789-66a6-bbd2-b56a-e47891f4522e@deltatee.com> Date: Wed, 29 Jun 2022 10:00:09 -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: Christoph Hellwig 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, iommu@lists.linux-foundation.org, Stephen Bates , Dan Williams , Jason Gunthorpe , =?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: <20220615161233.17527-1-logang@deltatee.com> <20220615161233.17527-21-logang@deltatee.com> <20220629064854.GD17576@lst.de> From: Logan Gunthorpe In-Reply-To: <20220629064854.GD17576@lst.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 24.64.144.200 X-SA-Exim-Rcpt-To: hch@lst.de, 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, jgg@ziepe.ca, 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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656518415; a=rsa-sha256; cv=none; b=JmfGGFMC7Rn8g14PFWguQQZFPY34pWGIBurTTFoOJNsYtDEe5Mbx+sXnZX6O//ksQ1Wa7J K0NsNQRNhP3CkmvEnQGQBVRT0TL8fXp9epR0jZPDuCc7z+WUqfF0rEDkniK400U65rhdWe Mi7pPh5MoahNH+pJFugztAgQzmqzMiI= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=deltatee.com header.s=20200525 header.b=iZsQhnlb; dmarc=pass (policy=none) header.from=deltatee.com; spf=pass (imf15.hostedemail.com: domain of logang@deltatee.com designates 204.191.154.188 as permitted sender) smtp.mailfrom=logang@deltatee.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656518415; 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=DB/o3OL3a8p7Pc5UauzdC49YqSJaVUxyZzB2ozvl7YI=; b=m/yLrGPwMg0tNG3xjS+moxy+cGmih7aQAscz1FEWBrXVfekmSMEAlospN4brgRwM7kl+Bo 9wHCGQRVf1bPv2MwOd6i3kLe21xSIY+/L9YeNOyYoYAGnvU8J+9UCWN1f2jliaOBwc54UF xpOvBCgSH6YYCUXZZ46xY2ug96DczFw= X-Stat-Signature: xdi85eanejf1f5b8suprdqyixsu1qwy5 X-Rspam-User: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 9FDAFA0026 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=deltatee.com header.s=20200525 header.b=iZsQhnlb; dmarc=pass (policy=none) header.from=deltatee.com; spf=pass (imf15.hostedemail.com: domain of logang@deltatee.com designates 204.191.154.188 as permitted sender) smtp.mailfrom=logang@deltatee.com X-HE-Tag: 1656518415-55843 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-06-29 00:48, Christoph Hellwig wrote: > On Wed, Jun 15, 2022 at 10:12:32AM -0600, Logan Gunthorpe wrote: >> A pseudo mount is used to allocate an inode for each PCI device. The >> inode's address_space is used in the file doing the mmap so that all >> VMAs are collected and can be unmapped if the PCI device is unbound. >> After unmapping, the VMAs are iterated through and their pages are >> put so the device can continue to be unbound. An active flag is used >> to signal to VMAs not to allocate any further P2P memory once the >> removal process starts. The flag is synchronized with concurrent >> access with an RCU lock. > > Can't we come up with a way of doing this without all the pseudo-fs > garbagage? I really hate all the overhead for that in the next > nvme patch as well. I assume you still want to be able to unmap the VMAs on unbind and not just hang? I'll see if I can come up with something to do the a similar thing using vm_private data or some such. I was not a fan of the extra code for this either, but I was given to understand that it was the standard way to collect and cleanup VMAs. Thanks for the reviews, Logan