linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/setup: Add boot messages about cmdline builtins
@ 2020-04-22  4:20 Tony Fischetti
  2020-04-22  7:11 ` Baoquan He
  0 siblings, 1 reply; 3+ messages in thread
From: Tony Fischetti @ 2020-04-22  4:20 UTC (permalink / raw)
  To: tglx, mingo
  Cc: bp, x86, hpa, bhe, dyoung, dave.hansen, linux, keescook,
	dan.j.williams, linux-kernel, tony.fischetti

While the ability to override or append to the boot command line has
been added, the boot messages contain no information as to whether the
cmdline was manipulated by the build-time options. This patch, for x86,
adds boot messages specifying whether the cmdline was manipulated and
waits for the potential changes to take place before printing the final
boot command line.

Signed-off-by: Tony Fischetti <tony.fischetti@gmail.com>
---
 arch/x86/kernel/setup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 4b3fa6cd3106..28d77f01fd0d 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -828,7 +828,6 @@ void __init setup_arch(char **cmdline_p)
 	 */
 	__flush_tlb_all();
 #else
-	printk(KERN_INFO "Command line: %s\n", boot_command_line);
 	boot_cpu_data.x86_phys_bits = MAX_PHYSMEM_BITS;
 #endif
 
@@ -904,10 +903,12 @@ void __init setup_arch(char **cmdline_p)
 
 #ifdef CONFIG_CMDLINE_BOOL
 #ifdef CONFIG_CMDLINE_OVERRIDE
+	pr_info("Overriding command line with builtin\n");
 	strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
 #else
 	if (builtin_cmdline[0]) {
 		/* append boot loader cmdline to builtin */
+		pr_info("Appending command line to builtin\n");
 		strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE);
 		strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE);
 		strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
@@ -916,6 +917,7 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
 	strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
+	pr_info("Command line: %s\n", command_line);
 	*cmdline_p = command_line;
 
 	/*
-- 
2.20.1


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

* Re: [PATCH] x86/setup: Add boot messages about cmdline builtins
  2020-04-22  4:20 [PATCH] x86/setup: Add boot messages about cmdline builtins Tony Fischetti
@ 2020-04-22  7:11 ` Baoquan He
  2020-04-24 21:20   ` Tony Fischetti
  0 siblings, 1 reply; 3+ messages in thread
From: Baoquan He @ 2020-04-22  7:11 UTC (permalink / raw)
  To: Tony Fischetti
  Cc: tglx, mingo, bp, x86, hpa, dyoung, dave.hansen, linux, keescook,
	dan.j.williams, linux-kernel

On 04/22/20 at 12:20am, Tony Fischetti wrote:
> While the ability to override or append to the boot command line has
> been added, the boot messages contain no information as to whether the
> cmdline was manipulated by the build-time options. This patch, for x86,
> adds boot messages specifying whether the cmdline was manipulated and
> waits for the potential changes to take place before printing the final
> boot command line.
> 
> Signed-off-by: Tony Fischetti <tony.fischetti@gmail.com>
> ---
>  arch/x86/kernel/setup.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 4b3fa6cd3106..28d77f01fd0d 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -828,7 +828,6 @@ void __init setup_arch(char **cmdline_p)
>  	 */
>  	__flush_tlb_all();
>  #else
> -	printk(KERN_INFO "Command line: %s\n", boot_command_line);
>  	boot_cpu_data.x86_phys_bits = MAX_PHYSMEM_BITS;
>  #endif
>  
> @@ -904,10 +903,12 @@ void __init setup_arch(char **cmdline_p)
>  
>  #ifdef CONFIG_CMDLINE_BOOL
>  #ifdef CONFIG_CMDLINE_OVERRIDE
> +	pr_info("Overriding command line with builtin\n");
>  	strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
>  #else
>  	if (builtin_cmdline[0]) {
>  		/* append boot loader cmdline to builtin */
> +		pr_info("Appending command line to builtin\n");
>  		strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE);
>  		strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE);
>  		strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
> @@ -916,6 +917,7 @@ void __init setup_arch(char **cmdline_p)
>  #endif
>  
>  	strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
> +	pr_info("Command line: %s\n", command_line);

Yeah, adding info to tell there's action on overriding or apending
command line looks good to me. Maybe keep the printing of the original
command, we can get the final command line from '/proc/cmdline' after
system boot, or just get it from the original cmdline + CONFIG_CMDLINE.
Or print the original cmdline and the final cmdline both.

Personal opinion.

>  	*cmdline_p = command_line;
>  
>  	/*
> -- 
> 2.20.1
> 


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

* Re: [PATCH] x86/setup: Add boot messages about cmdline builtins
  2020-04-22  7:11 ` Baoquan He
