Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751308AbcLDNaO (ORCPT ); Sun, 4 Dec 2016 08:30:14 -0500 Received: from mail-db5eur01on0050.outbound.protection.outlook.com ([104.47.2.50]:17856 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750971AbcLDNaI (ORCPT ); Sun, 4 Dec 2016 08:30:08 -0500 Authentication-Results: spf=pass (sender IP is 193.47.165.134) smtp.mailfrom=mellanox.com; amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=pass action=none header.from=mellanox.com;amd.com; dkim=none (message not signed) header.d=none; X-IncomingTopHeaderMarker: OriginalChecksum:;UpperCasedChecksum:;SizeAsReceived:2616;Count:17 Subject: Re: Enabling peer to peer device transactions for PCIe devices To: Jason Gunthorpe References: <20161123215510.GA16311@obsidianresearch.com> <91d28749-bc64-622f-56a1-26c00e6b462a@deltatee.com> <20161124164249.GD20818@obsidianresearch.com> <3f2d2db3-fb75-2422-2a18-a8497fd5d70e@amd.com> <20161125193252.GC16504@obsidianresearch.com> <20161128165751.GB28381@obsidianresearch.com> <1480357179.19407.13.camel@mellanox.com> <20161128190244.GA21975@obsidianresearch.com> <20161130162353.GA24639@obsidianresearch.com> CC: "linux-kernel@vger.kernel.org" , "linux-rdma@vger.kernel.org" , "linux-nvdimm@ml01.01.org" , "christian.koenig@amd.com" , "Suravee.Suthikulpanit@amd.com" , "John.Bridgman@amd.com" , "Alexander.Deucher@amd.com" , "Linux-media@vger.kernel.org" , "dan.j.williams@intel.com" , "logang@deltatee.com" , "dri-devel@lists.freedesktop.org" , "Max Gurtovoy" , "linux-pci@vger.kernel.org" , "serguei.sagalovitch@amd.com" , "Paul.Blinzer@amd.com" , "Felix.Kuehling@amd.com" , "ben.sander@amd.com" From: Haggai Eran Message-ID: <3781848f-d4a0-69d3-678d-c5623bac3c10@mellanox.com> Date: Sun, 4 Dec 2016 09:53:26 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 MIME-Version: 1.0 In-Reply-To: <20161130162353.GA24639@obsidianresearch.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.0.52.254] X-IncomingHeaderCount: 17 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:193.47.165.134;IPV:NLI;CTRY:IL;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(199003)(377454003)(189002)(24454002)(93886004)(6916009)(2950100002)(23746002)(86362001)(31696002)(92566002)(7416002)(189998001)(33646002)(4001350100001)(65826007)(5660300001)(64126003)(50466002)(110136003)(305945005)(626004)(7736002)(65806001)(65956001)(47776003)(356003)(8666005)(7846002)(77096006)(39450400002)(229853002)(83506001)(31686004)(38730400001)(230700001)(39410400001)(81156014)(4326007)(106466001)(81166006)(8676002)(36756003)(76176999)(54356999)(2906002)(50986999)(6116002)(3846002)(8936002)(7059030)(3940600001);DIR:OUT;SFP:1101;SCL:1;SRVR:AM5PR0501MB2468;H:mtlcas13.mtl.com;FPR:;SPF:Pass;PTR:mail13.mellanox.com;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;AM1FFO11FD008;1:1msuicHj0N/2Z3kFiuImbJvSQLmNwefHoH8j9jJQ1HqGNWBGDPwa/FoaKAXpSll13iIa0OmhgEMYfDCa7SYFP+mQ2KVJ4B8xJ3wQFSfd304QjD9GDnoev2wQfzlYg8hyT0KRNCLqGVVt9ePr84SVax2ut1aSv0do9097wDhwCKSXXhEiLeObs+0xiygSyYawTjhVUBd28bhr8g4ReunUXMHMYxkScbIiuRQ7nKDwzwGpXGE+IbUiJ9xxfDXegN8QZP950fZ3QbtDICYXrdHkpFdCdKAv6GAG7XepPGwGPfRcn9ek8n4Jcn2TQh+DvbE4d+dg7OasrpakEBQBsQYQoR/wt/OAw+sXNu5Y8+ZN8NArH/ApQ7Y0ce5bLGy7QOofyMmRbS/M5IYes2MiVo/5THStLOiC8YmvPECHhVbMuxUzSy5NzOfa6mh8rnwD8TdapjYqI8M8BhngSJ/4vz00L1HG9LWcb2s2mAYuapbwBAO9Wgq013Mv4MxaRI8bCD1FMB55cKMgIWrgrGOrByRND9d2I3cWyJJOlBMbXZpQT8DWJ900uzl273PiikdKKX+xCxHzShDXb2tW8dRVGfFB6qX+1y9pv1TazlyPg+oyPPs= X-MS-Office365-Filtering-Correlation-Id: 2fa675dd-8078-48f3-5bfc-08d41c1aa428 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(8251501002);SRVR:AM5PR0501MB2468; X-Microsoft-Exchange-Diagnostics: 1;AM5PR0501MB2468;3:bFd6F07uvIJ/ctk5pGpvBSUY4Ip0k7W/GD5nhCjudIHK2ldK1h6ko9YiQuNqZKxUHWWD0vHGMvVwxKGAUGhjyCktTKPPxqSvww7Rm0md6yfTokFy6qJyNdndlFG2JCWK/5xuYhxBWJkcsrvCQYSAgOucvOyUiFcqul0S0ItMeIHSQdK6E0Tev5PKqhQNWb9G97T9/V8PB+lHCBVpp2d/K3i30eVWZPYH1veHonz87bWV1lYlMk6iPBf4FSzpZkSLQgziBWVOzofx2rsPnRmvgV9g1DP6sMqGJ8oM2g6S9iir/xmvti++7gZopScK0iiBFJZfPQqe4ZQdacK7xtQm+0p65Mn1RaVfMuZ7omptm0WzV3gayWdNtCcD0ZlL6HS2lCrNpPvXdXyy7SuCkfQceg==;25:6zHSx2m62KN5gin2rjzf7463yb/Sji93d1tqLGnmP6J6p/cFwElFlhNGq2KCU/mrH1aRxdrAlbfVsqaY690MfPd9I5qONnLa3AE60FJIUb6rXMWWOLR3/ckxhp21pc2/vfqaJgzLf5qlmvY5mnHlnD0JRt7q2iGVySp9tLhlooyD6XyYED2YI/ykm4STGySdzApUhmpRrrWIezEqU7uvas0WI8g+EC5EJd2SvQmQCqY+Uef/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ispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(13018025)(13016025)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(20161123558021)(6072148);SRVR:AM5PR0501MB2468;BCL:0;PCL:0;RULEID:;SRVR:AM5PR0501MB2468; X-Microsoft-Exchange-Diagnostics: 1;AM5PR0501MB2468;4:9+RU+7APBXTjanaB1nVn7l705pZqiuxJZJMJqytzVP0FjM58/3Z2ySydKQgpaKvt+9TDhYuhFT6xs8njtsRl8Pvsz/Uk6YLMOnUaInZA5tbfA7u+/1YHbyFKu9fJt5gzHNRKLi8t+b+98+aZTCbLynGFvH2DykHvuNTV6+OxY3+WrLcvUUa8SpmiR95lVIXjL23Q/37ysQy19vNyiDlFvKgIxZtsSs+S2/4l16WWcypY3lT6WmgmQ9W5d8ygjBB55PvJ5eQIum98g1L7Eb+wxZrtqBxpE9to3Ya/c0SnzqKC331/f7PAZxJwuiSZ3Bug8804ICkcrxtRMznOvrf3y5qHk0z8YFzMMrvuagoxXoB8tR/eD+3fQ9jtMyV0NuTmDF30OziPwR3bAMnrlPQ0At0QA6XBJPSHst5vyTqwgbBPWUUa09vgBkUPvITNmTsFQCyvfiht8qP3eBVKvWylIz9frZAfePVWlmOEPgACw6u6SEFLBfHEtGtrDckYvHGzrM3+3Oiju4msT239firHsPMn0b8SMuWAObzg7iMf2ErBF38AxeBUGhCu3b7zh2mck4/+IiXI26qiK3Y6Br6XC/mP2i+kY4VWlelJFl+zqr81mJ58GfEU+mxLbS/hfJZT4W0iQlnZY4dfoseEfl+jf5hzXzMrmNYJJ50b/5+WMMM= X-Forefront-PRVS: 014617085B X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;AM5PR0501MB2468;23:+Ah7fhHWsS7WADYih5iMnPby2W1uj4FiMFT?= =?Windows-1252?Q?lXVeJVlM2BtiRte4AwS9zLGFs2L9iPzBB6Sd8AHd6R/QclTA5BVeU+s5?= =?Windows-1252?Q?haT6Gf49lT/W6VZjhA3bMmbwXR7e2x5rMnXNGzQ0PaW3xvR4pkEmTYC3?= =?Windows-1252?Q?OZmH/RrT+OfAP/cahjtDChUUnUv9O+9GJDAmjlirRdP7L98noYf3ZM0x?= =?Windows-1252?Q?xbccJcOR7WlmvhDiKyrTZc6AFbFiC6RJB2KRS1jkfo4KcgOGJBfSGtRO?= =?Windows-1252?Q?SfDCoLSQnISfZQfOxRHgPluJVDHGnlihlWZawz8pZWOikw0G2yPAjzGV?= =?Windows-1252?Q?1hqJa9eelXbXZtdlOmmgUjJxDlK6RGzKvSrCqbN+PlWwziwEGsehSONt?= =?Windows-1252?Q?OrCOqo02jZZZTSbzzvOOH/6iHIu/pDN/NPwuM80T+q6kAYmxp4wz/RgL?= =?Windows-1252?Q?JZZTny2sbKazCyOAGlGiDCksslsVvoNn8mTb1w6umysT+GCu15jlJHwI?= =?Windows-1252?Q?Y5ktma5F+qEwnVdc0MZkeXi+DFPIi9nDhjAsYgmBcCBPuujyB1IFcwSs?= =?Windows-1252?Q?abeC8uDPjdnX09PtPd7DF8GqdrF3BnR5wpLV4WPzFORIYiM0VuvPSxhl?= =?Windows-1252?Q?j5/BSn5Y9XRSaPmGGkdo+V7NVEkex/G2k5DPIKo/QOSAOliITDxg3ox7?= =?Windows-1252?Q?Ne6uxJE35OZyhhkb59h4m5qodFn7t74GaRCGlid8JCAk+rsOhCtDpe3L?= =?Windows-1252?Q?xiK9wY23c1TzD3AN9m00KcKG99mKMjWslYYlnrNgDDq6WfOjBTbkQWdP?= =?Windows-1252?Q?UCBglVMuFYgG19UzfhTqCgqELLP2poDAvn8AxnoiwMXyWAH9g7DbPfax?= =?Windows-1252?Q?j1+XUo7tvqUGHgzvFPHzzh2HtFgCUyLqz089wvjHkLux9HnmqjelFfAB?= =?Windows-1252?Q?h7KqJSCPgwEXOQAiToQ4TEgHsW7Spn9Km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rTDl6SfEz6//QdfS64Uxo15TtKNVo;5:FnXtnSo25s5EIo94ygpx0VJfopYhSzAw2qJx40GfDKOcK7YTceHMwCXw8//FmR+Ndaw9EcRtqRRjxMXTmTcvIKV0nEmtFQxpFBm9j9R0UqjiyBrVkt6qqVa1lAxb4hiDktCIiazIMg3y5q7ecCIDeQ==;24:Y3BvfVLMl8VggVFd0twAtSTgn8KK8IS2lVbeliengxVHxOEbiQ/O3BRckhZF1uWrJn4HWqk06QdVnC5FbGeaz5Mweo66wqevCa3z6m+1mt0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;AM5PR0501MB2468;7:SSt3VeROT+l9v8ja5qz+p3oweMM+438sNa+TQXuelb3DM9Dy6pLSoOzP5fYSXE4WDYWm803BqqDjVJrUpjl4ef4uCaIQNxFo9cVVZlNNAaxMUdHvHBH8r/bNlPQ39mIi3CITTQA0XkKYhqeJQCCaxXKLxM+5o3db4dhsnxMAQs2qP5gWVGaKQqP3EuLYDmdeTFBh5IFdCALGx0nGurVEH88hdTLkXMmE0xBaHQ9q7PfLZ1e1gMhfcRMBTaqorGcqE9LOAEdMSmLzq1A6u+HkqP5KOylOjRepcggAzL9zxe3c9DosbwPqGPXzU0TQf7PpdnZLLSDYscJTU8sR++ROmoaEKOp/KlfIZ0QNbAted62OBVA58I+C1KEfqCPFlh5qaqfhJzCBKT2Xhr6ccEylyioqAqSiggkC/4KAXsdfGpM9D7JU6VZA3gZQNapyqOIHeIAeihyx01XuoZg11lax2g== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2016 07:53:31.3046 (UTC) X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a652971c-7d2e-4d9b-a6a4-d149256f461b;Ip=[193.47.165.134];Helo=[mtlcas13.mtl.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0501MB2468 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1416 Lines: 26 On 11/30/2016 6:23 PM, Jason Gunthorpe wrote: >> and O_DIRECT operations that access GPU memory. > This goes through user space so there is still a VMA.. > >> Also, HMM's migration between two GPUs could use peer to peer in the >> kernel, although that is intended to be handled by the GPU driver if >> I understand correctly. > Hum, presumably these migrations are VMA backed as well... I guess so. >>> Presumably in-kernel could use a vmap or something and the same basic >>> flow? >> I think we can achieve the kernel's needs with ZONE_DEVICE and DMA-API support >> for peer to peer. I'm not sure we need vmap. We need a way to have a scatterlist >> of MMIO pfns, and ZONE_DEVICE allows that. > Well, if there is no virtual map then we are back to how do you do > migrations and other things people seem to want to do on these > pages. Maybe the loose 'struct page' flow is not for those users. I was thinking that kernel use cases would disallow migration, similar to how non-ODP MRs would work. Either they are short-lived (like an O_DIRECT transfer) or they can be longed lived but non-migratable (like perhaps a CMB staging buffer). > But I think if you want kGPU or similar then you probably need vmaps > or something similar to represent the GPU pages in kernel memory. Right, although sometimes the GPU pages are simply inaccessible to the CPU. In any case, I haven't thought about kGPU as a use-case.