linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
Cc: john.p.donnelly@oracle.com, stable@vger.kernel.org,
	"Dave Young" <dyoung@redhat.com>, "Baoquan He" <bhe@redhat.com>,
	"Vivek Goyal" <vgoyal@redhat.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Will Deacon" <will@kernel.org>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	"Bjorn Andersson" <bjorn.andersson@linaro.org>,
	"Shawn Guo" <shawnguo@kernel.org>, "Li Yang" <leoyang.li@nxp.com>,
	"Vinod Koul" <vkoul@kernel.org>, "Arnd Bergmann" <arnd@arndb.de>,
	"Anson Huang" <Anson.Huang@nxp.com>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Michael Walle" <michael@walle.cc>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Olof Johansson" <olof@lixom.net>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	"Diego Elio Pettenò" <flameeyes@flameeyes.com>,
	"Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
	kexec@lists.infradead.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/1] kernel/crash_core.c - Add crashkernel=auto for x86 and ARM
Date: Wed, 18 Nov 2020 17:06:40 -0800	[thread overview]
Message-ID: <7f9e6b63-1727-379b-55b7-9ad2bbdb2e5b@infradead.org> (raw)
In-Reply-To: <20201118232431.21832-1-saeed.mirzamohammadi@oracle.com>

Hi,

On 11/18/20 3:24 PM, Saeed Mirzamohammadi wrote:
> This adds crashkernel=auto feature to configure reserved memory for
> vmcore creation to both x86 and ARM platforms based on the total memory
> size.
> 
> Cc: stable@vger.kernel.org

why?

> Signed-off-by: John Donnelly <john.p.donnelly@oracle.com>
> Signed-off-by: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
> ---
>  Documentation/admin-guide/kdump/kdump.rst |  5 +++++
>  arch/arm64/Kconfig                        | 26 ++++++++++++++++++++++-
>  arch/arm64/configs/defconfig              |  1 +
>  arch/x86/Kconfig                          | 26 ++++++++++++++++++++++-
>  arch/x86/configs/x86_64_defconfig         |  1 +
>  kernel/crash_core.c                       | 20 +++++++++++++++--
>  6 files changed, 75 insertions(+), 4 deletions(-)
> 

> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 1515f6f153a0..d359dcffa80e 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig

> @@ -1135,6 +1135,30 @@ config CRASH_DUMP
>  
>  	  For more details see Documentation/admin-guide/kdump/kdump.rst
>  
> +if CRASH_DUMP
> +
> +config CRASH_AUTO_STR
> +        string "Memory reserved for crash kernel"

use tab instead of spaces above.

> +	depends on CRASH_DUMP
> +        default "1G-64G:128M,64G-1T:256M,1T-:512M"

ditto.

> +	help
> +	  This configures the reserved memory dependent
> +	  on the value of System RAM. The syntax is:
> +	  crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@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
> +
> +endif # CRASH_DUMP
> +
>  config XEN_DOM0
>  	def_bool y
>  	depends on XEN

> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index f6946b81f74a..bacd17312bb1 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig

> @@ -2049,6 +2049,30 @@ config CRASH_DUMP
>  	  (CONFIG_RELOCATABLE=y).
>  	  For more details see Documentation/admin-guide/kdump/kdump.rst
>  
> +if CRASH_DUMP
> +
> +config CRASH_AUTO_STR
> +        string "Memory reserved for crash kernel" if X86_64

ditto.

> +	depends on CRASH_DUMP
> +        default "1G-64G:128M,64G-1T:256M,1T-:512M"

ditto.

> +	help
> +	  This configures the reserved memory dependent
> +	  on the value of System RAM. The syntax is:
> +	  crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@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
> +
> +endif # CRASH_DUMP
> +
>  config KEXEC_JUMP
>  	bool "kexec jump"
>  	depends on KEXEC && HIBERNATION

> diff --git a/kernel/crash_core.c b/kernel/crash_core.c
> index 106e4500fd53..a44cd9cc12c4 100644
> --- a/kernel/crash_core.c
> +++ b/kernel/crash_core.c
> @@ -7,6 +7,7 @@
>  #include <linux/crash_core.h>
>  #include <linux/utsname.h>
>  #include <linux/vmalloc.h>
> +#include <linux/kexec.h>
>  
>  #include <asm/page.h>
>  #include <asm/sections.h>
> @@ -41,6 +42,15 @@ static int __init parse_crashkernel_mem(char *cmdline,
>  					unsigned long long *crash_base)
>  {
>  	char *cur = cmdline, *tmp;
> +	unsigned long long total_mem = system_ram;
> +
> +	/*
> +	 * Firmware sometimes reserves some memory regions for it's own use.

	                                                       its

> +	 * so we get less than actual system memory size.
> +	 * Workaround this by round up the total size to 128M which is
> +	 * enough for most test cases.
> +	 */
> +	total_mem = roundup(total_mem, SZ_128M);


thanks.
-- 
~Randy


  reply	other threads:[~2020-11-19  1:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 23:24 [PATCH 1/1] kernel/crash_core.c - Add crashkernel=auto for x86 and ARM Saeed Mirzamohammadi
2020-11-19  1:06 ` Randy Dunlap [this message]
2020-11-19 20:16   ` Saeed Mirzamohammadi
2020-11-19  6:09 ` Kairui Song
2020-11-19 20:52   ` Saeed Mirzamohammadi
     [not found]   ` <AC36B9BC-654C-4FC1-8EA3-94B986639F1E@oracle.com>
2020-11-20  9:34     ` Kairui Song
2020-11-22 15:32       ` Guilherme Piccoli
2020-11-23  3:47         ` Dave Young
2021-01-21 15:32           ` john.p.donnelly
2021-01-22  1:22             ` Dave Young
2021-01-22  3:12               ` Dave Young
     [not found]                 ` <730EBE33-5571-49C0-AF38-08C49736EB70@oracle.com>
2021-01-23  3:51                   ` Dave Young
2021-01-23  3:57                     ` Dave Young
2020-11-19 21:56 ` Guilherme Piccoli
2020-11-20  2:26   ` Dave Young

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f9e6b63-1727-379b-55b7-9ad2bbdb2e5b@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=Anson.Huang@nxp.com \
    --cc=arnd@arndb.de \
    --cc=bhe@redhat.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=corbet@lwn.net \
    --cc=dyoung@redhat.com \
    --cc=flameeyes@flameeyes.com \
    --cc=geert+renesas@glider.be \
    --cc=hpa@zytor.com \
    --cc=john.p.donnelly@oracle.com \
    --cc=kexec@lists.infradead.org \
    --cc=krzk@kernel.org \
    --cc=leoyang.li@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michael@walle.cc \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=mingo@redhat.com \
    --cc=olof@lixom.net \
    --cc=saeed.mirzamohammadi@oracle.com \
    --cc=shawnguo@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=vgoyal@redhat.com \
    --cc=vkoul@kernel.org \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).