Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2822154imu; Thu, 29 Nov 2018 10:46:45 -0800 (PST) X-Google-Smtp-Source: AFSGD/WHaKEe4UXsaVexBlsSWQ7gPECJYZIeeso7gcsrVXnf2y0LGK8SelPASTp43iy0Xn6CRhoi X-Received: by 2002:a63:e915:: with SMTP id i21mr2121906pgh.409.1543517205154; Thu, 29 Nov 2018 10:46:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543517205; cv=none; d=google.com; s=arc-20160816; b=YcgqvKJ7TPe5CNKWHO+UGS1jqw39bAhXOxMuEMKcXqTfc0as7FcPnOPzLeH6LYLnCI JcCwMpVLZRNCqAvRszrgecOXuiW5umMNBTMln8HGPc3E+7Y/O9OTWKEv1kIsZuJE8AgF S5xYtJpBD1S+c1BQt65gDAXy6hjCsZ7sCTuRvDA89t/Ul8NpouzE3aZQTcfF8IvmTXwh ABfwMMAuEeHWqF6H1zRdckQbZroDeDRr9NNzrNbi11QdIduND/IdR30sQvymN24ax+lC 76dnnVo0ErGZ/o83bPYoWr0D0xObEYojdLmYKzevxsCn7RZ+sAgypVDZBOdjusxZu5Wt Xwqw== 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; bh=Wq6fUkOUhC0vcqIacqjt9Oi/pcpi7fjXOrGUS4vhluM=; b=hlfyZ/RdKqyLN5EtJLeV55nzUeaSnnjo9QPUflUAKkxt5kV39nzQUKacRStEgYY5WQ PR1byJ+xGIvNCr7K5Pil0SHUPeJO4mGSlSW5YURLDgUmBFjvVOvpHC2pa7FX7Og27qam 2CwLncsFOnrGtdJJwUb0C9ypcK5ZIahzRmwAIlKQ0a8IoKoCZRZtTj+MXPueB7CmJ0zA T3/xEpdqSYJ9xdbK0EjwojioYHZh6g0KKeLrXNkSvF/KIMgEGBhMq3fHrzmcVYeY15Oe dOWFRYEGw06Aa0okz3AVlWEftLNGcpcugBOVfmwaFd+guQI0xl/VYdRFGnD5FlBypRIk Dr+g== ARC-Authentication-Results: i=1; mx.google.com; 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 cf16si2941605plb.227.2018.11.29.10.46.30; Thu, 29 Nov 2018 10:46:45 -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; 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 S1728870AbeK3Fjy (ORCPT + 99 others); Fri, 30 Nov 2018 00:39:54 -0500 Received: from verein.lst.de ([213.95.11.211]:45492 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725928AbeK3Fjy (ORCPT ); Fri, 30 Nov 2018 00:39:54 -0500 Received: by newverein.lst.de (Postfix, from userid 2407) id 8723468BDF; Thu, 29 Nov 2018 19:33:34 +0100 (CET) Date: Thu, 29 Nov 2018 19:33:34 +0100 From: Christoph Hellwig To: Daniel Vetter Cc: Christoph Hellwig , "Clark, Rob" , Dave Airlie , linux-arm-msm , Linux Kernel Mailing List , dri-devel , Tomasz Figa , Sean Paul , vivek.gautam@codeaurora.org, freedreno , Robin Murphy Subject: Re: [PATCH v3 1/1] drm: msm: Replace dma_map_sg with dma_sync_sg* Message-ID: <20181129183334.GB30281@lst.de> References: <20181129140315.28476-1-vivek.gautam@codeaurora.org> <20181129141429.GA22638@lst.de> <20181129155758.GC26537@lst.de> <20181129162807.GL21184@phenom.ffwll.local> <20181129165715.GA27786@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 29, 2018 at 06:09:05PM +0100, Daniel Vetter wrote: > What kind of abuse do you expect? It could very well be that gpu folks > call that "standard use case" ... At least on x86 with the i915 driver > we pretty much rely on architectural guarantees for how cache flushes > work very much. Down to userspace doing the cache flushing for > mappings the kernel has set up. Mostly the usual bypasses of the DMA API because people know better (and with that I don't mean low-level IOMMU API users, but "creative" direct mappings). > > As for the buffer sharing: at least for the DMA API side I want to > > move the current buffer sharing users away from dma_alloc_coherent > > (and coherent dma_alloc_attrs users) and the remapping done in there > > required for non-coherent architectures. Instead I'd like to allocate > > plain old pages, and then just dma map them for each device separately, > > with DMA_ATTR_SKIP_CPU_SYNC passed for all but the first user to map > > or last user to unmap. On the iommu side it could probably work > > similar. > > I think this is what's often done. Except then there's also the issue > of how to get at the cma allocator if your device needs something > contiguous. There's a lot of that still going on in graphics/media. Being able to dip into CMA and mayb iommu coalescing if we want to get fancy is indeed the only reason for this API. If we just wanted to map pages we could already do that now with just a little bit of boilerplate code (and quite a few drivers do - just adding this new API will remove tons of code).