[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7f9e6b63-1727-379b-55b7-9ad2bbdb2e5b@infradead.org>
Date: Wed, 18 Nov 2020 17:06:40 -0800
From: Randy Dunlap <rdunlap@...radead.org>
To: Saeed Mirzamohammadi <saeed.mirzamohammadi@...cle.com>
Cc: john.p.donnelly@...cle.com, stable@...r.kernel.org,
Dave Young <dyoung@...hat.com>, Baoquan He <bhe@...hat.com>,
Vivek Goyal <vgoyal@...hat.com>,
Jonathan Corbet <corbet@....net>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Shawn Guo <shawnguo@...nel.org>, Li Yang <leoyang.li@....com>,
Vinod Koul <vkoul@...nel.org>, Arnd Bergmann <arnd@...db.de>,
Anson Huang <Anson.Huang@....com>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Michael Walle <michael@...le.cc>,
Krzysztof Kozlowski <krzk@...nel.org>,
Olof Johansson <olof@...om.net>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Diego Elio Pettenò <flameeyes@...meeyes.com>,
Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
kexec@...ts.infradead.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 1/1] kernel/crash_core.c - Add crashkernel=auto for x86
and ARM
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@...r.kernel.org
why?
> Signed-off-by: John Donnelly <john.p.donnelly@...cle.com>
> Signed-off-by: Saeed Mirzamohammadi <saeed.mirzamohammadi@...cle.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
Powered by blists - more mailing lists