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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F626ECAAD8 for ; Fri, 23 Sep 2022 08:15:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230424AbiIWIPy (ORCPT ); Fri, 23 Sep 2022 04:15:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229788AbiIWIPx (ORCPT ); Fri, 23 Sep 2022 04:15:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0DDAB6561; Fri, 23 Sep 2022 01:15:51 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 4A3F361491; 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> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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