Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760360AbWLFJ2E (ORCPT ); Wed, 6 Dec 2006 04:28:04 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760370AbWLFJ2E (ORCPT ); Wed, 6 Dec 2006 04:28:04 -0500 Received: from mx2.mail.elte.hu ([157.181.151.9]:40350 "EHLO mx2.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760360AbWLFJ2B (ORCPT ); Wed, 6 Dec 2006 04:28:01 -0500 Date: Wed, 6 Dec 2006 10:27:15 +0100 From: Ingo Molnar To: Jiri Kosina Cc: Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH] let WARN_ON() output the condition Message-ID: <20061206092714.GA31980@elte.hu> References: <20061206083730.GB24851@elte.hu> <20061206085428.GA28160@elte.hu> <20061206090715.GA30931@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.2i X-ELTE-VirusStatus: clean X-ELTE-SpamScore: 0.0 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=0.0 required=5.9 tests=AWL autolearn=no SpamAssassin version=3.0.3 0.0 AWL AWL: From: address is in the auto white-list Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2699 Lines: 71 * Jiri Kosina wrote: > On Wed, 6 Dec 2006, Ingo Molnar wrote: > > > i'll probably ack such a patch, it can be useful even when the line > > number is unique: if someone reports a WARN_ON() from an old kernel i > > dont have to dig up the exact source but can see it right from the > > condition what happened. Useful redundancy in bug output can be quite > > useful at times. Please post it and we'll see whether it's acceptable. > > OK, thanks, I will send it later today. > > BTW I still don't see how to distinguish it easily ... for example: > > WARNING at kernel/mutex.c:132 __mutex_lock_common() > [] dump_trace+0x68/0x1b5 > [] show_trace_log_lvl+0x18/0x2c > [] show_trace+0xf/0x11 > [] dump_stack+0x12/0x14 > [] __mutex_lock_slowpath+0xc6/0x261 > [] create_dir+0x24/0x1ba > [] sysfs_create_dir+0x45/0x5f > [] kobject_add+0xd6/0x18d > [] kobject_register+0x19/0x30 > [] md_probe+0x11a/0x124 > [] kobj_lookup+0xe6/0x122 > [] get_gendisk+0xe/0x1b > [] do_open+0x2e/0x298 > [] blkdev_open+0x25/0x4d > [] __dentry_open+0xc3/0x17e > [] nameidata_to_filp+0x24/0x33 > [] do_filp_open+0x32/0x39 > [] do_sys_open+0x42/0xbe > [] sys_open+0x1c/0x1e > [] syscall_call+0x7/0xb > > How can you see immediately which one of the two WARN_ONs in > spin_lock_mutex() triggered? yeah, i can tell that even without assembly or gdb, just from the offset: > [] __mutex_lock_slowpath+0xc6/0x261 there are 4 WARN_ON()s in __mutex_lock_slowpath(), distributed roughly equally. Which makes the above one the second out of the four WARN_ON()s, i.e.: DEBUG_LOCKS_WARN_ON(l->magic != l); \ Did i get it right? (but then again i guess i've got an unfair advantage in interpreting locking related bug messages ;-) but it can also be told semantically, it cannot be the in_interrupt() assert because this is clearly not IRQ context: > [] __mutex_lock_slowpath+0xc6/0x261 > [] create_dir+0x24/0x1ba > [] sysfs_create_dir+0x45/0x5f but in such cases i'd rather suggest the use of inline functions instead of macros and then it's a simple gdb lookup to figure out the call site. So, which clown added that macro to mutex-debug.h ... oh, never mind. Ingo - 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/