Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5095571imu; Tue, 29 Jan 2019 12:41:58 -0800 (PST) X-Google-Smtp-Source: ALg8bN78qqAjgdZ8q9wmsMyt8CpollPilBq6UiZnFrTTd5aAHW6e/CjpptIiBlZDtTiOiKPDub4L X-Received: by 2002:a63:4101:: with SMTP id o1mr24858092pga.447.1548794518593; Tue, 29 Jan 2019 12:41:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548794518; cv=none; d=google.com; s=arc-20160816; b=u6m6FisE0nLcd6mhO86815IIJl9WLt+Ot0/Ypy6d0NkTtCOx+LBh7V6hVSCfZaNju7 P/+dRiANiYqzEODLSJr+JgwXj7xRT6kv4R12aMJp4i1gIXAfUNtaCnvniEUdP3UrbQoJ fjDu26DnvUGpy7Yv1+lsF+EwHkyABOCGA5S2lrFkR8ClhB2jSDlJ/6R4dc2B7wy41Pn3 YStmn3wsIKCzMJUdcTSL4hqX2oPl4skkPO+BPQcue7NZBWgj1E6fZEtRxGznkr91CzmG tZivGmUdVhrDZV03jcVUCkj5SIx/SNaz2lYYLSl0DeQxIKky0aJu/OSKmh7PhISob+Xu WxxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to; bh=D6ftez5nRx/sknuHk55FUizzDioe3nrsbEAHpQ5CoHU=; b=QsM0gPt7tNiGg+/IHkiLmxDb+Ny34umiSwHm7UZQdISFjHvb2MWN+GGm/XP3lNnZn/ fmSHL0Fz2c4prwCDnnwlUcrdx/IC9Dq2xZf7vKjbs1aRsGSeb+Z+E0KREBcw/DCSE7Dj l71wwNyRHMAfuOVUuo2cs2Ta3vrN2a792mP2e8oYT+QpiDqQnKGf7ud5dCJ7yalvCKqx jOsaMPEHyJnI5KO7RVUYsUrKtpvsPpT6SCwD/qglAHo3Yf2joM5wzWyF83mhDGbr76IC chV0u67DptQGw8ahWM4fC24bCmTFzcDVLUOvHf5/gFdWWIIT2VH91voyezZGd0Cvvhy1 mkVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j22si34938255pfi.252.2019.01.29.12.41.43; Tue, 29 Jan 2019 12:41:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729007AbfA2UkA (ORCPT + 99 others); Tue, 29 Jan 2019 15:40:00 -0500 Received: from ale.deltatee.com ([207.54.116.67]:59960 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726945AbfA2UkA (ORCPT ); Tue, 29 Jan 2019 15:40:00 -0500 Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.89) (envelope-from ) id 1goaAh-0006hr-4u; Tue, 29 Jan 2019 13:39:51 -0700 To: Jason Gunthorpe , Jerome Glisse Cc: "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Greg Kroah-Hartman , "Rafael J . Wysocki" , Bjorn Helgaas , Christian Koenig , Felix Kuehling , "linux-pci@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , Christoph Hellwig , Marek Szyprowski , Robin Murphy , Joerg Roedel , "iommu@lists.linux-foundation.org" References: <20190129174728.6430-1-jglisse@redhat.com> <20190129174728.6430-4-jglisse@redhat.com> <20190129191120.GE3176@redhat.com> <20190129193250.GK10108@mellanox.com> From: Logan Gunthorpe Message-ID: <99c228c6-ef96-7594-cb43-78931966c75d@deltatee.com> Date: Tue, 29 Jan 2019 13:39:49 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190129193250.GK10108@mellanox.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-CA Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: iommu@lists.linux-foundation.org, jroedel@suse.de, robin.murphy@arm.com, m.szyprowski@samsung.com, hch@lst.de, dri-devel@lists.freedesktop.org, linux-pci@vger.kernel.org, Felix.Kuehling@amd.com, christian.koenig@amd.com, bhelgaas@google.com, rafael@kernel.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, jglisse@redhat.com, jgg@mellanox.com X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-8.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE autolearn=ham autolearn_force=no version=3.4.2 Subject: Re: [RFC PATCH 3/5] mm/vma: add support for peer to peer to device vma X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-01-29 12:32 p.m., Jason Gunthorpe wrote: > Jerome, I think it would be nice to have a helper scheme - I think the > simple case would be simple remapping of PCI BAR memory, so if we > could have, say something like: > > static const struct vm_operations_struct my_ops { > .p2p_map = p2p_ioremap_map_op, > .p2p_unmap = p2p_ioremap_unmap_op, > } > > struct ioremap_data { > [..] > } > > fops_mmap() { > vma->private_data = &driver_priv->ioremap_data; > return p2p_ioremap_device_memory(vma, exporting_device, [..]); > } This is roughly what I was expecting, except I don't see exactly what the p2p_map and p2p_unmap callbacks are for. The importing driver should see p2pdma/hmm struct pages and use the appropriate function to map them. It shouldn't be the responsibility of the exporting driver to implement the mapping. And I don't think we should have 'special' vma's for this (though we may need something to ensure we don't get mapping requests mixed with different types of pages...). I also figured there'd be a fault version of p2p_ioremap_device_memory() for when you are mapping P2P memory and you want to assign the pages lazily. Though, this can come later when someone wants to implement that. Logan