Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1534306imw; Tue, 5 Jul 2022 11:04:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uaP2yw0kWQLb060uVoJcw2MqoW0uKHBlShTYQ3TQw1e2YTHN1pkxLy3reNQ6IJztuEwu86 X-Received: by 2002:a17:90b:388f:b0:1ed:3b:6c64 with SMTP id mu15-20020a17090b388f00b001ed003b6c64mr43204582pjb.34.1657044299189; Tue, 05 Jul 2022 11:04:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657044299; cv=none; d=google.com; s=arc-20160816; b=LwHxTO4Zj/bVoNfaXRQ9KlnsI4swgRdaz3b1e1LhnCzftvJmU3PtkvpFZgsEFTyDwn sRNgLyj2U+cgfhEhInrIj2f2hc+1NHcD++Mik9A8XgM7+iKz2O8TdoQP7InbefD85USW vrZp+7gA9BLTMiCUswvqV9W1T7yWJpgtozSqL/n5YsbfyOUml7dn+gTkSPQW0T2A/wbu kEBBvt0HyiqI8R9OOECjwvpxMF7C7GuFp/pV0WTr/VFC8vldMRofR1xXSup4ltZtu6v7 xysNFqjEy0CEznVnPTJ4lVxLNFbTjTJAkrGPJKjEo+eYEYn2AjNKNJmiZO2ta6uWH6GR AhGA== 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=ZZ183XwVsELBVPB7JnEyzJPWbbXM+pLVSpBuXVG55QQ=; b=SejKxq5Gx0gglzRETRY7N2sIb0Em+HCtqCsmiCi8BpsSrIE4/1Wirxz9P2+4s19T3s wbXRVvaZvH2q12mkF1umSupNJ9Ady0L7qpge2j4usaOYPRu8aJ8u2xTccAVvOHckjtTe /hLviJNyyAaRy3QoOOg8JMXU18tYIO/sTXAFov/TRoqI1F+5qrKWXQyUJN3sBmH8PB6K Y/fFvDKthm9so7ekOdAIWJoYphmlh/lF9Gp1M1jPwJ7ftbiPFvpB/60oUdVFjmbAd4xl Rp7HeCU5/I76PDjxBiVJczbM//+PiDW2PA1N8E7c4xLrnsGsI8ISVXKnjl8s0eSuFwwf xfPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E+wsESQz; 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 e8-20020a636908000000b0040da1209ed4si23172349pgc.775.2022.07.05.11.04.47; Tue, 05 Jul 2022 11:04:59 -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=E+wsESQz; 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 S233364AbiGERmk (ORCPT + 99 others); Tue, 5 Jul 2022 13:42:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232949AbiGERmj (ORCPT ); Tue, 5 Jul 2022 13:42:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D33119006; Tue, 5 Jul 2022 10:42:38 -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 ams.source.kernel.org (Postfix) with ESMTPS id CBCCAB81887; Tue, 5 Jul 2022 17:42:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4620C341C7; Tue, 5 Jul 2022 17:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657042955; bh=18T9JrVrQmGUhIeB/JuQTrGy9yUM/iGt2yUQiwv239s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=E+wsESQzjBq0Jm7GRcNunkZNg/B9u9pWxluE8Hvyw5c8ngmjtRMeYZplVgH18CEMg +CWBPqMRpf6vtqHc8uVHP4AxL8xobnRkwM4XtCynMLc+/O8b28/frnTwxcKPJt8aG2 gLkaIa6aOTwyOr/X8xpnr7Wu6h8BVukKTtB9ibvU= Date: Tue, 5 Jul 2022 19:42:32 +0200 From: Greg Kroah-Hartman To: Logan Gunthorpe Cc: Christoph Hellwig , 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 , 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 , Bjorn Helgaas Subject: Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem() Message-ID: References: <20220629175906.GU23621@ziepe.ca> <20220705075108.GB17451@lst.de> <20220705135102.GE23621@ziepe.ca> <20220705161240.GB13721@lst.de> <20220705164315.GB14484@lst.de> <20220705165039.GB14566@lst.de> <1bd43ef7-0403-bd25-087c-d54d5af677e4@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1bd43ef7-0403-bd25-087c-d54d5af677e4@deltatee.com> X-Spam-Status: No, score=-7.8 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,T_SCC_BODY_TEXT_LINE 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 Tue, Jul 05, 2022 at 11:32:23AM -0600, Logan Gunthorpe wrote: > > > 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. Why would you want to do this through a sysfs interface? that feels horrid...