From sgi-kdb@gmane.org Tue Feb 13 13:05:13 2007 Received: with ECARTIS (v1.0.0; list kdb); Tue, 13 Feb 2007 13:05:21 -0800 (PST) X-Spam-oss-Status: No, score=4.5 required=5.0 tests=BAYES_80, DATE_IN_PAST_03_06,SPF_HELO_PASS autolearn=no version=3.2.0-pre1-r497472 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id l1DL5Cm7032239 for ; Tue, 13 Feb 2007 13:05:13 -0800 Received: from root by ciao.gmane.org with local (Exim 4.43) id 1HH4D0-0000Wg-4Y for kdb@oss.sgi.com; Tue, 13 Feb 2007 21:25:02 +0100 Received: from paris.icsb.fr ([195.6.191.124]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 13 Feb 2007 21:25:02 +0100 Received: from {gmane}+no/spam by paris.icsb.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 13 Feb 2007 21:25:02 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: kdb@oss.sgi.com From: Eric Belhomme <{gmane}+no/spam@ricospirit.net> Subject: howto debug scsi device driver ? Date: Tue, 13 Feb 2007 17:20:09 +0000 (UTC) Lines: 30 Message-ID: X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: paris.icsb.fr User-Agent: Xnews/2006.08.24 X-archive-position: 1193 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: sgi-kdb@gmane.org Precedence: bulk X-list: kdb Hi, I have a LSI MegaRAID i4 (511 series) IDE RAID card (I believe it is the same than DELL CERC card). This card works well on a 2.6.11.6 vanilla kernel, with the old megaraid module. But I tried to upgrade the kernel to the last release (2.6.20) with almost the same config (I done a 'make oldconfig' command) and the card doesn't work anymore (the scsi host is not found on dmesg) I diff-ed megaraid.c from both versions and I noticed megaraid release from 2.6.11.6 is 2.00.3 while release from 2.6.20 is 2.00.4... I looked on the code with my little coding skills, and I understood the main differences are : * changing naming conventions for some data structures, * hardening some pieces of code when saving/restoring IRQs * adding some code for handling SCSI SENSE (don't know what it is for...) I never hacked linux kernel, nor scsi low-level drivers, so I have absolutelly no ideas of the way of debugging this code... So I wondered some kernel gurus here would be kind enough to give me some hints (maybe a howto or a cookbook exists ?) to try to debug by myself this module ! Thanks ! PS: I added an entry #7999 on http://bugzilla.kernel.org -- Rico --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From kaos@sgi.com Mon Feb 26 05:59:32 2007 Received: with ECARTIS (v1.0.0; list kdb); Mon, 26 Feb 2007 05:59:40 -0800 (PST) X-Spam-oss-Status: No, score=0.0 required=5.0 tests=BAYES_50 autolearn=ham version=3.2.0-pre1-r497472 Received: from larry.melbourne.sgi.com (larry.melbourne.sgi.com [134.14.52.130]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with SMTP id l1QDxSm7014033 for ; Mon, 26 Feb 2007 05:59:29 -0800 Received: from mail.ocs.com.au (kao1.melbourne.sgi.com [134.14.55.179]) by larry.melbourne.sgi.com (950413.SGI.8.6.12/950213.SGI.AUTOCF) via ESMTP id AAA09766 for ; Tue, 27 Feb 2007 00:42:53 +1100 Received: from ocs3.ocs.com.au (ocs3w.ocs.com.au [192.168.254.3]) by mail.ocs.com.au (Postfix) with ESMTP id 8C22AE0B209; Tue, 27 Feb 2007 00:42:53 +1100 (EST) X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.1 From: Keith Owens To: "Zhou, Water" cc: "kdb@oss.sgi.com" Subject: Re: one problem about using kdb 'ss' command In-reply-to: Your message of "Mon, 26 Feb 2007 14:13:24 +0800." <20070226141324709.00000003680@chnxsc383> Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Date: Tue, 27 Feb 2007 00:42:54 +1100 Message-ID: <13158.1172497374@ocs3.ocs.com.au> Content-Transfer-Encoding: 8bit X-archive-position: 1194 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: kaos@sgi.com Precedence: bulk X-list: kdb "Zhou, Water" (on Mon, 26 Feb 2007 14:13:24 +0800) wrote: > Entering kdb (current=0xc460b550, pid 1125) duo to Breakpoint @0xc016ca90 > kdb> ss > > kdb_ss: pt_regs not available > >I think the problem is because of get_irq_regs() inline function >return NULL when the breakpoint is touched. I don't know why ? Correct, there are a couple of paths that do not call set_irq_regs(). Could you try this patch, it is against kdb-v4.4-2.6.20-common-4 but should apply to 2.6.19 as well. The patch compiles but I will not be able to test it for for several hours. Index: linux/kdb/kdbmain.c =================================================================== --- linux.orig/kdb/kdbmain.c 2007-02-27 00:40:29.996600672 +1100 +++ linux/kdb/kdbmain.c 2007-02-27 00:40:18.934043094 +1100 @@ -1736,6 +1736,7 @@ kdb(kdb_reason_t reason, int error, stru kdb_reason_t reason2 = reason; int result = 0; /* Default is kdb did not handle it */ int ss_event; + struct pt_regs *old_regs = NULL; kdb_dbtrap_t db_result=KDB_DB_NOBPT; preempt_disable(); atomic_inc(&kdb_event); @@ -1745,6 +1746,11 @@ kdb(kdb_reason_t reason, int error, stru case KDB_REASON_NMI: KDB_FLAG_SET(CATASTROPHIC); /* kernel state is dubious now */ break; + case KDB_REASON_ENTER: + case KDB_REASON_ENTER_SLAVE: + if (regs != get_irq_regs()) + old_regs = set_irq_regs(regs); + break; default: break; } @@ -2060,6 +2066,8 @@ kdb(kdb_reason_t reason, int error, stru if (!(KDB_STATE(DOING_SS) || KDB_STATE(SSBPT) || KDB_STATE(RECURSE))) { KDB_DEBUG_STATE("kdb 15", result); kdb_bp_install_local(regs); + if (old_regs) + set_irq_regs(old_regs); KDB_STATE_CLEAR(KDB_CONTROL); } --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From kaos@sgi.com Mon Feb 26 16:01:47 2007 Received: with ECARTIS (v1.0.0; list kdb); Mon, 26 Feb 2007 16:01:54 -0800 (PST) X-Spam-oss-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.0-pre1-r497472 Received: from larry.melbourne.sgi.com (larry.melbourne.sgi.com [134.14.52.130]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with SMTP id l1R01im7007259 for ; Mon, 26 Feb 2007 16:01:46 -0800 Received: from kao2.melbourne.sgi.com (kao2.melbourne.sgi.com [134.14.55.180]) by larry.melbourne.sgi.com (950413.SGI.8.6.12/950213.SGI.AUTOCF) via ESMTP id LAA26992; Tue, 27 Feb 2007 11:01:37 +1100 X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.1 From: Keith Owens To: "Zhou, Water" cc: "kdb@oss.sgi.com" Subject: Re: one problem about using kdb 'ss' command In-reply-to: Your message of "Tue, 27 Feb 2007 00:42:54 +1100." <13158.1172497374@ocs3.ocs.com.au> Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Date: Tue, 27 Feb 2007 11:01:39 +1100 Message-ID: <6261.1172534499@kao2.melbourne.sgi.com> Content-Transfer-Encoding: 8bit X-archive-position: 1195 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: kaos@sgi.com Precedence: bulk X-list: kdb Keith Owens (on Tue, 27 Feb 2007 00:42:54 +1100) wrote: >"Zhou, Water" (on Mon, 26 Feb 2007 14:13:24 +0800) wrote: >> Entering kdb (current=3D0xc460b550, pid 1125) duo to Breakpoint @0xc016ca90 >> kdb> ss >> >> kdb_ss: pt_regs not available >> >>I think the problem is because of get_irq_regs() inline function >>return NULL when the breakpoint is touched. I don't know why ? > >Correct, there are a couple of paths that do not call set_irq_regs(). >Could you try this patch, it is against kdb-v4.4-2.6.20-common-4 but >should apply to 2.6.19 as well. The patch compiles but I will not be >able to test it for for several hours. After testing, this is the correct patch. It is included in kdb-v4.4-2.6.20-common-5. Index: linux/kdb/kdbmain.c =================================================================== --- linux.orig/kdb/kdbmain.c 2007-02-27 10:51:18.403100729 +1100 +++ linux/kdb/kdbmain.c 2007-02-27 10:44:43.146860775 +1100 @@ -1735,7 +1735,8 @@ kdb(kdb_reason_t reason, int error, stru kdb_intstate_t int_state; /* Interrupt state */ kdb_reason_t reason2 = reason; int result = 0; /* Default is kdb did not handle it */ - int ss_event; + int ss_event, old_regs_saved = 0; + struct pt_regs *old_regs = NULL; kdb_dbtrap_t db_result=KDB_DB_NOBPT; preempt_disable(); atomic_inc(&kdb_event); @@ -1748,6 +1749,23 @@ kdb(kdb_reason_t reason, int error, stru default: break; } + switch(reason) { + case KDB_REASON_ENTER: + case KDB_REASON_ENTER_SLAVE: + case KDB_REASON_BREAK: + case KDB_REASON_DEBUG: + case KDB_REASON_OOPS: + case KDB_REASON_SWITCH: + case KDB_REASON_KEYBOARD: + case KDB_REASON_NMI: + if (regs && regs != get_irq_regs()) { + old_regs = set_irq_regs(regs); + old_regs_saved = 1; + } + break; + default: + break; + } if (kdb_continue_catastrophic > 2) { kdb_printf("kdb_continue_catastrophic is out of range, setting to 2\n"); kdb_continue_catastrophic = 2; @@ -2060,6 +2078,8 @@ kdb(kdb_reason_t reason, int error, stru if (!(KDB_STATE(DOING_SS) || KDB_STATE(SSBPT) || KDB_STATE(RECURSE))) { KDB_DEBUG_STATE("kdb 15", result); kdb_bp_install_local(regs); + if (old_regs_saved) + set_irq_regs(old_regs); KDB_STATE_CLEAR(KDB_CONTROL); } --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe.