Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9205470ybi; Tue, 23 Jul 2019 23:56:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMxRVX1V8sOmdONZmSCV+i0DKkBZXxEq0ZBbolElcwhTm9opGVn7Jg33KMV1z3thgojtST X-Received: by 2002:aa7:8e18:: with SMTP id c24mr9804220pfr.24.1563951399649; Tue, 23 Jul 2019 23:56:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563951399; cv=none; d=google.com; s=arc-20160816; b=Sdr/mgmbEsH4jn4Ld7rPMzM8UVtsjzdOJU0KrXOgzC2QfhkinahmvL9Gi3fdMfaIYb 6YYrwAKofqsrAJj0ZJi6IX6cleLe1wvk8G6M2RUeevTTCjG4dtW7zHDTUT6t7aF2ZkEi wad5551BfVs7xwPddP5sq3lkrk3adHgPQd2hMJx+6q34WnIO09T0JVcRtln0wSazdW42 leXHAP7WsaGLnk9pFtzw1/6KJMFlWB97yAdZwAEk33BBnBc+UQ8gojfn2ldT94i7DOTX eZ+PmJ9gBbegwwhF8Fg0xeJCYVnxbf/J1Y9G1+Hvjygk9eR4PgHusd9xSELZoESUaT82 yZqQ== 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=FeQ44avxjhNKGvclmL+IaW/brdwZd48AYHsy5z6HFTA=; b=iGF1MyKSK5/HoZKmgG00dCaSdXYKO/Y6yZlXcItpCL0rRJT5zOHURiTOhYz/XZny4q VOnqY9D2cUjxjEgx8G2mXIYZsp7cGELSEzy6zcXK2Ub1IqPgC5Gca1r8B+iCfr431W70 twgbNXXh5GCr6fSGY6Y+Vr/NBXmBUZNrmf9eenLgrC3SOwnz1AHsTcYO57j57dQO2tYX 4tskWmf0OXqZ/2tu2v6cVAXdZSOuXwBJ7McQjZzQGnk58eFVSs8rwn4405c8zO/aqX0c ppKlJqqzMTZa6J4DnNbxKYQYwG4gjRbd0ZJPjryJPUYiSRyDcBI460/uou0wmcS0NHTk 9aZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=SRZc6fvQ; 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 h15si14224762plk.74.2019.07.23.23.56.25; Tue, 23 Jul 2019 23:56:39 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=SRZc6fvQ; 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 S1726384AbfGXGzd (ORCPT + 99 others); Wed, 24 Jul 2019 02:55:33 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:41128 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725878AbfGXGzd (ORCPT ); Wed, 24 Jul 2019 02:55:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=FeQ44avxjhNKGvclmL+IaW/brdwZd48AYHsy5z6HFTA=; b=SRZc6fvQkH2Cx6BKrVs1zG1pG HdVl1GhjX6GW6pHtPOfTP4qzncVkK2k3hGyRQTPK7uTqj4k/v8rlT1OWZCMUsTh+m03nEou75xUL6 d4wm73OlcqIqyEn0gXCeqXht0OdExcVR+P9cg8w4yAxVZcAvS2A9wYUs056gY8LM0pQ69uGSnrvyx pdL4AQ/ltJ0Ud6+XTSN2QiBVljMoIq5n16UvtwAhwZS5ruZPx2kmSv0dfmyYsNon2mqUiZHp2h8V6 xiQaZm9snI9m+RdBQ0bg9XTDmynrNCE4/ejLCnx309RG/et+4PZjYTHppyDiDhverokz5FMeIUSxv D2kKI3Owg==; Received: from hch by bombadil.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1hqBBS-0006A4-Vh; Wed, 24 Jul 2019 06:55:31 +0000 Date: Tue, 23 Jul 2019 23:55:30 -0700 From: Christoph Hellwig To: Rob Clark Cc: John Stultz , Christoph Hellwig , lkml , Laura Abbott , Benjamin Gaignard , Sumit Semwal , Liam Mark , Pratik Patel , Brian Starkey , Vincent Donnefort , Sudipto Paul , "Andrew F . Davis" , Xu YiPing , "Chenfeng (puck)" , butao , "Xiaqing (A)" , Yudongbin , Chenbo Feng , Alistair Strachan , dri-devel , Hridya Valsaraju Subject: Re: [PATCH v6 2/5] dma-buf: heaps: Add heap helpers Message-ID: <20190724065530.GA16225@infradead.org> References: <20190624194908.121273-1-john.stultz@linaro.org> <20190624194908.121273-3-john.stultz@linaro.org> <20190718100654.GA19666@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 23, 2019 at 01:09:55PM -0700, Rob Clark wrote: > On Mon, Jul 22, 2019 at 9:09 PM John Stultz wrote: > > > > On Thu, Jul 18, 2019 at 3:06 AM Christoph Hellwig wrote: > > > > > > Is there any exlusion between mmap / vmap and the device accessing > > > the data? Without that you are going to run into a lot of coherency > > > problems. > > dma_fence is basically the way to handle exclusion between different > device access (since device access tends to be asynchronous). For > device<->device access, each driver is expected to take care of any > cache(s) that the device might have. (Ie. device writing to buffer > should flush it's caches if needed before signalling fence to let > reading device know that it is safe to read, etc.) > > _begin/end_cpu_access() is intended to be the exclusion for CPU access > (which is synchronous) What I mean is that we need a clear state machine (preferably including ownership tracking ala dma-debug) where a piece of memory has one owner at a time that can access it. Only the owner can access is at that time, and at any owner switch we need to flush/invalidate all relevant caches. And with memory that is vmaped and mapped to userspace that can get really complicated. The above sounds like you have some of that in place, but we'll really need clear rules to make sure we don't have holes in the scheme.