All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@freescale.com>
To: Jason Baron <jbaron@akamai.com>
Cc: <corbet@lwn.net>, <linux-kernel@vger.kernel.org>,
	<stable@vger.kernel.org>
Subject: Re: [PATCH 1/2] dynamic_debug: fix boot parameters parse
Date: Thu, 29 Oct 2015 14:22:37 +0800	[thread overview]
Message-ID: <20151029062236.GA8367@shlinux2> (raw)
In-Reply-To: <5630D917.7010607@akamai.com>

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

      reply	other threads:[~2015-10-29  6:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151029062236.GA8367@shlinux2 \
    --to=peter.chen@freescale.com \
    --cc=corbet@lwn.net \
    --cc=jbaron@akamai.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.