From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FDF6C433FF for ; Thu, 1 Aug 2019 16:08:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A714206B8 for ; Thu, 1 Aug 2019 16:08:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731660AbfHAQH7 (ORCPT ); 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 > > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51F25C19759 for ; Thu, 1 Aug 2019 16:08:34 +0000 (UTC) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2BF66206B8 for ; Thu, 1 Aug 2019 16:08:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2BF66206B8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id E432D62DB; Thu, 1 Aug 2019 16:08:33 +0000 (UTC) Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 94A23431D for ; Thu, 1 Aug 2019 16:07:59 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id 35FC08B0 for ; Thu, 1 Aug 2019 16:07:59 +0000 (UTC) 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 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-Language: en-GB Cc: phill@raspberryi.org, devicetree@vger.kernel.org, f.fainelli@gmail.com, linux-mm@kvack.org, marc.zyngier@arm.com, Will Deacon , linux-kernel@vger.kernel.org, eric@anholt.net, iommu@lists.linux-foundation.org, robh+dt@kernel.org, linux-rpi-kernel@lists.infradead.org, mbrugger@suse.com, akpm@linux-foundation.org, frowand.list@gmail.com, hch@lst.de, linux-arm-kernel@lists.infradead.org, wahrenst@gmx.net X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: iommu-bounces@lists.linux-foundation.org Errors-To: iommu-bounces@lists.linux-foundation.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 > > _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0866C433FF for ; Thu, 1 Aug 2019 16:08:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B6B90206B8 for ; Thu, 1 Aug 2019 16:08:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OvFjpGbE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B6B90206B8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=271H/YqBKrbgCUyY5EyJeW8Q13zF11X0LzQml56Ag4Y=; b=OvFjpGbE2aKC5JjWYOScMqzLz ih5b9Hoy8OA2ATc1SxCcTt9+xNCwWV3hXobuGcI6Fu4NXEoDfLDxxZ7bGk5ecuBuqwUMvoVgsUz1B mOjnmIZLQEF+46vLWV9CsVSDl+nzh9XAlXV27wPStJ+8YubT6l8IqHGqkH1H9JLF9mS/TKQUrvSTs QuBUDc3H1hxFBddt982a+NN0tN+1cOCZ8QqMScWUy/6RK9M2HeqUWD/JyfKalQljaEhwdM+rCw7CC 4+NiD7ehk+gFMe0Me766phLyJvJU35jmnxKIGsZB5hLC4+zuiAZZ9ChWu/NEL6mKC+h3bouc2+rbf 7bWIAn12Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1htDcX-0006E8-VS; Thu, 01 Aug 2019 16:08:01 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1htDcV-0006Dj-Cn; Thu, 01 Aug 2019 16:08:00 +0000 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 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-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190801_090759_482684_0F49EE72 X-CRM114-Status: GOOD ( 19.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: phill@raspberryi.org, devicetree@vger.kernel.org, f.fainelli@gmail.com, linux-mm@kvack.org, marc.zyngier@arm.com, Will Deacon , linux-kernel@vger.kernel.org, eric@anholt.net, iommu@lists.linux-foundation.org, robh+dt@kernel.org, linux-rpi-kernel@lists.infradead.org, mbrugger@suse.com, akpm@linux-foundation.org, m.szyprowski@samsung.com, frowand.list@gmail.com, hch@lst.de, linux-arm-kernel@lists.infradead.org, wahrenst@gmx.net Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel