public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* [trace:bootconfig/for-next 16/16] init/main.c:437:20: warning: stack frame size (4192) exceeds limit (2048) in 'bootconfig_apply_early_params'
@ 2026-03-25  2:37 kernel test robot
  2026-03-25  6:52 ` Masami Hiramatsu
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2026-03-25  2:37 UTC (permalink / raw)
  To: Breno Leitao; +Cc: llvm, oe-kbuild-all, Masami Hiramatsu (Google)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace bootconfig/for-next
head:   1a427f2a710583872b6176ea8378e0a1a8719fc4
commit: 1a427f2a710583872b6176ea8378e0a1a8719fc4 [16/16] bootconfig: Apply early options from embedded config
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20260325/202603251010.5Ui0yrB2-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260325/202603251010.5Ui0yrB2-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603251010.5Ui0yrB2-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> init/main.c:437:20: warning: stack frame size (4192) exceeds limit (2048) in 'bootconfig_apply_early_params' [-Wframe-larger-than]
     437 | static void __init bootconfig_apply_early_params(void)
         |                    ^
   1 warning generated.


vim +/bootconfig_apply_early_params +437 init/main.c

   416	
   417	/*
   418	 * do_early_param() is defined later in this file but called from
   419	 * bootconfig_apply_early_params() below, so we need a forward declaration.
   420	 */
   421	static int __init do_early_param(char *param, char *val,
   422					 const char *unused, void *arg);
   423	
   424	/*
   425	 * bootconfig_apply_early_params - dispatch kernel.* keys from the embedded
   426	 * bootconfig as early_param() calls.
   427	 *
   428	 * early_param() handlers must run before most of the kernel initialises
   429	 * (e.g. before the GIC driver reads irqchip.gicv3_pseudo_nmi).  A bootconfig
   430	 * attached to the initrd arrives too late for this because the initrd is not
   431	 * mapped yet when early params are processed.  The embedded bootconfig lives
   432	 * in the kernel image itself (.init.data), so it is always reachable.
   433	 *
   434	 * This function is called from setup_boot_config() which runs in
   435	 * start_kernel() before parse_early_param(), making the timing correct.
   436	 */
 > 437	static void __init bootconfig_apply_early_params(void)
   438	{
   439		char val_buf[COMMAND_LINE_SIZE];
   440		struct xbc_node *knode, *root;
   441		const char *val;
   442	
   443		root = xbc_find_node("kernel");
   444		if (!root)
   445			return;
   446	
   447		/*
   448		 * Keys that do not match any early_param() handler are silently
   449		 * ignored — do_early_param() always returns 0.
   450		 */
   451		xbc_node_for_each_key_value(root, knode, val) {
   452			if (xbc_node_compose_key_after(root, knode, xbc_namebuf, XBC_KEYLEN_MAX) < 0)
   453				continue;
   454	
   455			if (!val) {
   456				do_early_param(xbc_namebuf, NULL, NULL, NULL);
   457				continue;
   458			}
   459	
   460			/*
   461			 * We need to copy const char *val to a char pointer,
   462			 * which is what do_early_param() need, given it might
   463			 * call strsep(), strtok() later.
   464			 */
   465			strscpy(val_buf, val, sizeof(val_buf));
   466			do_early_param(xbc_namebuf, val_buf, NULL, NULL);
   467		}
   468	}
   469	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [trace:bootconfig/for-next 16/16] init/main.c:437:20: warning: stack frame size (4192) exceeds limit (2048) in 'bootconfig_apply_early_params'
  2026-03-25  2:37 [trace:bootconfig/for-next 16/16] init/main.c:437:20: warning: stack frame size (4192) exceeds limit (2048) in 'bootconfig_apply_early_params' kernel test robot
@ 2026-03-25  6:52 ` Masami Hiramatsu
  2026-03-25  9:55   ` Breno Leitao
  0 siblings, 1 reply; 3+ messages in thread
From: Masami Hiramatsu @ 2026-03-25  6:52 UTC (permalink / raw)
  To: kernel test robot
  Cc: Breno Leitao, llvm, oe-kbuild-all, Masami Hiramatsu (Google)

On Wed, 25 Mar 2026 10:37:25 +0800
kernel test robot <lkp@intel.com> wrote:

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace bootconfig/for-next
> head:   1a427f2a710583872b6176ea8378e0a1a8719fc4
> commit: 1a427f2a710583872b6176ea8378e0a1a8719fc4 [16/16] bootconfig: Apply early options from embedded config
> config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20260325/202603251010.5Ui0yrB2-lkp@intel.com/config)
> compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260325/202603251010.5Ui0yrB2-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202603251010.5Ui0yrB2-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
> >> init/main.c:437:20: warning: stack frame size (4192) exceeds limit (2048) in 'bootconfig_apply_early_params' [-Wframe-larger-than]
>      437 | static void __init bootconfig_apply_early_params(void)
>          |                    ^
>    1 warning generated.
> 
> 
> vim +/bootconfig_apply_early_params +437 init/main.c
> 
>    416	
>    417	/*
>    418	 * do_early_param() is defined later in this file but called from
>    419	 * bootconfig_apply_early_params() below, so we need a forward declaration.
>    420	 */
>    421	static int __init do_early_param(char *param, char *val,
>    422					 const char *unused, void *arg);
>    423	
>    424	/*
>    425	 * bootconfig_apply_early_params - dispatch kernel.* keys from the embedded
>    426	 * bootconfig as early_param() calls.
>    427	 *
>    428	 * early_param() handlers must run before most of the kernel initialises
>    429	 * (e.g. before the GIC driver reads irqchip.gicv3_pseudo_nmi).  A bootconfig
>    430	 * attached to the initrd arrives too late for this because the initrd is not
>    431	 * mapped yet when early params are processed.  The embedded bootconfig lives
>    432	 * in the kernel image itself (.init.data), so it is always reachable.
>    433	 *
>    434	 * This function is called from setup_boot_config() which runs in
>    435	 * start_kernel() before parse_early_param(), making the timing correct.
>    436	 */
>  > 437	static void __init bootconfig_apply_early_params(void)
>    438	{
>    439		char val_buf[COMMAND_LINE_SIZE];

Ah, this COMMAND_LINE_SIZE is too big to allocate it on stack.
We need to make it as a static __initdata variable.

Thank you,

>    440		struct xbc_node *knode, *root;
>    441		const char *val;
>    442	
>    443		root = xbc_find_node("kernel");
>    444		if (!root)
>    445			return;
>    446	
>    447		/*
>    448		 * Keys that do not match any early_param() handler are silently
>    449		 * ignored — do_early_param() always returns 0.
>    450		 */
>    451		xbc_node_for_each_key_value(root, knode, val) {
>    452			if (xbc_node_compose_key_after(root, knode, xbc_namebuf, XBC_KEYLEN_MAX) < 0)
>    453				continue;
>    454	
>    455			if (!val) {
>    456				do_early_param(xbc_namebuf, NULL, NULL, NULL);
>    457				continue;
>    458			}
>    459	
>    460			/*
>    461			 * We need to copy const char *val to a char pointer,
>    462			 * which is what do_early_param() need, given it might
>    463			 * call strsep(), strtok() later.
>    464			 */
>    465			strscpy(val_buf, val, sizeof(val_buf));
>    466			do_early_param(xbc_namebuf, val_buf, NULL, NULL);
>    467		}
>    468	}
>    469	
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [trace:bootconfig/for-next 16/16] init/main.c:437:20: warning: stack frame size (4192) exceeds limit (2048) in 'bootconfig_apply_early_params'
  2026-03-25  6:52 ` Masami Hiramatsu
