Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10947117ybi; Thu, 25 Jul 2019 07:28:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqyp89B58NI+9PKkQoRhWp8h9bHsctc2nMjWemiGsos8F5CMMYHfk1imwxRx9ZdnMOyvow9r X-Received: by 2002:a62:8745:: with SMTP id i66mr16703675pfe.259.1564064915387; Thu, 25 Jul 2019 07:28:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564064915; cv=none; d=google.com; s=arc-20160816; b=I9Ug3qwa+fI2kSkvs1Dim2AjxQsQaraSmlbYc3WoaJTkT0Q2BsBAm4me2FtQvn+Wce 6iBq99ckGYEGkTpvm7wV23zh7HDNkQQKwJyqIwftQJ10oquzcrpfO3ceBN4sgIDDnbfV 0l3sQ+57JoBRFPitCbtlQOIBXK0dlwlwzTCB/DPhDCvBUQlAw0GvtXwMNtBN/8NdVfMv x3GmwSgOKD6I8dJvWryt6Ow6tvsVFHHbqnhF9ZkBxMhvt8YxogS6OdtMf1sxQ43pde7N 3hJ7hNazWpXMdTzalCyfVuThSZXHWH6mPemyJ2n9lwLzzG7TQrE+ymvkaKfw+xAhIpoi Je9w== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=mVv1nDWtq6/1PWlhIk1q4KK71i681umUf+79EFLyBFw=; b=d9deBQAb1KJybXQiI7908BV8ZGm5veze2OgW8wc36Mqu2c0d6oq8M4GjTDvBTR54xl wzr3c2qiJvQBOVou891nVzTi6s8xhGM429z2z+0SH2IWrpOy2FWqGBO+z/IbkB9GpxNT rM58hLb1schRthVaLRPXP/tYEIm/Ct42B8c18gfumWUEXxcyKJSuYW+OLn0yNQJVSY34 WKgkdduXmfMx5icUUN/Zv0Try2MiBuEYObarN8fOH+UgmMtS7QTVHcBKHXRBVUuw6wci I6g4s4QXFZ4cNY5X/sTaZQvPxA/BzUGSNE56QWQC9nsZOOjekTV5ibzFfhN2ug2F8qmG 9avQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=yvFj1CUL; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g5si18234087pgn.360.2019.07.25.07.28.20; Thu, 25 Jul 2019 07:28:35 -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=@ti.com header.s=ti-com-17Q1 header.b=yvFj1CUL; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387712AbfGYOKq (ORCPT + 99 others); Thu, 25 Jul 2019 10:10:46 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:32830 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387551AbfGYOKq (ORCPT ); Thu, 25 Jul 2019 10:10:46 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x6PEAAd8113214; Thu, 25 Jul 2019 09:10:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1564063810; bh=mVv1nDWtq6/1PWlhIk1q4KK71i681umUf+79EFLyBFw=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=yvFj1CULd+JqphxDYLptg+cY4QAlhkwlcybiAuiIpLD3ZiwvXbgwH46H2bL7zBrKv 36SFJLJLWpE//7+VGXqtssZKckCQ4+lQU6N7LvYNyYetXHpO3jmmesX0DyVKF0IYUn gYJErN5sBT/UMqrhxSj+M41yjqEkHuQxv/rAQyh8= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x6PEAAwj121944 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 25 Jul 2019 09:10:10 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Thu, 25 Jul 2019 09:10:10 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Thu, 25 Jul 2019 09:10:10 -0500 Received: from [10.250.86.29] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x6PEA8Zk034771; Thu, 25 Jul 2019 09:10:09 -0500 Subject: Re: [PATCH v6 4/5] dma-buf: heaps: Add CMA heap to dmabuf heaps To: Christoph Hellwig CC: 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 References: <20190624194908.121273-1-john.stultz@linaro.org> <20190624194908.121273-5-john.stultz@linaro.org> <20190718100840.GB19666@infradead.org> <20190724065958.GC16225@infradead.org> <8e6f8e4f-20fc-1f1f-2228-f4fd7c7c5c1f@ti.com> <20190725125014.GD20286@infradead.org> <0eae0024-1fdf-bd06-a8ff-1a41f0af3c69@ti.com> <20190725140448.GA25010@infradead.org> From: "Andrew F. Davis" Message-ID: <8e2ec315-5d18-68b2-8cb5-2bfb8a116d1b@ti.com> Date: Thu, 25 Jul 2019 10:10:08 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190725140448.GA25010@infradead.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/25/19 10:04 AM, Christoph Hellwig wrote: > On Thu, Jul 25, 2019 at 09:31:50AM -0400, Andrew F. Davis wrote: >> But that's just it, dma-buf does not assume buffers are backed by normal >> kernel managed memory, it is up to the buffer exporter where and when to >> allocate the memory. The memory backed by this SRAM buffer does not have >> the normal struct page backing. So moving the map, sync, etc functions >> to common code would fail for this and many other heap types. This was a >> major problem with Ion that prompted this new design. > > The code clearly shows it has page backing, e.g. this: > > + sg_set_page(table->sgl, pfn_to_page(PFN_DOWN(buffer->paddr)), buffer->len, 0); > > and the fact that it (and the dma-buf API) uses scatterlists, which > requires pages. > Pages yes, but not "normal" pages from the kernel managed area. page_to_pfn() will return bad values on the pages returned by this allocator and so will any of the kernel sync/map functions. Therefor those operations cannot be common and need special per-heap handling. Andrew