public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Dave Young <dyoung@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, kexec@lists.infradead.org,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Neil Horman <nhorman@redhat.com>, Ingo Molnar <mingo@kernel.org>,
	Vivek Goyal <vgoyal@redhat.com>, Tony Luck <tony.luck@intel.com>,
	Anton Vorontsov <avorontsov@ru.mvista.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Hari Bathini <hbathini@linux.vnet.ibm.com>,
	dzickus@redhat.com, bhe@redhat.com
Subject: Re: [PATCH] kdump: add default crashkernel reserve kernel config options
Date: Thu, 24 May 2018 11:41:58 -0500	[thread overview]
Message-ID: <87bmd53t0p.fsf@xmission.com> (raw)
In-Reply-To: <20180524014234.GA2031@dhcp-128-65.nay.redhat.com> (Dave Young's message of "Thu, 24 May 2018 09:42:34 +0800")

Dave Young <dyoung@redhat.com> writes:

> Hi Eric,
> On 05/23/18 at 10:53am, Eric W. Biederman wrote:
>> Dave Young <dyoung@redhat.com> writes:
>> 
>> > [snip]
>> >
>> >> >  
>> >> > +config CRASHKERNEL_DEFAULT_THRESHOLD_MB
>> >> > +	int "System memory size threshold for kdump memory default reserving"
>> >> > +	depends on CRASH_CORE
>> >> > +	default 0
>> >> > +	help
>> >> > +	  CRASHKERNEL_DEFAULT_MB is used as default crashkernel value if
>> >> > +	  the system memory size is equal or bigger than the threshold.
>> >> 
>> >> "the threshold" is rather vague.  Can it be clarified?
>> >> 
>> >> In fact I'm really struggling to understand the logic here....
>> >> 
>> >> 
>> >> > +config CRASHKERNEL_DEFAULT_MB
>> >> > +	int "Default crashkernel memory size reserved for kdump"
>> >> > +	depends on CRASH_CORE
>> >> > +	default 0
>> >> > +	help
>> >> > +	  This is used as the default kdump reserved memory size in MB.
>> >> > +	  crashkernel=X kernel cmdline can overwrite this value.
>> >> > +
>> >> >  config HAVE_IMA_KEXEC
>> >> >  	bool
>> >> >  
>> >> > @@ -143,6 +144,24 @@ static int __init parse_crashkernel_simp
>> >> >  	return 0;
>> >> >  }
>> >> >  
>> >> > +static int __init get_crashkernel_default(unsigned long long system_ram,
>> >> > +					  unsigned long long *size)
>> >> > +{
>> >> > +	unsigned long long sz = CONFIG_CRASHKERNEL_DEFAULT_MB;
>> >> > +	unsigned long long thres = CONFIG_CRASHKERNEL_DEFAULT_THRESHOLD_MB;
>> >> > +
>> >> > +	thres *= SZ_1M;
>> >> > +	sz *= SZ_1M;
>> >> > +
>> >> > +	if (sz >= system_ram || system_ram < thres) {
>> >> > +		pr_debug("crashkernel default size can not be used.\n");
>> >> > +		return -EINVAL;
>> >> 
>> >> In other words,
>> >> 
>> >> 	if (system_ram <= CONFIG_CRASHKERNEL_DEFAULT_MB ||
>> >> 	    system_ram < CONFIG_CRASHKERNEL_DEFAULT_THRESHOLD_MB)
>> >> 		fail;
>> >> 
>> >> yes?
>> >> 
>> >> How come?  What's happening here?  Perhaps a (good) explanatory comment
>> >> is needed.  And clearer Kconfig text.
>> >> 
>> >> All confused :(
>> >
>> > Andrew, I tuned it a bit, removed the check of sz >= system_ram, so if
>> > the size is too large and kernel can not find enough memory it will
>> > still fail in latter code.
>> >
>> > Is below version looks clearer?
>> 
>> What is the advantage of providing this in a kconfig option rather
>> than on the kernel command line as we can now?
>
> It is not a replacement of the cmdline, this can be a supplement to
> the crashkernel command line.  For a lot of common use cases if we have
> the auto reservation user just do not need to manually set the cmdline
> for example on a virtual machine and usual setup (except of the
> comlicate storage and very large machines).  The crashkernel=auto
> has been used for long time, Red Hat QE tested it on a lot of different
> lab machines and proved it works well.  Kdump usually just works so admin
> do little work to enable kdump.
>
> But the crashkernel=auto implementation has some drawbacks that is it
> is more like embed policy in the code and it is not flexible like a
> config option.

Have you considered using the builtin command line aka CONFIG_CMDLINE?
If as you are reserving a fixed amount of memory as your patch does that
should be sufficient, and doable without any kernel changes.

Eric

  reply	other threads:[~2018-05-24 16:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-21  2:53 [PATCH] kdump: add default crashkernel reserve kernel config options Dave Young
2018-05-21 19:02 ` Andrew Morton
2018-05-22  1:43   ` Dave Young
2018-05-22  1:48   ` Dave Young
2018-05-23  7:06   ` Dave Young
2018-05-23 15:53     ` Eric W. Biederman
2018-05-23 20:22       ` Petr Tesarik
2018-05-24  1:49         ` Dave Young
2018-05-24  6:57           ` Petr Tesarik
2018-05-24  7:26             ` Dave Young
2018-05-24  7:39               ` Dave Young
2018-05-24  7:56               ` Dave Young
2018-05-24  8:29                 ` Baoquan He
2018-05-24  9:02               ` Petr Tesarik
2018-05-24  7:31             ` Baoquan He
2018-05-24 16:34             ` Eric W. Biederman
2018-05-25  4:59               ` Petr Tesarik
2018-05-25 20:00                 ` Eric W. Biederman
2018-05-28 12:34                   ` Petr Tesarik
2018-05-29 12:19                     ` Eric W. Biederman
2018-05-24  1:42       ` Dave Young
2018-05-24 16:41         ` Eric W. Biederman [this message]
2018-05-25  2:43           ` 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=87bmd53t0p.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=akpm@linux-foundation.org \
    --cc=avorontsov@ru.mvista.com \
    --cc=benh@kernel.crashing.org \
    --cc=bhe@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=dzickus@redhat.com \
    --cc=hbathini@linux.vnet.ibm.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=nhorman@redhat.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=tony.luck@intel.com \
    --cc=vgoyal@redhat.com \
    --cc=xiyou.wangcong@gmail.com \
    /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