public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jim Cromie <jim.cromie@gmail.com>
Cc: jbaron@redhat.com, bart.vanassche@gmail.com, greg@kroah.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 25/26] dynamic_debug: add pr_fmt_dbg() for dynamic_pr_debug
Date: Thu, 29 Sep 2011 08:24:48 -0700	[thread overview]
Message-ID: <1317309888.1854.18.camel@Joe-Laptop> (raw)
In-Reply-To: <CAJfuBxxoJ=KvzS-XgD6h7oXZ==xOC72_1YiR6shkY=5wC7CNmw@mail.gmail.com>

On Wed, 2011-09-28 at 11:27 -0600, Jim Cromie wrote:
> On Tue, Sep 27, 2011 at 10:51 PM, Joe Perches <joe@perches.com> wrote:
> > On Tue, 2011-09-27 at 20:54 -0600, Jim Cromie wrote:
> >> Cleanest way is to drop the original synonym, and just use
> >> warn (its shorter), but that creates some churn (havent grepped to see
> >> how much).
> >> I picked what looked like least effort & fewest corner-cases.
> >> ICBW..
> >
> > #ifndef pr_fmt_warning
> > #define pr_fmt_warning pr_fmt_warn
> > #endif
> >
> 
> you've made it conditional, where line 203 is not. why ?
>     201 #define pr_warning(fmt, ...) \
>     202         printk(KERN_WARNING pr_fmt_warn(fmt), ##__VA_ARGS__)
>     203 #define pr_warn pr_warning
>     204 #define pr_notice(fmt, ...) \
> 
> Also, though minor, 203 adds pr_warn as the shortcut,
> youve suggested the opposite.  I presume this is an oversight.

I think pr_warning should be deprecated.
I think not #defining pr_fmt_warning is just fine.

> >> > What did you think of avoiding all of this and
> >> > having __dynamic_pr_debug move the fmt pointer over
> >> > any initial KBUILD_MODULE ": "
> >> >
> >> > int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
> >> > {
> >> > [...]
> >> >        size_t modsize = strlen(descriptor->modname);
> >> >        if (0 == strncmp(fmt, descriptor->modname, modsize) &&
> >> >            0 == strncmp(fmt + modsize, ": ", 2))
> >> >                fmt += modsize + 2;
> >> >        vprintk(fmt, ...)
> >> > ?
> >>
> >> I was getting to that... ;-)
> >> Im not crazy about it.  It feels like too much ..
> >> Its a runtime workaround for what I think is a
> >> problem in users' (or header's) #defines.

