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 35545C6FA82 for ; Fri, 23 Sep 2022 08:15:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B234580008; Fri, 23 Sep 2022 04:15:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AAA7680007; Fri, 23 Sep 2022 04:15:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8FC3580008; Fri, 23 Sep 2022 04:15:54 -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 7D80280007 for ; Fri, 23 Sep 2022 04:15:54 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 4F208A0F69 for ; Fri, 23 Sep 2022 08:15:54 +0000 (UTC) X-FDA: 79942641828.13.61D04A1 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf05.hostedemail.com (Postfix) with ESMTP id E73FB100003 for ; Fri, 23 Sep 2022 08:15:53 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DC891B82278; Fri, 23 Sep 2022 08:15:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2193DC433D6; Fri, 23 Sep 2022 08:15:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663920950; bh=ITi0Pkie/41exckOOEHb1oAjXkYdzFl60zYe1Z6SOsI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=v0KIwFqnf0h62gPG0bxhRtPlMQRU+sn46T0CtPVR5NKOnXZsjItRiireczqzCeKag pAvIG3SEtkcD85MT7X2TMXaDlhSnRQcrEOmrMoSMt/EK/FQujn5mkajW6X3k8utzpw anYADRkPfWaRWXGb6PsKo0p6qOHfHnd0hbjq1K+8= Date: Fri, 23 Sep 2022 10:15:46 +0200 From: Greg Kroah-Hartman 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 , Dan Williams , Jason Gunthorpe , 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 , Stephen Bates Subject: Re: [PATCH v10 7/8] PCI/P2PDMA: Allow userspace VMA allocations through sysfs Message-ID: References: <20220922163926.7077-1-logang@deltatee.com> <20220922163926.7077-8-logang@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220922163926.7077-8-logang@deltatee.com> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663920954; a=rsa-sha256; cv=none; b=c/04mC4Lpsh1fqqlG3Qnm1/WNpmb9GUCVxHT8Lt+AEWHZWiGVG21XYoLnI1+YIyHenje7C njC6FEG8JlmBtOpSb6Qxf1Nh4br7ghHiuCbghoKtZBPn8tlTnd0rZPd5Liv/4Dci91nCdL 5BuNDS9hnfb2eJ/6cF3FzwvfKjXdBio= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=v0KIwFqn; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf05.hostedemail.com: domain of gregkh@linuxfoundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663920954; 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=nxQOP36bH13DhZdpblozx9dhaLeK49H11GyoyHkKHJE=; b=SIOF5O5TTgAnpwEz6pwDvLSC5pNQF2CLImjTIzwSGcX9JGSDeVS6nLvvl2Gmhtoi4c2kId SWEfj+xmSllmsG5Ymx5/3kR8sLI4AswB1eUumRsjahSsaocyDQSiaw9vV3GSGbRRXiPK78 5gCPE61AqDnYE8eMtlThDal/R5i3OT8= X-Stat-Signature: r5i8fko6pur4ks1gdq6rshnn9kng5ctg X-Rspamd-Queue-Id: E73FB100003 Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=v0KIwFqn; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf05.hostedemail.com: domain of gregkh@linuxfoundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org X-Rspamd-Server: rspam05 X-Rspam-User: X-HE-Tag: 1663920953-223169 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 Thu, Sep 22, 2022 at 10:39:25AM -0600, Logan Gunthorpe wrote: > Create a sysfs bin attribute called "allocate" under the existing > "p2pmem" group. The only allowable operation on this file is the mmap() > call. > > When mmap() is called on this attribute, the kernel allocates a chunk of > memory from the genalloc and inserts the pages into the VMA. The > dev_pagemap .page_free callback will indicate when these pages are no > longer used and they will be put back into the genalloc. > > On device unbind, remove the sysfs file before the memremap_pages are > cleaned up. This ensures unmap_mapping_range() is called on the files > inode and no new mappings can be created. > > Signed-off-by: Logan Gunthorpe > --- > drivers/pci/p2pdma.c | 124 +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 124 insertions(+) Reviewed-by: Greg Kroah-Hartman