mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + kernel-crash_core-add-crashkernel=auto-for-vmcore-creation.patch added to -mm tree
@ 2021-03-04  0:35 akpm
  2021-03-08  1:25 ` Dave Young
  2021-04-05 22:47 ` john.p.donnelly
  0 siblings, 2 replies; 5+ messages in thread
From: akpm @ 2021-03-04  0:35 UTC (permalink / raw)
  To: andreyknvl, bhe, christian.brauner, colin.king, corbet, dyoung,
	frederic, gpiccoli, john.p.donnelly, jpoimboe, keescook,
	masahiroy, mchehab+huawei, mike.kravetz, mingo, mm-commits,
	paulmck, peterz, rdunlap, rostedt, rppt, saeed.mirzamohammadi,
	samitolvanen, sboyd, tglx, vgoyal, yifeifz2


The patch titled
     Subject: kernel/crash_core: add crashkernel=auto for vmcore creation
has been added to the -mm tree.  Its filename is
     kernel-crash_core-add-crashkernel=auto-for-vmcore-creation.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/kernel-crash_core-add-crashkernel%3Dauto-for-vmcore-creation.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/kernel-crash_core-add-crashkernel%3Dauto-for-vmcore-creation.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
Subject: kernel/crash_core: add crashkernel=auto for vmcore creation

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.

Link: https://lkml.kernel.org/r/20210223174153.72802-1-saeed.mirzamohammadi@oracle.com
Signed-off-by: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
Signed-off-by: John Donnelly <john.p.donnelly@oracle.com>
Tested-by: John Donnelly <john.p.donnelly@oracle.com>
ed-by: Dave Young <dyoung@redhat.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: "Guilherme G. Piccoli" <gpiccoli@canonical.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Cc: YiFei Zhu <yifeifz2@illinois.edu>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Sami Tolvanen <samitolvanen@google.com>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Andrey Konovalov <andreyknvl@google.com>
Cc: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 Documentation/admin-guide/kdump/kdump.rst       |    3 +-
 Documentation/admin-guide/kernel-parameters.txt |    6 ++++
 arch/Kconfig                                    |   20 ++++++++++++++
 kernel/crash_core.c                             |    7 ++++
 4 files changed, 35 insertions(+), 1 deletion(-)

--- a/arch/Kconfig~kernel-crash_core-add-crashkernel=auto-for-vmcore-creation
+++ a/arch/Kconfig
@@ -14,6 +14,26 @@ menu "General architecture-dependent opt
 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=<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
+
 config KEXEC_CORE
 	select CRASH_CORE
 	bool
--- a/Documentation/admin-guide/kdump/kdump.rst~kernel-crash_core-add-crashkernel=auto-for-vmcore-creation
+++ a/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
 =======================
