mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Dan Streetman <ddstreet@ieee.org>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <borislav.petkov@amd.com>,
	linux-kernel@vger.kernel.org, Fabian Frederick <fabf@skynet.be>
Subject: Re: [PATCH] plist: replace pr_debug with printk in plist_test()
Date: Mon, 05 May 2014 13:52:16 -0700	[thread overview]
Message-ID: <1399323136.26330.22.camel@joe-AO725> (raw)
In-Reply-To: <20140505133517.71b7dc7cf327cb304e8a9edc@linux-foundation.org>

On Mon, 2014-05-05 at 13:35 -0700, Andrew Morton wrote:
> On Mon,  5 May 2014 10:43:05 -0400 Dan Streetman <ddstreet@ieee.org> wrote:
> 
> > Replace pr_debug() in lib/plist.c test function plist_test() with
> > printk(KERN_DEBUG ...).
> > 
> > Without DEBUG defined, pr_debug() is complied out, but the entire
> > plist_test() function is already inside CONFIG_DEBUG_PI_LIST, so
> > printk should just be used directly.
> >
> > --- a/lib/plist.c
> > +++ b/lib/plist.c
> > @@ -175,7 +175,7 @@ static int  __init plist_test(void)
> >  	int nr_expect = 0, i, loop;
> >  	unsigned int r = local_clock();
> >  
> > -	pr_debug("start plist test\n");
> > +	printk(KERN_DEBUG "start plist test\n");
> 
> Now someone will come along and helpfully switch it back to pr_debug()
> again :(
> 
> What about adding a #define DEBUG?

That can be unfortunate when there are other

#if DEBUG
	some noisy or unnecessary code...
#endif

blocks in the same compilation unit.

> This aspect of pr_debug() is rather surprising and unfortunate and I
> guess we screwed it up.

meh.

It's been this way for quite awhile.

I have over long periods suggested adding
variants like pr_vdbg and pr_dbg_always.

https://lkml.org/lkml/2009/10/13/634
http://patchwork.ozlabs.org/patch/63513/

Never had much success or visibility.

> pr_debug() should unconditionally do the
> printk, just like pr_warn, pr_emerg, etc.

I think that would not be good.

That would set an expectation for dev_dbg which
has never been enabled unconditionally.

> And there should be a
> separate pr_debug_cond() which honours the DEBUG setting.

I think that's suboptimal.

> akpm3:/usr/src/linux-3.15-rc4> grep -r pr_debug . | wc -l
> 10286
> 
> Boy, that's going to be a big patch ;)

$ git grep -E "\bprintk\s*\(s*KERN_DEBUG\b" | wc -l
4412

Not to mention all the macros that use those and are
then themselves used hundreds or thousands of times...



  reply	other threads:[~2014-05-05 20:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-02 20:23 [PATCH] plist: include -DDEBUG if CONFIG_DEBUG_PI_LIST Dan Streetman
2014-05-02 20:41 ` Steven Rostedt
2014-05-05 14:35   ` Dan Streetman
2014-05-05 14:43     ` [PATCH] plist: replace pr_debug with printk in plist_test() Dan Streetman
2014-05-05 14:52       ` Steven Rostedt
2014-05-05 20:35       ` Andrew Morton
2014-05-05 20:52         ` Joe Perches [this message]
2014-05-06 12:30         ` Dan Streetman
2014-05-06 15:08           ` [PATCH] Documentation: expand/clarify debug documentation Dan Streetman
2014-05-06 15:44           ` [PATCH] plist: replace pr_debug with printk in plist_test() Fabian Frederick
2014-05-07 14:21             ` Dan Streetman
2014-05-07 14:35               ` Steven Rostedt
2014-05-07 18:10                 ` Joe Perches
2014-05-07 18:19                   ` Steven Rostedt
2014-05-07 18:37                     ` Joe Perches

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=1399323136.26330.22.camel@joe-AO725 \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=borislav.petkov@amd.com \
    --cc=ddstreet@ieee.org \
    --cc=fabf@skynet.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®