Re: [PATCH 0/2] arm64: Implement CONFIG_CMDLINE_EXTEND

Will Deacon
2020-11-19T19:25:49Z

On Thu, Nov 19, 2020 at 10:56:12AM -0600, Tyler Hicks wrote:
> On 2020-11-05 09:28:38, Tyler Hicks wrote:
> > On 2020-11-05 09:58:54, Will Deacon wrote:
> > > On Wed, Nov 04, 2020 at 11:40:09PM -0600, Tyler Hicks wrote:
> > > > On 2020-11-04 12:08:12, Will Deacon wrote:
> > > > > On Tue, Nov 03, 2020 at 09:59:52AM -0600, Tyler Hicks wrote:
> > > > > > On 2020-09-21 14:15:55, Tyler Hicks wrote:
> > > > > > > Provide the CONFIG_CMDLINE_EXTEND config option for arm64 kernels. This
> > > > > > > config option can be used to extend the kernel command line parameters,
> > > > > > > specified by the bootloader, with additional command line parameters
> > > > > > > specified in the kernel configuration.
> > > > > >
> > > > > > Hi Catalin and Will - Friendly ping on this series now that we're
> > > > > > on the other side of the 5.10 merge window. I hope it can be considered
> > > > > > for 5.10+1. Let me know if I need to rebase/resubmit. Thanks!
> > > > >
> > > > > Can you use bootconfig to achieve what you need?
> > > >
> > > > Thanks for mentioning bootconfig. I hadn't considered it.
> > > >
> > > > After reading the docs and code, I see a few reasons why I can't use it
> > > > out of the box:
> > > >
> > > > 1) It requires "bootconfig" to be appended to the kernel command line.
> > > > My proposed patch series makes it possible to append new options to
> > > > the kernel command line in situations where the bootloader is not
> > > > interactive. This presents a circular dependency problem for my use
> > > > case.
> > > >
> > > > A new config option could be added to force the enablement of
> > > > bootconfig but that would sort of be a single-use duplicate of
> > > > CONFIG_CMDLINE_EXTEND's functionality.
> > > >
> > > > 2) Not all kernel command line options can be configured using
> > > > bootconfig. For example, the "nokaslr" and "crashkernel=" parameters
> > > > are parsed/handled before setup_boot_config() is called. KASLR can
> > > > be disabled via a kernel config change but there's no config option
> > > > equivalent for "crashkernel=". Changing the "crashkernel=" command
> > > > line option is something that I need to support because a
> > > > development/debug kernel build often requires a larger reservation
> > > > and we find ourselves adjusting the "crashkernel=" value fairly
> > > > often.
> > > >
> > > > 3) External FIT image build systems do not yet support bootconfig since
> > > > it is so new. It is completely fair if you file this away in your
> > > > not-my-problem folder but simple kernel config modifications, as
> > > > needed for CONFIG_CMDLINE_EXTEND, are something that every image
> > > > build system is likely to support today.
> > > >
> > > > All that said, I do really like the look of bootconfig. Unfortunately,
> > > > it doesn't let me achieve everything I need.
> > >
> > > Ok, well thanks for having a look. A follow-up question I have is how is
> > > this handled on x86? They don't appear to have CONFIG_CMDLINE_EXTEND either
> > > afaict. Is it because their bootloader story tends to be more uniform?
> >
> > x86's equivalent was implemented by commit 516cbf3730c4 ("x86, bootup:
> > add built-in kernel command line for x86 (v2)"). To summarize, you have
> > to enable CONFIG_CMDLINE_BOOL and then that lets you define built-in
> > command line parameters in CONFIG_CMDLINE. However, it is backwards in
> > that the command line provided by the bootloader is appended onto the
> > end of CONFIG_CMDLINE.
> >
> > This doesn't seem as useful to me because, using the crashkernel=
> > example from above, the bootloader provided crashkernel= value may need
> > to be overridden by the built-in command line to provide a different
> > crashkernel= value for the particular kernel build being booted. Most
> > kernel command line parameter parsers are implemented in a way that
> > supports multiple instances of the parameter while only honoring the
> > last instance.
>
> Hey Will - Do you any additional concerns that I should look into?

No, you convinced me it's useful. I just haven't found time to look at the
implementation yet!

Will