Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Usama Arif <usamaarif642@gmail.com>
Cc: kexec@lists.infradead.org, horms@verge.net.au,
	paulmck@kernel.org, leitao@debian.org, kernel-team@meta.com
Subject: Re: [RFC] kexec: Add bootconfig support to get_command_line
Date: Fri, 22 Aug 2025 11:53:02 +0800	[thread overview]
Message-ID: <aKfpnjjKU23JNFO2@MiWiFi-R3L-srv> (raw)
In-Reply-To: <f24af1e6-509a-4a36-8b7d-0188b3a2e9e2@gmail.com>

On 08/21/25 at 12:32pm, Usama Arif wrote:
> 
> 
> On 21/08/2025 04:28, Baoquan He wrote:
> > Hi,
> > 
> > On 08/11/25 at 04:37pm, Usama Arif wrote:
> >> If the kernel is enabled with CONFIG_BOOT_CONFIG_FORCE, it will
> >> always append the bootconfig at the start of the kernel commandline.
> >> If reuse-cmdline option is used in kexec, the bootconfig will be
> >> repeatedly appended at the start of the commandline on every kexec.
> >> As there is a limit on the size of kernel commandline that can be
> >> used, --reuse-cmdline option will break kexec depending on the
> >> size of bootconfig on repeated kexec.
> >>
> >> Bootconfig is embedded in the kernel, so it should not be considered
> >> when reusing kernel command line.
> >> Modify get_command_line() to first attempt reading kernel parameters
> >> from /proc/bootconfig before falling back to /proc/cmdline. This allows
> >> kexec to use the original boot parameters without bootconfig which
> >> is embedded in the kernel.
> > 
> > Thanks for the great fix. While I have some questions about the change.
> > 
> > 1, if we can read kernel parameters from /proc/bootconfig, does it mean
> >    we will skip other kernel parameters, e.g I set some parameters in
> >    grub, meanwhile set bootconfg? Is this allowed?
> 
> Hi Baoquan,
> 
> Thanks for the questions.
> 
> /proc/bootconfig treats the parameters from bootconfig separate from the rest.
> i.e. parameters from grub will be coming after "# Parameters from bootloader:"
> in /proc/bootconfig. It shouldn't skip grub parameters. For e.g. on my machine
> 
> cat /proc/bootconfig 
> kernel.csdlock_debug = "1"
> kernel.mitigations = "off"
> # Parameters from bootloader:
> # crashkernel=.....
> 
> 
> kernel.csdlock_debug = "1"
> kernel.mitigations = "off"
> comes from bootconfig, while the crashkernel and the rest come from bootloader [1]
> 
> [1] https://elixir.bootlin.com/linux/v6.16.1/source/Documentation/filesystems/proc.rst#L739
> 
> > 
> > 2. If /proc/bootconfig includes the whole kernel parameters of the
> >    runnign kernel, setup_boot_config() will parse and append bootconfig
> >    to kernel cmdline again, right? But it doesn't matter.
> 
> /proc/bootconfig contains the whole parameters, but the bootconfig is seperated by "# Parameters from bootloader:".
> If we repeatedly kexec using /proc/cmdline, we will continuously append bootconfig,
> and wont be able to kexec anymore once the commandline gets too big..

I see, then it should be OK. I thought /proc/bootconfig only contains
the content of bootconfig, and was worried about the incomplete kernel
cmdline passing to 2nd kernel. Thanks for the explanation.

For the patch,

Acked-by: Baoquan He <bhe@redhat.com>



      reply	other threads:[~2025-08-22 11:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-11 15:37 [RFC] kexec: Add bootconfig support to get_command_line Usama Arif
2025-08-11 16:21 ` Paul E. McKenney
2025-08-20 13:01 ` Breno Leitao
2025-08-21  3:28 ` Baoquan He
2025-08-21 11:32   ` Usama Arif
2025-08-22  3:53     ` Baoquan He [this message]

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=aKfpnjjKU23JNFO2@MiWiFi-R3L-srv \
    --to=bhe@redhat.com \
    --cc=horms@verge.net.au \
    --cc=kernel-team@meta.com \
    --cc=kexec@lists.infradead.org \
    --cc=leitao@debian.org \
    --cc=paulmck@kernel.org \
    --cc=usamaarif642@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