From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757117AbcIGIu7 (ORCPT ); Wed, 7 Sep 2016 04:50:59 -0400 Received: from foss.arm.com ([217.140.101.70]:44682 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757090AbcIGIuw (ORCPT ); Wed, 7 Sep 2016 04:50:52 -0400 Date: Wed, 7 Sep 2016 09:50:38 +0100 From: Brian Starkey To: Laura Abbott Cc: Sumit Semwal , John Stultz , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Riley Andrews , Daniel Vetter , linaro-mm-sig@lists.linaro.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Eun Taik Lee , Liviu Dudau , Jon Medhurst , Mitchel Humpherys , Jeremy Gebben , Bryan Huntsman , Greg Kroah-Hartman , Android Kernel Team , Chen Feng Subject: Re: [PATCHv2 1/4] staging: android: ion: Drop heap type masks Message-ID: <20160907085038.GA30243@e106950-lin.cambridge.arm.com> References: <1472769644-11039-1-git-send-email-labbott@redhat.com> <1472769644-11039-2-git-send-email-labbott@redhat.com> <20160902134102.GA24721@e106950-lin.cambridge.arm.com> <20160905112026.GA3173@e106950-lin.cambridge.arm.com> <39b86efc-2b29-f482-cb83-7da076eb8cf6@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <39b86efc-2b29-f482-cb83-7da076eb8cf6@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 06, 2016 at 03:16:52PM -0700, Laura Abbott wrote: >On 09/05/2016 04:20 AM, Brian Starkey wrote: >>Hi, >> >>On Fri, Sep 02, 2016 at 12:36:25PM -0700, Laura Abbott wrote: >>>On 09/02/2016 06:41 AM, Brian Starkey wrote: >>>>Hi Laura, >>>> >>>>On Thu, Sep 01, 2016 at 03:40:41PM -0700, Laura Abbott wrote: >>>>> >>>>>There is no advantage to having heap types be a mask. The ion client has >>>>>long since dropped the mask. Drop the notion of heap type masks as well. >>>>> >>>> >>>>I know this is the same patch you sent last time, so sorry for not >>>>picking this up then - but I'm curious what "The" ion client is here? >>>> >>> >>>ion_client_create used to take a mask to indicate what heap types it >>>could allocate from. This hasn't been the case since 2bb9f5034ec7 >>>("gpu: ion: Remove heapmask from client"). "The ion client" probably >>>should have been "struct ion_client" >> >>Ah I see, the in-kernel ion_client. Sorry, I completely forgot that >>even existed (because it's totally useless - how is a driver meant to >>find the global ion_device?) >> >>> >>>>Our ion client(s) certainly still use these masks, and it's still >>>>used as a mask within ion itself - even if the relationship between a >>>>mask and a heap type has been somewhat lost. >>> >>>Where is it used in Ion? I don't see it in tree unless I missed something >>>and I'm not eager to keep this around for out of tree code. What's the >>>actual use for this? >> >>You're certainly right that these heap-ID-to-allocation-mask macros >>are unused in the kernel, but I don't really see the reason for >>removing them - they are convenient (for now). >> >>Example: I'm using the dummy ion driver, and I want to allocate from >>the SYSTEM_CONTIG heap - the ION_HEAP_SYSTEM_CONTIG_MASK gives me the >>exact mask I need for that. >> >>It seems your opinion is that heap-IDs are already, and should be, >>completely decoupled from their type. That sounds like a good idea to >>me, but it's not true (yet) - again check out the dummy driver. >> > >Good point, I need to clean up the dummy driver to stop using heap >types as the id ;) > >I get that it's convenient but it's a bad practice to conflate the >namespaces. > >>At the moment, heap-IDs are assigned by ion drivers in any way they >>see fit. For as long as that stays the case there's always going to >>be heap-masks hard-coded in UAPI kernel headers (in-tree or not), so >>removing these particular masks seems a bit fruitless. >> > >It's not fruitless, the concept of type as mask makes no sense. They >are two different name spaces and I've found Ion users have a hard >time keeping them separate and pass in the heap type mask when using >non dummy You can add me to that group :-) > >>I'd rather see driver-assigned heap-IDs disappear completely, and have >>them assigned by ion core from an idr or something. At that point >>these macros really *are* meaningless, and I'd be totally fine with >>removing them (and userspace won't be able to depend on hard-coded >>allocation masks any more - it will have to use the query ioctl, >>which I assume is the whole point?). >> > >Ideally yes we'd be able to get rid of the hard coded device IDs. >I consider the query ioctl a stepping stone to that, depending on >how enthusiastic people are about Ion. > >>IMO it's not the right time to remove these macros, because they still >>have meaning and usefulness. >> > >I still think they should be deleted to avoid namespace polution. > If you nuke type-as-ID in dummy, and put a clear comment on the ion_heap_type enum stating that heap-type and heap-ID are strictly different, then I'm happy. I think without that there'll still be confusion. Thanks! Brian >>Cheers, >>Brian >> >>> >>>> >>>>Thanks, >>>>Brian >>>> >>>>>Signed-off-by: Laura Abbott >>>>>--- >>>>>drivers/staging/android/uapi/ion.h | 6 ------ >>>>>1 file changed, 6 deletions(-) >>>>> >>>>>diff --git a/drivers/staging/android/uapi/ion.h b/drivers/staging/android/uapi/ion.h >>>>>index 0a8e40f..a9c4e8b 100644 >>>>>--- a/drivers/staging/android/uapi/ion.h >>>>>+++ b/drivers/staging/android/uapi/ion.h >>>>>@@ -44,14 +44,8 @@ enum ion_heap_type { >>>>> * must be last so device specific heaps always >>>>> * are at the end of this enum >>>>> */ >>>>>- ION_NUM_HEAPS = 16, >>>>>}; >>>>> >>>>>-#define ION_HEAP_SYSTEM_MASK (1 << ION_HEAP_TYPE_SYSTEM) >>>>>-#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << ION_HEAP_TYPE_SYSTEM_CONTIG) >>>>>-#define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT) >>>>>-#define ION_HEAP_TYPE_DMA_MASK (1 << ION_HEAP_TYPE_DMA) >>>>>- >>>>>#define ION_NUM_HEAP_IDS (sizeof(unsigned int) * 8) >>>>> >>>>>/** >>>>>-- >>>>>2.7.4 >>>>> >>> >