Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933449AbcKYUtJ (ORCPT ); Fri, 25 Nov 2016 15:49:09 -0500 Received: from mail-co1nam03on0071.outbound.protection.outlook.com ([104.47.40.71]:25824 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932466AbcKYUs4 (ORCPT ); Fri, 25 Nov 2016 15:48:56 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Serguei.Sagalovitch@amd.com; Subject: Re: Enabling peer to peer device transactions for PCIe devices To: Felix Kuehling , Logan Gunthorpe , =?UTF-8?Q?Christian_K=c3=b6nig?= , Jason Gunthorpe , Dan Williams References: <75a1f44f-c495-7d1e-7e1c-17e89555edba@amd.com> <45c6e878-bece-7987-aee7-0e940044158c@deltatee.com> <20161123190515.GA12146@obsidianresearch.com> <7bc38037-b6ab-943f-59db-6280e16901ab@amd.com> <20161123193228.GC12146@obsidianresearch.com> <20161123203332.GA15062@obsidianresearch.com> <20161123215510.GA16311@obsidianresearch.com> <20161123232503.GA13965@obsidianresearch.com> <5e1de9ee-34f5-136d-a07e-f949d492864f@deltatee.com> <209107c7-3098-ca70-7d62-b55021d01faa@deltatee.com> CC: "Deucher, Alexander" , "linux-nvdimm@lists.01.org" , "linux-rdma@vger.kernel.org" , "linux-pci@vger.kernel.org" , "Bridgman, John" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Sander, Ben" , "Suthikulpanit, Suravee" , "Blinzer, Paul" , "Linux-media@vger.kernel.org" , Haggai Eran From: Serguei Sagalovitch Message-ID: <5d43c69b-84fd-f13a-711f-e10c9bb5b1d1@amd.com> Date: Fri, 25 Nov 2016 15:48:36 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.55.251] X-ClientProxiedBy: YQBPR01CA0046.CANPRD01.PROD.OUTLOOK.COM (10.169.139.14) To BY2PR12MB0693.namprd12.prod.outlook.com (10.163.113.158) X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB0693;2:9v8LQ1LqZd0Wg0mGOGbRRXQBBH8R60xKgJ8jowZnJ4D30bDKPrqsTzr1v1VPVABiVnSaYNLVraD+GE2Qqi/+QTUo5YqR/7p0HYtQAJGUZSnmNnL/CGuTf8cHi2xWZbGjy1eerUdmr9IWwIMZaGpslf/QIzvmTcuDySYxsJs6Rr8=;3:CSlB6gzuTFI/u0E4MaJyiBMIpEtZnUaBF/tfR4SvV/oO7ATrLMqRt7qtRC6DSF1/iReg0p5G4JIMia1l2B2EglP2kS0pVSf/IoWo9rQM5WeBHEuEdbbMuUrcyQPJ17xO2JZAStp/ZVY4r1nV2fjBMQjiCOa6rONIM/02c3GMikg= X-MS-Office365-Filtering-Correlation-Id: f9c61bdd-075c-46ae-fb28-08d415747791 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BY2PR12MB0693; X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB0693;25:KWM9TqYM7QsE3mBmskqClyo0OX9erERmU1x8qN0hLfNdmcR/E1OXdUnZJDZYDSMI3KazkFATXIib1v0BWFYyVdcTf6Wzs5QVu7qnRZ9Wf3gH14AthZy2ciZNZ6jfql+rJv70K0qZi/Efy/Acxy4F10VDaQxvbn0kmtLgjeHV5f07CK6fegSyOPGDx3C7kUnJJasafi7mu4gQmD4KtnlGG8EtfM0+ZS0QhaYzddCsIe3q/SXQExbcd/kpulYVIMXLmxqTVSY5h56yg3BLsBCKUbJoXmsonAlftAQ5HhPP/IO1GWc9eDfoBHQzrQWoLE7kZ2DuDfWjTd8BYyKUBiGMsCGHFbvq62sTj/zFfvXHYtol5wEtFwG1vCq3wRGtX4r4qKysXPNzhn8jJkao45wR0SN3EfBeSIENgZglJk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KdNkyteQxzjjQVTmZ8fFp4fPoo/pvsEwB2u8U6EkUkHhDqGTayDVs1+sT09Busjo5V5Y8ugwiexGZYRAxOOiHCc7/AEemnEo3TmWBBGeIe8hft7wTaPE2GXAsFN6YetpLONRCykEseahdByLTn1xb3WP+V3kbu8iPOL3lwc+ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6060326)(6045199)(6040361)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6061324)(6041248)(20161123560025)(20161123555025)(20161123562025)(20161123564025);SRVR:BY2PR12MB0693;BCL:0;PCL:0;RULEID:;SRVR:BY2PR12MB0693; X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB0693;4:eN4t/J6cKvf6wKB+RbBur0j09sddrHsIZeaGPWneD8p0pxXy6sWJ+HlJ52bckP808JbuUBrml9sivIj1PJiuaKXzjKvQ7ySbc81ceIoTwZL0IZFRBk6vWUlCEmt/Lt/cWido8Xn00i8wrvldemjgJhi4zH1vL81CPIsbKkl1YVWl3d7eg/RKbV+Mdm+UvRqDk/Dh88Wk9RoickCEYNUR43w6D9V7yfk4xjTLMEADVw3Z39GPR2INQO6WVMS9lN7DfzrIi155usuSRDdfSymQ9yZofeB5K+8aVSohlI5VmBcR44T/xNpfTkl176jACABbC/j0IBD7yjmwq0UH2Yo51tD/siRuYRHXCUxs9YxnagNkM7LR9lidYvW5WbWAeXed9nmSzlkScx1/TxmpQOlreIIgi3xNdWa1gfl7r6vaWQqF/9S2JI477namGTw5P2YOs+69dCwPD+3uxon1ezZy1WRpl/Dm1Zk0qTjZzUV7eJeCK5YxGGbxzPmwyo2gZO/lXAj8SvkV1Pe2mv8J+5WuPlK8TfEEaZg1GnLhG/zH7y814PvAa4jHeDig/uG9TCmI6hdv+lYTT8u8JaqOgrCVU7OZ7195vWYOOLLRZgjaWGfZx82oH+A4EH/khn/CUtCM X-Forefront-PRVS: 01371B902F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(6049001)(7916002)(189002)(24454002)(199003)(377424004)(377454003)(106356001)(105586002)(42186005)(31686004)(83506001)(2906002)(5001770100001)(39450400002)(97736004)(39380400001)(39410400001)(39400400001)(65806001)(65956001)(4001150100001)(68736007)(66066001)(733004)(4001350100001)(23746002)(92566002)(8676002)(81156014)(81166006)(230700001)(47776003)(4326007)(86362001)(31696002)(2950100002)(305945005)(6666003)(7416002)(229853002)(93886004)(38730400001)(33646002)(50466002)(189998001)(65826007)(36756003)(54356999)(76176999)(5660300001)(3846002)(50986999)(101416001)(7846002)(6116002)(64126003)(7736002)(77096006);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR12MB0693;H:[172.27.224.67];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;BY2PR12MB0693;23:sdpeCUDJBd9mYPWS+PdZnMIA+u3aQ0VDWQ06z?= =?Windows-1252?Q?REy31ua6Q+vjaV9F8E4j+hMnBv4lphknB0sb8aK7fGI/jvWcYVwwrkkW?= =?Windows-1252?Q?tnYokxqzzBC+foAUyipPazGygoWQAVKKA7voOH643MjcbLt3FIOgLH4m?= =?Windows-1252?Q?/hkEUC8MuZ+mv2gg9Uw0Qvi7blmnI0IzE/1s5uwNtzmw6M6lxGETi+Nv?= =?Windows-1252?Q?l5TQlJS3hjmdDDaUfaSv3XNhKX9DiuBRA31hUvKYAHUMFnoQd6GfapG+?= =?Windows-1252?Q?VxRdHBVftY2K0mPG7MzapF1VVHnwtH6AKP+XkvkDF4EVWGX2Jneh15MX?= =?Windows-1252?Q?M+F78C7ARordTALSIAzjLq7cR6NYC9oJdPtwA7uwg8J6vC7sL2o4CW7u?= =?Windows-1252?Q?mE+ThJEHlPlqEX/iWk64ODwWNBDOjY09eflaBj/guMxLHZb5Kpr10wRN?= =?Windows-1252?Q?h5ak/tpVo4+PoL8f2nywd/6hPS70VUms8VouXVa8DskaIJcBfLQrvqvz?= =?Windows-1252?Q?ievDPGz+jKrFESWYnD8lQsxGjO70aQV6fB2TwFM3KCWybWl6n7gTCbKf?= =?Windows-1252?Q?rGEn0eukEdUYMR6taWM4ie2At5enZYr253Sc99sGiUZp1AbPvXDZLahV?= =?Windows-1252?Q?bgvHiUbUwBLDrFb4jWYU4aaoop+1fOP8mOreBe7VzQ0u6KB0NlXlO/KW?= =?Windows-1252?Q?0jhLCon4QQZNw9sOtQNSAwsH/7eIkTSSePUKvMKcM66zwI/NlRg898C0?= =?Windows-1252?Q?3HJoqACQGeU6ZuRSYd+UCL/MTyrVueGisiGvRWm8qZXULCbB2jbKc67K?= =?Windows-1252?Q?aeY6EwJ7kEQFsd6l6miHlocxgIKAJ4YJ5sDWgXm1M43QJb5AkrCmuYhj?= =?Windows-1252?Q?RM8V8z2pdkb70n3J4a9epqiEwY5dtC56Yt27NQIwGXLY0QeekE3DgirB?= =?Windows-1252?Q?H2Jnx1asKKULeNg5kmQPsJXGdzRfYypNcz/rqHp1Nay0K8M/sCkeAdOM?= =?Windows-1252?Q?ABUpiZ2iHy2wxTQU6AzkseeQn8a1huRMxi3zYKhSi8gWezMvChTHafqY?= =?Windows-1252?Q?7HpSS15XhVAU+QAHb4zmwLEexfn8Ct/nF7tEGNIJml8aFG2BXjFJKuN2?= =?Windows-1252?Q?JlwbI53kNrpeq8dBrOc8yXaGkE7ZYUryto7ZkxehNHqINI27Af1DtdNm?= =?Windows-1252?Q?fvhi2Mil2HkcCqxGC/CRhTLZqxjwJ3Z66qP9Wbd+vLO9/3jTUHJc8zkC?= =?Windows-1252?Q?+NyX5r+PSYql+xElkZoG3/ASmVnqaaeu2rsVkN3lWj5iF8rxjhgxWj1M?= =?Windows-1252?Q?y0fDB13QXOKo8+NWha1hFgi6k0ISn6DKhhBrXQZNmAC67sJpedtjxthB?= =?Windows-1252?Q?8napeI3LnH0nPbS3eIhc4RV6Qbc2KjR8Y3gzIQp+uW7rRhprwXQ+EUp3?= =?Windows-1252?Q?GWoTItnYSucqMqvnqPHWM1Rlg7Huh25/3I954S4VjcTU0pYPnH43JDJx?= =?Windows-1252?Q?xZrPAqECxgmCkwiXr7WBsfWPfqzC3OynDEicKcvbE+OzaVYcLdwylM4P?= =?Windows-1252?Q?tJ6gmak6Hgn1IFKU3HBlrrp2lNcczzs3uAOf5eb7M8LaAggSEAam+R85?= =?Windows-1252?Q?gK8sy1aZ+DIisg7bM7wTVZXvUzdYcb+e2OS1ip+P7MN?= X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB0693;6:uNRgvgyGXIhLieZiqjvcV+MIHGD+UFELapjZieFzgt7c5RZySpug/X0wNQqHrzpcEVYsBhAS5vSxgTBw+awZmNor54pD9SVNEcl6gJqh4ugxeU0rXcIPYkTPSKslJurvyiTUf9bDKAp1NnmqqksJbi3GQbzuaxjARm3IEqPqCuxkELLIhX7jiIr/5Nvv5jL00aBdd50wC+FQbDXvbIeOMayMPeRDzb/dZQm12gLLE+8UubNQ7tmjFrLpZiRDHHFqSwQo5bf40TlELxuBJAOzwxDrB2mlapKFECMPyhfVHZBvrub/qsQrQTaiSTHPra7EpamUljScW2sYjUm2zPOR0pb7zYjhsFFKwDIlSJACHxcU8POsO8D6D8hzB/8BwimS;5:rBR0BzY9zXIFJ6t3uGNGYrJIBd+5aS6pANH7E3j106HOakYHq0+gEo+JAOHtEE+P5p62Of90Om0uwTlfnq+LQbPzuJ69eoWWrEYdtEk8kKXq/P1d80fr3hHq7L2NpLDOs/dAZUbCK+hYTkdIltySCMJrhbnzC2AdFJwQpJzNF7M=;24:2j+QLsJmo3zaSUOlZLDLeZSA6E3bSpjadQwkd6dXaSsLroE+m+rxgTkslHKnMiQrItCPW6pg7mkHHW0ChRvXeBSzCmLjCLc+0hfXOKcHl+E= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BY2PR12MB0693;7:Z9+Tzkgs7Lh45O4KQrRpFZ0G1wGU3kbAIs/LsJfmo0MBAUCjQe3bdxYt70Ma/Kwd5roBRVAV1jG3t7Cw/wQ9NSsw56fL2aGFKeCWiEu5dQpY/LLEevcw+/hiyNIdEh3BhcYKhEt8rgvK6omhZhT/4K8ECEmXFnaV626jL+oXtb3paz/8QRL1EbG/gjpHvfNR3wcylDbgXrRKOILn7onpynrx8LYHMGClnGGMDEzJ/sCQ5WtqtpVVz4qr4L9mtDm+iox2+iojkzyA+ZKuohht0IlPzKg4MyqH+ThKOLpzwQU2XKDSD6BSfY4qVyyBDWvk2G9pZcVlrzZYdNm869EPNNo9/heY0dNjOppuZVnMYSA=;20:BykxAefdJVlC/vL3O2g1hTLnMe6kxKYPhy0rvnw+CYw0eLNReXQtUxJMiTOTjZ9KAJ7/XCVD5juL5lPNoMRmL2YNobdbn5dR+4fhrv6A91DA60OU6pR1h9l/8odRLe9PyBEDgEDYNj17rOuO0fhGBDxMa0mpgP2nLtq/LZ1RoDy9f8elsSBykfpb0SgHlevJ8U8yFHyOXeYcn56XPDc0to1z494W9B4mZ7RWvqC/Eb2QApnRgEi7N7fR/Ot6sgAh X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Nov 2016 20:48:48.6200 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR12MB0693 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2147 Lines: 45 On 2016-11-25 03:26 PM, Felix Kuehling wrote: > On 16-11-25 12:20 PM, Serguei Sagalovitch wrote: >>> A white list may end up being rather complicated if it has to cover >>> different CPU generations and system architectures. I feel this is a >>> decision user space could easily make. >>> >>> Logan >> I agreed that it is better to leave up to user space to check what is >> working >> and what is not. I found that write is practically always working but >> read very >> often not. Also sometimes system BIOS update could fix the issue. >> > But is user mode always aware that P2P is going on or even possible? For > example you may have a library reading a buffer from a file, but it > doesn't necessarily know where that buffer is located (system memory, > VRAM, ...) and it may not know what kind of the device the file is on > (SATA drive, NVMe SSD, ...). The library will never know if all it gets > is a pointer and a file descriptor. > > The library ends up calling a read system call. Then it would be up to > the kernel to figure out the most efficient way to read the buffer from > the file. If supported, it could use P2P between a GPU and NVMe where > the NVMe device performs a DMA write to VRAM. > > If you put the burden of figuring out the P2P details on user mode code, > I think it will severely limit the use cases that actually take > advantage of it. You also risk a bunch of different implementations that > get it wrong half the time on half the systems out there. > > Regards, > Felix > > I agreed in theory with you but I must admit that I do not know how kernel could effectively collect all informations without running pretty complicated tests each time on boot-up (if any configuration changed including BIOS settings) and on pnp events. Also for efficient way kernel needs to know performance results (and it could also depends on clock / power mode) for read/write of each pair devices, for double-buffering it needs to know / detect on which NUMA node to allocate, etc. etc. Also device could be fully configured only on the first request for access so it may be needed to change initialization sequences.