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 <b...@redhat.com>


Reply via email to