Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10971963ybi; Thu, 25 Jul 2019 07:53:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyKY4Vpqs22KZENum8j/SMr5Xvi3vFPfiEYZ/xg4KmxV4RrGNfT0IKvN4f/PjDIqEeeoMVD X-Received: by 2002:a63:a35e:: with SMTP id v30mr27646690pgn.129.1564066431395; Thu, 25 Jul 2019 07:53:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564066431; cv=none; d=google.com; s=arc-20160816; b=M1Fiwgj3j1GOq3D8f4PUKr0MfdCctDyk7WTJhxeNJ32kzUhf6WnuFIFUvRIMWhGWIx G1v2TWLnfQSmfJPN4VDbeui/StOErT+uZwxkw7jxiPPyvmVcHojcwTGsxlMlzJjC3TNm JfJ0X7lw64YfcWryR1Ljp27AAezPFMcWI4twDM0YbBZtZ34OyLDuWAZwfN+c2k6GlhfP ksZClCUYp7+mMKsMwiHTwFclCI315NS+EqwQkIwalS2dR6Z8cVaBSBiNvND2F4NeQIqn pgUmO0yUpKrriWtrWGEUtszsnlY94Mim7OLBKQRxCS58++WmpGagrxHJbSUQVTvsS6qj lSag== 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=6eVBtz7pC5rPsO60ddc64kp9iSy+XJZAc+HuTFyJ08s=; b=vx5tcmYgGRq1rX2g1kuab6DqZc5w6cjYWIKn951/oR+7NgmsPMyHCm42jmWKvI2qFi zsE9GoFevqTrEQsZFErGhuAdXmNkubfrnck0o5k0ckFJur8kEH1Rmy+vA0GvFc/CyGwG 3A28wPu9+HAEaou8BxwzZQpDLMQFM1+hU0Q3JO/sazvdggzUY7sgKXSvNvXnP781eYqq RYXtUZCRf19th48TU2y6q+6u1+uSZn9kjglHfESeFFNy30W7H0N4pUOMXmOKBjh6XvP4 6Mo6L5ygsYVS2iYtnmZhUdiqTQmGLCnnpewsUlLd4Oljc+bjNzewUFzeUJHL3KuslBhi YvNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Z5lSewpC; 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 b8si11098702pgn.56.2019.07.25.07.53.36; Thu, 25 Jul 2019 07:53:51 -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=Z5lSewpC; 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 S2388270AbfGYOw2 (ORCPT + 99 others); Thu, 25 Jul 2019 10:52:28 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:35766 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387646AbfGYOw2 (ORCPT ); Thu, 25 Jul 2019 10:52:28 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x6PEpwLH089026; Thu, 25 Jul 2019 09:51:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1564066318; bh=6eVBtz7pC5rPsO60ddc64kp9iSy+XJZAc+HuTFyJ08s=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=Z5lSewpCrBq60eVRn9ewoGY9sYcen7BfsGC5Ryho9b2zDeuf6W4TBq4LtUXOClE7A 2oZ8CbyMXq+O9xHqPrGY9XK0VwlRgc3O8IvVZyPvOEUpCVodA9wMfpkYqkM/dhpr+2 kRdTvW4xMnTvzmLV1QF/PUFQ+0el5ryqp5Nfs74Q= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x6PEpwex070194 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 25 Jul 2019 09:51:58 -0500 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE100.ent.ti.com (10.64.6.21) 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:51:58 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE114.ent.ti.com (10.64.6.35) 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:51:58 -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 x6PEpucs096397; Thu, 25 Jul 2019 09:51:57 -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: <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> <8e2ec315-5d18-68b2-8cb5-2bfb8a116d1b@ti.com> <20190725141144.GA14609@infradead.org> <20190725143040.GA21894@infradead.org> From: "Andrew F. Davis" Message-ID: Date: Thu, 25 Jul 2019 10:51:56 -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: <20190725143040.GA21894@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:30 AM, Christoph Hellwig wrote: > On Thu, Jul 25, 2019 at 10:25:50AM -0400, Andrew F. Davis wrote: >> On 7/25/19 10:11 AM, Christoph Hellwig wrote: >>> On Thu, Jul 25, 2019 at 10:10:08AM -0400, Andrew F. Davis wrote: >>>> 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. >>> >>> Well, that means this thing is buggy and abuses the scatterlist API >>> and we can't merge it anyway, so it is irrelevant. >>> >> >> Since when do scatterlists need to only have kernel virtual backed >> memory pages? Device memory is stored in scatterlists and >> dma_sync_sg_for_* would fail just the same when the cache ops were >> attempted. > > I'm not sure what you mean with virtual backed memory pages, as we > don't really have that concept. > > But a page in the scatterlist needs to be able to be used everywhere > we'd normally use a page, e.g. page_to_phys, page_to_pfn, kmap, > page_address (if !highmem) as consumers including the dma mapping > interface do all that. > > If you want to dma map memory that does not have page backing you > need to use dma_map_resource. > I probably should have worded that better. It does have page backing, what I meant by "page_to_pfn() will return bad values" is not that it won't give you the correct pfn, it will, but that then that pfn is not part of the normal memory space (lowmem/highmem) it's device memory, so cache ops won't work. But you should not be doing that on device memory anyway. That is a problem with Ion I want to avoid, it assumed all buffers were in DDR and so would do cache operations on them unconditionally, too many assumptions were made as too much was moved into the common core code and not enough was left for the heaps themselves to decide.