Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7618860ybi; Thu, 1 Aug 2019 10:57:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzdJdEyPEFlv48tYqtUZhM9MKL+Igqp7CmhVQLipBgpsnTZE6YtkAmsbpey1wDf5tzlamoO X-Received: by 2002:a63:290:: with SMTP id 138mr27816246pgc.402.1564682250113; Thu, 01 Aug 2019 10:57:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564682250; cv=none; d=google.com; s=arc-20160816; b=a1ssaT14KjFyyBT836oV09TFwIs2DD8Bf/Tyys8Du99uoBQDngN2i5enAB5NxTncAp oKKWWuEbxlFH3ReX4qJmYBuENKSVftjPw6QK0A0MrxwZwv7u51498hq77l0GeUF9P3Mg 5P118HkskZIAnCtuZCqjEEyYPb2nnA+9w4Kn3KYhvEAOPE6/yyDiHDXrF88bxE9tej+0 KFhD2n5s6XNn759cod+pB8SnKxWQZdFZrXUasZXzXjYZ2jfjtBY4uilNJ4eQhY6CjZPW kroafnx+Vet5GLzLUMqS2Ni4pkqLmwwGsAiHi7vm6jp0HrDEgU40mEgqWZ131N/SHEDw /6VQ== 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; bh=FshrkZ2Nb29G3AHALWiniqRqRIv/uvPJJY2TxMrQthQ=; b=EzLEyJP1n9SPZs0Y50rCm2HjYev3IVLw72RWaLUHRtO1kciCGAxs/uss2iZusUvV/e QvUh/UWTDVfUrchFou2FWdsdlQ1nD6QdMtHLyfEHGq+XRyFBCYMDj5PyS2vHqlz2aI+Z JZOt0zlPFuDKzMkpk5pdgENrm0TsL27UMx3d0JsZYQBL/8E20HX9I1U0+HVXVDmIziwD j2D6HpcHYQ5ndx/a5H4Ug86BpRCDkl0LjYdV6uAzNvM4q8Akkm+oJw6T3ff3nIq8Xfvy fTUdKX+2V0gb0QZy5kM5ZB6Ucx45cqErmqJQFNASNDEzrBP/Z/1e6mK1z84F38O1L6N8 2ktw== 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 p123si5459647pga.12.2019.08.01.10.57.14; Thu, 01 Aug 2019 10:57: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 S1731616AbfHAQH7 (ORCPT + 99 others); Thu, 1 Aug 2019 12:07:59 -0400 Received: from foss.arm.com ([217.140.110.172]:38504 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727403AbfHAQH7 (ORCPT ); Thu, 1 Aug 2019 12:07:59 -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 BEF84337; Thu, 1 Aug 2019 09:07:58 -0700 (PDT) Received: from [10.32.8.205] (unknown [10.32.8.205]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0B6A23F694; Thu, 1 Aug 2019 09:07:55 -0700 (PDT) Subject: Re: [PATCH 5/8] arm64: use ZONE_DMA on DMA addressing limited devices To: Nicolas Saenz Julienne , Catalin Marinas Cc: phill@raspberryi.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, f.fainelli@gmail.com, frowand.list@gmail.com, eric@anholt.net, marc.zyngier@arm.com, Will Deacon , linux-kernel@vger.kernel.org, linux-mm@kvack.org, iommu@lists.linux-foundation.org, robh+dt@kernel.org, wahrenst@gmx.net, mbrugger@suse.com, akpm@linux-foundation.org, hch@lst.de, linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com References: <20190731154752.16557-1-nsaenzjulienne@suse.de> <20190731154752.16557-6-nsaenzjulienne@suse.de> <20190731170742.GC17773@arrakis.emea.arm.com> From: Robin Murphy Message-ID: Date: Thu, 1 Aug 2019 17:07:54 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-08-01 4:44 pm, Nicolas Saenz Julienne wrote: > On Wed, 2019-07-31 at 18:07 +0100, Catalin Marinas wrote: >> On Wed, Jul 31, 2019 at 05:47:48PM +0200, Nicolas Saenz Julienne wrote: >>> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c >>> index 1c4ffabbe1cb..f5279ef85756 100644 >>> --- a/arch/arm64/mm/init.c >>> +++ b/arch/arm64/mm/init.c >>> @@ -50,6 +50,13 @@ >>> s64 memstart_addr __ro_after_init = -1; >>> EXPORT_SYMBOL(memstart_addr); >>> >>> +/* >>> + * We might create both a ZONE_DMA and ZONE_DMA32. ZONE_DMA is needed if >>> there >>> + * are periferals unable to address the first naturally aligned 4GB of ram. >>> + * ZONE_DMA32 will be expanded to cover the rest of that memory. If such >>> + * limitations doesn't exist only ZONE_DMA32 is created. >>> + */ >> >> Shouldn't we instead only create ZONE_DMA to cover the whole 32-bit >> range and leave ZONE_DMA32 empty? Can__GFP_DMA allocations fall back >> onto ZONE_DMA32? > > Hi Catalin, thanks for the review. > > You're right, the GFP_DMA page allocation will fail with a nasty dmesg error if > ZONE_DMA is configured but empty. Unsurprisingly the opposite situation is fine > (GFP_DMA32 with an empty ZONE_DMA32). Was that tested on something other than RPi4 with more than 4GB of RAM? (i.e. with a non-empty ZONE_NORMAL either way) Robin. > I switched to the scheme you're suggesting for the next version of the series. > The comment will be something the likes of this: > > /* > * We create both a ZONE_DMA and ZONE_DMA32. ZONE_DMA's size is decided based > * on whether the SoC's peripherals are able to address the first naturally > * aligned 4 GB of ram. > * > * If limited, ZONE_DMA covers that area and ZONE_DMA32 the rest of that 32 bit > * addressable memory. > * > * If not ZONE_DMA is expanded to cover the whole 32 bit addressable memory and > * ZONE_DMA32 is left empty. > */ > > Regards, > Nicolas > >