Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10913031ybi; Thu, 25 Jul 2019 07:00:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+5KL/KUs2jMoFL/Rgty13EvxuFfmuxjNqn8qX10vBN9rvnNjzlKWvPJp25Jfvxnwd0tC2 X-Received: by 2002:a17:90a:2023:: with SMTP id n32mr89164509pjc.3.1564063238026; Thu, 25 Jul 2019 07:00:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564063238; cv=none; d=google.com; s=arc-20160816; b=e0YIsBp73nPee2WEruynQTdROpxJFK2vJEfzliLBT2t5RGG5QkfyZL0PJ1do2FR4IC a4iRQO29IV+S+lZWrqoebKr3UF4P0zs6Orpm45bsPBDQfkWn2DFm3XYTIi38byOWgEzB 6nux5P4S/iqnB3j1R0fJdLawuIivLY/793VNIzHFGMcmYKAXN24fxV/oJwVsQvF4QZcf hIm8kTCKrBnjqEGIMSk+G7TXp4EehqSVNEelU2x9rJaqOzOg4G2Rg6YS1WQMMGOCMyXd LjLeLRM/guvvMycReO1ez2hn3YB3nKI/3Xtfhygv56tzSrgN6j1t2JA9JtPLfFPVIlZq pSNA== 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=7Wjp5H7m0b0vMT7USOlYqcUzNgRanEqvXTqhheDAilA=; b=lDmtbGBe0dlCZd2xoM1g3am9VS5Y9t94XI9bE60raIBrqRA78UhfUAV92IwoO5iIyR t7/jAhoRzJAC3XqF/aB3kFsxI1WGuM35mr/ZMY9BzOI9aKuWluwdWId09BG7pUbuhwjH 5Xgq5wKwWFjxMa30fADPcGqkZIHFvqTPLXQwb73a783tYivBnNpF1YlUsiEnfgaYTMT1 4UwTkFXa0Y6QbD/N8qiPf5+9TQoWbbfLwPGWRe3sTEOHcV9ZaQgYFww/7mIzx72nOJrm Vzx0k4KZ1as7ogeGWXxpUYFNhW7YRSEYJPyETtjtYLjrDw/k0ppTu5aaghkf3iQIqtBL V34Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=rKY91dce; 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 k137si16649837pga.59.2019.07.25.07.00.22; Thu, 25 Jul 2019 07:00: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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=rKY91dce; 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 S2388770AbfGYMlo (ORCPT + 99 others); Thu, 25 Jul 2019 08:41:44 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:37306 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388147AbfGYMln (ORCPT ); Thu, 25 Jul 2019 08:41:43 -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=7Wjp5H7m0b0vMT7USOlYqcUzNgRanEqvXTqhheDAilA=; b=rKY91dce2li+C2U57/tnASrA2 47Bd6vgLifnqq1zIETijL3aVlqmAoTd3GaCod8NXW4hm9y6l5qJpdTcG9p1UpWjEwdY4EainApIzD xsC761C1zsnE82N1Ztnh0J74oQX5LHcQMGM1dM3iqpLqaLEvz3T07kLYVhxHSSccZa6teJKSETpAE a4ZlIZEqbMB+4fXaA87xcrwx4prSssxpfIEdtfbJ4vFGVhm7YPr4dNUlNfStWc/ZFtGaAASxR5CWD 7VS8kKIdprjJdq0aM8Iv4ZdirfThvVKuRC3xIlIwjkcBnVuB4Tg6husLf/f3KmhcJ0bqTQ6FmDmfA y1v4B5wZA==; Received: from hch by bombadil.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1hqd42-0006dB-AA; Thu, 25 Jul 2019 12:41:42 +0000 Date: Thu, 25 Jul 2019 05:41:42 -0700 From: Christoph Hellwig To: "Andrew F. Davis" Cc: Christoph Hellwig , Rob Clark , John Stultz , lkml , Laura Abbott , Benjamin Gaignard , Sumit Semwal , Liam Mark , Pratik Patel , Brian Starkey , Vincent Donnefort , Sudipto Paul , 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: <20190725124142.GA20286@infradead.org> References: <20190624194908.121273-1-john.stultz@linaro.org> <20190624194908.121273-3-john.stultz@linaro.org> <20190718100654.GA19666@infradead.org> <20190724065530.GA16225@infradead.org> <3966dff1-864d-cad4-565f-7c7120301265@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3966dff1-864d-cad4-565f-7c7120301265@ti.com> 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 Wed, Jul 24, 2019 at 11:20:31AM -0400, Andrew F. Davis wrote: > Well then lets think on this. A given buffer can have 3 owners states > (CPU-owned, Device-owned, and Un-owned). These are based on the caching > state from the CPU perspective. > > If a buffer is CPU-owned then we (Linux) can write to the buffer safely > without worry that the data is stale or that it will be accessed by the > device without having been flushed. Device-owned buffers should not be > accessed by the CPU, and inter-device synchronization should be handled > by fencing as Rob points out. Un-owned is how a buffer starts for > consistency and to prevent unneeded cache operations on unwritten buffers. CPU owned also needs to be split into which mapping owns it - in the normal DMA this is the kernel direct mapping, but in dma-buf it seems the primary way of using it in kernel space is the vmap, in addition to that the mappings can also be exported to userspace, which is another mapping that is possibly not cache coherent with the kernel one.