Received: by 10.223.185.116 with SMTP id b49csp2664713wrg; Mon, 12 Feb 2018 13:40:31 -0800 (PST) X-Google-Smtp-Source: AH8x226IxPS+oZC33muJxbbpW416k5nZbUNUsk42jsnYuEZc/nx2ob9IkxGlw506TkA0pRyG1nG6 X-Received: by 10.101.74.132 with SMTP id b4mr10637766pgu.355.1518471631217; Mon, 12 Feb 2018 13:40:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518471631; cv=none; d=google.com; s=arc-20160816; b=pEmL7ln2DeAvr4JGAVvIIXwRdbfxB4P2gNAzhGgh3SXjFdDUCZvZYoL/YWSVjKGBBc 0BhVsyFKiUzq8il39t6vkJjN4ox7t9ip2rhwKWd46gtzNHF5DOYoL2S9XjcBdGkdbaFh O16OzpJfALdgAxYnGtvwt3J4i6t4JgSUG6yQW4MY70XztxiHUTRhUIzdsgA2Bm1Q+4JT NQnemhlD/kyU8Jf95LnwIloBTlE1fQjFNpFmB/S0jZ2+ETSqBy4dlbXktOfQo+hivgQz fpJL18BHR4O77LBCgM90KzZlYdHMtxrBnVxbRlK9iIgHVUSfKU++DJl0A2L+XcpDIbld MmXg== 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:arc-authentication-results; bh=cwKHQ5khqJKrmqTQTLJTRtl33VPl+gm2GZnCpr3G41g=; b=gn4VzvB3GCzgNsrgCqoWLIjAoJP0kL1vMU47cbHAiFNb7TDVclkgyBCqbDeuzdqG32 uMDSWvjJbOgPEsYiMFEhMV9ZgFHKtjtqEk65RdNzsFRh9awYaepttbd8I7g3LZKoS2BK 6iYehhCBWVIUJDBZXRfJ2EpK1KBYihoZbBJ9ipCYDLU0AWX9YCFjMhsLzMptBMVLc2KD k4t92XN496lNWam0WnfLddRZ0A3O/k1y9guBBg8lKLP41LYgeQX4dDqraL4gI0scUcb3 XKRjB2hvKJk27vKlGyggNgCiGXF53Vffr+4+cQSiciBlEBvoCXTnXqikOl0M3UMEHwjS 0Ylw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3si192408pgc.496.2018.02.12.13.40.16; Mon, 12 Feb 2018 13:40:31 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932402AbeBLVje (ORCPT + 99 others); Mon, 12 Feb 2018 16:39:34 -0500 Received: from mga05.intel.com ([192.55.52.43]:31025 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932204AbeBLVjd (ORCPT ); Mon, 12 Feb 2018 16:39:33 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Feb 2018 13:39:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,504,1511856000"; d="scan'208";a="26769653" Received: from alexey-system-product-name.iil.intel.com (HELO [10.236.193.131]) ([10.236.193.131]) by FMSMGA003.fm.intel.com with ESMTP; 12 Feb 2018 13:39:14 -0800 Subject: Re: [PATCH] staging: android: ion: Add requested allocation alignment To: Laura Abbott , sumit.semwal@linaro.org, gregkh@linuxfoundation.org, arve@android.com, tkjos@android.com, maco@android.com, devel@driverdev.osuosl.org Cc: linux-kernel@vger.kernel.org, Liam Mark References: <1518257863-6903-1-git-send-email-alexey.skidanov@intel.com> <8284b2ba-a532-23fd-4c52-7ac556d63918@intel.com> <8eb1f6c9-e08d-c6a5-934a-c7e7873d79f2@intel.com> From: Alexey Skidanov Message-ID: Date: Mon, 12 Feb 2018 23:39:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/12/2018 10:46 PM, Laura Abbott wrote: > On 02/12/2018 12:22 PM, Alexey Skidanov wrote: >> >> >> On 02/12/2018 09:52 PM, Laura Abbott wrote: >>> On 02/12/2018 11:11 AM, Alexey Skidanov wrote: >>>> >>>> On 02/12/2018 08:42 PM, Laura Abbott wrote: >>>>> On 02/10/2018 02:17 AM, Alexey Skidanov wrote: >>>>>> Current ion defined allocation ioctl doesn't allow to specify the >>>>>> requested >>>>>> allocation alignment. CMA heap allocates buffers aligned on buffer >>>>>> size >>>>>> page order. >>>>>> >>>>>> Sometimes, the alignment requirement is less restrictive. In such >>>>>> cases, >>>>>> providing specific alignment may reduce the external memory >>>>>> fragmentation >>>>>> and in some cases it may avoid the allocation request failure. >>>>>> >>>>> I really do not want to bring this back as part of the regular >>>>> ABI. >>>> Yes, I know it was removed in 4.12. >>>> Having an alignment parameter that gets used for exactly >>>>> one heap only leads to confusion (which is why it was removed >>>>> from the ABI in the first place). >>>> You are correct regarding the CMA heap. But, probably it may be used by >>>> custom heap as well. >>> >>> I can think of a lot of instances where it could be used but >>> ultimately there needs to be an actual in kernel user who wants >>> it. >>> >>>>> The alignment came from the behavior of the DMA APIs. Do you >>>>> actually need to specify any alignment from userspace or do >>>>> you only need page size? >>>> Yes. If CMA gives it for free, I would suggest to let the ion user to >>>> decide >>> >>> I'm really not convinced changing the ABI yet again just to let >>> the user decide is actually worth it. If we can manage it, I'd >>> much rather see a proposal that doesn't change the ABI. >> I didn't actually change the ABI - I just use the "unused" member: >> struct ion_allocation_data { >> @@ -80,7 +79,7 @@ struct ion_allocation_data { >>          __u32 heap_id_mask; >>          __u32 flags; >>          __u32 fd; >> -       __u32 unused; >> +       __u32 align; >>   }; >> > > Something that was previously unused is now being used. That's a change > in how the structure is interpreted which is an ABI change, especially > since we haven't been checking that the __unused field is set > to 0. Yes you are correct. I just realized that it isn't even backward compatible. > >> As an alternative, I may add __u64 heap_specific_param - but this will >> change the ABI. But, probably it makes the ABI more generic? > > Why does the ABI need to be more generic? If we change the ABI > we're stuck with it and I'd like to approach it as the very last > resort. > > Thanks, > Laura It seems, that there is no way to do it without some ABI change? Thanks, Alexey