linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dynamic_debug: fix boot parameters parse
@ 2015-10-27  7:40 Peter Chen
  2015-10-27  7:40 ` [PATCH 2/2] Doc: dynamic-debug-howto: fix the way to enable ddebug during boot process Peter Chen
  2015-10-28 14:17 ` [PATCH 1/2] dynamic_debug: fix boot parameters parse Jason Baron
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Chen @ 2015-10-27  7:40 UTC (permalink / raw)
  To: jbaron; +Cc: corbet, linux-kernel, Peter Chen, stable

The parse_args will delete space between boot parameters, so
if we add dyndbg="file drivers/usb/* +p" at bootargs, the parse_args
will split it as three parameters, and only "file" is for dyndbg,
then below error will occur at ddebug, it causes all non-module
ddebug fail during the boot process.

===============================================================
dynamic_debug:ddebug_parse_flags: bad flag-op f, at start of file
dynamic_debug:ddebug_exec_query: flags parse failed
===============================================================

As a solution, we can use comma to split parameters for ddebug booting
parameter, and replace comma with space at code, in that case, the ddebug
core can handle it with the same way we do it for /sys.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Cc: <stable@vger.kernel.org>
---
 lib/dynamic_debug.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index e491e02..da4883b 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -880,6 +880,8 @@ static int ddebug_dyndbg_param_cb(char *param, char *val,
 	if (strcmp(param, "dyndbg"))
 		return on_err; /* determined by caller */
 
+	/* relace comma with space */
+	strreplace(val, ',', ' ');
 	ddebug_exec_queries((val ? val : "+p"), modname);
 
 	return 0; /* query failure shouldnt stop module load */
-- 
1.9.1


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

* [PATCH 2/2] Doc: dynamic-debug-howto: fix the way to enable ddebug during boot process
  2015-10-27  7:40 [PATCH 1/2] dynamic_debug: fix boot parameters parse Peter Chen
@ 2015-10-27  7:40 ` Peter Chen
  2015-10-28 14:17 ` [PATCH 1/2] dynamic_debug: fix boot parameters parse Jason Baron
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Chen @ 2015-10-27  7:40 UTC (permalink / raw)
  To: jbaron; +Cc: corbet, linux-kernel, Peter Chen, stable

Current non-module ddebug during boot process will fail due to
parse_args will delete space and give ddebug only the first
parameter, the code changes using comma to split ddebug parameters
for boot process, and we change documentation accordingly.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Cc: <stable@vger.kernel.org>
---
 Documentation/dynamic-debug-howto.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/dynamic-debug-howto.txt b/Documentation/dynamic-debug-howto.txt
index 9417871..fcd9ca6 100644
--- a/Documentation/dynamic-debug-howto.txt
+++ b/Documentation/dynamic-debug-howto.txt
@@ -242,7 +242,7 @@ messages in all code run after this arch_initcall via this boot
 parameter.
 
 On an x86 system for example ACPI enablement is a subsys_initcall and
-   dyndbg="file ec.c +p"
+   dyndbg="file,ec.c,+p"
 will show early Embedded Controller transactions during ACPI setup if
 your machine (typically a laptop) has an Embedded Controller.
 PCI (or other devices) initialization also is a hot candidate for using
-- 
1.9.1


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

* Re: [PATCH 1/2] dynamic_debug: fix boot parameters parse
  2015-10-27  7:40 [PATCH 1/2] dynamic_debug: fix boot parameters parse Peter Chen
  2015-10-27  7:40 ` [PATCH 2/2] Doc: dynamic-debug-howto: fix the way to enable ddebug during boot process Peter Chen
@ 2015-10-28 14:17 ` Jason Baron
  2015-10-29  6:22   ` Peter Chen
  1 sibling, 1 reply; 4+ messages in thread
From: Jason Baron @ 2015-10-28 14:17 UTC (permalink / raw)
  To: Peter Chen; +Cc: corbet, linux-kernel, stable

On 10/27/2015 03:40 AM, Peter Chen wrote:
> The parse_args will delete space between boot parameters, so
> if we add dyndbg="file drivers/usb/* +p" at bootargs, the parse_args
> will split it as three parameters, and only "file" is for dyndbg,
> then below error will occur at ddebug, it causes all non-module
> ddebug fail during the boot process.
> 
> ===============================================================
> dynamic_debug:ddebug_parse_flags: bad flag-op f, at start of file
> dynamic_debug:ddebug_exec_query: flags parse failed
> ===============================================================
> 

Hi,

So the spaces there should be preserved if they are in quotes. Looking at
kernel/params.c:next_arg(), the comment there explicitly says:

/* You can use " around spaces, but can't escape ". */

So this should still be working. And if its not, I suspect other
command-line parsing would be broken as well. So if it did change,
what changed in command line parsing?

What's the output of $ cat /proc/cmdline ? Perhaps, the quotes
were not passed properly from the bootloader to the kernel?

Thanks,

-Jason


> As a solution, we can use comma to split parameters for ddebug booting
> parameter, and replace comma with space at code, in that case, the ddebug
> core can handle it with the same way we do it for /sys.
> 
> Signed-off-by: Peter Chen <peter.chen@freescale.com>
> Cc: <stable@vger.kernel.org>
> ---
>  lib/dynamic_debug.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> index e491e02..da4883b 100644
> --- a/lib/dynamic_debug.c
> +++ b/lib/dynamic_debug.c
> @@ -880,6 +880,8 @@ static int ddebug_dyndbg_param_cb(char *param, char *val,
>  	if (strcmp(param, "dyndbg"))
>  		return on_err; /* determined by caller */
>  
> +	/* relace comma with space */
> +	strreplace(val, ',', ' ');
>  	ddebug_exec_queries((val ? val : "+p"), modname);
>  
>  	return 0; /* query failure shouldnt stop module load */
> 


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

* Re: [PATCH 1/2] dynamic_debug: fix boot parameters parse
  2015-10-28 14:17 ` [PATCH 1/2] dynamic_debug: fix boot parameters parse Jason Baron
@ 2015-10-29  6:22   ` Peter Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Chen @ 2015-10-29  6:22 UTC (permalink / raw)
  To: Jason Baron; +Cc: corbet, linux-kernel, stable

On Wed, Oct 28, 2015 at 10:17:59AM -0400, Jason Baron wrote:
> On 10/27/2015 03:40 AM, Peter Chen wrote:
> > The parse_args will delete space between boot parameters, so
> > if we add dyndbg="file drivers/usb/* +p" at bootargs, the parse_args
> > will split it as three parameters, and only "file" is for dyndbg,
> > then below error will occur at ddebug, it causes all non-module
> > ddebug fail during the boot process.
> > 
> > ===============================================================
> > dynamic_debug:ddebug_parse_flags: bad flag-op f, at start of file
> > dynamic_debug:ddebug_exec_query: flags parse failed
> > ===============================================================
> > 
> 
> Hi,
> 
> So the spaces there should be preserved if they are in quotes. Looking at
> kernel/params.c:next_arg(), the comment there explicitly says:
> 
> /* You can use " around spaces, but can't escape ". */
> 
> So this should still be working. And if its not, I suspect other
> command-line parsing would be broken as well. So if it did change,
> what changed in command line parsing?
> 
> What's the output of $ cat /proc/cmdline ? Perhaps, the quotes
> were not passed properly from the bootloader to the kernel?
> 
> Thanks,
> 
> -Jason

Oh, Jason. skip this patch pleaes, the u-boot needs to use "\\" below
double quoting to setenv. eg: dyndbg="\\"file drivers/usb/chipidea/*+p"\\",
then, the cmdline will like: dyndbg="file drivers/usb/chipidea/* +p",
otherwise, there is no double quoting around QUERY.

Peter
> 
> 
> > As a solution, we can use comma to split parameters for ddebug booting
> > parameter, and replace comma with space at code, in that case, the ddebug
> > core can handle it with the same way we do it for /sys.
> > 
> > Signed-off-by: Peter Chen <peter.chen@freescale.com>
> > Cc: <stable@vger.kernel.org>
> > ---
> >  lib/dynamic_debug.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> > index e491e02..da4883b 100644
> > --- a/lib/dynamic_debug.c
> > +++ b/lib/dynamic_debug.c
> > @@ -880,6 +880,8 @@ static int ddebug_dyndbg_param_cb(char *param, char *val,
> >  	if (strcmp(param, "dyndbg"))
> >  		return on_err; /* determined by caller */
> >  
> > +	/* relace comma with space */
> > +	strreplace(val, ',', ' ');
> >  	ddebug_exec_queries((val ? val : "+p"), modname);
> >  
> >  	return 0; /* query failure shouldnt stop module load */
> > 
> 

-- 

Best Regards,
Peter Chen

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

end of thread, other threads:[~2015-10-29  6:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-27  7:40 [PATCH 1/2] dynamic_debug: fix boot parameters parse Peter Chen
2015-10-27  7:40 ` [PATCH 2/2] Doc: dynamic-debug-howto: fix the way to enable ddebug during boot process Peter Chen
2015-10-28 14:17 ` [PATCH 1/2] dynamic_debug: fix boot parameters parse Jason Baron
2015-10-29  6:22   ` Peter Chen

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).