> > I think exactly the opposite myself.
> >
> > I think all of the '#define pr_fmt(fmt) KBUILD_MODNAME ": "'
> > are effectivly useless and I will eventually delete them.
> >
> > The printk subsystem should look up the module name and
> > prefix them to the printk akin to how the dynamic_debug
> > system does.  Except the module name should be a singleton.
> 
> hmm, maybe Ive missed something in your argument.
> 
> For non-dynamic-debug builds, it seems you still want
> the MODNAME in the pr_(crit|warn|info|debug) output,
> you just dont like the hundreds of defines throughout drivers/*

Yes. I've added most all of them.

It's because the current printk / pr_<level>
subsystem chose to not prefix by default.
Over the last couple of years, I've helped
slowly converted about half of the kernel to
pr_<level> and pr_fmt.

At some point next year or so, enough of the
kernel should be converted so that marking
the last few uses of pr_debug or other
pr_<level> without a preceding pr_fmt should
be be relatively easy to convert to a more
standard KBUILD_MODNAME or other user specified
prefix.

It takes awhile though.

> IOW, it seems to take care of everything, w/o runtime workarounds.

Nope.  Try it with and without DEBUG.

Also, look at the pr_debug uses that include __func__.
These also duplicate output.

I'd prefer a solution that allows deduplication.
Having a dynamic_debug output to a fixed buffer
via vsnprintf, scanning that output for leading
KBUILD_MODNAME/__file__/__func__/__LINE__ prefixes
and then skipping them when enabled would seem
appropriate to me.

cheers, Joe


  reply	other threads:[~2011-09-29 15:24 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-21 21:54 jim.cromie
2011-09-21 21:54 ` [PATCH 01/26] dynamic_debug: drop enabled field from struct _ddebug, use flags & _DPRINTK_FLAGS_PRINT jim.cromie
2011-09-21 21:54 ` [PATCH 02/26] dynamic_debug: make dynamic-debug supersede DEBUG ccflag jim.cromie
2011-09-21 21:54 ` [PATCH 03/26] dynamic_debug: replace strcpy with strlcpy, in ddebug_setup_query() jim.cromie
2011-09-21 21:54 ` [PATCH 04/26] dynamic_debug: warn when >1 of each type of match-spec is given jim.cromie
2011-09-21 21:54 ` [PATCH 05/26] dynamic_debug: pr_err() call should not depend upon verbosity jim.cromie
2011-09-21 21:54 ` [PATCH 06/26] dynamic_debug: add trim_prefix() to provide source-root relative paths jim.cromie
2011-09-21 21:54 ` [PATCH 07/26] dynamic_debug: change verbosity at runtime jim.cromie
2011-09-21 21:54 ` [PATCH 08/26] dynamic_debug: define several levels of verbosity jim.cromie
2011-09-21 21:54 ` [PATCH 09/26] dynamic_debug: process multiple commands on a line jim.cromie
2011-09-21 21:54 ` [PATCH 10/26] dynamic_debug: enlarge command/query write buffer jim.cromie
2011-09-21 22:29   ` Joe Perches
2011-09-21 21:55 ` [PATCH 11/26] dynamic_debug: hoist locking in ddebug_change to callers jim.cromie
2011-09-21 21:55 ` [PATCH 12/26] dynamic_debug: dont kill entire facility on error parsing ddebug_query jim.cromie
2011-09-21 21:55 ` [PATCH 13/26] dynamic_debug: factor vpr_info_dq out of ddebug_parse_query jim.cromie
2011-09-21 21:55 ` [PATCH 14/26] dynamic_debug: refactor query_matches_callsite out of ddebug_change jim.cromie
2011-09-21 21:55 ` [PATCH 15/26] dynamic_debug: drop explicit foo != NULL checks jim.cromie
2011-09-21 21:55 ` [PATCH 16/26] dynamic_debug: save 'a' queries to pending-list for later (re)application jim.cromie
2011-09-21 21:55 ` [PATCH 17/26] dynamic_debug: remove pending query when flags zeroed jim.cromie
2011-09-21 21:55 ` [PATCH 18/26] dynamic_debug: describe_flags with '=[pmflta_]*' jim.cromie
2011-09-21 21:55 ` [PATCH 19/26] dynamic_debug: add flags filtering to flags spec jim.cromie
2011-09-21 21:55 ` [PATCH 20/26] dynamic_debug: make ddebug_describe_flags more generic jim.cromie
2011-09-21 21:55 ` [PATCH 21/26] dynamic_debug: add $DBGFS/dynamic_debug/pending file jim.cromie
2011-09-21 21:55 ` [PATCH 22/26] dynamic_debug: early return if _ddebug table is empty jim.cromie
2011-09-21 21:55 ` [PATCH 23/26] dynamic_debug: document pending queries, flags-filter, multiple queries jim.cromie
2011-09-21 22:35   ` Randy Dunlap
2011-09-27 16:33     ` [patch 23/26 revised] jim.cromie
2011-09-27 16:33       ` [PATCH 23/26] dynamic_debug: document pending queries, flags-filter, multiple queries jim.cromie
2011-10-10 18:54   ` Jonathan Corbet
2011-10-10 19:27     ` Jason Baron
2011-10-18 20:41     ` Jim Cromie
2011-10-19 20:52       ` Jason Baron
2011-09-21 21:55 ` [PATCH 24/26] dynamic_debug: reduce lineno field to a saner 18 bits jim.cromie
2011-09-21 21:55 ` [PATCH 25/26] dynamic_debug: add pr_fmt_dbg() for dynamic_pr_debug jim.cromie
2011-09-22 20:57   ` Joe Perches
2011-09-23 10:31     ` Bart Van Assche
2011-09-23 17:42       ` Joe Perches
2011-09-27 20:37     ` Jim Cromie
2011-09-27 23:36       ` Joe Perches
2011-09-28  2:54         ` Jim Cromie
2011-09-28  4:51           ` Joe Perches
2011-09-28 17:27             ` Jim Cromie
2011-09-29 15:24               ` Joe Perches [this message]
2011-10-08 19:07             ` Bart Van Assche
2011-10-08 20:53               ` Joe Perches
2011-09-27 21:40     ` [revised patches 25,26/26] dynamic_debug: add pr_fmt_*() jim.cromie
2011-09-27 21:40       ` [PATCH 25/26] dynamic_debug: add pr_fmt_debug() for dynamic_pr_debug jim.cromie
2011-09-27 21:41       ` [PATCH 26/26] scx200_acb: use pr_(info|warn|err|debug) and dynamic-debug facilities jim.cromie
2011-09-21 21:55 ` jim.cromie
2011-09-26 23:23 ` your mail Greg KH
2011-10-07 20:33 ` [PATCH 00/26] dynamic_debug: add pending queries, etc (~resend) jim.cromie
2011-10-07 20:33   ` [PATCH 01/26] dynamic_debug: drop enabled field from struct _ddebug, use flags & _DPRINTK_FLAGS_PRINT jim.cromie
2011-10-07 20:33   ` [PATCH 02/26] dynamic_debug: make dynamic-debug supersede DEBUG ccflag jim.cromie
2011-10-07 20:33   ` [PATCH 03/26] dynamic_debug: replace strcpy with strlcpy, in ddebug_setup_query() jim.cromie
2011-10-07 20:33   ` [PATCH 04/26] dynamic_debug: warn when >1 of each type of match-spec is given jim.cromie
2011-10-07 20:33   ` [PATCH 05/26] dynamic_debug: pr_err() call should not depend upon verbosity jim.cromie
2011-10-07 21:21     ` Joe Perches
2011-10-07 20:33   ` [PATCH 06/26] dynamic_debug: add trim_prefix() to provide source-root relative paths jim.cromie
2011-10-07 20:33   ` [PATCH 07/26] dynamic_debug: change verbosity at runtime jim.cromie
2011-10-07 20:33   ` [PATCH 08/26] dynamic_debug: define several levels of verbosity jim.cromie
2011-10-07 20:33   ` [PATCH 09/26] dynamic_debug: process multiple commands on a line jim.cromie
2011-10-07 20:33   ` [PATCH 10/26] dynamic_debug: enlarge command/query write buffer jim.cromie
2011-10-07 20:33   ` [PATCH 11/26] dynamic_debug: hoist locking in ddebug_change to callers jim.cromie
2011-10-07 20:33   ` [PATCH 12/26] dynamic_debug: dont kill entire facility on error parsing ddebug_query jim.cromie
2011-10-07 20:33   ` [PATCH 13/26] dynamic_debug: factor vpr_info_dq out of ddebug_parse_query jim.cromie
2011-10-07 20:33   ` [PATCH 14/26] dynamic_debug: refactor query_matches_callsite out of ddebug_change jim.cromie
2011-10-07 20:33   ` [PATCH 15/26] dynamic_debug: drop explicit foo != NULL checks jim.cromie
2011-10-07 20:33   ` [PATCH 16/26] dynamic_debug: save 'a' queries to pending-list for later (re)application jim.cromie
2011-10-07 20:33   ` [PATCH 17/26] dynamic_debug: remove pending query when flags zeroed jim.cromie
2011-10-07 20:33   ` [PATCH 18/26] dynamic_debug: describe_flags with '=[pmflta_]*' jim.cromie
2011-10-07 20:33   ` [PATCH 19/26] dynamic_debug: add flags filtering to flags spec jim.cromie
2011-10-07 20:33   ` [PATCH 20/26] dynamic_debug: make ddebug_describe_flags more generic jim.cromie
2011-10-07 20:33   ` [PATCH 21/26] dynamic_debug: add $DBGFS/dynamic_debug/pending file jim.cromie
2011-10-07 20:33   ` [PATCH 22/26] dynamic_debug: early return if _ddebug table is empty jim.cromie
2011-10-07 20:33   ` [PATCH 23/26] dynamic_debug: document pending queries, flags-filter, multiple queries jim.cromie
2011-10-07 20:33   ` [PATCH 24/26] dynamic_debug: reduce lineno field to a saner 18 bits jim.cromie
2011-10-07 20:33   ` [PATCH 25/26] dynamic_debug: add pr_fmt_*() for each severity jim.cromie
2011-10-07 20:33   ` [PATCH 26/26] printk.h: fix pr_cont_once() to not use pr_fmt() jim.cromie
2011-10-07 20:45     ` Joe Perches
2011-10-18 18:52   ` [PATCH 00/26] dynamic_debug: add pending queries, etc (~resend) Greg KH
2011-10-19 20:57     ` Jason Baron
2011-10-19 22:29       ` Greg KH

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=1317309888.1854.18.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=bart.vanassche@gmail.com \
    --cc=greg@kroah.com \
    --cc=jbaron@redhat.com \
    --cc=jim.cromie@gmail.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox