Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2145072pxb; Fri, 25 Mar 2022 11:54:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyySuUzKtOC159q6s2hiNx3BHSfkV2S4bqotY7QzBjrnJ6gZ46jdcg0snmqjdu9gaIYlxbY X-Received: by 2002:a05:6a00:1741:b0:4fa:f5bc:30bd with SMTP id j1-20020a056a00174100b004faf5bc30bdmr8172038pfc.0.1648234442099; Fri, 25 Mar 2022 11:54:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648234442; cv=none; d=google.com; s=arc-20160816; b=hL3DK2ZA5Ct6PYPQYPJsWSAwujt0ZM0CDURB/8RERo5mFFkAEyafcmNa9SZg6fOaYH 7fN+4Dj+7QT1qv397w11KAggyHb3o2ZII0m1JYutL8c6s0SP2kIpnM3v68B5vt5OvI83 pjKPROgZHCuQ5d+x8qyPcvi6a+SOJR+mZ1iF+Bv2Yse45tkYVqrEDzNyALMA/vFWLB1v 2F69Gq2D4rJpX2+xP0YZJxU5Ke1ATzNau7DqFVEEzr104dsIIrCQZyDt7F7EMu2CPMmG UwCaAxhyEbbbMSEaC4KoLcH/y4j2ZmbuZq+DZYKqXgkHIgvHpqpZfMxK7jX0yIQ6SLbu /CCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=t5dzPMJspvn9Rj1P6ieK/fi10ncMb4Ojm10ryq6vn6I=; b=NdYmXGdULxTWaA/FZI4uVdgNyUir8Hd5WaMsLdSp5coRrlXEosEQABxodIJrAIhV7u gRHdAnhoudfxFWuKsl+zDlNwq4pt8TkJ6lon3SzkF0yYRlKzeF9Sy2mRPFWRkJmYaNk0 t9PkpjxXSnaaAw0BttARjUsjg/GGDSjMt/Xj0Fg+WqNeSNJEGwFhP6nQqjJuyUMao5Qh Y0xeQgCfM3nBB2ggbUzONpBT7ay4gzhs1fLVSLFiPFKgVLKbfcxHh8I0clISNF9O1vTj JvZnPT3A5isLJA1beiR8eo2T4IlwGRbb6yidjrNOY+kWmrlw4p4xgH2ZgUdsjPu7/WMV Ho6A== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id mh18-20020a17090b4ad200b001c680dc9e6asi7408041pjb.61.2022.03.25.11.54.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 11:54:02 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8DA891C7E94; Fri, 25 Mar 2022 11:06:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358354AbiCYFmV (ORCPT + 99 others); Fri, 25 Mar 2022 01:42:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231767AbiCYFmQ (ORCPT ); Fri, 25 Mar 2022 01:42:16 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADB2A1EEDE for ; Thu, 24 Mar 2022 22:40:41 -0700 (PDT) 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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- 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, -- 2.26.2