@ 2020-04-24 21:20   ` Tony Fischetti
  0 siblings, 0 replies; 3+ messages in thread
From: Tony Fischetti @ 2020-04-24 21:20 UTC (permalink / raw)
  To: Baoquan He
  Cc: tglx, mingo, bp, x86, hpa, dyoung, dave.hansen, linux, Kees Cook,
	dan.j.williams, linux-kernel

I like the idea of printing the original one, printing the information
about the cmdline manipulation, and, then, printing the final one at the
end, too.

The only problem is I don't know what to label the first printk so that it
remains clear that it's not necessarily the _final_ one, yet.

In either case, they should probably be changed to `pr_info`s, right?


On Wed, Apr 22, 2020 at 3:11 AM Baoquan He <bhe@redhat.com> wrote:
>
> On 04/22/20 at 12:20am, Tony Fischetti wrote:
> > While the ability to override or append to the boot command line has
> > been added, the boot messages contain no information as to whether the
> > cmdline was manipulated by the build-time options. This patch, for x86,
> > adds boot messages specifying whether the cmdline was manipulated and
> > waits for the potential changes to take place before printing the final
> > boot command line.
> >
> > Signed-off-by: Tony Fischetti <tony.fischetti@gmail.com>
> > ---
> >  arch/x86/kernel/setup.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> > index 4b3fa6cd3106..28d77f01fd0d 100644
> > --- a/arch/x86/kernel/setup.c
> > +++ b/arch/x86/kernel/setup.c
> > @@ -828,7 +828,6 @@ void __init setup_arch(char **cmdline_p)
> >        */
> >       __flush_tlb_all();
> >  #else
> > -     printk(KERN_INFO "Command line: %s\n", boot_command_line);
> >       boot_cpu_data.x86_phys_bits = MAX_PHYSMEM_BITS;
> >  #endif
> >
> > @@ -904,10 +903,12 @@ void __init setup_arch(char **cmdline_p)
> >
> >  #ifdef CONFIG_CMDLINE_BOOL
> >  #ifdef CONFIG_CMDLINE_OVERRIDE
> > +     pr_info("Overriding command line with builtin\n");
> >       strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
> >  #else
> >       if (builtin_cmdline[0]) {
> >               /* append boot loader cmdline to builtin */
> > +             pr_info("Appending command line to builtin\n");
> >               strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE);
> >               strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE);
> >               strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
> > @@ -916,6 +917,7 @@ void __init setup_arch(char **cmdline_p)
> >  #endif
> >
> >       strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
> > +     pr_info("Command line: %s\n", command_line);
>
> Yeah, adding info to tell there's action on overriding or apending
> command line looks good to me. Maybe keep the printing of the original
> command, we can get the final command line from '/proc/cmdline' after
> system boot, or just get it from the original cmdline + CONFIG_CMDLINE.
> Or print the original cmdline and the final cmdline both.
>
> Personal opinion.
>
> >       *cmdline_p = command_line;
> >
> >       /*
> > --
> > 2.20.1
> >
>


-- 
--
Tony Fischetti
tony.fischetti@gmail.com
(718) 431-4597

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

end of thread, other threads:[~2020-04-24 21:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-22  4:20 [PATCH] x86/setup: Add boot messages about cmdline builtins Tony Fischetti
2020-04-22  7:11 ` Baoquan He
2020-04-24 21:20   ` Tony Fischetti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).