Received: by 10.192.165.148 with SMTP id m20csp313674imm; Tue, 24 Apr 2018 23:13:38 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+iTYs6PX4HdUYI0FzsdKbBilDsE7hKYj5J337YCbxfJekiteVffSaDdpi1ASKz0dq52Yd6 X-Received: by 2002:a17:902:144:: with SMTP id 62-v6mr27923977plb.202.1524636818554; Tue, 24 Apr 2018 23:13:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524636818; cv=none; d=google.com; s=arc-20160816; b=uvQ6KZDS5hEkMZoVdWGeM/25GZmXi9csr6EsJ/tZn5s70WN8FhqvFgcaaTUoPMzSNk sU6bWioz+oCZiXZ+tUXjCfpCr/4gFhZbLkyp32xWwbuMRxF+c041SlVtVhb/UZxmL/dr Nu2lGLYt+5yl+oeyYX55p+QdbabA3ipS1RRkaPuq6FYPN+86IO43/hBomzUANL2geTFK y4j6eiMh4+TET9YMBkJIJJL7M7dJJ7BHhXe40ARqnKzjLyTKF2Gp+WAzvqhMcQOpYX8F +6MlHGZncH07pla+nnrfWGYGqyn8RMZbw8pEvorr6wqKDLcnBLMxxoxfXnoCTl/4KBeF WDXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=Sl2L8JeDwL4gZcshhXpsasqT0JcmcIanazSM5TeRUA0=; b=h/TuY1hy8hRLgHc+RFchdCs4ff9YEQ1D7cGyBCbftv4ARuoTB48JdkmEUmS9Xvvis0 lKbQehLYrarA2/ntcDWtk8BqP+axok2uw0rj89z+O2z+fxOh3GfjVw3iirpEsJOS07K9 UjyDvcC9Z+UvfF8QgUzgr776foJXL2TObEdv89icpi2IFn3puYQRw4omjJgoYwSAzo8A A2TXcwUsCxL95B54S02oL+3hgdPzen9yelZhE5fRVIf6YR7WDzfPET/9UddsS7BNT94t 7yFpAqtLWIWUvuL8JUfF4ubeGkkRGMTL3Q2L+pyWAD+/HHS78Q0TcmR8OInH/2L7/DAv hVUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JT9m+p4O; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x1si12605849pgp.89.2018.04.24.23.13.23; Tue, 24 Apr 2018 23:13:38 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=JT9m+p4O; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751300AbeDYGLD (ORCPT + 99 others); Wed, 25 Apr 2018 02:11:03 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:38120 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750882AbeDYGLC (ORCPT ); Wed, 25 Apr 2018 02:11:02 -0400 Received: by mail-wr0-f195.google.com with SMTP id h3-v6so52104172wrh.5; Tue, 24 Apr 2018 23:11:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Sl2L8JeDwL4gZcshhXpsasqT0JcmcIanazSM5TeRUA0=; b=JT9m+p4Oqd8kN3iLSgp6DWlwY59LqATh3zsR72mlAN9avbd9/QaPyPq7FMBeq21BTr BLmWzncm3KDaFvw72X9reSVnesRdkCRdvTe6gVV3q8BNdDnKruNBkdZLIdil9B0z5GKJ 99GpcBtIgyaZq+p9E9jbiGLB6QGfERHitsX6L/6FU6F/1Q4VX4rLiKzyRY95ydbXHew7 Hs60BVp0JeuYeBGvC4ZuKxSC5wKuraOdSFcUAndyX/J4KaBF5bQjY8dVMAG/XGyxjXd/ mlJPpFPLiWQh0S77EnW4SsemYy5nA5uKLb3FgntPp6iWtzeaTP5SvyPYq0G/4hVprO+q 5QrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Sl2L8JeDwL4gZcshhXpsasqT0JcmcIanazSM5TeRUA0=; b=eYV8CeHXdWNU1SnFPLiz0g8VCIZgQRIeQd/79ZZQNvI/VFFNmhbV3OOAmvWB72aWyv 6ZbojcphykEywjmqsMSe0/GJdYcYi9hyEujgHtb7FSAVfAanA4fHI0sxv2kYdg7X9EKR LoeCIuiroIBnSgw+L5eWtzlFLhuIWhv1Kg62BXka20Nh9rXazmlRPhJR1KYqn+ECQShl tIwKB5REoWTmK+cAJsH1tgWKhaDhoANKjrEwNff448HARCjSUbdG6sesG7DUONLeqxY2 FGNL7fnPXGXmQONema8xuNleaGAahJPo0Bfvm8zbPdseB8qEkfHgi+vcyAhb0OmA+0Kr LBIQ== X-Gm-Message-State: ALQs6tBeDZrPO2V1CpP2B67xPLrs+ZDOKyqDHNmvr5QWQZrhoWOWlbYx T+j7iwU9at715vtQUK/IMXrnwgMSD3655meRX4s= X-Received: by 2002:adf:972c:: with SMTP id r41-v6mr22993716wrb.79.1524636660488; Tue, 24 Apr 2018 23:11:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.175.76 with HTTP; Tue, 24 Apr 2018 23:10:59 -0700 (PDT) In-Reply-To: <20180425054855.GA17038@infradead.org> References: <20180419081657.GA16735@infradead.org> <20180420071312.GF31310@phenom.ffwll.local> <3e17afc5-7d6c-5795-07bd-f23e34cf8d4b@gmail.com> <20180420101755.GA11400@infradead.org> <20180420124625.GA31078@infradead.org> <20180420152111.GR31310@phenom.ffwll.local> <20180424184847.GA3247@infradead.org> <20180425054855.GA17038@infradead.org> From: Alex Deucher Date: Wed, 25 Apr 2018 02:10:59 -0400 Message-ID: Subject: Re: [Linaro-mm-sig] [PATCH 4/8] dma-buf: add peer2peer flag To: Christoph Hellwig Cc: Daniel Vetter , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Linux Kernel Mailing List , amd-gfx list , Jerome Glisse , dri-devel , Dan Williams , Logan Gunthorpe , =?UTF-8?Q?Christian_K=C3=B6nig?= , "open list:DMA BUFFER SHARING FRAMEWORK" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 25, 2018 at 1:48 AM, Christoph Hellwig wrot= e: > On Tue, Apr 24, 2018 at 09:32:20PM +0200, Daniel Vetter wrote: >> Out of curiosity, how much virtual flushing stuff is there still out >> there? At least in drm we've pretty much ignore this, and seem to be >> getting away without a huge uproar (at least from driver developers >> and users, core folks are less amused about that). > > As I've just been wading through the code, the following architectures > have non-coherent dma that flushes by virtual address for at least some > platforms: > > - arm [1], arm64, hexagon, nds32, nios2, parisc, sh, xtensa, mips, > powerpc > > These have non-coherent dma ops that flush by physical address: > > - arc, arm [1], c6x, m68k, microblaze, openrisc, sparc > > And these do not have non-coherent dma ops at all: > > - alpha, h8300, riscv, unicore32, x86 > > [1] arm =D1=95eems to do both virtually and physically based ops, further > audit needed. > > Note that using virtual addresses in the cache flushing interface > doesn't mean that the cache actually is virtually indexed, but it at > least allows for the possibility. > >> > I think the most important thing about such a buffer object is that >> > it can distinguish the underlying mapping types. While >> > dma_alloc_coherent, dma_alloc_attrs with DMA_ATTR_NON_CONSISTENT, >> > dma_map_page/dma_map_single/dma_map_sg and dma_map_resource all give >> > back a dma_addr_t they are in now way interchangable. And trying to >> > stuff them all into a structure like struct scatterlist that has >> > no indication what kind of mapping you are dealing with is just >> > asking for trouble. >> >> Well the idea was to have 1 interface to allow all drivers to share >> buffers with anything else, no matter how exactly they're allocated. > > Isn't that interface supposed to be dmabuf? Currently dma_map leaks > a scatterlist through the sg_table in dma_buf_map_attachment / > ->map_dma_buf, but looking at a few of the callers it seems like they > really do not even want a scatterlist to start with, but check that > is contains a physically contiguous range first. So kicking the > scatterlist our there will probably improve the interface in general. > >> dma-buf has all the functions for flushing, so you can have coherent >> mappings, non-coherent mappings and pretty much anything else. Or well >> could, because in practice people hack up layering violations until it >> works for the 2-3 drivers they care about. On top of that there's the >> small issue that x86 insists that dma is coherent (and that's true for >> most devices, including v4l drivers you might want to share stuff >> with), and gpus really, really really do want to make almost >> everything incoherent. > > How do discrete GPUs manage to be incoherent when attached over PCIe? They can do CPU cache snooped (coherent) or non-snooped (incoherent) DMA. Also for things like APUs, they show up as a PCIe device, but that actual GPU core is part of the same die as the CPU and they have their own special paths to memory, etc. The fact that they show up as PCIe devices is mostly for enumeration purposes. Alex > _______________________________________________ > Linaro-mm-sig mailing list > Linaro-mm-sig@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/linaro-mm-sig