lkml.org 
[lkml]   [2006]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] let WARN_ON() output the condition
On Wed, 6 Dec 2006, Ingo Molnar wrote:

> a WARN_ON() also triggers a stack dump, which should pinpoint the exact
> location. (especially if combined with kallsyms) For example:

Actually, I was referring to something a little bit different. For example
kernel/mutex.c:__mutex_lock_common() calls spin_lock_mutex() on line 132.
spin_lock_mutex() contains

DEBUG_LOCKS_WARN_ON(in_interrupt()); \
local_irq_save(flags); \
__raw_spin_lock(&(lock)->raw_lock); \
DEBUG_LOCKS_WARN_ON(l->magic != l); \

When one of these two WARN_ONs trigger, we get only

WARNING at kernel/mutex.c:132 __mutex_lock_common()

but it's indistuingishable which of the two WARN_ONs triggered. My patch
turns this into

WARNING (l->magic != l) at kernel/mutex.c:132 __mutex_lock_common()

> side-effects happen regularly in WARN_ON()s and while they should be
> avoided, they are not noticed by the compiler and can cause nasty bugs
> if executed twice. Do we really need this change?

I absolutely don't insist on it to be merged, besides this Andrew also
pointed out non-trivial .text growth. I just cooked it up for myself when
debugging some locking problems and that warning at kernel/mutex.c:132
triggered, and I didn't know which one was the reason.

--
Jiri Kosina
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-12-06 09:51    [W:0.110 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site