--- a/Documentation/admin-guide/kernel-parameters.txt~kernel-crash_core-add-crashkernel=auto-for-vmcore-creation
+++ a/Documentation/admin-guide/kernel-parameters.txt
@@ -753,6 +753,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
--- a/kernel/crash_core.c~kernel-crash_core-add-crashkernel=auto-for-vmcore-creation
+++ a/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>
@@ -250,6 +251,12 @@ static int __init __parse_crashkernel(ch
 	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
_

Patches currently in -mm which might be from saeed.mirzamohammadi@oracle.com are

kernel-crash_core-add-crashkernel=auto-for-vmcore-creation.patch


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: + kernel-crash_core-add-crashkernel=auto-for-vmcore-creation.patch added to -mm tree
  2021-03-04  0:35 + kernel-crash_core-add-crashkernel=auto-for-vmcore-creation.patch added to -mm tree akpm
@ 2021-03-08  1:25 ` Dave Young
  2021-03-16 12:42   ` John Donnelly
  2021-04-05 22:47 ` john.p.donnelly
  1 sibling, 1 reply; 5+ messages in thread
From: Dave Young @ 2021-03-08  1:25 UTC (permalink / raw)
  To: akpm
  Cc: andreyknvl, bhe, christian.brauner, colin.king, corbet, frederic,
	gpiccoli, john.p.donnelly, jpoimboe, keescook, masahiroy,
	mchehab+huawei, mike.kravetz, mingo, mm-commits, paulmck, peterz,
	rdunlap, rostedt, rppt, saeed.mirzamohammadi, samitolvanen,
	sboyd, tglx, vgoyal, yifeifz2

Hi Andrew,

Thank you for taking this :)  But seems the Acked/Tested chain should be
corrected.
On 03/03/21 at 04:35pm, akpm@linux-foundation.org wrote:
> 
> The patch titled
>      Subject: kernel/crash_core: add crashkernel=auto for vmcore creation
> has been added to the -mm tree.  Its filename is
>      kernel-crash_core-add-crashkernel=auto-for-vmcore-creation.patch
> 
> This patch should soon appear at
>     https://ozlabs.org/~akpm/mmots/broken-out/kernel-crash_core-add-crashkernel%3Dauto-for-vmcore-creation.patch
> and later at
>     https://ozlabs.org/~akpm/mmotm/broken-out/kernel-crash_core-add-crashkernel%3Dauto-for-vmcore-creation.patch
> 
> Before you just go and hit "reply", please:
>    a) Consider who else should be cc'ed
>    b) Prefer to cc a suitable mailing list as well
>    c) Ideally: find the original patch on the mailing list and do a
>       reply-to-all to that, adding suitable additional cc's
> 
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
> 
> The -mm tree is included into linux-next and is updated
> there every 3-4 working days
> 
> ------------------------------------------------------
> From: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
> Subject: kernel/crash_core: add crashkernel=auto for vmcore creation
> 
> 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.
> 
> Link: https://lkml.kernel.org/r/20210223174153.72802-1-saeed.mirzamohammadi@oracle.com
> Signed-off-by: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
> Signed-off-by: John Donnelly <john.p.donnelly@oracle.com>
> Tested-by: John Donnelly <john.p.donnelly@oracle.com>
> ed-by: Dave Young <dyoung@redhat.com>

Seems above line is not correct, s/ed-by/Acked-by
Otherwise there is also ack from Baoquan, and Tested-by from Kairui.

> Cc: Baoquan He <bhe@redhat.com>
> Cc: Vivek Goyal <vgoyal@redhat.com>
> Cc: Jonathan Corbet <corbet@lwn.net>
> Cc: "Paul E. McKenney" <paulmck@kernel.org>
> Cc: Randy Dunlap <rdunlap@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> Cc: Mike Kravetz <mike.kravetz@oracle.com>
> Cc: "Guilherme G. Piccoli" <gpiccoli@canonical.com>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> Cc: YiFei Zhu <yifeifz2@illinois.edu>
> Cc: Josh Poimboeuf <jpoimboe@redhat.com>
> Cc: Mike Rapoport <rppt@kernel.org>
> Cc: Masahiro Yamada <masahiroy@kernel.org>
> Cc: Sami Tolvanen <samitolvanen@google.com>
> Cc: Frederic Weisbecker <frederic@kernel.org>
> Cc: Christian Brauner <christian.brauner@ubuntu.com>
> Cc: Stephen Boyd <sboyd@kernel.org>
> Cc: Andrey Konovalov <andreyknvl@google.com>
> Cc: Colin Ian King <colin.king@canonical.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>  Documentation/admin-guide/kdump/kdump.rst       |    3 +-
>  Documentation/admin-guide/kernel-parameters.txt |    6 ++++
>  arch/Kconfig                                    |   20 ++++++++++++++
>  kernel/crash_core.c                             |    7 ++++
>  4 files changed, 35 insertions(+), 1 deletion(-)
> 
> --- a/arch/Kconfig~kernel-crash_core-add-crashkernel=auto-for-vmcore-creation
> +++ a/arch/Kconfig
> @@ -14,6 +14,26 @@ menu "General architecture-dependent opt
>  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=<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
> +
>  config KEXEC_CORE
>  	select CRASH_CORE
>  	bool
> --- a/Documentation/admin-guide/kdump/kdump.rst~kernel-crash_core-add-crashkernel=auto-for-vmcore-creation
> +++ a/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
>  =======================
> --- a/Documentation/admin-guide/kernel-parameters.txt~kernel-crash_core-add-crashkernel=auto-for-vmcore-creation
> +++ a/Documentation/admin-guide/kernel-parameters.txt
> @@ -753,6 +753,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
> --- a/kernel/crash_core.c~kernel-crash_core-add-crashkernel=auto-for-vmcore-creation
> +++ a/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>
> @@ -250,6 +251,12 @@ static int __init __parse_crashkernel(ch
>  	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
> _
> 
> Patches currently in -mm which might be from saeed.mirzamohammadi@oracle.com are
> 
> kernel-crash_core-add-crashkernel=auto-for-vmcore-creation.patch
> 

Thanks
Dave


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: + kernel-crash_core-add-crashkernel=auto-for-vmcore-creation.patch added to -mm tree
  2021-03-08  1:25 ` Dave Young
@ 2021-03-16 12:42   ` John Donnelly
  0 siblings, 0 replies; 5+ messages in thread
From: John Donnelly @ 2021-03-16 12:42 UTC (permalink / raw)
  To: Dave Young, akpm
  Cc: andreyknvl, bhe, christian.brauner, colin.king, corbet, frederic,
	gpiccoli, jpoimboe, keescook, masahiroy, mchehab+huawei,
	mike.kravetz, mingo, mm-commits, paulmck, peterz, rdunlap,
	rostedt, rppt, saeed.mirzamohammadi, samitolvanen, sboyd, tglx,
	vgoyal, yifeifz2

On 3/7/21 7:25 PM, Dave Young wrote:
> Hi Andrew,
> 
> Thank you for taking this :)  But seems the Acked/Tested chain should be
> corrected.
> On 03/03/21 at 04:35pm, akpm@linux-foundation.org wrote:


Hi,

Was this resolved ? Has this feature  been promoted to a build yet ?

Thank you,

John.


>>
>> The patch titled
>>       Subject: kernel/crash_core: add crashkernel=auto for vmcore creation
>> has been added to the -mm tree.  Its filename is
>>       kernel-crash_core-add-crashkernel=auto-for-vmcore-creation.patch
>>
>> This patch should soon appear at
>>      https://urldefense.com/v3/__https://ozlabs.org/*akpm/mmots/broken-out/kernel-crash_core-add-crashkernel*3Dauto-for-vmcore-creation.patch__;fiU!!GqivPVa7Brio!JMfEfDVdzTrgoMAlSaYkEtc5MAdJCoKNyorgwfpAnJXaMccPOze91zumSEfKLaUI4tqE$
>> and later at
>>      https://urldefense.com/v3/__https://ozlabs.org/*akpm/mmotm/broken-out/kernel-crash_core-add-crashkernel*3Dauto-for-vmcore-creation.patch__;fiU!!GqivPVa7Brio!JMfEfDVdzTrgoMAlSaYkEtc5MAdJCoKNyorgwfpAnJXaMccPOze91zumSEfKLb_gfDew$
>>
>> Before you just go and hit "reply", please:
>>     a) Consider who else should be cc'ed
>>     b) Prefer to cc a suitable mailing list as well
>>     c) Ideally: find the original patch on the mailing list and do a
>>        reply-to-all to that, adding suitable additional cc's
>>
>> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
>>
>> The -mm tree is included into linux-next and is updated
>> there every 3-4 working days
>>
>> ------------------------------------------------------
>> From: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
>> Subject: kernel/crash_core: add crashkernel=auto for vmcore creation
>>
>> 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.
>>
>> Link: https://urldefense.com/v3/__https://lkml.kernel.org/r/20210223174153.72802-1-saeed.mirzamohammadi@oracle.com__;!!GqivPVa7Brio!JMfEfDVdzTrgoMAlSaYkEtc5MAdJCoKNyorgwfpAnJXaMccPOze91zumSEfKLfp-wcYj$
>> Signed-off-by: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
>> Signed-off-by: John Donnelly <john.p.donnelly@oracle.com>
>> Tested-by: John Donnelly <john.p.donnelly@oracle.com>
>> ed-by: Dave Young <dyoung@redhat.com>
> 
> Seems above line is not correct, s/ed-by/Acked-by
> Otherwise there is also ack from Baoquan, and Tested-by from Kairui.
> 
>> Cc: Baoquan He <bhe@redhat.com>
>> Cc: Vivek Goyal <vgoyal@redhat.com>
>> Cc: Jonathan Corbet <corbet@lwn.net>
>> Cc: "Paul E. McKenney" <paulmck@kernel.org>
>> Cc: Randy Dunlap <rdunlap@infradead.org>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
>> Cc: Mike Kravetz <mike.kravetz@oracle.com>
>> Cc: "Guilherme G. Piccoli" <gpiccoli@canonical.com>
>> Cc: Kees Cook <keescook@chromium.org>
>> Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
>> Cc: Ingo Molnar <mingo@kernel.org>
>> Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
>> Cc: YiFei Zhu <yifeifz2@illinois.edu>
>> Cc: Josh Poimboeuf <jpoimboe@redhat.com>
>> Cc: Mike Rapoport <rppt@kernel.org>
>> Cc: Masahiro Yamada <masahiroy@kernel.org>
>> Cc: Sami Tolvanen <samitolvanen@google.com>
>> Cc: Frederic Weisbecker <frederic@kernel.org>
>> Cc: Christian Brauner <christian.brauner@ubuntu.com>
>> Cc: Stephen Boyd <sboyd@kernel.org>
>> Cc: Andrey Konovalov <andreyknvl@google.com>
>> Cc: Colin Ian King <colin.king@canonical.com>
>> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
>> ---
>>
>>   Documentation/admin-guide/kdump/kdump.rst       |    3 +-
>>   Documentation/admin-guide/kernel-parameters.txt |    6 ++++
>>   arch/Kconfig                                    |   20 ++++++++++++++
>>   kernel/crash_core.c                             |    7 ++++
>>   4 files changed, 35 insertions(+), 1 deletion(-)
>>
>> --- a/arch/Kconfig~kernel-crash_core-add-crashkernel=auto-for-vmcore-creation
>> +++ a/arch/Kconfig
>> @@ -14,6 +14,26 @@ menu "General architecture-dependent opt
>>   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=<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
>> +
>>   config KEXEC_CORE
>>   	select CRASH_CORE
>>   	bool
>> --- a/Documentation/admin-guide/kdump/kdump.rst~kernel-crash_core-add-crashkernel=auto-for-vmcore-creation
>> +++ a/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
>>   =======================
>> --- a/Documentation/admin-guide/kernel-parameters.txt~kernel-crash_core-add-crashkernel=auto-for-vmcore-creation
>> +++ a/Documentation/admin-guide/kernel-parameters.txt
>> @@ -753,6 +753,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
>> --- a/kernel/crash_core.c~kernel-crash_core-add-crashkernel=auto-for-vmcore-creation
>> +++ a/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>
>> @@ -250,6 +251,12 @@ static int __init __parse_crashkernel(ch
>>   	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
>> _
>>
>> Patches currently in -mm which might be from saeed.mirzamohammadi@oracle.com are
>>
>> kernel-crash_core-add-crashkernel=auto-for-vmcore-creation.patch
>>
> 
> Thanks
> Dave
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: + kernel-crash_core-add-crashkernel=auto-for-vmcore-creation.patch added to -mm tree
  2021-03-04  0:35 + kernel-crash_core-add-crashkernel=auto-for-vmcore-creation.patch added to -mm tree akpm
  2021-03-08  1:25 ` Dave Young
@ 2021-04-05 22:47 ` john.p.donnelly
  2021-04-06  1:53   ` Andrew Morton
  1 sibling, 1 reply; 5+ messages in thread
From: john.p.donnelly @ 2021-04-05 22:47 UTC (permalink / raw)
  To: akpm, andreyknvl, bhe, christian.brauner, colin.king, corbet,
	dyoung, frederic, gpiccoli, jpoimboe, keescook, masahiroy,
	mchehab+huawei, mike.kravetz, mingo, mm-commits, paulmck, peterz,
	rdunlap, rostedt, rppt, saeed.mirzamohammadi, samitolvanen,
	sboyd, tglx, vgoyal, yifeifz2, John Donnelly

On 3/3/21 6:35 PM, akpm@linux-foundation.org wrote:
> 
> The patch titled
>       Subject: kernel/crash_core: add crashkernel=auto for vmcore creation
> has been added to the -mm tree.  Its filename is
>       kernel-crash_core-add-crashkernel=auto-for-vmcore-creation.patch
> 
> This patch should soon appear at
>      https://urldefense.com/v3/__https://ozlabs.org/*akpm/mmots/broken-out/kernel-crash_core-add-crashkernel*3Dauto-for-vmcore-creation.patch__;fiU!!GqivPVa7Brio!MLHY1w_3hV0y52rhRxKhKOowN74en2d227vz_f7srC7CflpUH-pI6n994y5xz_jryw2c$
> and later at
>      https://urldefense.com/v3/__https://ozlabs.org/*akpm/mmotm/broken-out/kernel-crash_core-add-crashkernel*3Dauto-for-vmcore-creation.patch__;fiU!!GqivPVa7Brio!MLHY1w_3hV0y52rhRxKhKOowN74en2d227vz_f7srC7CflpUH-pI6n994y5xz4Skx6yF$
> 
> Before you just go and hit "reply", please:
>     a) Consider who else should be cc'ed
>     b) Prefer to cc a suitable mailing list as well
>     c) Ideally: find the original patch on the mailing list and do a
>        reply-to-all to that, adding suitable additional cc's
> 
> *** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
> 
> The -mm tree is included into linux-next and is updated
> there every 3-4 working days
> 
> ------------------------------------------------------
> From: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
> Subject: kernel/crash_core: add crashkernel=auto for vmcore creation
> 
> 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.
> 
> Link: https://urldefense.com/v3/__https://lkml.kernel.org/r/20210223174153.72802-1-saeed.mirzamohammadi@oracle.com__;!!GqivPVa7Brio!MLHY1w_3hV0y52rhRxKhKOowN74en2d227vz_f7srC7CflpUH-pI6n994y5xz1KwmmHx$
> Signed-off-by: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
> Signed-off-by: John Donnelly <john.p.donnelly@oracle.com>
> Tested-by: John Donnelly <john.p.donnelly@oracle.com>
> ed-by: Dave Young <dyoung@redhat.com>
> Cc: Baoquan He <bhe@redhat.com>
> Cc: Vivek Goyal <vgoyal@redhat.com>
> Cc: Jonathan Corbet <corbet@lwn.net>
> Cc: "Paul E. McKenney" <paulmck@kernel.org>
> Cc: Randy Dunlap <rdunlap@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> Cc: Mike Kravetz <mike.kravetz@oracle.com>
> Cc: "Guilherme G. Piccoli" <gpiccoli@canonical.com>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> Cc: YiFei Zhu <yifeifz2@illinois.edu>
> Cc: Josh Poimboeuf <jpoimboe@redhat.com>
> Cc: Mike Rapoport <rppt@kernel.org>
> Cc: Masahiro Yamada <masahiroy@kernel.org>
> Cc: Sami Tolvanen <samitolvanen@google.com>
> Cc: Frederic Weisbecker <frederic@kernel.org>
> Cc: Christian Brauner <christian.brauner@ubuntu.com>
> Cc: Stephen Boyd <sboyd@kernel.org>
> Cc: Andrey Konovalov <andreyknvl@google.com>
> Cc: Colin Ian King <colin.king@canonical.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
> 
>   Documentation/admin-guide/kdump/kdump.rst       |    3 +-
>   Documentation/admin-guide/kernel-parameters.txt |    6 ++++
>   arch/Kconfig                                    |   20 ++++++++++++++
>   kernel/crash_core.c                             |    7 ++++
>   4 files changed, 35 insertions(+), 1 deletion(-)
> 
> --- a/arch/Kconfig~kernel-crash_core-add-crashkernel=auto-for-vmcore-creation
> +++ a/arch/Kconfig
> @@ -14,6 +14,26 @@ menu "General architecture-dependent opt
>   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=<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
> +
>   config KEXEC_CORE
>   	select CRASH_CORE
>   	bool
> --- a/Documentation/admin-guide/kdump/kdump.rst~kernel-crash_core-add-crashkernel=auto-for-vmcore-creation
> +++ a/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
>   =======================
> --- a/Documentation/admin-guide/kernel-parameters.txt~kernel-crash_core-add-crashkernel=auto-for-vmcore-creation
> +++ a/Documentation/admin-guide/kernel-parameters.txt
> @@ -753,6 +753,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
> --- a/kernel/crash_core.c~kernel-crash_core-add-crashkernel=auto-for-vmcore-creation
> +++ a/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>
> @@ -250,6 +251,12 @@ static int __init __parse_crashkernel(ch
>   	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
> _
> 
> Patches currently in -mm which might be from saeed.mirzamohammadi@oracle.com are
> 
> kernel-crash_core-add-crashkernel=auto-for-vmcore-creation.patch
> 


Hi,

When  will this appear in a build ?

Thank you,

John.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: + kernel-crash_core-add-crashkernel=auto-for-vmcore-creation.patch added to -mm tree
  2021-04-05 22:47 ` john.p.donnelly
@ 2021-04-06  1:53   ` Andrew Morton
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2021-04-06  1:53 UTC (permalink / raw)
  To: john.p.donnelly
  Cc: andreyknvl, bhe, christian.brauner, colin.king, corbet, dyoung,
	frederic, gpiccoli, jpoimboe, keescook, masahiroy,
	mchehab+huawei, mike.kravetz, mingo, mm-commits, paulmck, peterz,
	rdunlap, rostedt, rppt, saeed.mirzamohammadi, samitolvanen,
	sboyd, tglx, vgoyal, yifeifz2

On Mon, 5 Apr 2021 17:47:21 -0500 john.p.donnelly@oracle.com wrote:

> > Patches currently in -mm which might be from saeed.mirzamohammadi@oracle.com are
> > 
> > kernel-crash_core-add-crashkernel=auto-for-vmcore-creation.patch
> > 
> 
> 
> Hi,
> 
> When  will this appear in a build ?

It's in linux-next now and I expect it will appear in Linus's tree for
5.13-r1.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-06  1:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-04  0:35 + kernel-crash_core-add-crashkernel=auto-for-vmcore-creation.patch added to -mm tree akpm
2021-03-08  1:25 ` Dave Young
2021-03-16 12:42   ` John Donnelly
2021-04-05 22:47 ` john.p.donnelly
2021-04-06  1:53   ` Andrew Morton

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).