Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1230405imu; Wed, 16 Jan 2019 15:16:14 -0800 (PST) X-Google-Smtp-Source: ALg8bN4G17ucdjkHvmIXuh0Z7i20/pHO+QyUs12U072j8KvVUaNe2mjhga7pXKFcoASwmc8qVkcP X-Received: by 2002:a62:36c1:: with SMTP id d184mr12465488pfa.242.1547680574871; Wed, 16 Jan 2019 15:16:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547680574; cv=none; d=google.com; s=arc-20160816; b=I7aGs7i4h0ei6nCUoX95Q6/S0F7KfVHGhp/RtE/0dvakKnDTLSCxuYhbcS7nRCSR7r Dqr2a6NH6QZ6mlqDn6xZwHZ0wqdk0c7BjCAOv+ktotF3JIWUMdvGiNw4MaDzNCWszOUm 3eVo4hBl5+FShIvSvK4SX4unbCqEG07cQn+docsSHyWjrZVG1owb0ECDZlbdHo2KJmZ/ EFTtjF3wsdRvkcTU+SRyUeMJc8z80DyRDFZIzU8wRsCMpnV2YR1iZgfX9M+defEUlmH3 g6VA387+BiN8bWLrrZ0Fs2rtNX+etw2yWvA2sQTrYQRoX9KxFnR3TpAdgDWC7d7Et1ou h0rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=53gplsLprQpA+D4at2sEDjQat4FsTNpx+lEgkZg6Hko=; b=WbpCQVvpP6plu0Ed0zlap5Rr1WaT5gz6xZzJEXdB5BPkAEDCKA5Z9iIRyTwztefLx7 rf5QSuUAZXf8efsqztSu7VHCfprmioQ/5/RWi4z3q2XD6xhEAT1t3erg7xWQ093bAzb2 LSJNzfJQFBd9uQE8CFgCcMitgN53Sv59ICRyrSFeqxFthOIxUO6HbyZ0fc9SS+yDazWn 5JxSD1yyJkHLMNWkyKXCwBb9BV3bUBvtfElWEOWkWWP5vTH+YiMNQH+laNkzoZu/tndH ZHs1xa8nN7qEpvxMFjcCfbfdDNNfpcmCXQ9w6M31Wiu8Cje1jpH+su4UWlqmNpNOROnA m4bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=pYcm+5gD; 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 d23si7351784pgj.558.2019.01.16.15.15.56; Wed, 16 Jan 2019 15:16:14 -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; dkim=pass header.i=@ziepe.ca header.s=google header.b=pYcm+5gD; 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 S2391422AbfAPRYk (ORCPT + 99 others); Wed, 16 Jan 2019 12:24:40 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:45931 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387882AbfAPRYj (ORCPT ); Wed, 16 Jan 2019 12:24:39 -0500 Received: by mail-pf1-f195.google.com with SMTP id g62so3356041pfd.12 for ; Wed, 16 Jan 2019 09:24:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=53gplsLprQpA+D4at2sEDjQat4FsTNpx+lEgkZg6Hko=; b=pYcm+5gDO//dME8UYshYttaRSQbppOmTnxOtK3irYkbYq4HF6N30GVBGvACX8uQzm3 RRCF9H+Ix0roK7DxoD+3LgYpWl2+9L1IWt65bd1SkiWZcVKWXh3OL7O2EndEq5i/REmn h2/QZ/jQDFgafaNFt24hb7+X5JxAuiE0EQl0fn9VvS3zSNtnVytUUGxlq/JXYejZNsgf 1hVjv7D2CdU6NMoKss7DdBP5iHevRZpzl36NrPC5H8mKwNcsgbz+GK6y2fGMZMpch9Dd KL8jBL8auVJQR4Ome4TP/NB810uOMkM4K9SnOO5BKhK5ChjivI3rWhg80733Xf31tcQO 5dnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=53gplsLprQpA+D4at2sEDjQat4FsTNpx+lEgkZg6Hko=; b=S4c05s+S8LD9jmaH8IQYiVpmg2ET7fizxEvM+lGGAAnywEPW4XepKO27GNxukNi6c0 wUtdRglqUOINxw0Lh+J1Elubvmm6yJvy0JArP0uAqlp3folviNS7l316gAeElwC9s/yA 9VPWaKQzHjxdteRVtpidOdDMdcK6pwvkHSz4RFGLZmITMqDDRSsbm0UPj+klf/+im0kq HtXQaTNXGZQLDS2dQcY7QVkcPifNRamdpTULT8mF5DgTydEVWVjqQE4ecnRq2cQu2zhu aPgUvaypVS/usbf5jtwVyreRCE6fDdtBOxJfOzDf4vIt04nI4Q7uk9u5Qg6Ucna4d0Rv geGQ== X-Gm-Message-State: AJcUukc9XEzEveqHbmB0SUt8sfKhI7RGtn56t3PxA9N020T6b3VP/l9P SuBMDUi4X/ZesgMAhbujvUBMRQ== X-Received: by 2002:a62:1b50:: with SMTP id b77mr10920234pfb.36.1547659477846; Wed, 16 Jan 2019 09:24:37 -0800 (PST) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id e23sm9459511pfh.68.2019.01.16.09.24.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Jan 2019 09:24:36 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1gjovc-0001KE-2A; Wed, 16 Jan 2019 10:24:36 -0700 Date: Wed, 16 Jan 2019 10:24:36 -0700 From: Jason Gunthorpe To: "hch@lst.de" Cc: Thomas Hellstrom , "linux-kernel@vger.kernel.org" , "yong.zhi@intel.com" , "daniel.vetter@ffwll.ch" , "linux-rdma@vger.kernel.org" , "syeh@vmware.com" , "linux-media@vger.kernel.org" , "bingbu.cao@intel.com" , "imre.deak@intel.com" , "tian.shu.qiu@intel.com" , "jian.xu.zheng@intel.com" , "shiraz.saleem@intel.com" , "sakari.ailus@linux.intel.com" , "dri-devel@lists.freedesktop.org" Subject: Re: [PATCH] lib/scatterlist: Provide a DMA page iterator Message-ID: <20190116172436.GM22045@ziepe.ca> References: <20190104223531.GA1705@ziepe.ca> <20190110234218.GM6890@ziepe.ca> <20190114094856.GB29604@lst.de> <1fb20ab4b171b281e9994b6c55734c120958530b.camel@vmware.com> <20190115212501.GE22045@ziepe.ca> <20190116161134.GA29041@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190116161134.GA29041@lst.de> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 16, 2019 at 05:11:34PM +0100, hch@lst.de wrote: > On Tue, Jan 15, 2019 at 02:25:01PM -0700, Jason Gunthorpe wrote: > > RDMA needs something similar as well, in this case drivers take a > > struct page * from get_user_pages() and need to have the DMA map fail > > if the platform can't DMA map in a way that does not require any > > additional DMA API calls to ensure coherence. (think Userspace RDMA > > MR's) > > Any time you dma map pages you need to do further DMA API calls to > ensure coherent, that is the way it is implemented. These calls > just happen to be no-ops sometimes. > > > Today we just do the normal DMA map and when it randomly doesn't work > > and corrupts data tell those people their platforms don't support RDMA > > - it would be nice to have a safer API base solution.. > > Now that all these drivers are consolidated in rdma-core you can fix > the code to actually do the right thing. It isn't that userspace DMA > coherent is any harder than in-kernel DMA coherenence. It just is > that no one bothered to do it properly. If I recall we actually can't.. libverbs presents an API to the user that does not consider this possibility. ie consider post_recv - the driver has no idea what user buffers received data and can't possibly flush them transparently. The user would have to call some special DMA syncing API, which we don't have. It is the same reason the kernel API makes the ULP handle dma sync, not the driver. The fact is there is 0 industry interest in using RDMA on platforms that can't do HW DMA cache coherency - the kernel syscalls required to do the cache flushing on the IO path would just destroy performance to the point of making RDMA pointless. Better to use netdev on those platforms. VFIO is in a similar boat. Their user API can't handle cache syncing either, so they would use the same API too. .. and the GPU-compute systems (ie OpenCL/CUDA) are like verbs, they were never designed with incoherent DMA in mind, and don't have the API design to support it. The reality is that *all* the subsytems doing DMA kernel bypass are ignoring the DMA mapping rules, I think we should support this better, and just accept that user space DMA will not be using syncing. Block access in cases when this is required, otherwise let it work as is today. Jason