Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp781212ybx; Tue, 5 Nov 2019 05:32:16 -0800 (PST) X-Google-Smtp-Source: APXvYqwVBvCFIKCw92y1XoAjiJ1htDW1ciqF0sW0bb6dXX96QrIG49kKUBsuZQ8uIruzIWXllDSh X-Received: by 2002:a50:9a85:: with SMTP id p5mr1075365edb.223.1572960736396; Tue, 05 Nov 2019 05:32:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572960736; cv=none; d=google.com; s=arc-20160816; b=nvZrO+0t1W8X5JsBhWznzZpFcFjv4MhMYgAKYpFsRvJZI0OnCOkquEqQP206E0uvFP J6EPJb9TSJaEnUYWmYsFwNy7MnGUv7whBI2meKUWf71ysZ3KlfPDKN81t0AnV8i+sMHa zXT2FpI4114Nn9RfDSjPFTCzGO6SjKBTPXEbiHs41ybPK6l35CmLMr50cuWC7iq6rGIV VVHdl+U1rItz0+/CA4sh8w5xGuUi+Dymg2XMFwNe4ubKewQOw9szHSkmAuOzi93HLT9M MuQ62eB8Cqz5594Z33yq4fq5QBF65z+PuOji3nFI13WKYrX6fHtt/pvywhpHHeHN2wG7 Q0cw== 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:to:subject:dkim-signature; bh=X2r1E+5verQirY3pPc+pLDG8R8Z0eAEU6/97FnwaeJE=; b=dnOfrdNQVwfDfP5xitH3dWA9CMYVUfqnn5MuZnGovxx09ZPFjkP8hXwQN8KCq16hVU c6ZsShycBGBkjHd6uqVIGGshewwCMl/lqLnLJXpOpIb6Myv1kW5S2bFkEfB22zXQ79Hk LnEcecCJzdjvyFAXouvJnHJjj5H3wGYOsX5Jhnr75E4PuzA+fT8PcGirzF6Nr3b7eYxj a38MlzQKWHgl3aLCSWRcilP3jXFOHp852puVOB+ZD0OvesjnwyEXM9zxuIu3NbbZadZB P0fDg0SI7XFga/hzmek1P9QVY2PpbI9KCAtxkuOb4y0ecloMS2saAu95MNUMEGxBDVts hnfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=i2X9SNHI; 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 o15si215369ejh.124.2019.11.05.05.31.52; Tue, 05 Nov 2019 05:32:16 -0800 (PST) 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=i2X9SNHI; 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 S2389243AbfKENat (ORCPT + 99 others); Tue, 5 Nov 2019 08:30:49 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:59056 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388883AbfKENas (ORCPT ); Tue, 5 Nov 2019 08:30:48 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id xA5DUeZa029559; Tue, 5 Nov 2019 07:30:40 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1572960640; bh=X2r1E+5verQirY3pPc+pLDG8R8Z0eAEU6/97FnwaeJE=; h=Subject:To:References:From:Date:In-Reply-To; b=i2X9SNHIaWyxje87ekrjovkH7KcKd8+Uv4zRDPgQqCS2KklVMgqThvsNrhGdccnO0 toL/VNiqQXNlum/mc5Loj8mvMERyzATixCxGkR+dpj1HHw40/9OFdIeuLBmrsQM+Y8 CPPptuc4zxsiS7Id6yM3FAGqjXt0hMah4inpCgxI= Received: from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xA5DUeIA012898 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 5 Nov 2019 07:30:40 -0600 Received: from DLEE111.ent.ti.com (157.170.170.22) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 5 Nov 2019 07:30:25 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Tue, 5 Nov 2019 07:30:25 -0600 Received: from [10.250.45.147] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id xA5DUdiv055261; Tue, 5 Nov 2019 07:30:39 -0600 Subject: Re: [RFC][PATCH 0/2] Allow DMA BUF heaps to be loaded as modules To: John Stultz , lkml , Sandeep Patil , Mike Rapoport , Chenbo Feng , Alistair Strachan , Liam Mark , Yue Hu , dri-devel , Hridya Valsaraju , Andrew Morton , Pratik Patel References: <20191025234834.28214-1-john.stultz@linaro.org> <20191104095823.GD10326@phenom.ffwll.local> <20191105094259.GX10326@phenom.ffwll.local> From: "Andrew F. Davis" Message-ID: <5b591240-43c8-495a-e9c9-881a2997c492@ti.com> Date: Tue, 5 Nov 2019 08:30:38 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191105094259.GX10326@phenom.ffwll.local> 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 11/5/19 4:42 AM, Daniel Vetter wrote: > On Mon, Nov 04, 2019 at 10:57:44AM -0800, John Stultz wrote: >> On Mon, Nov 4, 2019 at 1:58 AM Daniel Vetter wrote: >>> On Fri, Oct 25, 2019 at 11:48:32PM +0000, John Stultz wrote: >>>> Now that the DMA BUF heaps core code has been queued, I wanted >>>> to send out some of the pending changes that I've been working >>>> on. >>>> >>>> For use with Android and their GKI effort, it is desired that >>>> DMA BUF heaps are able to be loaded as modules. This is required >>>> for migrating vendors off of ION which was also recently changed >>>> to support modules. >>>> >>>> So this patch series simply provides the necessary exported >>>> symbols and allows the system and CMA drivers to be built >>>> as modules. >>>> >>>> Due to the fact that dmabuf's allocated from a heap may >>>> be in use for quite some time, there isn't a way to safely >>>> unload the driver once it has been loaded. Thus these >>>> drivers do no implement module_exit() functions and will >>>> show up in lsmod as "[permanent]" >>>> >>>> Feedback and thoughts on this would be greatly appreciated! >>> >>> Do we actually want this? >> >> I guess that always depends on the definition of "we" :) >> >>> I figured if we just state that vendors should set up all the right >>> dma-buf heaps in dt, is that not enough? >> >> So even if the heaps are configured via DT (which at the moment there >> is no such binding, so that's not really a valid method yet), there's >> still the question of if the heap is necessary/makes sense on the >> device. And the DT would only control the availability of the heap >> interface, not if the heap driver is loaded or not. > > Hm I thought the cma regions are configured in DT? How does that work if > it's not using DT? > >> On the HiKey/HiKey960 boards, we have to allocate contiguous buffers >> for the display framebuffer. So gralloc uses ION to allocate from the >> CMA heap. However on the db845c, it has no such restrictions, so the >> CMA heap isn't necessary. > > Why do you have a CMA region for the 2nd board if you don't need it? > _That_ sounds like some serious memory waster, not a few lines of code > loaded for nothing :-) > >> With Android's GKI effort, there needs to be one kernel that works on >> all the devices, and they are using modules to try to minimize the >> amount of memory spent on functionality that isn't universally needed. >> So on devices that don't need the CMA heap, they'd probably prefer not >> to load the CMA dmabuf heap driver, so it would be best if it could be >> built as a module. If we want to build the CMA heap as a module, the >> symbols it uses need to be exported. > > Yeah, I guess I'm disagreeing on whether dma-buf heaps are core or not. > >>> Exporting symbols for no real in-tree users feels fishy. >> >> I'm submitting an in-tree user here. So I'm not sure what you mean? I >> suspect you're thinking there is some hidden/nefarious plan here, but >> really there isn't. > > I was working under the assumption that you're only exporting the symbols > for other heaps, and keep the current ones in-tree. Are there even any > out-of-tree dma-buf heaps still? out-of-tree and legit different use-case > I mean ofc, not just out-of-tree because inertia :-) Not sure what you mean here, hopefully all the heaps can be "in-tree" some day. https://patchwork.kernel.org/patch/10863957/ Plus some non-caching heaps and one that forces early allocation of our PAT (gart like) IP. All this stuff is going into our evil vendor tree next cycle (if not upstream by then :)), if we want some of these "specialty" heaps to go into generic kernel builds at some point they will need to be modules if the core is. Although I am still thinking Heaps should be always built in + system + CMA heaps, then the rando heaps could be modules if needed. Andrew > -Daniel >