Re: [PATCH] let WARN_ON() output the condition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux