NetBSD Problem Report #40288

From fun@naobsd.org  Mon Dec 29 13:21:10 2008
Return-Path: <fun@naobsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id E9A9D63B8BD
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 29 Dec 2008 13:21:10 +0000 (UTC)
Message-Id: <200812291321.mBTDL51r008574@mail.naobsd.org>
Date: Mon, 29 Dec 2008 22:21:06 +0900 (JST)
From: fun@naobsd.org
Reply-To: fun@naobsd.org
To: gnats-bugs@gnats.NetBSD.org
Subject: ci_idepth{++,--} is needed in ext_intr() for ibm4xx
X-Send-Pr-Version: 3.95

>Number:         40288
>Category:       port-evbppc
>Synopsis:       ci_idepth{++,--} seems to be needed in ext_intr() for ibm4xx
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-evbppc-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 29 13:25:00 +0000 2008
>Closed-Date:    Sun Feb 08 06:24:51 +0000 2009
>Last-Modified:  Sun Feb 08 06:24:51 +0000 2009
>Originator:     FUKAUMI Naoki
>Release:        NetBSD 5.0_BETA
>Organization:
	FUKAUMI Naoki
>Environment:
NetBSD 5.0_BETA (OPENBLOCKS266) #0: Sun Dec 28 20:35:53 JST 2008
>Description:
	OPENBLOCKS266 kernel panics while using wd(4) attached at
	hptide(4).

  :
hptide0 at pci0 dev 3 function 0
hptide0: Triones/Highpoint HPT371 IDE Controller
hptide0: using irq 30 for native-PCI interrupt
atabus0 at hptide0 channel 0
atabus1 at hptide0 channel 1
wd0 at atabus1 drive 0: <TRANSCEND>
wd0: 1911 MB, 3884 cyl, 16 head, 63 sec, 512 bytes/sect x 3915072 sectors
root device: wd0c
dump device (default wd0b): 
file system (default generic): 
root on wd0c dumps on wd0b
  :
