2022-03-17 03:34:53

by Baoquan He

[permalink] [raw]
Subject: Re: [PATCH v21 1/5] kdump: return -ENOENT if required cmdline option does not exist

On 02/27/22 at 11:07am, Zhen Lei wrote:
> The crashkernel=Y,low is an optional command-line option. When it doesn't
> exist, kernel will try to allocate minimum required memory below 4G
> automatically. Give it a unique error code to distinguish it from other
> error scenarios.
>
> Signed-off-by: Zhen Lei <[email protected]>
> ---
> kernel/crash_core.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/kernel/crash_core.c b/kernel/crash_core.c
> index 256cf6db573cd09..4d57c03714f4e13 100644
> --- a/kernel/crash_core.c
> +++ b/kernel/crash_core.c
> @@ -243,9 +243,8 @@ static int __init __parse_crashkernel(char *cmdline,
> *crash_base = 0;
>
> ck_cmdline = get_last_crashkernel(cmdline, name, suffix);
> -
> if (!ck_cmdline)
> - return -EINVAL;
> + return -ENOENT;

Firstly, I am not sure if '-ENOENT' is a right value to return. From the
code comment of ENOENT, it's used for file or dir?
#define ENOENT 2 /* No such file or directory */

Secondly, we ever discussed the case including
- no crashkernel=,low is provided;
- messy code is provied, e.g crashkernel=aaaaaabbbb,low

The 2nd one is not handled in this patchset. How about taking the
handling into another round of patches. This patchset just adds
crashkernel=,high purely.

>
> ck_cmdline += strlen(name);
>
> --
> 2.25.1
>


2022-03-17 04:57:43

by Baoquan He

[permalink] [raw]
Subject: Re: [PATCH v21 1/5] kdump: return -ENOENT if required cmdline option does not exist

On 03/15/22 at 07:57pm, Baoquan He wrote:
> On 02/27/22 at 11:07am, Zhen Lei wrote:
> > The crashkernel=Y,low is an optional command-line option. When it doesn't
> > exist, kernel will try to allocate minimum required memory below 4G
> > automatically. Give it a unique error code to distinguish it from other
> > error scenarios.
> >
> > Signed-off-by: Zhen Lei <[email protected]>
> > ---
> > kernel/crash_core.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/kernel/crash_core.c b/kernel/crash_core.c
> > index 256cf6db573cd09..4d57c03714f4e13 100644
> > --- a/kernel/crash_core.c
> > +++ b/kernel/crash_core.c
> > @@ -243,9 +243,8 @@ static int __init __parse_crashkernel(char *cmdline,
> > *crash_base = 0;
> >
> > ck_cmdline = get_last_crashkernel(cmdline, name, suffix);
> > -
> > if (!ck_cmdline)
> > - return -EINVAL;
> > + return -ENOENT;
>
> Firstly, I am not sure if '-ENOENT' is a right value to return. From the
> code comment of ENOENT, it's used for file or dir?
> #define ENOENT 2 /* No such file or directory */
>
> Secondly, we ever discussed the case including
> - no crashkernel=,low is provided;
> - messy code is provied, e.g crashkernel=aaaaaabbbb,low

Checking the 3rd pach, this is handled. Take back my below words,
continue reviewing.

>
> The 2nd one is not handled in this patchset. How about taking the
> handling into another round of patches. This patchset just adds
> crashkernel=,high purely.
>
> >
> > ck_cmdline += strlen(name);
> >
> > --
> > 2.25.1
> >
>