Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2152631rwb; Mon, 7 Nov 2022 09:44:33 -0800 (PST) X-Google-Smtp-Source: AMsMyM5h1yILTTIkZxONMVnm+fR71qEk7ybRo3Ch9aGeQ1E7UhH+is3Xstgv7a4ERAJTfQZEeOZz X-Received: by 2002:a17:90a:8a16:b0:213:bc0c:74cd with SMTP id w22-20020a17090a8a1600b00213bc0c74cdmr47113888pjn.28.1667843073321; Mon, 07 Nov 2022 09:44:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667843073; cv=none; d=google.com; s=arc-20160816; b=qRrBfOsyVLaZzjQJrJnGNgep9X5SVDTl+sFHWTLkdHPTkO4mWdgpsreRF7Ik1zRxdq vlvVmCCvxQeD7LTkGN8lPPQ9HSGocFZRjSqAdx7xdlD/UiYuJjgLabOPyHEyT/xb3sZM PogcmQUBEOKAHRfWjOcVcQ5+dN0LhCgYRjoQi+qlX6VYqaA5meJHrP6+oxg37prtND8d h3MeDiDve3t5rvzK5eBOU6XW3fO/GcUbas+VmhLN5Ml7QYpaSqM8JhWKctz0O8mxtgEG 5eZW+5lCqZp1wrqLshIPFMkT4IiDe6ZaUQ8tKneck39RUwn8HGJ8wArFnXcC9taezcLh JP7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=oTm0o2gel8XN/ZI1Li/xPMDFLSbeDoYkTt8qivUd7+g=; b=padQ7ktmS8QmL1Vy0RbD7a5SArseKDZ8QANoHF62+/qMqMZXyr6NIl+dHQ6jPD2SmE ipozTD9byizzITRh43/OW1chokiwdwIY6lkUuu77ef+1PkyYCRtjH85vIQH9GqDYWNBI oqHEmuuuR5N6TiJ382LUkxnT/o6Uj4q1V/XZOHNNe3YUlSZvD1fin87kODl2ElxW5mRA 7XQufrhWa6kzk5X9vBy+rWTbRXM5RRreZDrX5in3VNDGhZQxEPhRAVq/BoAQzWC1q5WA 050BtGLriOlH2anf7MhsbBTcvBlDSH+QGVrcSNMbP4T9qv6+NsG3FFxukCfezm2zMIav QCsA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lw14-20020a17090b180e00b0020d887ded6esi11941135pjb.120.2022.11.07.09.44.20; Mon, 07 Nov 2022 09:44:33 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231302AbiKGRS5 (ORCPT + 92 others); Mon, 7 Nov 2022 12:18:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232611AbiKGRSu (ORCPT ); Mon, 7 Nov 2022 12:18:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FC16209BF; Mon, 7 Nov 2022 09:18:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 093D0611C2; Mon, 7 Nov 2022 17:18:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B513C433C1; Mon, 7 Nov 2022 17:18:45 +0000 (UTC) Date: Mon, 7 Nov 2022 17:18:42 +0000 From: Catalin Marinas To: Zhen Lei Cc: Dave Young , Baoquan He , Vivek Goyal , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Will Deacon , linux-arm-kernel@lists.infradead.org, Jonathan Corbet , linux-doc@vger.kernel.org, "Eric W . Biederman" , Randy Dunlap , Feng Zhou , Kefeng Wang , Chen Zhou , John Donnelly , Dave Kleikamp Subject: Re: [PATCH v3 1/2] arm64: kdump: Provide default size when crashkernel=Y,low is not specified Message-ID: References: <20220711090319.1604-1-thunder.leizhen@huawei.com> <20220711090319.1604-2-thunder.leizhen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220711090319.1604-2-thunder.leizhen@huawei.com> X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 On Mon, Jul 11, 2022 at 05:03:18PM +0800, Zhen Lei wrote: > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > index 2522b11e593f239..65a2c3a22a4b57d 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -843,7 +843,7 @@ > available. > It will be ignored if crashkernel=X is specified. > crashkernel=size[KMG],low > - [KNL, X86-64] range under 4G. When crashkernel=X,high > + [KNL, X86-64, ARM64] range under 4G. When crashkernel=X,high > is passed, kernel could allocate physical memory region > above 4G, that cause second kernel crash on system > that require some amount of low memory, e.g. swiotlb > @@ -857,12 +857,6 @@ > It will be ignored when crashkernel=X,high is not used > or memory reserved is below 4G. > > - [KNL, ARM64] range in low memory. > - This one lets the user specify a low range in the > - DMA zone for the crash dump kernel. > - It will be ignored when crashkernel=X,high is not used > - or memory reserved is located in the DMA zones. > - > cryptomgr.notests > [KNL] Disable crypto self-tests > > diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c > index 339ee84e5a61a0b..5390f361208ccf7 100644 > --- a/arch/arm64/mm/init.c > +++ b/arch/arm64/mm/init.c > @@ -96,6 +96,14 @@ phys_addr_t __ro_after_init arm64_dma_phys_limit = PHYS_MASK + 1; > #define CRASH_ADDR_LOW_MAX arm64_dma_phys_limit > #define CRASH_ADDR_HIGH_MAX (PHYS_MASK + 1) > > +/* > + * This is an empirical value in x86_64 and taken here directly. Please > + * refer to the code comment in reserve_crashkernel_low() of x86_64 for more > + * details. > + */ > +#define DEFAULT_CRASH_KERNEL_LOW_SIZE \ > + max(swiotlb_size_or_default() + (8UL << 20), 256UL << 20) > + > static int __init reserve_crashkernel_low(unsigned long long low_size) > { > unsigned long long low_base; > @@ -147,7 +155,9 @@ static void __init reserve_crashkernel(void) > * is not allowed. > */ > ret = parse_crashkernel_low(cmdline, 0, &crash_low_size, &crash_base); > - if (ret && (ret != -ENOENT)) > + if (ret == -ENOENT) > + crash_low_size = DEFAULT_CRASH_KERNEL_LOW_SIZE; > + else if (ret) > return; BTW, since we want a default low allocation, I think we should change the checking logic slightly. Currently we have: if ((crash_base >= CRASH_ADDR_LOW_MAX) && crash_low_size && reserve_crashkernel_low(crash_low_size)) { ... If crash_base is just below CRASH_ADDR_LOW_MAX, we deem it sufficient but a crashkernel trying to allocate 64MB of swiotlb may fail. So maybe change this to crash_base >= CRASH_ADDR_LOW_MAX - crash_low_size. -- Catalin