Re: [PATCH v2] bootconfig: Apply early options from embedded config
From: Google
Date: Mon Mar 30 2026 - 20:01:53 EST
On Mon, 30 Mar 2026 06:15:17 -0700
Breno Leitao <leitao@xxxxxxxxxx> wrote:
> On Fri, Mar 27, 2026 at 10:37:44PM +0900, Masami Hiramatsu wrote:
> > On Fri, 27 Mar 2026 03:06:41 -0700
> > Breno Leitao <leitao@xxxxxxxxxx> wrote:
>
> > > > To fix this, we need to change setup_arch() for each architecture so
> > > > that it calls this bootconfig_apply_early_params().
> > >
> > > Could we instead integrate this into parse_early_param() itself? That
> > > approach would avoid the need to modify each architecture individually.
> >
> > Ah, indeed.
>
> I investigated integrating bootconfig into parse_early_param() and hit a
> blocker: xbc_init() and xbc_make_cmdline() depend on memblock_alloc(), but on
> most architectures (x86, arm64, arm, s390, riscv) parse_early_param() is called
> from setup_arch() _before_ memblock is initialized.
Yeah, that's right.
>
> So, bootconfig will not be available as early as parse_early_param().
>
> An alternative is replace memblock allocations in lib/bootconfig.c with static
> __initdata buffers, similar to Petr's approach in 2023:
>
> https://lore.kernel.org/all/20231121231342.193646-3-oss@xxxxxxxxx/
>
> But, there was concerns about the allocation size:
>
> Petr Malat <oss@xxxxxxxxx> wrote:
> > To allow handling of early options, it's necessary to eliminate allocations
> > from embedded bootconfig handling
>
> "Hm, my concern is that this can introduce some sort of overhead to parse the bootconfig."
>
As far as we can correctly handle the early params and it is limited only
with the embedded bootconfig, I think it is OK to allocate it statically.
Thank you,
--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>