From: Vivek Goyal <vgoyal@redhat.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
"H. Peter Anvin" <hpa@zytor.com>, WANG Chao <chaowang@redhat.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/4] x86, kdump: Change crashkernel_high/low= to crashkernel=;high/low
Date: Tue, 9 Apr 2013 09:45:44 -0400 [thread overview]
Message-ID: <20130409134544.GA6320@redhat.com> (raw)
In-Reply-To: <1365113821-22749-5-git-send-email-yinghai@kernel.org>
On Thu, Apr 04, 2013 at 03:17:01PM -0700, Yinghai Lu wrote:
[..]
> @@ -1360,37 +1369,80 @@ static int __init parse_crashkernel_simp
>
> if (*cur == '@')
> *crash_base = memparse(cur+1, &cur);
> - else if (*cur != ' ' && *cur != '\0') {
> - pr_warning("crashkernel: unrecognized char\n");
> - return -EINVAL;
> + else {
> + int i;
> +
> + /* check with known suffix */
> + for (i = 0; suffix_tbl[i]; i++)
> + if (!strncmp(cur, suffix_tbl[i], strlen(suffix_tbl[i])))
> + return 0;
> +
So crashkernel=X@Y;high is a valid syntax? Looks like we will reserve
X amount of RAM at base Y and ignore "high" or "low".
[..]
> static int __init __parse_crashkernel(char *cmdline,
> unsigned long long system_ram,
> unsigned long long *crash_size,
> unsigned long long *crash_base,
> - const char *name)
> + const char *name,
> + const char *suffix,
> + bool simple_only)
> {
> - char *p = cmdline, *ck_cmdline = NULL;
> char *first_colon, *first_space;
> + char *ck_cmdline;
>
> BUG_ON(!crash_size || !crash_base);
> *crash_size = 0;
> *crash_base = 0;
>
> - /* find crashkernel and use the last one if there are more */
> - p = strstr(p, name);
> - while (p) {
> - ck_cmdline = p;
> - p = strstr(p+1, name);
> - }
> + ck_cmdline = get_last_crashkernel(cmdline, name, suffix);
>
> if (!ck_cmdline)
> return -EINVAL;
> @@ -1403,23 +1455,30 @@ static int __init __parse_crashkernel(ch
> */
> first_colon = strchr(ck_cmdline, ':');
> first_space = strchr(ck_cmdline, ' ');
> - if (first_colon && (!first_space || first_colon < first_space))
> - return parse_crashkernel_mem(ck_cmdline, system_ram,
> - crash_size, crash_base);
> - else
> + if (first_colon && (!first_space || first_colon < first_space)) {
> + if (simple_only)
> + return -EINVAL;
> + else
> + return parse_crashkernel_mem(ck_cmdline, system_ram,
> + crash_size, crash_base);
> + } else
> return parse_crashkernel_simple(ck_cmdline, crash_size,
> crash_base);
Why don't we structure it little differently. Now we seem to have 3
categories of crashkernel= parameters.
- crashkernel_simple (crashkernel=X or crashkernel=X@Y)
- crashkernel_mem (crashkernel=range:size,.....)
- crashkerenl_high_low_suffix (crashkernel=X;high or crashkernel=Y;low)
if (suffix) {
parse_crashkernel_high_low_suffix()
} else {
if (first_colon.....)
parse_crashkernel_mem()
else
parse_crashkernel_simple();
}
And now you should not require "simple_only" function parameter and you
can also do strict syntax checking for each type of crashkernel=
parameter.
Thanks
Vivek
next prev parent reply other threads:[~2013-04-09 13:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-04 22:16 [PATCH -v3 0/4] x86, kdump: Fix crashkernel high with old kexec-tools Yinghai Lu
2013-04-04 22:16 ` [PATCH v3 1/4] x86, kdump: Set crashkernel_low automatically Yinghai Lu
2013-04-08 7:09 ` Dave Young
2013-04-08 18:37 ` Yinghai Lu
2013-04-09 3:25 ` Dave Young
2013-04-09 3:37 ` Yinghai Lu
2013-04-04 22:16 ` [PATCH v3 4/4] kexec: use Crash kernel for Crash kernel low Yinghai Lu
2013-04-04 22:17 ` [PATCH v3 2/4] x86, kdump: Retore crashkernel= to allocate under 896M Yinghai Lu
2013-04-04 22:17 ` [PATCH v3 3/4] x86, kdump: Change crashkernel_high/low= to crashkernel=;high/low Yinghai Lu
2013-04-09 13:45 ` Vivek Goyal [this message]
2013-04-09 15:00 ` H. Peter Anvin
2013-04-09 16:47 ` Vivek Goyal
2013-04-09 16:49 ` H. Peter Anvin
2013-04-09 17:00 ` Vivek Goyal
2013-04-09 17:12 ` Vivek Goyal
2013-04-09 17:20 ` H. Peter Anvin
2013-04-09 20:05 ` Yinghai Lu
2013-04-09 20:24 ` H. Peter Anvin
2013-04-09 20:29 ` Vivek Goyal
2013-04-09 20:33 ` H. Peter Anvin
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=20130409134544.GA6320@redhat.com \
--to=vgoyal@redhat.com \
--cc=chaowang@redhat.com \
--cc=ebiederm@xmission.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=yinghai@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