From patchwork Fri Mar 25 05:53:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 12791293 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 10689C433FE for ; Fri, 25 Mar 2022 05:42:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=VzDiEha7hqs4B9Edqb2EpzAfL8PHc1CR1f4QGDBGt3k=; b=B1LEdfqvdsp49x +1vDGW9DCiouRQ55IpvU2E3RaLpT+7ErQNSxNdLny/37fnjmDJ9+wsU8qPuzNpZlOLAnMvxAVA0n8 XH8Hkr+NMiu2ZlN0ya5cmTUXWND6xMN5t8Prai206lvfIwl/61JCYZvNdHYQU3V2hCJHdFDb4mObo oOYL+ohmZgP2mN8W9EfRq1Tc86tz/dNbNSriqdlhtlGUSh5nFbNlcRqAnboSbg85zI/gjBJ+8gzIl G0MjezlLmiJFQTKuUsFCGOv5dyP0Hys/phmpee+myJLQKPgTcxwa74Ziuivbq2seSYK+wGKs1rtf+ 2H9ZYc76LnfX+MwIxbbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nXch4-001BJW-7Z; Fri, 25 Mar 2022 05:41:02 +0000 Received: from szxga08-in.huawei.com ([45.249.212.255]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nXcgp-001BCT-DN for linux-arm-kernel@lists.infradead.org; Fri, 25 Mar 2022 05:40:49 +0000 Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4KPrXX3mNMz1GD3Q; Fri, 25 Mar 2022 13:40:28 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Fri, 25 Mar 2022 13:40:39 +0800 Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Fri, 25 Mar 2022 13:40:38 +0800 From: Kefeng Wang To: Catalin Marinas , Will Deacon , , CC: Kefeng Wang , Vijay Balakrishna , Pasha Tatashin Subject: [PATCH 1/2] arm64: mm: Do not defer reserve_crashkernel() if only ZONE_DMA32 Date: Fri, 25 Mar 2022 13:53:14 +0800 Message-ID: <20220325055315.25671-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220324_224047_828803_ED08524E X-CRM114-Status: GOOD ( 12.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The kernel could be benifit due to BLOCK_MAPPINGS, see commit 031495635b46 ("arm64: Do not defer reserve_crashkernel() for platforms with no DMA memory zones"), if there is only with ZONE_DMA32, we could set arm64_dma_phys_limit to max_zone_phys(32) earlier in arm64_memblock_init(), then we will benifit too. Cc: Vijay Balakrishna Cc: Pasha Tatashin Cc: Will Deacon Signed-off-by: Kefeng Wang Reviewed-by: Vijay Balakrishna --- arch/arm64/mm/init.c | 18 ++++++++++-------- arch/arm64/mm/mmu.c | 6 ++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 8ac25f19084e..9dded8779d72 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -157,14 +157,14 @@ static phys_addr_t __init max_zone_phys(unsigned int zone_bits) return min(zone_mask, memblock_end_of_DRAM() - 1) + 1; } +phys_addr_t __ro_after_init dma32_phys_limit; static void __init zone_sizes_init(unsigned long min, unsigned long max) { unsigned long max_zone_pfns[MAX_NR_ZONES] = {0}; - unsigned int __maybe_unused acpi_zone_dma_bits; - unsigned int __maybe_unused dt_zone_dma_bits; - phys_addr_t __maybe_unused dma32_phys_limit = max_zone_phys(32); - #ifdef CONFIG_ZONE_DMA + unsigned int acpi_zone_dma_bits; + unsigned int dt_zone_dma_bits; + acpi_zone_dma_bits = fls64(acpi_iort_dma_get_max_cpu_address()); dt_zone_dma_bits = fls64(of_dma_get_max_cpu_address(NULL)); zone_dma_bits = min3(32U, dt_zone_dma_bits, acpi_zone_dma_bits); @@ -173,8 +173,6 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max) #endif #ifdef CONFIG_ZONE_DMA32 max_zone_pfns[ZONE_DMA32] = PFN_DOWN(dma32_phys_limit); - if (!arm64_dma_phys_limit) - arm64_dma_phys_limit = dma32_phys_limit; #endif max_zone_pfns[ZONE_NORMAL] = max; @@ -336,8 +334,12 @@ void __init arm64_memblock_init(void) early_init_fdt_scan_reserved_mem(); - if (!IS_ENABLED(CONFIG_ZONE_DMA) && !IS_ENABLED(CONFIG_ZONE_DMA32)) + dma32_phys_limit = max_zone_phys(32); + if (!IS_ENABLED(CONFIG_ZONE_DMA)) { + if (IS_ENABLED(CONFIG_ZONE_DMA32)) + arm64_dma_phys_limit = dma32_phys_limit; reserve_crashkernel(); + } high_memory = __va(memblock_end_of_DRAM() - 1) + 1; } @@ -385,7 +387,7 @@ void __init bootmem_init(void) * request_standard_resources() depends on crashkernel's memory being * reserved, so do it here. */ - if (IS_ENABLED(CONFIG_ZONE_DMA) || IS_ENABLED(CONFIG_ZONE_DMA32)) + if (IS_ENABLED(CONFIG_ZONE_DMA)) reserve_crashkernel(); memblock_dump_all(); diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 626ec32873c6..23734481318a 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -529,8 +529,7 @@ static void __init map_mem(pgd_t *pgdp) #ifdef CONFIG_KEXEC_CORE if (crash_mem_map) { - if (IS_ENABLED(CONFIG_ZONE_DMA) || - IS_ENABLED(CONFIG_ZONE_DMA32)) + if (IS_ENABLED(CONFIG_ZONE_DMA)) flags |= NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS; else if (crashk_res.end) memblock_mark_nomap(crashk_res.start, @@ -571,8 +570,7 @@ static void __init map_mem(pgd_t *pgdp) * through /sys/kernel/kexec_crash_size interface. */ #ifdef CONFIG_KEXEC_CORE - if (crash_mem_map && - !IS_ENABLED(CONFIG_ZONE_DMA) && !IS_ENABLED(CONFIG_ZONE_DMA32)) { + if (crash_mem_map && !IS_ENABLED(CONFIG_ZONE_DMA)) { if (crashk_res.end) { __map_memblock(pgdp, crashk_res.start, crashk_res.end + 1, From patchwork Fri Mar 25 05:53:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 12791292 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A0D94C433EF for ; Fri, 25 Mar 2022 05:41:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=j3OJMZDkjMiu7E97h8ENbsOazaekWSSjeUmPpn2ntOg=; b=bOW/MRK2DnUpS+ O32Yswz3/znovdyspbF/g5gQhril+Z9PZ5tr993/5CK0tNfZ3S8WTMZfxdYB0gZtvrCMM56KVVlUX ILiZwqRiM9d1mNfa+LRjlwQBmwrbGoShW0L1q9QkGazmV+Bazj6WcHgYanBVoKZ/oy3FjyvnNwGCM NnWBgzriKXgO0cZnvazFh0CG9dSaYYQuTw7a3O68L1oJzGF/dldKA9XC+ktVhF7rk/AOCRVrOC7SZ ZDX1sfUwXe80wB980aTWOVJ361CngHeNj1ft0XhMwQKK9BVrrD0f2e+vOgmYazQ/V4JXO4SFHPNRh GVUF6RBelA7pjXlRhphw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nXcgt-001BFS-Fl; Fri, 25 Mar 2022 05:40:51 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nXcgp-001BCY-MT for linux-arm-kernel@lists.infradead.org; Fri, 25 Mar 2022 05:40:49 +0000 Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KPrVG6T9GzCrp8; Fri, 25 Mar 2022 13:38:30 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Fri, 25 Mar 2022 13:40:39 +0800 Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Fri, 25 Mar 2022 13:40:39 +0800 From: Kefeng Wang To: Catalin Marinas , Will Deacon , , CC: Kefeng Wang Subject: [PATCH 2/2] arm64: mm: Cleanup useless parameters in zone_sizes_init() Date: Fri, 25 Mar 2022 13:53:15 +0800 Message-ID: <20220325055315.25671-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220325055315.25671-1-wangkefeng.wang@huawei.com> References: <20220325055315.25671-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220324_224047_948917_F5E4E14F X-CRM114-Status: UNSURE ( 9.89 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Directly use max_pfn for max and no one use min, kill them. Signed-off-by: Kefeng Wang --- arch/arm64/mm/init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 9dded8779d72..eacb38c2d225 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -158,7 +158,7 @@ static phys_addr_t __init max_zone_phys(unsigned int zone_bits) } phys_addr_t __ro_after_init dma32_phys_limit; -static void __init zone_sizes_init(unsigned long min, unsigned long max) +static void __init zone_sizes_init(void) { unsigned long max_zone_pfns[MAX_NR_ZONES] = {0}; #ifdef CONFIG_ZONE_DMA @@ -174,7 +174,7 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max) #ifdef CONFIG_ZONE_DMA32 max_zone_pfns[ZONE_DMA32] = PFN_DOWN(dma32_phys_limit); #endif - max_zone_pfns[ZONE_NORMAL] = max; + max_zone_pfns[ZONE_NORMAL] = max_pfn; free_area_init(max_zone_pfns); } @@ -376,7 +376,7 @@ void __init bootmem_init(void) * done after the fixed reservations */ sparse_init(); - zone_sizes_init(min, max); + zone_sizes_init(); /* * Reserve the CMA area after arm64_dma_phys_limit was initialised.