From: "Horst H. von Brand" <vonbrand@inf.utfsm.cl>
To: Andrew Morton <akpm@osdl.org>
Cc: Jiri Kosina <jkosina@suse.cz>, Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] let WARN_ON() output the condition
Date: Wed, 06 Dec 2006 09:52:27 -0300 [thread overview]
Message-ID: <200612061252.kB6CqRYP008046@laptop13.inf.utfsm.cl> (raw)
In-Reply-To: Message from Andrew Morton <akpm@osdl.org> of "Tue, 05 Dec 2006 17:27:37 -0800." <20061205172737.14ecfeb3.akpm@osdl.org>
Andrew Morton <akpm@osdl.org> wrote:
> On Wed, 6 Dec 2006 01:51:01 +0100 (CET)
> Jiri Kosina <jkosina@suse.cz> wrote:
>
> > [PATCH] let WARN_ON() output the condition
> >
> > It is possible, in some cases, that the output of WARN_ON() is ambiguous
> > and can't be properly used to identify the exact condition which caused
> > the warning to trigger. This happens whenever there is a macro that
> > contains multiple WARN_ONs inside. Notable example is spin_lock_mutex().
> > If any of the two WARN_ONs trigger, we are not able to say which one was
> > the cause (as we get only line number, which however belongs to the place
> > where the macro was expanded).
> >
> > This patch lets WARN_ON() to output also the condition and fixes the
> > DEBUG_LOCKS_WARN_ON() macro to pass the condition properly to WARN_ON. The
> > possible drawback could be when someone passes a condition which has
> > sideeffects. Then it would be evaluated twice, instead of current one
> > evaluation. On the other hand, when anyone passes expression with
> > sideeffects to WARN_ON(), he is asking for problems anyway.
> >
> > Patch against 2.6.19-rc6-mm2.
> >
> > Signed-off-by: Jiri Kosina <jkosina@suse.cz>
> >
> > ---
> >
> > include/asm-generic/bug.h | 4 ++--
> > include/linux/debug_locks.h | 2 +-
> > 2 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
> > index a06eecd..af7574e 100644
> > --- a/include/asm-generic/bug.h
> > +++ b/include/asm-generic/bug.h
> > @@ -35,8 +35,8 @@ #ifndef HAVE_ARCH_WARN_ON
> > #define WARN_ON(condition) ({ \
> > typeof(condition) __ret_warn_on = (condition); \
> > if (unlikely(__ret_warn_on)) { \
> > - printk("WARNING at %s:%d %s()\n", __FILE__, \
> > - __LINE__, __FUNCTION__); \
> > + printk("WARNING (%s) at %s:%d %s()\n", #condition, \
> > + __FILE__,__LINE__, __FUNCTION__); \
__FILE__, __LINE__, __FUNCTION__);
(missing space after "__FILE__,")
> > dump_stack(); \
> > } \
> > unlikely(__ret_warn_on); \
> > diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
> > index 952bee7..1c2b682 100644
> > --- a/include/linux/debug_locks.h
> > +++ b/include/linux/debug_locks.h
> > @@ -25,7 +25,7 @@ ({ \
> > \
> > if (unlikely(c)) { \
> > if (debug_locks_off()) \
> > - WARN_ON(1); \
> > + WARN_ON(c); \
> > __ret = 1; \
> > } \
> > __ret; \
Why not just:
WARN_ON(debug_locks_off())
here? Would give a more readable message too, IMHO.
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria +56 32 2654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 2797513
next prev parent reply other threads:[~2006-12-06 12:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-06 0:51 Jiri Kosina
2006-12-06 1:27 ` Andrew Morton
2006-12-06 12:52 ` Horst H. von Brand [this message]
2006-12-06 13:54 ` Ingo Molnar
2006-12-06 14:35 ` Jaswinder Singh
2006-12-06 15:08 ` Jiri Kosina
2006-12-06 8:37 ` Ingo Molnar
2006-12-06 8:47 ` Jiri Kosina
2006-12-06 8:54 ` Ingo Molnar
2006-12-06 9:04 ` Jiri Kosina
2006-12-06 9:07 ` Ingo Molnar
2006-12-06 9:11 ` Jiri Kosina
2006-12-06 9:27 ` Ingo Molnar
2006-12-06 9:14 ` Jan Engelhardt
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=200612061252.kB6CqRYP008046@laptop13.inf.utfsm.cl \
--to=vonbrand@inf.utfsm.cl \
--cc=akpm@osdl.org \
--cc=jkosina@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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®