init path (default /sbin/init): 
init: copying out path `/sbin/init' 11
Mutex error: mutex_vector_enter: locking against myself

lock address : 0x0000000007de3200
current cpu  :                  0
current lwp  : 0x0000000007f2d900
owner field  : 0x0000000007f2d900 wait/spin:                0/0

panic: lock error
Stopped in pid 2.1 (init) at    netbsd:cpu_Debugger+0x10:       lwz     r0, r1, 0
x14
db> bt
0x003f3d30: at panic+0x21c
0x003f3d80: at lockdebug_abort+0x48
0x003f3da0: at mutex_abort+0x54
0x003f3db0: at mutex_vector_enter+0x1b0
0x003f3de0: at biodone2+0x3c
0x003f3e00: at wddone+0x84
0x003f3e20: at wdc_ata_bio_done+0xa8
0x003f3e40: at wdc_ata_bio_intr+0x33c
0x003f3e70: at wdcintr+0xb4
0x003f3e90: at hpt_pci_intr+0x84
0x003f3ec0: at ext_intr+0xfc
0x003f3f00: at emptyidlespin+0x4d8
0x003f3f60: at ext_intr+0xfc
0x003f3fa0: at emptyidlespin+0x4d8
0x89653d60: at 0xfffffffc
0x89653d70: at pmap_enter+0x3d4
0x89653db0: at uvm_fault_internal+0xc1c
0x89653ee0: at trap+0xfc
0x89653f40: user trap 0x1200 by 0x4191a880: srr1=0xc030
            r1=0xfffeab60 cr=0x44000042 xer=0 ctr=0x4191a878 esr=0 pid=0x4

>How-To-Repeat:
	access wd(4) on OPENBLOCKS266 kernel.
>Fix:
	I'm not sure this is correct.

Index: sys/arch/powerpc/ibm4xx/intr.c
===================================================================
RCS file: /home/fun/cvsroot/NetBSD/src/sys/arch/powerpc/ibm4xx/intr.c,v
retrieving revision 1.20
diff -u -p -r1.20 intr.c
--- sys/arch/powerpc/ibm4xx/intr.c	2 Jan 2008 11:48:27 -0000	1.20
+++ sys/arch/powerpc/ibm4xx/intr.c	26 Dec 2008 07:36:33 -0000
@@ -234,6 +234,11 @@ ext_intr(void)
 	int pcpl;
 	u_long int_state;

+#ifdef __HAVE_FAST_SOFTINTS
+#error don't count soft interrupts
+#else
+	ci->ci_idepth++;
+#endif
 	pcpl = ci->ci_cpl;
 	msr = mfmsr();

@@ -279,6 +284,7 @@ ext_intr(void)
 	wrteei(1);
 	splx(pcpl);
 	mtmsr(msr);
+	ci->ci_idepth--;
 }

 static inline void

>Release-Note:

>Audit-Trail:
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@NetBSD.org
Cc: port-evbppc-maintainer@NetBSD.org, gnats-admin@NetBSD.org,
        netbsd-bugs@NetBSD.org, tsutsui@ceres.dti.ne.jp
Subject: Re: port-evbppc/40288: ci_idepth{++,--} is needed in ext_intr() for
	 ibm4xx
Date: Thu, 1 Jan 2009 02:00:43 +0900

 > >Synopsis:       ci_idepth{++,--} seems to be needed in ext_intr() for ibm4xx

 Could you try this one instead?
 (taken from powerpc/pic/intr.c:pic_handle_intr())

 Index: intr.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/powerpc/ibm4xx/intr.c,v
 retrieving revision 1.20
 diff -u -r1.20 intr.c
 --- intr.c	2 Jan 2008 11:48:27 -0000	1.20
 +++ intr.c	31 Dec 2008 16:58:06 -0000
 @@ -251,6 +251,7 @@
  			ci->ci_ipending |= r_imen;
  			disable_irq(i);
   		} else {
 +			ci->ci_idepth++;
  			splraise(intrs[i].is_mask);
  			if (intrs[i].is_type == IST_LEVEL)
  				disable_irq(i);
 @@ -272,6 +273,7 @@
  			ci->ci_cpl = pcpl;
  			uvmexp.intrs++;
  			intrs[i].is_evcnt.ev_count++;
 +			ci->ci_idepth--;
  		}
  	}
  	mtdcr(INTR_ACK, bits_to_clear);	/* Acknowledge all pending interrupts */

 ---
 Izumi Tsutsui

From: FUKAUMI Naoki <fun@naobsd.org>
To: gnats-bugs@NetBSD.org
Cc: port-evbppc-maintainer@NetBSD.org, gnats-admin@NetBSD.org,
        netbsd-bugs@NetBSD.org
Subject: Re: port-evbppc/40288: ci_idepth{++,--} is needed in ext_intr() for	 ibm4xx
Date: Sun, 04 Jan 2009 22:42:02 +0900

 At Wed, 31 Dec 2008 17:05:03 +0000 (UTC),
 Izumi Tsutsui wrote:
 >  Could you try this one instead?
 >  (taken from powerpc/pic/intr.c:pic_handle_intr())

 your patch also works fine!

 >  Index: intr.c
 >  ===================================================================
 >  RCS file: /cvsroot/src/sys/arch/powerpc/ibm4xx/intr.c,v
 >  retrieving revision 1.20
 >  diff -u -r1.20 intr.c
 >  --- intr.c	2 Jan 2008 11:48:27 -0000	1.20
 >  +++ intr.c	31 Dec 2008 16:58:06 -0000
 >  @@ -251,6 +251,7 @@
 >   			ci->ci_ipending |= r_imen;
 >   			disable_irq(i);
 >    		} else {
 >  +			ci->ci_idepth++;
 >   			splraise(intrs[i].is_mask);
 >   			if (intrs[i].is_type == IST_LEVEL)
 >   				disable_irq(i);
 >  @@ -272,6 +273,7 @@
 >   			ci->ci_cpl = pcpl;
 >   			uvmexp.intrs++;
 >   			intrs[i].is_evcnt.ev_count++;
 >  +			ci->ci_idepth--;
 >   		}
 >   	}
 >   	mtdcr(INTR_ACK, bits_to_clear);	/* Acknowledge all pending interrupts */

 --
 FUKAUMI Naoki

From: Izumi Tsutsui <tsutsui@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/40288 CVS commit: src/sys/arch/powerpc/ibm4xx
Date: Sun,  4 Jan 2009 15:34:18 +0000 (UTC)

 Module Name:	src
 Committed By:	tsutsui
 Date:		Sun Jan  4 15:34:18 UTC 2009

 Modified Files:
 	src/sys/arch/powerpc/ibm4xx: intr.c

 Log Message:
 Account ci->ci_idepth on calling handlers in ext_intr() as well as
 powerpc/pic/intr.c:pic_handle_intr().  Closes PR port-evbppc/40288.

 Should be pulled up to netbsd-5.


 To generate a diff of this commit:
 cvs rdiff -r1.20 -r1.21 src/sys/arch/powerpc/ibm4xx/intr.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->pending-pullups
State-Changed-By: tsutsui@NetBSD.org
State-Changed-When: Mon, 05 Jan 2009 00:40:22 +0900
State-Changed-Why:
Fix committed, and pullup request will be sent later.


From: Soren Jacobsen <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/40288 CVS commit: [netbsd-5] src/sys/arch/powerpc/ibm4xx
Date: Wed, 14 Jan 2009 17:50:25 +0000 (UTC)

 Module Name:	src
 Committed By:	snj
 Date:		Wed Jan 14 17:50:25 UTC 2009

 Modified Files:
 	src/sys/arch/powerpc/ibm4xx [netbsd-5]: intr.c

 Log Message:
 Pull up following revision(s) (requested by tsutsui in ticket #246):
 	sys/arch/powerpc/ibm4xx/intr.c: revision 1.21
 Account ci->ci_idepth on calling handlers in ext_intr() as well as
 powerpc/pic/intr.c:pic_handle_intr().  Closes PR port-evbppc/40288.
 Should be pulled up to netbsd-5.


 To generate a diff of this commit:
 cvs rdiff -r1.20 -r1.20.20.1 src/sys/arch/powerpc/ibm4xx/intr.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 08 Feb 2009 06:24:51 +0000
State-Changed-Why:
Pullup completed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.