Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp458184ybb; Wed, 25 Mar 2020 03:17:31 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvpgyIhKZasG33hg9wjQgq5mbvfH8BnruuG7Jq8qviczNxK2Yz6Xl6U0I/rs1EacrxoxuhS X-Received: by 2002:a9d:7859:: with SMTP id c25mr1925643otm.323.1585131450831; Wed, 25 Mar 2020 03:17:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585131450; cv=none; d=google.com; s=arc-20160816; b=E3GA9GMNztB5N1nm4rILjyI0Cf+7FrPyRULN1xr3xJmGck/OmKwB/FN0bzfGWD8aqz CHw7DEa0Asj2gwTVYNYrVR0XpxfzkFppQ6uVZm97H+uGRoY7adUr4aLBSV1fwinhiSWA +6TmYgcnenPF3YVEFAuath55ZDPDPD2sOFZQ+31gFP7SC19Z6alpMk180/dSbcuNtyby W2UUsR4Y50oeuwdcMyFw+58siJfvdd4+lj7KFcGTqNFHCUj+5oO830X32t6PkdlnXmpq rk7WluRG6Cspr6w7yU0++62twpJNQg8pjDBAULLbjSdll9O8IQHLNh0ZuRk4OudemXKY Zh+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=AP4hG531itSjqg3fPHSQXMe5h+bjTnKffjVy+TXCU88=; b=DYPyaDbSt3ZSahp/rVRYbH/vEeGHRHh7dcbLZAG41tqGR3lcjtW2HMRYorqJ9fDrVn 1seduW+0jHM02yWoQPFUtPuumU+sw18E3SBjmKPkpcOWgxLTaXWiqhmW0NURu7LzfLgY RpzkqAm75PKNosUaac/JgAFZb4epODbPskptdlc764THOc3YjeL9uYWeV9jURNKLgnC/ b8jA8CHG2xJETw4Bqvygw5AHs1gtHzOK3/0i/qnLQp0ObddEPHp99igvfLL9wI8UR695 nTJdY/84y+jZiixzFaz0DKNSP/JcpW55frQT5uOqfDr7f6Tr6VFxVZk5fggEvBy9jV+K vCdQ== 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 l5si3596106oic.3.2020.03.25.03.17.18; Wed, 25 Mar 2020 03:17:30 -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; 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 S1726276AbgCYKQ5 (ORCPT + 99 others); Wed, 25 Mar 2020 06:16:57 -0400 Received: from foss.arm.com ([217.140.110.172]:45932 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726109AbgCYKQ5 (ORCPT ); Wed, 25 Mar 2020 06:16:57 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8114E31B; Wed, 25 Mar 2020 03:16:56 -0700 (PDT) Received: from mbp (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 71DA83F52E; Wed, 25 Mar 2020 03:16:55 -0700 (PDT) Date: Wed, 25 Mar 2020 10:16:52 +0000 From: Catalin Marinas To: Peng Fan Cc: "will@kernel.org" , "nsaenzjulienne@suse.de" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , dl-linux-imx , Robin Murphy Subject: Re: [PATCH] arm64: mm: make CONFIG_ZONE_DMA configurable without EXPERT Message-ID: <20200325101652.GJ3901@mbp> References: <1583844526-24229-1-git-send-email-peng.fan@nxp.com> <20200324174134.GH3901@mbp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 25, 2020 at 12:34:15AM +0000, Peng Fan wrote: > > On Tue, Mar 10, 2020 at 08:48:46PM +0800, peng.fan@nxp.com wrote: > > > From: Peng Fan > > > > > > commit 1a8e1cef7603 ("arm64: use both ZONE_DMA and ZONE_DMA32") > > > enables both ZONE_DMA and ZONE_DMA32. The lower 1GB memory will be > > > occupied by ZONE_DMA, this will cause CMA allocation fail on some > > > platforms, because CMA area could not across different type of memory > > > zones. > > > > > > Make CONFIG_ZONE_DMA configurable without EXPERT option could let > > > people build non debug kernel image with CONFIG_ZONE_DMA disabled. > > > > While I see why you need to toggle this feature, I'd rather try to figure out > > whether there is a better solution that does not break the single kernel image > > aim (i.e. the same config works for all supported SoCs). > > > > When we decided to go ahead with a static 1GB ZONE_DMA for Raspberry Pi > > 4, we thought that other platforms would be fine, ZONE_DMA32 allocations > > fall back to ZONE_DMA. We missed the large CMA case. > > > > I see a few potential options: > > > > a) Ensure the CMA is contained within a single zone. > > This will break legacy dts with new version kernel. > > > How large is it in your case? > > It is 1GB > > > Is it allocated by the kernel dynamically or a fixed start set by > > the boot loader? > > We use alloc-ranges and size in kernel dts. > > But there is only 2GB DRAM in the board. So I guess without changing the dts, option (a) doesn't really work. > > b) Change the CMA allocator to allow spanning multiple zones (last time > > I looked it wasn't trivial since it relied on some per-zone lock). > > > > c) Make ZONE_DMA dynamic on arm64 and only enable it if RPi4. > > Option c seems a bit easier to me :) > > I will try to explore both, but if you have time to help, that would be > appreciated. I don't have time but option (c) was already discussed and there are patches from Nicolas on the list: https://lore.kernel.org/linux-arm-kernel/20190820145821.27214-5-nsaenzjulienne@suse.de/ The above series was checking whether the platform is RPi4 and limiting the ZONE_DMA size to 1GB (otherwise 4GB with ZONE_DMA32 empty). We ended up with a static 1GB for ZONE_DMA but we missed the fact that it may break existing platforms. So I don't think it would be too hard to revive the above series (most of it was already merged). -- Catalin