Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp610604rwb; Fri, 23 Sep 2022 01:26:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4pNIKVvgKXF7AlXL+pxkyL+gTNFPTU5AWBc73Waj0PiSjDfSRbNTEP7CNbkdbTgflNRfWI X-Received: by 2002:a05:6a00:a22:b0:54e:6a90:fbef with SMTP id p34-20020a056a000a2200b0054e6a90fbefmr7752287pfh.53.1663921594307; Fri, 23 Sep 2022 01:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663921594; cv=none; d=google.com; s=arc-20160816; b=naJN94AKWWjuQpyni5D4cBUuHngRNZmflUY/3YdmDbgm0VgEBa0NveTNf+mI2vhGxM X+zpeASTIJsnz/TaWnvn718EWm+TUseiLupc0qUSwDchmQjeKmfQnia/2i0io1qKDKyY wYl1apM2nza623Hx5xPVrtcQE7QM+2HaMMRlWKXwXFtLXx5Vc5NMOtlmj9Vo0Z4bfHBO 10ti2tZALzRbUVcddFlVJ1Fx1tNVxZ1PqFK/GLeTgS9X+dl3BfQDGPjbTdlDEkbLGyFm 5jgK1rxycIVExMIsMENYRR9KVBKkTl/JBR6BU/AzRu2FFNPxGmsho6e0XxUR/n5EQi4u GlTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nxQOP36bH13DhZdpblozx9dhaLeK49H11GyoyHkKHJE=; b=ifhcySP83FmrcddSiMRxmtltnOfnPzhwg7R9dkt8sLNfrnWSC5IZUNh9wL+0oD2xJW 69zsZe5vq63anVkwUOl6pALxjUsFEC15jqzq6fD8V06zmLxtQd2u2e2MphoqKre+K+YF MW10WNUMmLLEAke8UC4PmyCZ0IKQKjmCZW7fz5vWVmNaNp023Jui6olJ2WMzQGSahfD8 LRsFbExH4OgLY+6rHwRYuM5lrxSN8fy7TRm9e9MyR8IO6EvNyOTkZNzWLtLx3zeybJHJ ilmxgQjacx3YAzAUqC1UwyAnPiB2Eq7TDg8eqU3T/WYi1tzP+t9gHkAgtTPCEjt4hip8 Ir4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v0KIwFqn; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h2-20020a170902748200b0017840d9d579si2310955pll.67.2022.09.23.01.26.21; Fri, 23 Sep 2022 01:26:34 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v0KIwFqn; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231236AbiIWIPz (ORCPT + 99 others); Fri, 23 Sep 2022 04:15:55 -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> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 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