Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp64255pxb; Tue, 23 Feb 2021 18:10:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJy93a7KnvT8pMDgLqLD6Os2Ki44kzRILo23gICgDIN/OlZk/hWM4KKySr7NCQhUzm3W8JwC X-Received: by 2002:aa7:dd07:: with SMTP id i7mr25893869edv.191.1614132656590; Tue, 23 Feb 2021 18:10:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614132656; cv=none; d=google.com; s=arc-20160816; b=kbaIGA0DThRFGm4RyyF2qFyde+ISLAn/CW5M6klFu6trnHvldzLHFq7/uxftaQvnFH eKu59KuMrWya2lv1vfrAxNWULgmrYo5gpIGaRh/+lPSHc2/7SrEHkHKrkFqB7aHztmpw dvnApSZ+Au9fsSck7gGtZ6d87dPPruQIqRIht0FYMHRrGMuu9m57QUMj35AzfU+0hA4+ eRiMdvUIJmmZBFuhwA8JWoc7AF+7/0w0gFXDd7O+cmI5zcKjzQpoLjqJsXC+pxx3k/uw 6xQ0XiD+mmH9gOoutWavrHE+l3d8WQkMpA1ubrs97lv1jPFaHOfgA2O7t1z/+lxPYpt5 OlHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=LdBX1usnZ8DORWQSdKhftp19ZlKzEc7iUOkDPD+x3mA=; b=0i/VJcdj/MJ3L3mG1FKDieAKjTHDUN9HKmb41cjqigXyf6RrjHcKG/1srq+NhL+5hk i37v4Ni4wndaRjSb6JI72mfo0gTk7gIDDwEkngGK0Gtk691qydd1qvhMMONYSGGKHAKa OLbTMeqHzqb0cszmbEPtTTdeHf9Uv7EBaiMtZYPc6phYHO65tOhUM2VN17+uk7l3miQg ZyCLg4ekZZQx1FgdlKdosYY4SYl2Zjs0eLa3a6e6lwDAwrq9PAeUeYI6AmApMZ0w8X/s GyBdaTxbeAyexME6Uirrko9bEt7AAlTm+Lv1ud0qg4LnzDblsjNacRBn0b8rQTfiMLdU iKcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ME+VVozj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mm25si363870ejb.487.2021.02.23.18.10.33; Tue, 23 Feb 2021 18:10:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ME+VVozj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S229954AbhBXCIs (ORCPT + 99 others); Tue, 23 Feb 2021 21:08:48 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:60771 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230429AbhBXCIp (ORCPT ); Tue, 23 Feb 2021 21:08:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614132438; 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: in-reply-to:in-reply-to:references:references; bh=LdBX1usnZ8DORWQSdKhftp19ZlKzEc7iUOkDPD+x3mA=; b=ME+VVozjbypKEGI5CqlqvNuyFJ5sekd5CihhE0I5feSTHtkttEFz5qIFMHZ/nI0o113v10 UlNuARQLGAtJcQTQpeaStsIT7vfnr6Fq7FKIKor+EIqniChGiFhuLfYt8QJnolRSUHZQ5t JxDVNz3ssHzsp35paT5mRqIRrca9yxg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-300-75PnVOfLOiWJj979R0zp9A-1; Tue, 23 Feb 2021 21:07:14 -0500 X-MC-Unique: 75PnVOfLOiWJj979R0zp9A-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AC45C835E22; Wed, 24 Feb 2021 02:07:10 +0000 (UTC) Received: from localhost (ovpn-12-189.pek2.redhat.com [10.72.12.189]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E97F260C43; Wed, 24 Feb 2021 02:07:06 +0000 (UTC) Date: Wed, 24 Feb 2021 10:07:04 +0800 From: Baoquan He To: Saeed Mirzamohammadi , Andrew Morton Cc: John Donnelly , Dave Young , Vivek Goyal , Jonathan Corbet , "Paul E. McKenney" , Randy Dunlap , Thomas Gleixner , Mauro Carvalho Chehab , Mike Kravetz , "Guilherme G. Piccoli" , Kees Cook , "Peter Zijlstra (Intel)" , Ingo Molnar , "Steven Rostedt (VMware)" , YiFei Zhu , Josh Poimboeuf , Mike Rapoport , Masahiro Yamada , Sami Tolvanen , Frederic Weisbecker , Christian Brauner , Stephen Boyd , Andrey Konovalov , Colin Ian King , kexec@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 1/1] kernel/crash_core: Add crashkernel=auto for vmcore creation Message-ID: <20210224020704.GD3553@MiWiFi-R3L-srv> References: <20210223174153.72802-1-saeed.mirzamohammadi@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210223174153.72802-1-saeed.mirzamohammadi@oracle.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/23/21 at 09:41am, Saeed Mirzamohammadi wrote: > This adds crashkernel=auto feature to configure reserved memory for > vmcore creation. CONFIG_CRASH_AUTO_STR is defined to be set for > different kernel distributions and different archs based on their > needs. > > Signed-off-by: Saeed Mirzamohammadi > Signed-off-by: John Donnelly > Tested-by: John Donnelly Looks good, thx. Acked-by: Baoquan He By the way, please provide changelog in the future. That can help people know better what's happened during patch reviewing and evolution. Thanks Baoquan > --- > Documentation/admin-guide/kdump/kdump.rst | 3 ++- > .../admin-guide/kernel-parameters.txt | 6 ++++++ > arch/Kconfig | 20 +++++++++++++++++++ > kernel/crash_core.c | 7 +++++++ > 4 files changed, 35 insertions(+), 1 deletion(-) > > diff --git a/Documentation/admin-guide/kdump/kdump.rst b/Documentation/admin-guide/kdump/kdump.rst > index 75a9dd98e76e..ae030111e22a 100644 > --- a/Documentation/admin-guide/kdump/kdump.rst > +++ b/Documentation/admin-guide/kdump/kdump.rst > @@ -285,7 +285,8 @@ This would mean: > 2) if the RAM size is between 512M and 2G (exclusive), then reserve 64M > 3) if the RAM size is larger than 2G, then reserve 128M > > - > +Or you can use crashkernel=auto to choose the crash kernel memory size > +based on the recommended configuration set for each arch. > > Boot into System Kernel > ======================= > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > index 9e3cdb271d06..a5deda5c85fe 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -747,6 +747,12 @@ > a memory unit (amount[KMG]). See also > Documentation/admin-guide/kdump/kdump.rst for an example. > > + crashkernel=auto > + [KNL] This parameter will set the reserved memory for > + the crash kernel based on the value of the CRASH_AUTO_STR > + that is the best effort estimation for each arch. See also > + arch/Kconfig for further details. > + > crashkernel=size[KMG],high > [KNL, X86-64] range could be above 4G. Allow kernel > to allocate physical memory region from top, so could > diff --git a/arch/Kconfig b/arch/Kconfig > index 24862d15f3a3..23d047548772 100644 > --- a/arch/Kconfig > +++ b/arch/Kconfig > @@ -14,6 +14,26 @@ menu "General architecture-dependent options" > config CRASH_CORE > bool > > +config CRASH_AUTO_STR > + string "Memory reserved for crash kernel" > + depends on CRASH_CORE > + default "1G-64G:128M,64G-1T:256M,1T-:512M" > + help > + This configures the reserved memory dependent > + on the value of System RAM. The syntax is: > + crashkernel=:[,:,...][@offset] > + range=start-[end] > + > + For example: > + crashkernel=512M-2G:64M,2G-:128M > + > + This would mean: > + > + 1) if the RAM is smaller than 512M, then don't reserve anything > + (this is the "rescue" case) > + 2) if the RAM size is between 512M and 2G (exclusive), then reserve 64M > + 3) if the RAM size is larger than 2G, then reserve 128M > + > config KEXEC_CORE > select CRASH_CORE > bool > diff --git a/kernel/crash_core.c b/kernel/crash_core.c > index 825284baaf46..90f9e4bb6704 100644 > --- a/kernel/crash_core.c > +++ b/kernel/crash_core.c > @@ -7,6 +7,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -250,6 +251,12 @@ static int __init __parse_crashkernel(char *cmdline, > if (suffix) > return parse_crashkernel_suffix(ck_cmdline, crash_size, > suffix); > +#ifdef CONFIG_CRASH_AUTO_STR > + if (strncmp(ck_cmdline, "auto", 4) == 0) { > + ck_cmdline = CONFIG_CRASH_AUTO_STR; > + pr_info("Using crashkernel=auto, the size chosen is a best effort estimation.\n"); > + } > +#endif > /* > * if the commandline contains a ':', then that's the extended > * syntax -- if not, it must be the classic syntax > -- > 2.27.0 >