Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp566461ybb; Wed, 25 Mar 2020 05:32:02 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtP9tnVjNQmIie04or0NkxywhJJs/EIEEMRa595P2XCZWmptPIKCtXorJ502wWDUCRaTcd+ X-Received: by 2002:a05:6830:1541:: with SMTP id l1mr34654otp.297.1585139521934; Wed, 25 Mar 2020 05:32:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1585139521; cv=pass; d=google.com; s=arc-20160816; b=0J/ZcOSNlj2zqryprwWahUKYi7fJHZphabgwr3wzVKZPqVSJvarwbIg54Sao+bXM5Z 394JbCo7+g4DJhDrh+mlyTyAfdQvfMg5C0lV8Z4orfmInoY4FzK9xrBDWaHZubbyHEx5 jO93U8opUEMP9QJOKAalmI4DYCQK1hLc0rgCXwAKCJHD5JtgbXzx3FLJ7tgZ/EcUgZI7 30iMOd5hHWkgpsw3cjbWmREJn8eVgdQFDA8kqLQ47uvKwxwOE6cfaoAKj1B/N6aa3yB4 sCT9OcQdDjt0GT/5a86mYdvtf48KFGmhEk8+ZeWjZnmz0HRRL0UYFH+kWL8ev2V2CFSa /gQw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=x4BjYlW/6YO0guIU3ipAjjc8TE1V69gyw/Vq7shKALM=; b=MNTzakntgMYIjy31vQpaEzqwSzIpwNWVA3Ye1bxZrC++iFLriQVjWrvPBkZRK48haQ sxmFWHjg8/2PMtmBjVgEA57wXkEGj3NWtW74D/YoXMYAYzO61mtRKVt/2FVjfGavatko +JQGX/hzXOcquYWywTmPEJy1R7jtxMfhXaBrTaNnEOzNmQv4LDgseUFECDushbUOMvb0 uwyVQu3gOpT3AA0iFTCMZdtDzlxWAr7wL3FSuXVuMzzPDLYAEcvK1GQl2/kVnDidyEqw OYuiAvnpuOu92XAeK9DcJYh1gxR4e9rqG+rdqGa+kP9/KWVVB6wZWUyGVRBaIGuJsLGM KurA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Nd1qeHuK; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s70si1433071oos.6.2020.03.25.05.31.48; Wed, 25 Mar 2020 05:32:01 -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; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Nd1qeHuK; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727487AbgCYMa3 (ORCPT + 99 others); Wed, 25 Mar 2020 08:30:29 -0400 Received: from mail-eopbgr80083.outbound.protection.outlook.com ([40.107.8.83]:53924 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727046AbgCYMa2 (ORCPT ); Wed, 25 Mar 2020 08:30:28 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dsfk93Z7S/jGXIe2Y92MlVHS2ZF4424UQ0RmZMezKo7avpfLfIaJzFdP4Ds3RQt8sMqPLQJopvrF0qevtAD2dV7+FHBkbY2RlbtB6KnyHamPilPnLpZHc9hPGouFgwKl3NpvAlKKbq7FrPmG7Ya7VJOw8uSzL+qnZgXpootrUjmDN89tLnv6XVTxexvyBh68wCqlPwsX357EttE/CN0gfTFiiEOPGJ88uwj95rqFm7MUo073EEhRBDzUxkkt8cnl483jcjT4N4CYg3YDCVBkekl2VX6IzE8ky/90oyREyfqYUi7EBjvUx6nzoYBMQNpUwVWawSvkAr2x3mjlIgl+zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x4BjYlW/6YO0guIU3ipAjjc8TE1V69gyw/Vq7shKALM=; b=SF7MLkmn6HZJoJ64JM3ANB1KKc8+cvv7G0pBHd99nfJy9AvSlmYaC4HMZXgZDTRLowozWSESKjrVEH7I7Cu0Ec4AVbU5d1ZmAGwSebq1/1c0ZSsvgubpgFHQC6vU9vkEm17cMsFoei/0q2qga+RpGxfWtKJqfxi1/HQedh+UuDiy7qEOC12x1lsUgqWOOWRryXomTj5IURmgFRSRAj3ymzCUjJHE5CQXgLXdAFWcf3oaPFevQI12anoluHXbIvwX81lpOmyFcvSYyJDreJuqSE1EaV0gU2hsvRQK9gms5JO1q3njkxXX+90uKXfbujVBrD7CLmbIQehvNRYEO/LqRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x4BjYlW/6YO0guIU3ipAjjc8TE1V69gyw/Vq7shKALM=; b=Nd1qeHuKyDQLgVWuXwvJXPvZT95ONAzG8eqcVhp7IDw1EarHYMdhC+ZNVYKblKXyxUHl3KGfDFqq4FuutJA2KRZ+vAv8n34UNw2CrL6sAnufI5YfEAwbJNz9MmjyRh+zIag6wmeeR7lIp7RplhRe/+I6x8nTnu2+MUwpNZ2WR2E= Received: from AM0PR04MB4481.eurprd04.prod.outlook.com (52.135.147.15) by AM0PR04MB4353.eurprd04.prod.outlook.com (52.134.125.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.18; Wed, 25 Mar 2020 12:30:11 +0000 Received: from AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::ad44:6b0d:205d:f8fc]) by AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::ad44:6b0d:205d:f8fc%7]) with mapi id 15.20.2835.023; Wed, 25 Mar 2020 12:30:11 +0000 From: Peng Fan To: Catalin Marinas 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 Thread-Topic: [PATCH] arm64: mm: make CONFIG_ZONE_DMA configurable without EXPERT Thread-Index: AQHV9tsrS4nkBuxsuEaY66LPIEgB5ahYGTaAgABvteCAAKZfAIAAJLhQ Date: Wed, 25 Mar 2020 12:30:11 +0000 Message-ID: References: <1583844526-24229-1-git-send-email-peng.fan@nxp.com> <20200324174134.GH3901@mbp> <20200325101652.GJ3901@mbp> In-Reply-To: <20200325101652.GJ3901@mbp> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=peng.fan@nxp.com; x-originating-ip: [119.31.174.68] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 2756cbd8-7d92-445e-2c62-08d7d0b842f7 x-ms-traffictypediagnostic: AM0PR04MB4353:|AM0PR04MB4353: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 0353563E2B x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(346002)(376002)(136003)(39860400002)(396003)(45080400002)(64756008)(66446008)(76116006)(66476007)(66946007)(66556008)(7696005)(55016002)(81166006)(81156014)(8936002)(8676002)(478600001)(5660300002)(4326008)(9686003)(966005)(52536014)(316002)(44832011)(6506007)(33656002)(71200400001)(186003)(2906002)(54906003)(86362001)(26005)(6916009);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB4353;H:AM0PR04MB4481.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fmIQPvNrh5P1wVcvbh11m0GzNWPP+Fi4R6m8+qWHXZxABeNgFzdQUj9bPmWz9Nfw4D2bqpGPUNuyu3VFwqHPdJD6Ae3YScaI1yNfxxq9DszP/0TYJMQwd/gUXvD5AhQomSRofDs1xxnfLn3k+/bMPfhGoigmTYub4DxR0WUyvYIHl/3DN9TGOm62pOvk5jHS4NgU5PlKAtfxXqs9s2qzBZJEIpt26bPFDrN0f+RauMJ29i2IRtaW0kIINDiJOILeMuV4ARnWFJ86SXmURA7uh1ZW7fwW6+YEFBnxFcsmDi4ITNIcRp8OFndUkYFB7oTiG/Kihvy2MtSaDntH2JsuLgDLq7Xplz3Z9XDyLNaQKjthYuXeVaILASU+cwTDIYNFyXi2XZmYREh4W2MYFCoN5hQsUKTI2n6ZQlxkQVZXjNvvwY38LHNTGQ4Qn0CLH8RX+MyDK2j93mqJ+Haovq25YTomlSKxmeyskUAjaIPc9gQ7E2iw2BRLwyjDkQyZrOt8b7F1vsmw/zooSffHaBeITQ== x-ms-exchange-antispam-messagedata: Po4jOW8p9I14Hl6pv95ENiWVoAYFD79XDwxUEVxVB14SGm6SuzRdV42r3Zg1HVbz/u4bathb4GBN4HpVJwoKRr7ncqNuD4kWItgGoJVHmk5tfqcWtcxBVAPWN88glj4t2MeTBlPrtQZU8ezAQSgFNQ== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2756cbd8-7d92-445e-2c62-08d7d0b842f7 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Mar 2020 12:30:11.1599 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: uo/VuOfGok600PDPuTFOeIFYpI2pCeB/JLn4l+55yqyUaTWmTaSkqVS/N63wV6hzAkq5npypANOE+pqQJn5Wsw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4353 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Subject: Re: [PATCH] arm64: mm: make CONFIG_ZONE_DMA configurable > without EXPERT >=20 > 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 suppo= rted > 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. >=20 > So I guess without changing the dts, option (a) doesn't really work. >=20 > > > b) Change the CMA allocator to allow spanning multiple zones (last ti= me > > > 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. >=20 > I don't have time but option (c) was already discussed and there are patc= hes > from Nicolas on the list: >=20 > https://eur01.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Flore.= ke > rnel.org%2Flinux-arm-kernel%2F20190820145821.27214-5-nsaenzjulienne% > 40suse.de%2F&data=3D02%7C01%7Cpeng.fan%40nxp.com%7C6403ddf37 > 89b452ae5ee08d7d0a5a659%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0 > %7C0%7C637207282191026738&sdata=3Dt2cZ9HTCcRuaL9RO4kD%2BzN > 2n4VqM%2F66zYNZIOComCVs%3D&reserved=3D0 >=20 > The above series was checking whether the platform is RPi4 and limiting t= he > 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 ma= y > break existing platforms. Thanks for the information. I'll check the patchset and work out something proper to fix the issue I met. Thanks, Peng. >=20 > So I don't think it would be too hard to revive the above series (most of= it was > already merged). >=20 > -- > Catalin