Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp250797imj; Fri, 15 Feb 2019 23:03:14 -0800 (PST) X-Google-Smtp-Source: AHgI3IboitKDXU1TdbDpo29aEfq/BTnVFokzdYXbsked908BMuTAfpQvRC8Lvegr49aaOGCtFRDP X-Received: by 2002:a62:2a4b:: with SMTP id q72mr13517009pfq.61.1550300594792; Fri, 15 Feb 2019 23:03:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550300594; cv=none; d=google.com; s=arc-20160816; b=zUlnnglP/2ndttAnOTu1FBW+nzPj5le2Cq6chIaTkv7jOA59sEprtwc1QzUpsPjJKt TDobML3KxPp4c+PPl+DNNNoEov6MxOWulL1AnQi2qWkE3XSB32hwANhOL8QMzazzpZQN 4/WNfcAJzCrFSlPG8UUPp4+kDk2ZwJV3QAQXR1+h2elUbkkj+xdq8bA57tyVUAEG47sg ij1iC54JPYrcIqsquOG7JsKYGN00qENlyr6rVl7qqMB7sb8mTYzNtHXZkZCYB/6GLan7 DYLV7MC1df+blzqbgtUBoJRMRqAbOLQQ6F2jt1lORBhHTMS7FfEWMlU0XW3wkjlLNROn timw== 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=Wz062inumZg+GMp1aWcO8D5uT8CL/zet1HCrakkQ+m4=; b=M0iLSka3q/Sx/m9OT8EkjWeoX2YAFt1vcmQnFQL7ZR61ooQeOzaqp8ICqpM4yrV2fM uRublxvxU1JjBIz3CHFN9N6xveX3FiLp6rvxexVcUXI5ULbfegvFilveqhnSkUJZUgnk aBGMqbg2/FNrU7ILj0M3ie1aPA3vbmGGtpE8kIjymmp/R0N/d49FcRN7TqsCvt6TWRIV /WnoyUXsYexQ+Gj+je57XcMlRwA/JVkHGKLYjHC2oidUDQGew+zRciY3oWRx921BERV2 9SyubjPP/Vc4DQPWqkf0UEkvzXeEL22DF2Ixntw30VGWrJdUjpYo7C8Hdajc2x472Ye6 IuTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=VCiYF5ZR; 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 h38si5692472pgm.345.2019.02.15.23.02.59; Fri, 15 Feb 2019 23:03:14 -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=VCiYF5ZR; 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 S1729957AbfBOTW4 (ORCPT + 99 others); Fri, 15 Feb 2019 14:22:56 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:48098 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726010AbfBOTWz (ORCPT ); Fri, 15 Feb 2019 14:22:55 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x1FJMXB5002046; Fri, 15 Feb 2019 13:22:33 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1550258553; bh=Wz062inumZg+GMp1aWcO8D5uT8CL/zet1HCrakkQ+m4=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=VCiYF5ZRD7QSkqKWZ/ENpzNZlFePqtXkKBGC6N5kzoEHpem92ON8fYxuZC+HGB4jc JmDPxgyqquiLIpDRRuoxYjQBLpZSfXrsAWonGJzod3qVCxtmShzckQ1yA4skdWNdhv p4pj6wN0vOVeUB7OW6RmGzGLQ8qdXoyZddIvXjBA= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x1FJMXxw096210 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 15 Feb 2019 13:22:33 -0600 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Fri, 15 Feb 2019 13:22:32 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Fri, 15 Feb 2019 13:22:32 -0600 Received: from [172.22.98.110] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id x1FJMVgs016336; Fri, 15 Feb 2019 13:22:31 -0600 Subject: Re: [PATCH v2] staging: android: ion: Allocate from heap ID directly without mask To: John Stultz , Brian Starkey CC: Laura Abbott , Sumit Semwal , Greg Kroah-Hartman , =?UTF-8?Q?Arve_Hj=c3=b8nnev=c3=a5g?= , Christoph Hellwig , Liam Mark , "devel@driverdev.osuosl.org" , lkml , dri-devel , nd References: <20190128214408.25442-1-afd@ti.com> <20190215105057.jujgm4k77rhkvmo7@DESKTOP-E1NTVVP.localdomain> From: "Andrew F. Davis" Message-ID: <0cc81357-034b-9c74-8172-2a7a26e77804@ti.com> Date: Fri, 15 Feb 2019 13:22:31 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: 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 2/15/19 1:01 PM, John Stultz wrote: > On Fri, Feb 15, 2019 at 2:51 AM Brian Starkey wrote: >> >> Hi John, >> >> On Thu, Feb 14, 2019 at 09:38:29AM -0800, John Stultz wrote: >>> >> [snip] >> >>> Some thoughts, as this ABI break has the potential to be pretty painful. >>> >>> 1) Unfortunately, this ABI is exposed *through* libion via >>> ion_alloc/ion_alloc_fd out to gralloc implementations. Which means it >>> will have a wider impact to vendor userland code. >> >> I figured libion could fairly easily loop through all the set bits in >> heap_mask and call the ioctl for each until it succeeds. That >> preserves the old behaviour from the libion clients' perspective. > > Potentially, though that implicitly still caps the heaps to 32. So > I'm not sure what the net benefit would be. > That is a libion problem, libion can expose an un-capped API and users can migrate. > >>> 2) For patches that cause ABI breaks, it might be good to make it >>> clear in the commit what the userland impact looks like in userspace, >>> possibly with an example, so the poor folks who bisect down the change >>> as breaking their system in a year or so have a clear example as to >>> what they need to change in their code. >>> >>> 3) Also, its not clear how a given userland should distinguish between >>> the different ABIs. We already have logic in libion to distinguish >>> between pre-4.12 legacy and post-4.12 implementations (using implicit >>> ion_free() behavior). I don't see any such check we can make with this >>> code. Adding another ABI version may require we provide an actual >>> interface version ioctl. >>> >> >> A slightly fragile/ugly approach might be to attempt a small >> allocation with a heap_mask of 0xffffffff. On an "old" implementation, >> you'd expect that to succeed, whereas it would/could be made to fail >> in the "new" one. > > Yea I think having a proper ION_IOC_VERSION is going to be necessary. > I think that will be helpful to have ready the future just looking at the way libdrm does things, but not right now as backwards compatibility with staging code is not a reasonable thing to do. > I'm hoping to send out an ugly first stab at the kernel side for > switching to per-heap devices (with a config for keeping /dev/ion for > legacy compat), which I hope will address the core issue this patch > does (moving away from heap masks to specifically requested heaps). > Yes, that would remove the need for what this patch does. Question though, what does the user side look like for this? With the old /dev/ion we would: ion_fd = open("/dev/ion") ask for a list of heaps (ioctl on ion_fd) iterate over the details of each heap pick the best heap for the job request allocation from that heap (ioctl on ion_fd) with per-heap devs we need some way to iterate all over heap devices in a system, and extract details from each heap device. Maybe we leave /dev/ion but it's only job is to service ION_IOC_HEAP_QUERY requests but instead of heap numbers it returns heap names, then device files just match those names. Then we go allocate() from those. If all that is addressed in your patch-set then feel free to ignore this question :) Andrew > thanks > -john >