Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932327AbdDRTfl (ORCPT ); Tue, 18 Apr 2017 15:35:41 -0400 Received: from ale.deltatee.com ([207.54.116.67]:54330 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754240AbdDRTfj (ORCPT ); Tue, 18 Apr 2017 15:35:39 -0400 To: Jason Gunthorpe References: <1492381396.25766.43.camel@kernel.crashing.org> <20170418164557.GA7181@obsidianresearch.com> <20170418190138.GH7181@obsidianresearch.com> Cc: Benjamin Herrenschmidt , Dan Williams , Bjorn Helgaas , Christoph Hellwig , Sagi Grimberg , "James E.J. Bottomley" , "Martin K. Petersen" , Jens Axboe , Steve Wise , Stephen Bates , Max Gurtovoy , Keith Busch , linux-pci@vger.kernel.org, linux-scsi , linux-nvme@lists.infradead.org, linux-rdma@vger.kernel.org, linux-nvdimm , "linux-kernel@vger.kernel.org" , Jerome Glisse From: Logan Gunthorpe Message-ID: Date: Tue, 18 Apr 2017 13:35:32 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170418190138.GH7181@obsidianresearch.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.111 X-SA-Exim-Rcpt-To: jglisse@redhat.com, linux-kernel@vger.kernel.org, linux-nvdimm@ml01.01.org, linux-rdma@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, linux-pci@vger.kernel.org, keith.busch@intel.com, maxg@mellanox.com, sbates@raithlin.com, swise@opengridcomputing.com, axboe@kernel.dk, martin.petersen@oracle.com, jejb@linux.vnet.ibm.com, sagi@grimberg.me, hch@lst.de, helgaas@kernel.org, dan.j.williams@intel.com, benh@kernel.crashing.org, jgunthorpe@obsidianresearch.com X-SA-Exim-Mail-From: logang@deltatee.com Subject: Re: [RFC 0/8] Copy Offload with Peer-to-Peer PCI Memory X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1441 Lines: 30 On 18/04/17 01:01 PM, Jason Gunthorpe wrote: > Ultimately every dma_ops will need special code to support P2P with > the special hardware that ops is controlling, so it makes some sense > to start by pushing the check down there in the first place. This > advice is partially motivated by how dma_map_sg is just a small > wrapper around the function pointer call... Yes, I noticed this problem too and that makes sense. It just means every dma_ops will probably need to be modified to either support p2p pages or fail on them. Though, the only real difficulty there is that it will be a lot of work. > Where p2p_same_segment_map_page checks if the two devices are on the > 'same switch' and if so returns the address translated to match the > bus address programmed into the BAR or fails. We knows this case is > required to work by the PCI spec, so it makes sense to use it as the > first canned helper. I've also suggested that this check should probably be done (or perhaps duplicated) before we even get to the map stage. In the case of nvme-fabrics we'd probably want to let the user know when they try to configure it or at least fall back to allocating regular memory instead. It would be a difficult situation to have already copied a block of data from a NIC to p2p memory only to have it be deemed unmappable on the NVMe device it's destined for. (Or vice-versa.) This was another issue p2pmem was attempting to solve. Logan