Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp5088141ybb; Tue, 24 Mar 2020 10:43:32 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuvqaBQufgNGoBTz47YkHgFX2YEGqoX+rR2fqFQx9JNBeJZk/On37B0vPg8EUTvgbelUCJN X-Received: by 2002:a9d:7147:: with SMTP id y7mr1400770otj.230.1585071812032; Tue, 24 Mar 2020 10:43:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585071812; cv=none; d=google.com; s=arc-20160816; b=wCn+4V5OU8nvqub210/Yq5iJ21hPrlmj3EbM37CFWCjpEuiLVMvFqhl3d7HRuJBTkH +3jEIvDn1OD8ih3uySpJpZkdz5ccDjj76Sdaj/R3P8vK2GqoqD+6QrzcJmczM+1LGvyj D6SSKdxLxA6AZCIbddkRyMdzWqWrVZtbW3woC3rxye4my0Pvgm/1IN5BagnjjRqoRJh+ CDNcz3aie+4FXpzGgrmR3H5JJvSSEj/SyQ0bYn0F4QnvIw2Vq7lWFbiljiZt/9wwrooz 5n5EMzWl4RPL94aoHoE0WW94z8feIGF9ORgtgT0/Pv2Qf7NGoIEaQs+X1Ma022E9cjB4 QO1w== 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=k05oPvmV/fc2yzo27LDeW/LodmguuM3ccQtFPjuMm3o=; b=UvP0799n58/jqjDH0v63rm8jY0+7wLdH4NrGrDEfzyRuR/Vuglvt8IUC4IU0bKeDZS tsepRiSSTfHqYnVZGpgDUodavpAvFszcNOyLRQBiAb/lrQwrRZvnazHwDePvIR9hYVP0 MxzdnHeicTsIDAohZX0/QTf6LQvhq/49Tj93cOUmseLJyotazkguW2Ey1vvpAffe0sAa zEF9T4xjKoglKmgl39dgKu+bOumMkwYJKlHZ7AZhnGOlETFRCAo3r/StdRVzxguZNb0R bE8SyFy5zxY07PL9cFBdcp3igNlZ4X3couI/8SYlbdObRSJPK9EWRctGpnapU6p6OqwI pwWg== 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 x9si9612924oia.194.2020.03.24.10.43.06; Tue, 24 Mar 2020 10:43:32 -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 S1727689AbgCXRlj (ORCPT + 99 others); Tue, 24 Mar 2020 13:41:39 -0400 Received: from foss.arm.com ([217.140.110.172]:38842 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727316AbgCXRlj (ORCPT ); Tue, 24 Mar 2020 13:41:39 -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 27F291FB; Tue, 24 Mar 2020 10:41:39 -0700 (PDT) Received: from mbp (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 14E383F71F; Tue, 24 Mar 2020 10:41:37 -0700 (PDT) Date: Tue, 24 Mar 2020 17:41:35 +0000 From: Catalin Marinas To: peng.fan@nxp.com Cc: will@kernel.org, nsaenzjulienne@suse.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, Robin Murphy Subject: Re: [PATCH] arm64: mm: make CONFIG_ZONE_DMA configurable without EXPERT Message-ID: <20200324174134.GH3901@mbp> References: <1583844526-24229-1-git-send-email-peng.fan@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1583844526-24229-1-git-send-email-peng.fan@nxp.com> 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 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. How large is it in your case? Is it allocated by the kernel dynamically or a fixed start set by the boot loader? 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. -- Catalin