Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756939AbcKWRNN (ORCPT ); Wed, 23 Nov 2016 12:13:13 -0500 Received: from ale.deltatee.com ([207.54.116.67]:35216 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751895AbcKWRNJ (ORCPT ); Wed, 23 Nov 2016 12:13:09 -0500 To: Serguei Sagalovitch , Dan Williams , "Deucher, Alexander" References: <75a1f44f-c495-7d1e-7e1c-17e89555edba@amd.com> Cc: "linux-nvdimm@lists.01.org" , "linux-rdma@vger.kernel.org" , "linux-pci@vger.kernel.org" , "Kuehling, Felix" , "Bridgman, John" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Koenig, Christian" , "Sander, Ben" , "Suthikulpanit, Suravee" , "Blinzer, Paul" , "Linux-media@vger.kernel.org" From: Logan Gunthorpe Message-ID: <45c6e878-bece-7987-aee7-0e940044158c@deltatee.com> Date: Wed, 23 Nov 2016 10:13:03 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 In-Reply-To: <75a1f44f-c495-7d1e-7e1c-17e89555edba@amd.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: Linux-media@vger.kernel.org, Paul.Blinzer@amd.com, Suravee.Suthikulpanit@amd.com, ben.sander@amd.com, Christian.Koenig@amd.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, John.Bridgman@amd.com, Felix.Kuehling@amd.com, linux-pci@vger.kernel.org, linux-rdma@vger.kernel.org, linux-nvdimm@lists.01.org, Alexander.Deucher@amd.com, dan.j.williams@intel.com, serguei.sagalovitch@amd.com X-SA-Exim-Mail-From: logang@deltatee.com Subject: Re: Enabling peer to peer device transactions for PCIe devices 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: 1529 Lines: 30 Hey, On 22/11/16 11:59 AM, Serguei Sagalovitch wrote: > - How well we will be able to handle case when we need to "move"/"evict" > memory/data to the new location so CPU pointer should point to the > new physical location/address > (and may be not in PCI device memory at all)? IMO any memory that has been registered for a P2P transaction should be locked from being evicted. So if there's a get_user_pages call it needs to be pinned until the put_page. The main issue being with the RDMA case: handling an eviction when a chunk of memory has been registered as an MR would be very tricky. The MR may be relied upon by another host and the kernel would have to inform user-space the MR was invalid then user-space would have to tell the remote application. This seems like a lot of burden to place on applications and may be subject to timing issues. Either that or all RDMA applications need to be written with the assumption that their target memory could go away at any time. More generally, if you tell one PCI device to do a DMA transfer to another PCI device's BAR space, and the target memory gets evicted then DMA transaction needs to be aborted which means every driver doing the transfer would need special support for this. If the memory can be relied on to not be evicted than existing drivers should work unmodified (ie O_DIRECT to/from an NVMe card would just work). I feel the better approach is to pin memory subject to P2P transactions as is typically done with DMA transfers to main memory. Logan