@ 2026-03-25  9:55   ` Breno Leitao
  0 siblings, 0 replies; 3+ messages in thread
From: Breno Leitao @ 2026-03-25  9:55 UTC (permalink / raw)
  To: Masami Hiramatsu; +Cc: kernel test robot, llvm, oe-kbuild-all

On Wed, Mar 25, 2026 at 03:52:27PM +0900, Masami Hiramatsu wrote:

> >  > 437	static void __init bootconfig_apply_early_params(void)
> >    438	{
> >    439		char val_buf[COMMAND_LINE_SIZE];
> 
> Ah, this COMMAND_LINE_SIZE is too big to allocate it on stack.
> We need to make it as a static __initdata variable.

Ack, I will respin it. Thanks!

> Thank you,
> 
> >    440		struct xbc_node *knode, *root;
> >    441		const char *val;
> >    442	
> >    443		root = xbc_find_node("kernel");
> >    444		if (!root)
> >    445			return;
> >    446	
> >    447		/*
> >    448		 * Keys that do not match any early_param() handler are silently
> >    449		 * ignored — do_early_param() always returns 0.
> >    450		 */
> >    451		xbc_node_for_each_key_value(root, knode, val) {
> >    452			if (xbc_node_compose_key_after(root, knode, xbc_namebuf, XBC_KEYLEN_MAX) < 0)
> >    453				continue;
> >    454	
> >    455			if (!val) {

I also found that val cannot be NULL here, given
xbc_node_for_each_key_value() returns an empty string ("") instead of
NULL, so, I will remove this branch here as well.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-25  9:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25  2:37 [trace:bootconfig/for-next 16/16] init/main.c:437:20: warning: stack frame size (4192) exceeds limit (2048) in 'bootconfig_apply_early_params' kernel test robot
2026-03-25  6:52 ` Masami Hiramatsu
2026-03-25  9:55   ` Breno Leitao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox