Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Philipp Rudo <prudo@redhat.com>
To: Sven Schnelle <svens@linux.ibm.com>
Cc: Simon Horman <horms@verge.net.au>,
	kexec@lists.infradead.org,
	Alexander Egorenkov <egorenar@linux.ibm.com>
Subject: Re: [PATCH 3/3] s390: add support for --reuse-cmdline
Date: Tue, 7 Dec 2021 15:34:04 +0100	[thread overview]
Message-ID: <20211207153404.4ff7f7fd@rhtmp> (raw)
In-Reply-To: <20211122071401.3106858-4-svens@linux.ibm.com>

Hi Sven,

makes absolutely sense to have this option. One problem though...

On Mon, 22 Nov 2021 08:14:01 +0100
Sven Schnelle <svens@linux.ibm.com> wrote:

> --reuse-cmdline reads the command line of the currently
> running kernel from /proc/cmdline and uses that for the
> kernel that should be kexec'd.
> 
> Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
> Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
> ---
>  kexec/arch/s390/include/arch/options.h | 10 ++++++----
>  kexec/arch/s390/kexec-image.c          |  9 +++++++++
>  2 files changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/kexec/arch/s390/include/arch/options.h b/kexec/arch/s390/include/arch/options.h
> index 76044a301ceb..b030b61d61be 100644
[...]
> diff --git a/kexec/arch/s390/kexec-image.c b/kexec/arch/s390/kexec-image.c
> index dbeb689b830a..310d967ea331 100644
> --- a/kexec/arch/s390/kexec-image.c
> +++ b/kexec/arch/s390/kexec-image.c
> @@ -72,6 +72,10 @@ int image_s390_load_file(int argc, char **argv, struct kexec_info *info)
>  		case OPT_RAMDISK:
>  			ramdisk = optarg;
>  			break;
> +		case OPT_REUSE_CMDLINE:
> +			free(command_line);
> +			command_line = get_command_line();

get_command_line reads a maximum of 2048 bytes from /prc/cmdline. With
the configurable size on s390 defaulting to 4096 bytes this will
ultimately cause problems. So you need to make get_command_line more
flexible first.

Thanks
Philipp

> +			break;
>  		}
>  	}
>  
> @@ -123,6 +127,10 @@ image_s390_load(int argc, char **argv, const char *kernel_buf,
>  			if (command_line_add(optarg))
>  				return -1;
>  			break;
> +		case OPT_REUSE_CMDLINE:
> +			free(command_line);
> +			command_line = get_command_line();
> +			break;
>  		case OPT_RAMDISK:
>  			ramdisk = optarg;
>  			break;
> @@ -223,5 +231,6 @@ image_s390_usage(void)
>  	printf("--command-line=STRING Set the kernel command line to STRING.\n"
>  	       "--append=STRING       Set the kernel command line to STRING.\n"
>  	       "--initrd=FILENAME     Use the file FILENAME as a ramdisk.\n"
> +	       "--reuse-cmdline       Use kernel command line from running system.\n"
>  		);
>  }


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2021-12-07 14:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22  7:13 [PATCH 0/3] s390: add support for extended cmdline length Sven Schnelle
2021-11-22  7:13 ` [PATCH 1/3] s390: add variable command line size Sven Schnelle
2021-12-07 14:29   ` Philipp Rudo
2021-12-07 16:06     ` Sven Schnelle
2021-11-22  7:14 ` [PATCH 2/3] s390: use KEXEC_ALL_OPTIONS Sven Schnelle
2021-11-22  7:14 ` [PATCH 3/3] s390: add support for --reuse-cmdline Sven Schnelle
2021-12-07 14:34   ` Philipp Rudo [this message]
2021-12-07 16:12     ` Sven Schnelle

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=20211207153404.4ff7f7fd@rhtmp \
    --to=prudo@redhat.com \
    --cc=egorenar@linux.ibm.com \
    --cc=horms@verge.net.au \
    --cc=kexec@lists.infradead.org \
    --cc=svens@linux.ibm.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