From patchwork Fri Mar 24 13:18:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 74537 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp624616vqo; Fri, 24 Mar 2023 06:27:53 -0700 (PDT) X-Google-Smtp-Source: AKy350Z28g1r9i479gRJJfA/PL2yLBTJpxxxYv4ZP1xPKR74eGJ8sQ76kr0nEi81XAV/QNoO8RxW X-Received: by 2002:a17:906:478a:b0:930:fded:5bf2 with SMTP id cw10-20020a170906478a00b00930fded5bf2mr3325723ejc.52.1679664473679; Fri, 24 Mar 2023 06:27:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679664473; cv=none; d=google.com; s=arc-20160816; b=I0OnHpmVMnbPN6Vb7FM9E9O915c9Mtr+OoeWZMZ5Ny/GhKhlPtcwV5/lurtOx/+DTM G16hcepsZ+othP9IFKD0/jskO3N7IOLkre30o9G/A/soOIGcoyASTh5PdpKldjZSrqXb JJIbx7gHboib7m+sEh7F4KA192oqeCisAzI7MSI0CTPzmRxQtcnsM7W18xg21e38ujer 4csNAoFrVRfxfeJV6UdRUkAOXuKJ28/v27/1Cp20BiwU2Qpj6yjxMGtx9Wuhwm4KMHlj sHz020r6jiZP1+hZqnpjUSEzeLv97L3alIA48YiIFAGgjMuBM1a3vtMffx/EC6jonkOo wVXQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LJ2yqGl1dqMrrwi5w6gpxIhSEUS+wEm3daG74vQ+ZWo=; b=ex2MGSWNfzrHxaZaJsbN+vbf905NB39mvOq6QbVhL983lPGYkzpFChOCWy4sdDGk4Q o/Xm7biR48LVlYk+8tTSSX6jogKD4blrut1aR23eCDl5PyFxQpFO9x/p8CHvq0SnZWpd DQT6qG5APpT3rZjzO9L1rBDCmgZnsItapgCY4k/1kJ7+ZbsNaUL0MVr8VbcGJd1uxLIo YBY2oJsz1gDpul3/JDQeInz7sk+Q4kM1ZH6rcGA+Wg1WuSTuwg0kB9tJ2r22kV6OYjom 5YCkzVbuGzs8SjSFJHRxXTEtqFdeQxtuIDkPsjnVwKRH8J6VrEU4SiNDIEkAVX7BEVg1 uf2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SJOKT5Vg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g10-20020aa7c84a000000b005021d17243csi1971164edt.259.2023.03.24.06.27.30; Fri, 24 Mar 2023 06:27:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SJOKT5Vg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232032AbjCXNT4 (ORCPT + 99 others); Fri, 24 Mar 2023 09:19:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232038AbjCXNTt (ORCPT ); Fri, 24 Mar 2023 09:19:49 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C4F0199B for ; Fri, 24 Mar 2023 06:19:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679663939; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LJ2yqGl1dqMrrwi5w6gpxIhSEUS+wEm3daG74vQ+ZWo=; b=SJOKT5Vg+HrdN1gpREgUU1fKn/qanwHZMR1gSlahryCQUAfQmSQnncA5zt103EUt4rMdqf 8SjkOMc8NSFQoSMXQ2LUGU39BcZKKi2guQOwi3rjCsPPiDO3C8D4mFCMFyqUx8UMvPefbc ss1r9NNEoG3DcKvxsv3fAxXNoMP5lmY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-639-YFzlrtPDMX2bsaJljY9CHg-1; Fri, 24 Mar 2023 09:18:54 -0400 X-MC-Unique: YFzlrtPDMX2bsaJljY9CHg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BAF4B801779; Fri, 24 Mar 2023 13:18:53 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-55.pek2.redhat.com [10.72.12.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4D35492B0A; Fri, 24 Mar 2023 13:18:48 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: catalin.marinas@arm.com, horms@kernel.org, thunder.leizhen@huawei.com, John.p.donnelly@oracle.com, will@kernel.org, kexec@lists.infradead.org, ardb@kernel.org, rppt@kernel.org, linux-arm-kernel@lists.infradead.org, Baoquan He Subject: [PATCH 1/3] arm64: kdump : take off the protection on crashkernel memory region Date: Fri, 24 Mar 2023 21:18:36 +0800 Message-Id: <20230324131838.409996-2-bhe@redhat.com> In-Reply-To: <20230324131838.409996-1-bhe@redhat.com> References: <20230324131838.409996-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761255719957201954?= X-GMAIL-MSGID: =?utf-8?q?1761255855256590904?= Problem: ======= On arm64, block and section mapping is supported to build page tables. However, currently it enforces to take base page mapping for the whole linear mapping if CONFIG_ZONE_DMA or CONFIG_ZONE_DMA32 is enabled and crashkernel kernel parameter is set. This will cause longer time of the linear mapping process during bootup and severe performance degradation during running time. Root cause: ========== On arm64, crashkernel reservation relies on knowing the upper limit of low memory zone because it needs to reserve memory in the zone so that devices' DMA addressing in kdump kernel can be satisfied. However, the upper limit of low memory on arm64 is variant. And the upper limit can only be decided late till bootmem_init() is called [1]. And we need to map the crashkernel region with base page granularity when doing linear mapping, because kdump needs to protect the crashkernel region via set_memory_valid(,0) after kdump kernel loading. However, arm64 doesn't support well on splitting the built block or section mapping due to some cpu reststriction [2]. And unfortunately, the linear mapping is done before bootmem_init(). To resolve the above conflict on arm64, the compromise is enforcing to take base page mapping for the entire linear mapping if crashkernel is set, and CONFIG_ZONE_DMA or CONFIG_ZONE_DMA32 is enabed. Hence performance is sacrificed. Solution: ========= Comparing with the base page mapping for the whole linear region, it's better to take off the protection on crashkernel memory region for the time being because the anticipated stamping on crashkernel memory region could only happen in a chance in one million, while the base page mapping for the whole linear region is mitigating arm64 systems with crashkernel set always. [1] https://lore.kernel.org/all/YrIIJkhKWSuAqkCx@arm.com/T/#u [2] https://lore.kernel.org/linux-arm-kernel/20190911182546.17094-1-nsaenzjulienne@suse.de/T/ Signed-off-by: Baoquan He Reviewed-by: Zhen Lei --- arch/arm64/include/asm/kexec.h | 6 ------ arch/arm64/kernel/machine_kexec.c | 20 -------------------- 2 files changed, 26 deletions(-) diff --git a/arch/arm64/include/asm/kexec.h b/arch/arm64/include/asm/kexec.h index 559bfae26715..9ac9572a3bbe 100644 --- a/arch/arm64/include/asm/kexec.h +++ b/arch/arm64/include/asm/kexec.h @@ -102,12 +102,6 @@ void cpu_soft_restart(unsigned long el2_switch, unsigned long entry, int machine_kexec_post_load(struct kimage *image); #define machine_kexec_post_load machine_kexec_post_load - -void arch_kexec_protect_crashkres(void); -#define arch_kexec_protect_crashkres arch_kexec_protect_crashkres - -void arch_kexec_unprotect_crashkres(void); -#define arch_kexec_unprotect_crashkres arch_kexec_unprotect_crashkres #endif #define ARCH_HAS_KIMAGE_ARCH diff --git a/arch/arm64/kernel/machine_kexec.c b/arch/arm64/kernel/machine_kexec.c index ce3d40120f72..22da7fc1ff50 100644 --- a/arch/arm64/kernel/machine_kexec.c +++ b/arch/arm64/kernel/machine_kexec.c @@ -268,26 +268,6 @@ void machine_crash_shutdown(struct pt_regs *regs) pr_info("Starting crashdump kernel...\n"); } -void arch_kexec_protect_crashkres(void) -{ - int i; - - for (i = 0; i < kexec_crash_image->nr_segments; i++) - set_memory_valid( - __phys_to_virt(kexec_crash_image->segment[i].mem), - kexec_crash_image->segment[i].memsz >> PAGE_SHIFT, 0); -} - -void arch_kexec_unprotect_crashkres(void) -{ - int i; - - for (i = 0; i < kexec_crash_image->nr_segments; i++) - set_memory_valid( - __phys_to_virt(kexec_crash_image->segment[i].mem), - kexec_crash_image->segment[i].memsz >> PAGE_SHIFT, 1); -} - #ifdef CONFIG_HIBERNATION /* * To preserve the crash dump kernel image, the relevant memory segments From patchwork Fri Mar 24 13:18:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 74539 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp628686vqo; Fri, 24 Mar 2023 06:33:23 -0700 (PDT) X-Google-Smtp-Source: AKy350ZGkXhE+TA0FgztzbXzkhXpClYSm0uHQjHmTMCd6Sh78xJGIfAXlqWnebPCgDO1R/Cmzv13 X-Received: by 2002:a17:906:5d14:b0:92f:e7e2:b7b3 with SMTP id g20-20020a1709065d1400b0092fe7e2b7b3mr3587280ejt.5.1679664803071; Fri, 24 Mar 2023 06:33:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679664803; cv=none; d=google.com; s=arc-20160816; b=nqeE5ARF3/xSrrYtPxLkmAPKdJWt7sslO5/T/zuXn5USM8Pqn3fNKOY1y7tWl7Ycwe TdhkBoWw2vaGMQ5DyRVitQKeG5jfR55OKDdNEIY90YC1LWt6aA7lR3f80QbXJxi9A4/H 4uGQ4CQGcDZtMo00p8uwHQ9Wzec3AsJr8bpDAEQVzwRCoPSpjY6slFtPbIiOWkA8L0C3 JiflBQLUs0xFB2i8iIFeP078acV+IfJnaGYz90JANlx8ZRQZvsDYogL/BLL70ql5OePB G5tRkoSSeKwrfuSvHF9IPKIx3QzNhILzKsrG+wjJ2DEaIITK1P1D878qlM5h4t0odo5r a/vQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Z4Zd3FmSQrP8VoTRAz/Dsw0uzW+X7SUiRpwEnvcStdA=; b=snDcABHBYhbwj2qHysPncUrAGnV9ASfATiDpIGVzKjSsly8zHml2kdEFFtbmuL1b0r uhdzv1wy1exnsZV2AWthZLAs6ZjdjYGzq/t8xm9hcjQCp5Mrz46z6LAqphmIzHIOD9EK RbqtVva6rEnXpoB/lFdPWTwvJbkJyKNw+WzBas6i3ziV5rvdGMjWVBssJC4eR9zjookd gT7mLhNYPFn19YtRcagGg5Sx48CGhjBtTgF3D6PczYuDqc8g+wfSYcsrlTxkuH2emyuH mZGI4oQ8KosMHPHtEUT9jshwLPjkfz2GCVKyjtMkziwjFEMI+WxTxIQvSu94YYV2+J5b T/TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Y/KDxXYs"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l9-20020a170906938900b0092451ed6ef8si5595154ejx.932.2023.03.24.06.32.59; Fri, 24 Mar 2023 06:33:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Y/KDxXYs"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232033AbjCXNUD (ORCPT + 99 others); Fri, 24 Mar 2023 09:20:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232027AbjCXNT4 (ORCPT ); Fri, 24 Mar 2023 09:19:56 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8650F22A2B for ; Fri, 24 Mar 2023 06:19:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679663945; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z4Zd3FmSQrP8VoTRAz/Dsw0uzW+X7SUiRpwEnvcStdA=; b=Y/KDxXYsHG/uSVzwTDNnAfYXNwlPGNyhSL9GHKK4TaD7aB2zbDOyCNM0DiETapqjP3MZ5j rKBi9FptLup7vPSF29jPYXFnR470ShbhACxupsuDbSjHZWtLemMF8xOEUQlwfbjAqCyzNz 1Y6StnvQ/vyTuosSytNvX3p/ksEGUBU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-47-z8XOSbReN6mdSQbmi5IqRQ-1; Fri, 24 Mar 2023 09:19:00 -0400 X-MC-Unique: z8XOSbReN6mdSQbmi5IqRQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C5B5E185A794; Fri, 24 Mar 2023 13:18:59 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-55.pek2.redhat.com [10.72.12.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8CC6D492B0A; Fri, 24 Mar 2023 13:18:54 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: catalin.marinas@arm.com, horms@kernel.org, thunder.leizhen@huawei.com, John.p.donnelly@oracle.com, will@kernel.org, kexec@lists.infradead.org, ardb@kernel.org, rppt@kernel.org, linux-arm-kernel@lists.infradead.org, Baoquan He Subject: [PATCH 2/3] arm64: kdump: do not map crashkernel region specifically Date: Fri, 24 Mar 2023 21:18:37 +0800 Message-Id: <20230324131838.409996-3-bhe@redhat.com> In-Reply-To: <20230324131838.409996-1-bhe@redhat.com> References: <20230324131838.409996-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761256200562140073?= X-GMAIL-MSGID: =?utf-8?q?1761256200562140073?= After taking off the protection functions on crashkernel memory region, there's no need to map crashkernel region with page granularity during linear mapping. With this change, the system can make use of block or section mapping on linear region to largely improve perforcemence during system bootup and running. Signed-off-by: Baoquan He Reviewed-by: Zhen Lei --- arch/arm64/mm/mmu.c | 43 ------------------------------------------- 1 file changed, 43 deletions(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 6f9d8898a025..7556020a27b7 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -510,21 +510,6 @@ void __init mark_linear_text_alias_ro(void) PAGE_KERNEL_RO); } -static bool crash_mem_map __initdata; - -static int __init enable_crash_mem_map(char *arg) -{ - /* - * Proper parameter parsing is done by reserve_crashkernel(). We only - * need to know if the linear map has to avoid block mappings so that - * the crashkernel reservations can be unmapped later. - */ - crash_mem_map = true; - - return 0; -} -early_param("crashkernel", enable_crash_mem_map); - static void __init map_mem(pgd_t *pgdp) { static const u64 direct_map_end = _PAGE_END(VA_BITS_MIN); @@ -554,16 +539,6 @@ static void __init map_mem(pgd_t *pgdp) */ memblock_mark_nomap(kernel_start, kernel_end - kernel_start); -#ifdef CONFIG_KEXEC_CORE - if (crash_mem_map) { - if (defer_reserve_crashkernel()) - flags |= NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS; - else if (crashk_res.end) - memblock_mark_nomap(crashk_res.start, - resource_size(&crashk_res)); - } -#endif - /* map all the memory banks */ for_each_mem_range(i, &start, &end) { if (start >= end) @@ -590,24 +565,6 @@ static void __init map_mem(pgd_t *pgdp) __map_memblock(pgdp, kernel_start, kernel_end, PAGE_KERNEL, NO_CONT_MAPPINGS); memblock_clear_nomap(kernel_start, kernel_end - kernel_start); - - /* - * Use page-level mappings here so that we can shrink the region - * in page granularity and put back unused memory to buddy system - * through /sys/kernel/kexec_crash_size interface. - */ -#ifdef CONFIG_KEXEC_CORE - if (crash_mem_map && !defer_reserve_crashkernel()) { - if (crashk_res.end) { - __map_memblock(pgdp, crashk_res.start, - crashk_res.end + 1, - PAGE_KERNEL, - NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS); - memblock_clear_nomap(crashk_res.start, - resource_size(&crashk_res)); - } - } -#endif } void mark_rodata_ro(void) From patchwork Fri Mar 24 13:18:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 74538 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp628278vqo; Fri, 24 Mar 2023 06:32:49 -0700 (PDT) X-Google-Smtp-Source: AKy350buvAZSZWnSuK1jCRzyxhjBCVfDqvuWjayhHi5QFbDt0RzupZklKUcNxnmSkgKo0LRwHCxG X-Received: by 2002:a17:903:2308:b0:1a1:c7b2:e7c7 with SMTP id d8-20020a170903230800b001a1c7b2e7c7mr3045952plh.49.1679664768780; Fri, 24 Mar 2023 06:32:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679664768; cv=none; d=google.com; s=arc-20160816; b=ReWhbRQ2iPQQfvTzylJhJfL/h3kZe9edi0cuaJXOD6gSgBYY1TTiZ6JedylBSEIGzI 1ixVrzbJgCVQupquvZ2EiBwMjYvxPsCxHreg0tagsZZxhM8rOI69xjafKgeKV1E7ScP7 q37eBW7vVdLVWpuffsiJ/ed6ySmztE7anw9gWOWgAutYuhk3kyb5mPMLp4SrxNs5lmGd QXhpGtXZQsQeIl9ckHYokfPCXaUFcxk/nVCyCS+sRm5ooAffhY6l3OuETA01RZAJhhjv M4ly9lRkHiLGOpOxVnLcYezdoAv/Lw8tRsUZi5de3cresaDBSf2S6tEiejsowAnnunZ/ dxkw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oqnpIZ5GkpM+kmmJnZqA1o1ZNLYJuti4DYPr6Ni2jEw=; b=uX3fypMGFHqgnr3v3l72dXYqX7dzNrtxxSXB2g4HkZxU37FO8K7SSlw23vwrZnIfCV 47asTfKoZYOxDCDmwlrgt3GRFNWT3cq1gZECeuC6kcZxLImr6iKsamf9EXaCGZsfK2qa yqoxKIOydzNYZAWGOn1oc7GyIHvfKES5i0q0cuHNgXyKX/4kEZoa7obJM9yAWVIA+kbP bmjhkK8j6zYc91B1fkajfJd7zONkxZWDot0wmkMfLMRql37cbOLkfb52+cI4ATzE01fp aKr6FQtr7vAZpRsciBHDTzV69aaYfwtdyYj+m9OOiYAo9kCYD39bipVPlvqxNUULx/wo 1T8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=N515RUu9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j12-20020a170902da8c00b0019ec2a63408si22247496plx.477.2023.03.24.06.32.32; Fri, 24 Mar 2023 06:32:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=N515RUu9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232039AbjCXNUF (ORCPT + 99 others); Fri, 24 Mar 2023 09:20:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232038AbjCXNT5 (ORCPT ); Fri, 24 Mar 2023 09:19:57 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5864B233CF for ; Fri, 24 Mar 2023 06:19:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679663951; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oqnpIZ5GkpM+kmmJnZqA1o1ZNLYJuti4DYPr6Ni2jEw=; b=N515RUu9ALD4Xv2eZt+IlhJqSrWciRQanYwShqZVpdphHun0N1hnhJnMKSP8p//kDHbcnN MVZse3FhPsJIYcTXopTHDYGTmAn5RolGZcqhCloWH9ikcmismlYjE3ebB6CrSeRtklwbRy PwjLCnONnIf7Wa3KVbF07C9cGHCkClU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-553-GK-E1deeOayVA85ZKw2nlA-1; Fri, 24 Mar 2023 09:19:06 -0400 X-MC-Unique: GK-E1deeOayVA85ZKw2nlA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B647A801206; Fri, 24 Mar 2023 13:19:05 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-55.pek2.redhat.com [10.72.12.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B494492B0A; Fri, 24 Mar 2023 13:19:00 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: catalin.marinas@arm.com, horms@kernel.org, thunder.leizhen@huawei.com, John.p.donnelly@oracle.com, will@kernel.org, kexec@lists.infradead.org, ardb@kernel.org, rppt@kernel.org, linux-arm-kernel@lists.infradead.org, Baoquan He Subject: [PATCH 3/3] arm64: kdump: defer the crashkernel reservation for platforms with no DMA memory zones Date: Fri, 24 Mar 2023 21:18:38 +0800 Message-Id: <20230324131838.409996-4-bhe@redhat.com> In-Reply-To: <20230324131838.409996-1-bhe@redhat.com> References: <20230324131838.409996-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761256164453158432?= X-GMAIL-MSGID: =?utf-8?q?1761256164453158432?= In commit 031495635b46 ("arm64: Do not defer reserve_crashkernel() for platforms with no DMA memory zones"), reserve_crashkernel() is called much earlier in arm64_memblock_init() to avoid causing base apge mapping on platforms with no DMA meomry zones. With taking off protection on crashkernel memory region, no need to call reserve_crashkernel() specially in advance. The deferred invocation of reserve_crashkernel() in bootmem_init() can cover all cases. Signed-off-by: Baoquan He --- arch/arm64/include/asm/memory.h | 5 ----- arch/arm64/mm/init.c | 6 +----- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index 78e5163836a0..efcd68154a3a 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -374,11 +374,6 @@ static inline void *phys_to_virt(phys_addr_t x) }) void dump_mem_limit(void); - -static inline bool defer_reserve_crashkernel(void) -{ - return IS_ENABLED(CONFIG_ZONE_DMA) || IS_ENABLED(CONFIG_ZONE_DMA32); -} #endif /* !ASSEMBLY */ /* diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 58a0bb2c17f1..b888de59e0b7 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -408,9 +408,6 @@ void __init arm64_memblock_init(void) early_init_fdt_scan_reserved_mem(); - if (!defer_reserve_crashkernel()) - reserve_crashkernel(); - high_memory = __va(memblock_end_of_DRAM() - 1) + 1; } @@ -457,8 +454,7 @@ void __init bootmem_init(void) * request_standard_resources() depends on crashkernel's memory being * reserved, so do it here. */ - if (defer_reserve_crashkernel()) - reserve_crashkernel(); + reserve_crashkernel(); memblock_dump_all(); }