NetBSD Problem Report #13827

Received: (qmail 22693 invoked from network); 30 Aug 2001 02:53:37 -0000
Message-Id: <20010830025832.ABDF75436@woffi.planix.com>
Date: Wed, 29 Aug 2001 22:58:32 -0400 (EDT)
From: Andreas Wrede <andreas@planix.com>
Reply-To: Andreas Wrede <andreas@planix.com>
To: gnats-bugs@gnats.netbsd.org
Subject: fatal page fault in supervisor mode and hang in 1.5.1
X-Send-Pr-Version: 3.95

>Number:         13827
>Category:       kern
>Synopsis:       Kernel panics with fatal page fault in supervisor mode and reboot hangs while syncing disks
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    bouyer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 30 02:54:00 +0000 2001
>Closed-Date:    Sat Mar 09 16:16:54 +0000 2002
>Last-Modified:  Sat Mar 09 16:16:54 +0000 2002
>Originator:     Andreas Wrede
>Release:        1.5.1
>Organization:
Planix, Inc.
>Environment:

System:NetBSD idefix.tvo.org 1.5.1 NetBSD 1.5.1 (TVO) #0: Wed Aug 29 09:25:13 EDT 2001     root@tube.tvo.org:/usr/src/sys/arch/i386/compile/TVO i386


>Description:
After upgrading two (nearly) identical Compaq Proliant 3000 servers 
from NetBSD 1.4.1 to 1.5.1, both servers will sometimes panic during 
periods of high I/O load, ie. during /etc/daily runs and/or 
amanda/dump backups. The kernel is a GENERIC kernel minus some 
fs-types and drivers, plus IPsec.

The filesystem were mounted with and without softdep at the time of 
the various crashes. 

After the panic, during 'syncing disk' the system hangs after 
printing 'command timeout' messages for the SCSI devices. Breaking 
into the debugger running sync will rest the scsibus and proceed to 
dump memory to disk but savecore does not find the core dump in the 
swap partition.


------ BOOT -----
>How-To-Repeat:
	Build custom kernel(?). Run high I/O load. 
>Fix:

unknown
>Release-Note:
>Audit-Trail:

From: Andreas Wrede <andreas@planix.com>
To: <gnats-bugs@netbsd.org>
Cc:  
Subject: Re: kern/13827
Date: Fri, 31 Aug 2001 08:27:20 -0400 (EDT)

 In order to narrow down the source of the problem, I replaced the
 customer kernel with a GENERIC kernel:

 NetBSD 1.5.1 (GENERIC) #56: Mon Jul  2 15:54:23 CEST 2001
     he@nsa.uninett.no:/usr/src/sys/arch/i386/compile/GENERIC

 The panic re-occured while running /etc/daily. This time it gets hung
 after printing 'kernel: fault trap, code=0' the remainder of the trap
 line (ie  eip xxxxxxxx cs x eflags xxxx...) is missing. Also missing
 is the line 'fatal page fault in supervisor mode'.

 kernel: page fault trap, code=0
 Stopped at      lockmgr+0x78:   movl          0x3c(%ecx),%ecx
 db>
 db> trace
 lockmgr(c0545024,10012,c05450a8) at lockmgr+0x78
 uvm_map(c0545020,d25a1a80,1000,c0544fc0,ffffffff) at uvm_map+0x79
 uvm_km_valloc(c0545020,1000,c0531da0,c0b12420,c0b09b00) at uvm_km_valloc+0x37
 _bus_dmamem_map(c0531da0,d25a1af4,1,1000,c0b1242c) at _bus_dmamem_map+0x2e
 siop_morecbd(c0a72c00) at siop_morecbd+0xf9
 siop_scsicmd(c0a9065c) at siop_scsicmd+0x52
 scsipi_execute_xs(c0a9065c,0,1009,c0a70200,d25a1bac) at scsipi_execute_xs+0x36
 scsi_scsipi_cmd(c0a70200,d25a1c00,a,c524a000,2000) at scsi_scsipi_cmd+0xd3
 scsipi_command(c0a70200,d25a1c00,a,c524a000,2000) at scsipi_command+0x59
 sdstart(c0a8a800,d000fdc4,c501ecc0,d25a1c40,c0308b9f) at sdstart+0x1ea
 scsipi_free_xs(c0a9065c,1) at scsipi_free_xs+0x8b
 scsipi_done(c0a9065c,c0a72c00,ff00,1,1009) at scsipi_done+0x123
 siop_scsicmd_end(c0a8ba00,c0a7ee80,d25924bc,d25924bc,c0a72c00) at siop_scsicmd_end+0x35d
 siop_intr(c0a72c00) at siop_intr+0x1370
 Xintr10() at Xintr10+0x7c
 --- interrupt ---
 idle(d25924bc) at idle+0x1c
 bpendtsleep(c4fe26e8,11,c041de7a,0,0) at bpendtsleep
 biowait(c4fe26e8,40,d25b8b0c,c0a9d000,c04ebc20) at biowait+0x31
 bread(d259a8f0,40,2000,ffffffff,d25a1df8) at bread+0x95
 ffs_update(d25a1e2c,d25b9288,d25a1ef4,d25aa1a4,0) at ffs_update+0x1bc
 ffs_full_fsync(d25a1ef4,d25b9288,d25a1ef4,d25aa1a4,d28b8330) at ffs_full_fsync+0x224
 ffs_fsync(d25a1ef4) at ffs_fsync+0x3a
 ffs_sync(c0a9f200,3,c0a70f80,d25924bc) at ffs_sync+0xf3
 sync_fsync(d25a1f68) at sync_fsync+0x53
 db> sync
 syncing disks... tl1: receiver ring buffer overrun
 tl0: receiver ring buffer overrun
 Stopped at      cpu_Debugger+0x4:       leave
 db> sync

 dumping to dev 4,1 offset 500487
 dump
 [here the machine looks up hard].

 For completness, here is the boot log:

 >> NetBSD/i386 BIOS Boot, Revision 2.7
 >> (he@nsa.uninett.no, Mon Jun 18 01:32:10 CEST 2001)
 >> Memory: 639/261120 k
 Use hd1a:netbsd to boot sd0 when wd0 is also installed
 Press return to boot now, any other key for boot menu
 booting wd0a:netbsd - starting in 0
 4057080+386684+316588 [65+245488+200220]=0x4f823c
 [ preserving 446228 bytes of netbsd ELF symbol table ]
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001
     The NetBSD Foundation, Inc.  All rights reserved.
 Copyright (c) 1982, 1986, 1989, 1991, 1993
     The Regents of the University of California.  All rights reserved.

 NetBSD 1.5.1 (GENERIC) #56: Mon Jul  2 15:54:23 CEST 2001
     he@nsa.uninett.no:/usr/src/sys/arch/i386/compile/GENERIC
 cpu0: Intel Pentium III (Katmai) (686-class), 498.90 MHz
 total memory = 255 MB
 avail memory = 231 MB
 using 3297 buffers containing 13188 KB of memory
 BIOS32 rev. 0 found at 0xf0000
 mainbus0 (root)
 pci0 at mainbus0 bus 0: configuration mode 1
 pci0: i/o space, memory space enabled
 pchb0 at pci0 dev 0 function 0
 pchb0: Intel 82443BX Host Bridge/Controller (AGP disabled) (rev. 0x02)
 vga1 at pci0 dev 11 function 0: Cirrus Logic CL-GD5446 (rev. 0x45)
 wsdisplay0 at vga1
 ppb0 at pci0 dev 13 function 0: Digital Equipment DECchip 21150 PCI-PCI Bridge (rev. 0x04)
 pci1 at ppb0 bus 1
 pci1: i/o space, memory space enabled
 tl0 at pci1 dev 7 function 0
 tl0: Compaq ProLiant Integrated Netelligent 10/100 TX
 tl0: Ethernet address 00:50:8b:2c:e5:94
 tl0: interrupting at irq 9
 nsphy0 at tl0 phy 1: DP83840 10/100 media interface, rev. 1
 nsphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 tlphy0 at tl0 phy 31: ThunderLAN 10baseT media interface, rev. 5
 tlphy0: 10base2
 siop0 at pci1 dev 9 function 0: Symbios Logic 53c875 (ultra-wide scsi)
 siop0: using on-board RAM
 siop0: interrupting at irq 10
 scsibus0 at siop0: 16 targets, 8 luns per target
 siop1 at pci1 dev 9 function 1: Symbios Logic 53c875 (ultra-wide scsi)
 siop1: using on-board RAM
 siop1: interrupting at irq 11
 scsibus1 at siop1: 16 targets, 8 luns per target
 tl1 at pci1 dev 11 function 0
 tl1: Compaq Netelligent 10/100 TX
 tl1: Ethernet address 00:80:5f:31:2e:81
 tl1: interrupting at irq 5
 nsphy1 at tl1 phy 1: DP83840 10/100 media interface, rev. 1
 nsphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 tlphy1 at tl1 phy 31: ThunderLAN 10baseT media interface, rev. 5
 tlphy1: no media present
 Compaq product 0xa0f0 (miscellaneous system) at pci0 dev 14 function 0 not configured
 pcib0 at pci0 dev 20 function 0
 pcib0: Intel 82371AB PCI-to-ISA Bridge (PIIX4) (rev. 0x02)
 pciide0 at pci0 dev 20 function 1: Intel 82371AB IDE controller (PIIX4) (rev. 0x
 01)
 pciide0: bus-master DMA support present
 pciide0: primary channel wired to compatibility mode
 atapibus0 at pciide0 channel 0
 cd0 at atapibus0 drive 0: <CD-ROM CDU701-Q, , 1.0r> type 5 cdrom removable
 cd0: 32-bit data port
 cd0: drive supports PIO mode 4, DMA mode 2
 pciide0: primary channel interrupting at irq 14
 cd0(pciide0:0:0): using PIO mode 4, DMA mode 2 (using DMA data transfers)
 pciide0: secondary channel wired to compatibility mode
 pciide0: secondary channel ignored (disabled)
 Uhci0 at pci0 dev 20 function 2: Intel 82371AB USB Host Controller (PIIX4) (rev. 0x01)
 uhci0: can't map i/o space
 Intel 82371AB Power Management Controller (PIIX4) (miscellaneous bridge, revision 0x02) at pci0 dev 20 function 3 not configured
 isa0 at pcib0
 com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
 com0: console
 com1 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
 pckbc0 at isa0 port 0x60-0x64
 pckbd0 at pckbc0 (kbd slot)
 pckbc0: using irq 1 for kbd slot
 wskbd0 at pckbd0
 pcppi0 at isa0 port 0x61
 midi0 at pcppi0: PC speaker
 sysbeep0 at pcppi0
 isapnp0 at isa0 port 0x279: ISA Plug 'n Play device support
 npx0 at isa0 port 0xf0-0xff: using exception 16
 fdc0 at isa0 port 0x3f0-0x3f7 irq 6 drq 2
 fd0 at fdc0 drive 0: 1.44MB, 80 cyl, 2 head, 18 sec
 isapnp0: no ISA Plug 'n Play devices found
 biomask fdc5 netmask ffe5 ttymask ffe7
 scsibus0: waiting 2 seconds for devices to settle...
 siop0: target 0 using tagged queuing
 sd0 at scsibus0 target 0 lun 0: <COMPAQ, BD009122C6, B016> SCSI2 0/direct fixed
 siop0: target 0 using 16bit transfers
 siop0: target 0 now synchronous at 20.0Mhz, offset 16
 sd0: 8678 MB, 5273 cyl, 20 head, 168 sec, 512 bytes/sect x 17773524 sectors
 siop0: target 1 using tagged queuing
 sd1 at scsibus0 target 1 lun 0: <COMPAQ, BD009122C6, B016> SCSI2 0/direct fixed
 siop0: target 1 using 16bit transfers
 siop0: target 1 now synchronous at 20.0Mhz, offset 16
 sd1: 8678 MB, 5273 cyl, 20 head, 168 sec, 512 bytes/sect x 17773524 sectors
 siop0: target 2 using tagged queuing
 sd2 at scsibus0 target 2 lun 0: <COMPAQ, BD009122C6, B016> SCSI2 0/direct fixed
 siop0: target 2 using 16bit transfers
 siop0: target 2 now synchronous at 20.0Mhz, offset 16
 sd2: 8678 MB, 5273 cyl, 20 head, 168 sec, 512 bytes/sect x 17773524 sectors
 scsibus1: waiting 2 seconds for devices to settle...
 siop1: target 6 using 8bit transfers
 siop1: target 6 now synchronous at 10.0Mhz, offset 15
 st0 at scsibus1 target 6 lun 0: <COMPAQ, DLT8000, 011A> SCSI2 1/sequential removable
 st0: siop1: target 6 using 16bit transfers
 siop1: target 6 now synchronous at 10.0Mhz, offset 15
 drive empty
 boot device: sd0
 root on sd0a dumps on sd0b
 root file system type: ffs


 -- 
     - aew

State-Changed-From-To: open->feedback 
State-Changed-By: jdolecek 
State-Changed-When: Sat Sep 29 13:31:29 PDT 2001 
State-Changed-Why:  
Is this still problem with 1.5.2? 

From: Jaromír Dolecek <jdolecek@netbsd.org>
To: Andreas Wrede <andreas@planix.com>
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/13827
Date: Sun, 30 Sep 2001 12:19:10 +0200 (CEST)

 Andreas Wrede wrote:
 > Don't know (yet).  I workded around the problem by installing an
 > Adaptec 2940UW card and the machine has been up and running production
 > solid for the last 18 days. A quick check in the cvs repository shows
 > that none of the siop or scsi related files in the kernel have
 > changed, so I would  expect the same problme to re-occur with 1.5.2.

 I see. Yeah, there are not many changes between 1.5.1 and 1.5.2,
 so trying 1.5.2 would probably not help.

 I guess (since the machine is in production) it's not possible to try
 if -current kernel has same problem as the 1.5.1 one with siop, is it?

 Jaromir
 -- 
 Jaromir Dolecek <jdolecek@NetBSD.org>      http://www.ics.muni.cz/~dolecek/
 NetBSD - just plain best OS! -=*=- Got spare MCA cards or docs? Hand me them!

From: Andreas Wrede <andreas@planix.com>
To: JaromXr Dolecek <jdolecek@netbsd.org>
Cc: <gnats-bugs@netbsd.org>
Subject: Re: kern/13827
Date: Sun, 30 Sep 2001 10:34:00 -0400 (EDT)

 On Sun, 30 Sep 2001, JaromXr Dolecek wrote:

 > Andreas Wrede wrote:
 > > Don't know (yet).  I workded around the problem by installing an
 > > Adaptec 2940UW card and the machine has been up and running production
 > > solid for the last 18 days. A quick check in the cvs repository shows
 > > that none of the siop or scsi related files in the kernel have
 > > changed, so I would  expect the same problme to re-occur with 1.5.2.
 >
 > I see. Yeah, there are not many changes between 1.5.1 and 1.5.2,
 > so trying 1.5.2 would probably not help.
 >
 > I guess (since the machine is in production) it's not possible to try
 > if -current kernel has same problem as the 1.5.1 one with siop, is it?

 The two machines are running as the firewall and webcache for
 over 1000 people in 24/7 TV production and broadcasting facility.
 Uptime is important here..

 I'll see if one of the machines can handle the entire load for a day
 or so. Can I run 1.5.1 userland with a -current kernel? Or what is the
 minimim I need from -current? Will just /bin and /sbin do?

 -- 
     - aew


From: Jaromír Dolecek <jdolecek@netbsd.org>
To: Andreas Wrede <andreas@planix.com>
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/13827
Date: Sun, 30 Sep 2001 21:18:33 +0200 (CEST)

 Andreas Wrede wrote:
 > The two machines are running as the firewall and webcache for
 > over 1000 people in 24/7 TV production and broadcasting facility.
 > Uptime is important here..

 Sure.

 > I'll see if one of the machines can handle the entire load for a day
 > or so. Can I run 1.5.1 userland with a -current kernel? Or what is the
 > minimim I need from -current? Will just /bin and /sbin do?

 Yes, you should be able to run -current kernel and 1.5.1 userland without
 problem.

 Thanks for you cooperation. I really appreciate you are willing
 to run the test.

 Jaromir
 -- 
 Jaromir Dolecek <jdolecek@NetBSD.org>      http://www.ics.muni.cz/~dolecek/
 NetBSD - just plain best OS! -=*=- Got spare MCA cards or docs? Hand me them!

From: Andreas Wrede <andreas@planix.com>
To: JaromXr Dolecek <jdolecek@netbsd.org>
Cc: <gnats-bugs@netbsd.org>
Subject: Re: kern/13827
Date: Sun, 30 Sep 2001 19:31:26 -0400 (EDT)

 On Sun, 30 Sep 2001, JaromXr Dolecek wrote:

 > Andreas Wrede wrote:
 > > The two machines are running as the firewall and webcache for
 > > over 1000 people in 24/7 TV production and broadcasting facility.
 > > Uptime is important here..
 >
 > Sure.
 >
 > > I'll see if one of the machines can handle the entire load for a day
 > > or so. Can I run 1.5.1 userland with a -current kernel? Or what is the
 > > minimim I need from -current? Will just /bin and /sbin do?
 >
 > Yes, you should be able to run -current kernel and 1.5.1 userland without
 > problem.

 Cool! I tried to setup a build environment for -current on my 1.5.2
 system but am having mixed results.  Is the GENERIC kernel in the
 20010827-1.5X snapshot in /pub/NetBSD/arch/i386/snapshot the right one
 to try this with?  Or should I pursue getting my -current environment
 built so i can have a -g kernel?

  >
 > Thanks for you cooperation. I really appreciate you are willing
 > to run the test.

 I save commits for 1.5.3 started. What's the timeframe for it's
 release? (ie. how long do I have to track this problem down :-)

 -- 
     - aew


From: Jaromír Dolecek <jdolecek@netbsd.org>
To: Andreas Wrede <andreas@planix.com>
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/13827
Date: Mon, 1 Oct 2001 20:39:35 +0200 (CEST)

 Andreas Wrede wrote:
 > Cool! I tried to setup a build environment for -current on my 1.5.2
 > system but am having mixed results.  Is the GENERIC kernel in the
 > 20010827-1.5X snapshot in /pub/NetBSD/arch/i386/snapshot the right one
 > to try this with?  Or should I pursue getting my -current environment
 > built so i can have a -g kernel?

 Well, true, you'd need newer as IIRC to build recent i386 kernels.
 The 1.5X snaphost should be fine, I don't recally any siop-related
 changes too recently.

 > I save commits for 1.5.3 started. What's the timeframe for it's
 > release? (ie. how long do I have to track this problem down :-)

 There is no timeframe yet.

 Jaromir
 -- 
 Jaromir Dolecek <jdolecek@NetBSD.org>      http://www.ics.muni.cz/~dolecek/
 NetBSD - just plain best OS! -=*=- Got spare MCA cards or docs? Hand me them!
Responsible-Changed-From-To: kern-bug-people->bouyer 
Responsible-Changed-By: bouyer 
Responsible-Changed-When: Sun Oct 14 13:41:55 PDT 2001 
Responsible-Changed-Why:  
I'm going to take care of this, now that I know _bus_dmamem_map() can't 
be called from interrupt context :) 
I just sent a patch to andreas for 1.5.2; I already commited a fix to -current 
(different because the new scsipi gives us more facility for this). 

From: Manuel Bouyer <bouyer@antioche.eu.org>
To: Andreas Wrede <andreas@planix.com>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/13827: fatal page fault in supervisor mode and hang in 1.5.1
Date: Sun, 14 Oct 2001 22:41:12 +0200

 --fUYQa+Pmc3FrFX/N
 Content-Type: text/plain; charset=us-ascii

 On Wed, Aug 29, 2001 at 10:58:32PM -0400, Andreas Wrede wrote:
 >  [...]
 >  --- CRASH---
 >  fatal page fault in supervisor mode
 >  trap type 6 code 0 eip c0183574 cs 8 eflags 10246 cr2 3c cpl d000f7c4
 >  panic: trap
 >  Begin traceback...
 >  trap() at trap+0x1ed
 >  --- trap (number 6) ---
 >  lockmgr(c04502e4,10012,c0450368) at lockmgr+0x78
 >  uvm_map(c04502e0,d2a96a6c,1000,c0450280,ffffffff) at uvm_map+0x79
 >  uvm_km_valloc(c04502e0,1000,c0440c80,c09fe680,c0a7ff00) at uvm_km_valloc+0x37
 >  _bus_dmamem_map(c0440c80,d2a96ae0,1,1000,c09fe68c) at _bus_dmamem_map+0x2e
 >  siop_morecbd(c095ba00) at siop_morecbd+0xf9
 >  siop_scsicmd(c097e094) at siop_scsicmd+0x52
 >  scsipi_execute_xs(c097e094,0,1009,c0959480,d2a96b98) at scsipi_execute_xs+0x36
 >  scsi_scsipi_cmd(c0959480,d2a96bec,a,ca65a000,2000) at scsi_scsipi_cmd+0xd3
 >  scsipi_command(c0959480,d2a96bec,a,ca65a000,2000) at scsipi_command+0x59
 >  sdstart(c0979400,d000f7c4,c4edc834,d2a96c2c,c02b072b) at sdstart+0x1ea
 >  scsipi_free_xs(c097e094,1) at scsipi_free_xs+0x8b
 >  scsipi_done(c097e094,c095ba00,ff00,1,1009) at scsipi_done+0x123
 >  siop_scsicmd_end(c097f800,c0965c60,d2a874bc,d2a874bc,c095ba00) at siop_scsicmd_end+0x35d
 >  siop_intr(c095ba00) at siop_intr+0x1370
 >  Xintr10() at Xintr10+0x7c

 OK, it's because bus_dmamem_map() is called from interrupt context.
 Can you try the attached patch ? I'm running with this on 2 servers; one of
 them has 22 disks on 4 siop controllers.
 This is for 1.5.2, but it should work for 1.5.1 too.

 --
 Manuel Bouyer <bouyer@antioche.eu.org>
 --

 --fUYQa+Pmc3FrFX/N
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="siop-diff-1.5.2"

 Index: siop.c
 ===================================================================
 RCS file: /cvsroot/syssrc/sys/dev/ic/siop.c,v
 retrieving revision 1.21.2.7
 diff -u -r1.21.2.7 siop.c
 --- siop.c	2001/02/26 17:47:46	1.21.2.7
 +++ siop.c	2001/10/11 16:05:33
 @@ -83,7 +83,6 @@
  void 	siop_timeout __P((void *));
  int	siop_scsicmd __P((struct scsipi_xfer *));
  void	siop_dump_script __P((struct siop_softc *));
 -int	siop_morecbd __P((struct siop_softc *));
  struct siop_lunsw *siop_get_lunsw __P((struct siop_softc *));
  void	siop_add_reselsw __P((struct siop_softc *, int));
  void	siop_update_scntl3 __P((struct siop_softc *, struct siop_target *));
 @@ -163,6 +162,8 @@
  	int error, i;
  	bus_dma_segment_t seg;
  	int rseg;
 +	int ncbd;
 +	int ncbdpgs;

  	/*
  	 * Allocate DMA-safe memory for the script and map it.
 @@ -202,7 +203,6 @@
  	TAILQ_INIT(&sc->free_list);
  	TAILQ_INIT(&sc->ready_list);
  	TAILQ_INIT(&sc->urgent_list);
 -	TAILQ_INIT(&sc->cmds);
  	TAILQ_INIT(&sc->lunsw_list);
  	sc->sc_currschedslot = 0;
  #ifdef SIOP_DEBUG
 @@ -244,6 +244,132 @@
  	}
  	if (sc->maxsync == 255 || sc->minsync == 0)
  		panic("siop: can't find my sync parameters\n");
 +
 +	/*
 +	 * allocate memory for command descriptors.
 +	 * Allocate enouth memory for the max commands we may have pending
 +	 * (number of tagged cmds per device * number of possible devices).
 +	 * Way too much (we need only one 4k page per target), but as we can't
 +	 * allocate from interrupt routine we can't adjust this dynamically.
 +	 */
 +	ncbd = SIOP_NTAG * sc->sc_link.scsipi_scsi.max_target;
 +	ncbdpgs = (ncbd + SIOP_NCMDPB - 1) / SIOP_NCMDPB;
 +	ncbd = ncbdpgs * SIOP_NCMDPB;
 +
 +#ifdef DEBUG
 +	printf("%s: allocate %d CBD (%d pages)\n", sc->sc_dev.dv_xname, ncbd, ncbdpgs);
 +#endif
 +	sc->sc_cmds = malloc(sizeof(struct siop_cmd) * ncbd,
 +	    M_DEVBUF, M_NOWAIT);
 +	if (sc->sc_cmds == NULL) {
 +		printf("%s: can't allocate memory for command descriptors\n",
 +		    sc->sc_dev.dv_xname);
 +		return;
 +	}
 +	memset(sc->sc_cmds, 0, sizeof(struct siop_cmd) * ncbd);
 +	error = bus_dmamem_alloc(sc->sc_dmat, NBPG * ncbdpgs, NBPG, 
 +	    0, &seg, 1, &rseg, BUS_DMA_NOWAIT);
 +	if (error) {
 +		printf("%s: unable to allocate cbd DMA memory, error = %d\n",
 +		    sc->sc_dev.dv_xname, error);
 +		return;
 +	}
 +	error = bus_dmamem_map(sc->sc_dmat, &seg, rseg, NBPG * ncbdpgs,
 +	    (caddr_t *)&sc->cmds_xfers, BUS_DMA_NOWAIT|BUS_DMA_COHERENT);
 +	if (error) {
 +		printf("%s: unable to map cbd DMA memory, error = %d\n",
 +		    sc->sc_dev.dv_xname, error);
 +		return;
 +	}
 +	error = bus_dmamap_create(sc->sc_dmat, NBPG * ncbdpgs, 1,
 +	    NBPG * ncbdpgs, 0, BUS_DMA_NOWAIT, &sc->xfersdma);
 +	if (error) {
 +		printf("%s: unable to create cbd DMA map, error = %d\n",
 +		    sc->sc_dev.dv_xname, error);
 +		return;
 +	}
 +	error = bus_dmamap_load(sc->sc_dmat, sc->xfersdma, sc->cmds_xfers,
 +	    NBPG * ncbdpgs, NULL, BUS_DMA_NOWAIT);
 +	if (error) {
 +		printf("%s: unable to load cbd DMA map, error = %d\n",
 +		    sc->sc_dev.dv_xname, error);
 +		return;
 +	}
 +	for (i = 0; i < ncbd ; i++) {
 +		bus_addr_t dsa;
 +		u_int32_t *scr;
 +		int j;
 +		error = bus_dmamap_create(sc->sc_dmat, MAXPHYS, SIOP_NSG,
 +		    MAXPHYS, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
 +		    &sc->sc_cmds[i].dmamap_data);
 +		if (error) {
 +			printf("%s: unable to create data DMA map for cbd: "
 +			    "error %d\n", sc->sc_dev.dv_xname, error);
 +			return;
 +		}
 +		error = bus_dmamap_create(sc->sc_dmat,
 +		    sizeof(struct scsipi_generic), 1,
 +		    sizeof(struct scsipi_generic), 0,
 +		    BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
 +		    &sc->sc_cmds[i].dmamap_cmd);
 +		if (error) {
 +			printf("%s: unable to create cmd DMA map for cbd %d\n",
 +			   sc->sc_dev.dv_xname, error);
 +			return;
 +		}
 +		sc->sc_cmds[i].siop_sc = sc;
 +		sc->sc_cmds[i].siop_xfer = &sc->cmds_xfers[i];
 +		memset(sc->sc_cmds[i].siop_xfer, 0, sizeof(struct siop_xfer));
 +		sc->sc_cmds[i].dsa = sc->xfersdma->dm_segs[0].ds_addr +
 +		    i * sizeof(struct siop_xfer);
 +		dsa = sc->sc_cmds[i].dsa;
 +		sc->sc_cmds[i].status = CMDST_FREE;
 +		sc->sc_cmds[i].siop_tables.t_msgout.count= htole32(1);
 +		sc->sc_cmds[i].siop_tables.t_msgout.addr = htole32(dsa);
 +		sc->sc_cmds[i].siop_tables.t_msgin.count= htole32(1);
 +		sc->sc_cmds[i].siop_tables.t_msgin.addr = htole32(dsa + 8);
 +		sc->sc_cmds[i].siop_tables.t_extmsgin.count= htole32(2);
 +		sc->sc_cmds[i].siop_tables.t_extmsgin.addr = htole32(dsa + 9);
 +		sc->sc_cmds[i].siop_tables.t_extmsgdata.addr =
 +							htole32(dsa + 11);
 +		sc->sc_cmds[i].siop_tables.t_status.count= htole32(1);
 +		sc->sc_cmds[i].siop_tables.t_status.addr = htole32(dsa + 16);
 +
 +		/* The select/reselect script */
 +		scr = &sc->sc_cmds[i].siop_xfer->resel[0];
 +		for (j = 0; j < sizeof(load_dsa) / sizeof(load_dsa[0]); j++)
 +			scr[j] = htole32(load_dsa[j]);
 +		/*
 +		 * 0x78000000 is a 'move data8 to reg'. data8 is the second
 +		 * octet, reg offset is the third.
 +		 */
 +		scr[Ent_rdsa0 / 4] =
 +		    htole32(0x78100000 | ((dsa & 0x000000ff) <<  8));
 +		scr[Ent_rdsa1 / 4] =
 +		    htole32(0x78110000 | ( dsa & 0x0000ff00       ));
 +		scr[Ent_rdsa2 / 4] =
 +		    htole32(0x78120000 | ((dsa & 0x00ff0000) >>  8));
 +		scr[Ent_rdsa3 / 4] =
 +		    htole32(0x78130000 | ((dsa & 0xff000000) >> 16));
 +		scr[E_ldsa_abs_reselected_Used[0]] =
 +		    htole32(sc->sc_scriptaddr + Ent_reselected);
 +		scr[E_ldsa_abs_reselect_Used[0]] =
 +		    htole32(sc->sc_scriptaddr + Ent_reselect);
 +		scr[E_ldsa_abs_selected_Used[0]] =
 +		    htole32(sc->sc_scriptaddr + Ent_selected);
 +		scr[E_ldsa_abs_data_Used[0]] =
 +		    htole32(dsa + sizeof(struct siop_xfer_common) +
 +		    Ent_ldsa_data);
 +		/* JUMP foo, IF FALSE - used by MOVE MEMORY to clear the slot */
 +		scr[Ent_ldsa_data / 4] = htole32(0x80000000);
 +		TAILQ_INSERT_TAIL(&sc->free_list, &sc->sc_cmds[i], next);
 +#ifdef SIOP_DEBUG
 +		printf("tables[%d]: in=0x%x out=0x%x status=0x%x\n", i,
 +		    le32toh(sc->sc_cmds[i].siop_tables.t_msgin.addr),
 +		    le32toh(sc->sc_cmds[i].siop_tables.t_msgout.addr),
 +		    le32toh(sc->sc_cmds[i].siop_tables.t_status.addr));
 +#endif
 +	}
  	/* Do a bus reset, so that devices fall back to narrow/async */
  	siop_resetbus(sc);
  	/*
 @@ -356,7 +482,6 @@
  	int need_reset = 0;
  	int offset, target, lun, tag;
  	bus_addr_t dsa;
 -	struct siop_cbd *cbdp;
  	int freetarget = 0;
  	int restart = 0;

 @@ -370,21 +495,13 @@
  	}
  	/* use DSA to find the current siop_cmd */
  	dsa = bus_space_read_4(sc->sc_rt, sc->sc_rh, SIOP_DSA);
 -	for (cbdp = TAILQ_FIRST(&sc->cmds); cbdp != NULL;
 -	    cbdp = TAILQ_NEXT(cbdp, next)) {
 -		if (dsa >= cbdp->xferdma->dm_segs[0].ds_addr &&
 -	    	    dsa < cbdp->xferdma->dm_segs[0].ds_addr + NBPG) {
 -			dsa -= cbdp->xferdma->dm_segs[0].ds_addr;
 -			siop_cmd = &cbdp->cmds[dsa / sizeof(struct siop_xfer)];
 -			siop_table_sync(siop_cmd,
 -			    BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 -			break;
 -		}
 -	} 
 -	if (cbdp == NULL) {
 -		siop_cmd = NULL;
 -	}
 -	if (siop_cmd) {
 +	if (dsa >= sc->xfersdma->dm_segs[0].ds_addr &&
 +    	    dsa < sc->xfersdma->dm_segs[0].ds_addr + 
 +	    sc->xfersdma->dm_segs[0].ds_len) {
 +		dsa -= sc->xfersdma->dm_segs[0].ds_addr;
 +		siop_cmd = &sc->sc_cmds[dsa / sizeof(struct siop_xfer)];
 +		siop_table_sync(siop_cmd,
 +		    BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
  		xs = siop_cmd->xs;
  		siop_target = siop_cmd->siop_target;
  		target = siop_cmd->xs->sc_link->scsipi_scsi.target;
 @@ -410,6 +527,7 @@
  		}
  #endif
  	} else {
 +		siop_cmd = NULL;
  		xs = NULL;
  		siop_target = NULL;
  		target = -1;
 @@ -1247,16 +1365,8 @@
  	if (siop_cmd) {
  		TAILQ_REMOVE(&sc->free_list, siop_cmd, next);
  	} else {
 -		if (siop_morecbd(sc) == 0) {
 -			siop_cmd = TAILQ_FIRST(&sc->free_list);
 -#ifdef DIAGNOSTIC
 -			if (siop_cmd == NULL)
 -				panic("siop_morecbd succeed and does nothing");
 -#endif
 -			TAILQ_REMOVE(&sc->free_list, siop_cmd, next);
 -		}
 -	}
 -	if (siop_cmd == NULL) {
 +		/* this is not supposed to happen */
 +		printf("%s: no free siop_cmd\n", sc->sc_dev.dv_xname);
  		xs->error = XS_DRIVER_STUFFUP;
  		splx(s);
  		return(TRY_AGAIN_LATER);
 @@ -1604,157 +1714,6 @@
  		}
  		printf("\n");
  	}
 -}
 -
 -int
 -siop_morecbd(sc)
 -	struct siop_softc *sc;
 -{
 -	int error, i, j;
 -	bus_dma_segment_t seg;
 -	int rseg;
 -	struct siop_cbd *newcbd;
 -	bus_addr_t dsa;
 -	u_int32_t *scr;
 -
 -	/* allocate a new list head */
 -	newcbd = malloc(sizeof(struct siop_cbd), M_DEVBUF, M_NOWAIT);
 -	if (newcbd == NULL) {
 -		printf("%s: can't allocate memory for command descriptors "
 -		    "head\n", sc->sc_dev.dv_xname);
 -		return ENOMEM;
 -	}
 -	memset(newcbd, 0, sizeof(struct siop_cbd));
 -
 -	/* allocate cmd list */
 -	newcbd->cmds =
 -	    malloc(sizeof(struct siop_cmd) * SIOP_NCMDPB, M_DEVBUF, M_NOWAIT);
 -	if (newcbd->cmds == NULL) {
 -		printf("%s: can't allocate memory for command descriptors\n",
 -		    sc->sc_dev.dv_xname);
 -		error = ENOMEM;
 -		goto bad3;
 -	}
 -	memset(newcbd->cmds, 0, sizeof(struct siop_cmd) * SIOP_NCMDPB);
 -	error = bus_dmamem_alloc(sc->sc_dmat, NBPG, NBPG, 0, &seg, 1, &rseg,
 -	    BUS_DMA_NOWAIT);
 -	if (error) {
 -		printf("%s: unable to allocate cbd DMA memory, error = %d\n",
 -		    sc->sc_dev.dv_xname, error);
 -		goto bad2;
 -	}
 -	error = bus_dmamem_map(sc->sc_dmat, &seg, rseg, NBPG,
 -	    (caddr_t *)&newcbd->xfers, BUS_DMA_NOWAIT|BUS_DMA_COHERENT);
 -	if (error) {
 -		printf("%s: unable to map cbd DMA memory, error = %d\n",
 -		    sc->sc_dev.dv_xname, error);
 -		goto bad2;
 -	}
 -	error = bus_dmamap_create(sc->sc_dmat, NBPG, 1, NBPG, 0,
 -	    BUS_DMA_NOWAIT, &newcbd->xferdma);
 -	if (error) {
 -		printf("%s: unable to create cbd DMA map, error = %d\n",
 -		    sc->sc_dev.dv_xname, error);
 -		goto bad1;
 -	}
 -	error = bus_dmamap_load(sc->sc_dmat, newcbd->xferdma, newcbd->xfers,
 -	    NBPG, NULL, BUS_DMA_NOWAIT);
 -	if (error) {
 -		printf("%s: unable to load cbd DMA map, error = %d\n",
 -		    sc->sc_dev.dv_xname, error);
 -		goto bad0;
 -	}
 -#ifdef DEBUG
 -	printf("%s: alloc newcdb at PHY addr 0x%lx\n", sc->sc_dev.dv_xname,
 -	    (unsigned long)newcbd->xferdma->dm_segs[0].ds_addr);
 -#endif
 -	
 -	for (i = 0; i < SIOP_NCMDPB; i++) {
 -		error = bus_dmamap_create(sc->sc_dmat, MAXPHYS, SIOP_NSG,
 -		    MAXPHYS, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
 -		    &newcbd->cmds[i].dmamap_data);
 -		if (error) {
 -			printf("%s: unable to create data DMA map for cbd: "
 -			    "error %d\n",
 -			    sc->sc_dev.dv_xname, error);
 -			goto bad0;
 -		}
 -		error = bus_dmamap_create(sc->sc_dmat,
 -		    sizeof(struct scsipi_generic), 1,
 -		    sizeof(struct scsipi_generic), 0,
 -		    BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
 -		    &newcbd->cmds[i].dmamap_cmd);
 -		if (error) {
 -			printf("%s: unable to create cmd DMA map for cbd %d\n",
 -			    sc->sc_dev.dv_xname, error);
 -			goto bad0;
 -		}
 -		newcbd->cmds[i].siop_sc = sc;
 -		newcbd->cmds[i].siop_cbdp = newcbd;
 -		newcbd->cmds[i].siop_xfer = &newcbd->xfers[i];
 -		memset(newcbd->cmds[i].siop_xfer, 0,
 -		    sizeof(struct siop_xfer));
 -		newcbd->cmds[i].dsa = newcbd->xferdma->dm_segs[0].ds_addr +
 -		    i * sizeof(struct siop_xfer);
 -		dsa = newcbd->cmds[i].dsa;
 -		newcbd->cmds[i].status = CMDST_FREE;
 -		newcbd->cmds[i].siop_tables.t_msgout.count= htole32(1);
 -		newcbd->cmds[i].siop_tables.t_msgout.addr = htole32(dsa);
 -		newcbd->cmds[i].siop_tables.t_msgin.count= htole32(1);
 -		newcbd->cmds[i].siop_tables.t_msgin.addr = htole32(dsa + 8);
 -		newcbd->cmds[i].siop_tables.t_extmsgin.count= htole32(2);
 -		newcbd->cmds[i].siop_tables.t_extmsgin.addr = htole32(dsa + 9);
 -		newcbd->cmds[i].siop_tables.t_extmsgdata.addr =
 -		    htole32(dsa + 11);
 -		newcbd->cmds[i].siop_tables.t_status.count= htole32(1);
 -		newcbd->cmds[i].siop_tables.t_status.addr = htole32(dsa + 16);
 -
 -		/* The select/reselect script */
 -		scr = &newcbd->cmds[i].siop_xfer->resel[0];
 -		for (j = 0; j < sizeof(load_dsa) / sizeof(load_dsa[0]); j++)
 -			scr[j] = htole32(load_dsa[j]);
 -		/*
 -		 * 0x78000000 is a 'move data8 to reg'. data8 is the second
 -		 * octet, reg offset is the third.
 -		 */
 -		scr[Ent_rdsa0 / 4] =
 -		    htole32(0x78100000 | ((dsa & 0x000000ff) <<  8));
 -		scr[Ent_rdsa1 / 4] =
 -		    htole32(0x78110000 | ( dsa & 0x0000ff00       ));
 -		scr[Ent_rdsa2 / 4] =
 -		    htole32(0x78120000 | ((dsa & 0x00ff0000) >>  8));
 -		scr[Ent_rdsa3 / 4] =
 -		    htole32(0x78130000 | ((dsa & 0xff000000) >> 16));
 -		scr[E_ldsa_abs_reselected_Used[0]] =
 -		    htole32(sc->sc_scriptaddr + Ent_reselected);
 -		scr[E_ldsa_abs_reselect_Used[0]] =
 -		    htole32(sc->sc_scriptaddr + Ent_reselect);
 -		scr[E_ldsa_abs_selected_Used[0]] =
 -		    htole32(sc->sc_scriptaddr + Ent_selected);
 -		scr[E_ldsa_abs_data_Used[0]] =
 -		    htole32(dsa + sizeof(struct siop_xfer_common) +
 -		    Ent_ldsa_data);
 -		/* JUMP foo, IF FALSE - used by MOVE MEMORY to clear the slot */
 -		scr[Ent_ldsa_data / 4] = htole32(0x80000000);
 -		TAILQ_INSERT_TAIL(&sc->free_list, &newcbd->cmds[i], next);
 -#ifdef SIOP_DEBUG
 -		printf("tables[%d]: in=0x%x out=0x%x status=0x%x\n", i,
 -		    le32toh(newcbd->cmds[i].siop_tables.t_msgin.addr),
 -		    le32toh(newcbd->cmds[i].siop_tables.t_msgout.addr),
 -		    le32toh(newcbd->cmds[i].siop_tables.t_status.addr));
 -#endif
 -	}
 -	TAILQ_INSERT_TAIL(&sc->cmds, newcbd, next);
 -	return 0;
 -bad0:
 -	bus_dmamap_destroy(sc->sc_dmat, newcbd->xferdma);
 -bad1:
 -	bus_dmamem_free(sc->sc_dmat, &seg, rseg);
 -bad2:
 -	free(newcbd->cmds, M_DEVBUF);
 -bad3:
 -	free(newcbd, M_DEVBUF);
 -	return error;
  }

  struct siop_lunsw *
 Index: siopvar.h
 ===================================================================
 RCS file: /cvsroot/syssrc/sys/dev/ic/siopvar.h,v
 retrieving revision 1.8.2.1
 diff -u -r1.8.2.1 siopvar.h
 --- siopvar.h	2000/12/15 04:49:52	1.8.2.1
 +++ siopvar.h	2001/10/11 16:05:33
 @@ -33,7 +33,6 @@
  /* structure and definitions for the siop driver */

  TAILQ_HEAD(cmd_list, siop_cmd);
 -TAILQ_HEAD(cbd_list, siop_cbd);
  TAILQ_HEAD(lunsw_list, siop_lunsw);

  /* Driver internal state */
 @@ -59,7 +58,9 @@
  	bus_addr_t sc_scriptaddr;	/* on-board ram or physical adress */
  	u_int32_t *sc_script;		/* script location in memory */
  	int sc_currschedslot;		/* current scheduler slot */
 -	struct cbd_list cmds;		/* list of command block descriptors */
 +	struct siop_cmd *sc_cmds;	/* array of command descriptors */
 +	struct siop_xfer *cmds_xfers;	/* array of hw descriptors for sc_cmds*/
 +	bus_dmamap_t xfersdma;		/* DMA map for cmds_xfers */
  	struct cmd_list free_list;	/* cmd descr free list */
  	struct cmd_list urgent_list;	/* hitgh priority cmd descr list */
  	struct cmd_list ready_list;	/* cmd descr ready list */
 Index: siopvar_common.h
 ===================================================================
 RCS file: /cvsroot/syssrc/sys/dev/ic/siopvar_common.h,v
 retrieving revision 1.3.2.3
 diff -u -r1.3.2.3 siopvar_common.h
 --- siopvar_common.h	2001/02/04 18:58:26	1.3.2.3
 +++ siopvar_common.h	2001/10/11 16:05:33
 @@ -91,7 +91,6 @@
  	struct scsipi_xfer *xs; /* xfer from the upper level */
  	struct siop_xfer *siop_xfer; /* tables dealing with this xfer */
  #define siop_tables siop_xfer->tables
 -	struct siop_cbd *siop_cbdp; /* pointer to our siop_cbd */
  	bus_addr_t	dsa; /* DSA value to load */
  	bus_dmamap_t	dmamap_cmd;
  	bus_dmamap_t	dmamap_data;
 @@ -102,15 +101,6 @@
  	int tag;	/* tag used for tagged command queuing */
  };

 -/* command block descriptors: an array of siop_cmd + an array of siop_xfer */
 -
 -struct siop_cbd {
 -	TAILQ_ENTRY (siop_cbd) next;
 -	struct siop_cmd *cmds;
 -	struct siop_xfer *xfers;
 -	bus_dmamap_t xferdma; /* DMA map for this block of xfers */
 -};
 -
  /* status defs */
  #define CMDST_FREE		0 /* cmd slot is free */
  #define CMDST_READY		1 /* cmd slot is waiting for processing */
 @@ -177,8 +167,8 @@
  	bus_addr_t offset;

  	offset = siop_cmd->dsa -
 -	    siop_cmd->siop_cbdp->xferdma->dm_segs[0].ds_addr;
 -	bus_dmamap_sync(sc->sc_dmat, siop_cmd->siop_cbdp->xferdma, offset,
 +	    sc->xfersdma->dm_segs[0].ds_addr;
 +	bus_dmamap_sync(sc->sc_dmat, sc->xfersdma, offset,
  	    sizeof(struct siop_xfer), ops);
  }


 --fUYQa+Pmc3FrFX/N--

From: Andreas Wrede <andreas@planix.com>
To: Manuel Bouyer <bouyer@antioche.eu.org>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/13827: fatal page fault in supervisor mode and hang in
 1.5.1
Date: Sun, 14 Oct 2001 17:28:03 -0400 (EDT)

 On Sun, 14 Oct 2001, Manuel Bouyer wrote:

 > On Wed, Aug 29, 2001 at 10:58:32PM -0400, Andreas Wrede wrote:
 > >  [...]
 > >  --- CRASH---
 > >  fatal page fault in supervisor mode
 > >  trap type 6 code 0 eip c0183574 cs 8 eflags 10246 cr2 3c cpl d000f7c4
 > >  panic: trap
 > >  Begin traceback...
 > >  trap() at trap+0x1ed
 > >  --- trap (number 6) ---
 > >  lockmgr(c04502e4,10012,c0450368) at lockmgr+0x78
 > >  uvm_map(c04502e0,d2a96a6c,1000,c0450280,ffffffff) at uvm_map+0x79
 > >  uvm_km_valloc(c04502e0,1000,c0440c80,c09fe680,c0a7ff00) at uvm_km_valloc+0x37
 > >  _bus_dmamem_map(c0440c80,d2a96ae0,1,1000,c09fe68c) at _bus_dmamem_map+0x2e
 > >  siop_morecbd(c095ba00) at siop_morecbd+0xf9
 > >  siop_scsicmd(c097e094) at siop_scsicmd+0x52
 > >  scsipi_execute_xs(c097e094,0,1009,c0959480,d2a96b98) at scsipi_execute_xs+0x36
 > >  scsi_scsipi_cmd(c0959480,d2a96bec,a,ca65a000,2000) at scsi_scsipi_cmd+0xd3
 > >  scsipi_command(c0959480,d2a96bec,a,ca65a000,2000) at scsipi_command+0x59
 > >  sdstart(c0979400,d000f7c4,c4edc834,d2a96c2c,c02b072b) at sdstart+0x1ea
 > >  scsipi_free_xs(c097e094,1) at scsipi_free_xs+0x8b
 > >  scsipi_done(c097e094,c095ba00,ff00,1,1009) at scsipi_done+0x123
 > >  siop_scsicmd_end(c097f800,c0965c60,d2a874bc,d2a874bc,c095ba00) at siop_scsicmd_end+0x35d
 > >  siop_intr(c095ba00) at siop_intr+0x1370
 > >  Xintr10() at Xintr10+0x7c
 >
 > OK, it's because bus_dmamem_map() is called from interrupt context.
 > Can you try the attached patch ? I'm running with this on 2 servers; one of
 > them has 22 disks on 4 siop controllers.
 > This is for 1.5.2, but it should work for 1.5.1 too.

 Thanks for the patch!

 I build a 1.5.2 kernel with the patch applied but will have to wait
 till next weekend to run with it, since it involves removing the
 Adaptec controller and putting the drives back on the ncr controller.
 I'll let you know.

 -- 
     - aew



From: "Erik E. Fair" <fair@clock.org>
To: NetBSD GNATS Problem Report Tracking System <gnats-bugs@gnats.netbsd.org>
Cc:  
Subject: Re: kern/13827
Date: Fri, 4 Jan 2002 19:45:09 -0800

 Is this PR now resolved with that patch?

 	Erik <fair@clock.org>

From: Andreas Wrede <andreas@planix.com>
To: gnats-bugs@netbsd.org
Cc:  
Subject: Re: kern/13827
Date: Sat, 9 Mar 2002 09:39:15 -0500 (EST)

 I no longer have access to the hardware that produced the bug to test
 the patch. For my part, this pr can be closed.

 -- 
     - aew

State-Changed-From-To: feedback->closed 
State-Changed-By: bouyer 
State-Changed-When: Sat Mar 9 08:16:11 PST 2002 
State-Changed-Why:  
Closed per author request. The author doesn't have access to the hardware 
any more, but I'm almost sure that this is solved: the problem has been 
well analysed and patches tested by a few other peoples. 
>Unformatted:
 >> NetBSD/i386 BIOS Boot, Revision 2.7
 >> (he@nsa.uninett.no, Mon Jun 18 01:32:10 CEST 2001)
 >> Memory: 639/261120 k
 Use hd1a:netbsd to boot sd0 when wd0 is also installed
 Press return to boot now, any other key for boot menu
 booting wd0a:netbsd - starting in 0 
 3134862+306440+263396 [65+168880+148937]=0x3d7310
 [ preserving 318340 bytes of netbsd ELF symbol table ]
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001
     The NetBSD Foundation, Inc.  All rights reserved.
 Copyright (c) 1982, 1986, 1989, 1991, 1993
     The Regents of the University of California.  All rights reserved.

 NetBSD 1.5.1 (TVO) #0: Wed Aug 29 09:25:13 EDT 2001
     root@tube.tvo.org:/usr/src/sys/arch/i386/compile/TVO
 cpu0: Intel Pentium III (Katmai) (686-class), 498.72 MHz
 total memory = 255 MB
 avail memory = 232 MB
 using 3297 buffers containing 13188 KB of memory
 BIOS32 rev. 0 found at 0xf0000
 mainbus0 (root)
 pci0 at mainbus0 bus 0: configuration mode 1
 pci0: i/o space, memory space enabled
 pchb0 at pci0 dev 0 function 0
 pchb0: Intel 82443BX Host Bridge/Controller (AGP disabled) (rev. 0x03)
 vga1 at pci0 dev 11 function 0: Cirrus Logic CL-GD5446 (rev. 0x45)
 wsdisplay0 at vga1
 ppb0 at pci0 dev 13 function 0: Digital Equipment DECchip 21150 PCI-PCI Bridge (rev. 0x04)
 pci1 at ppb0 bus 1
 pci1: i/o space, memory space enabled
 tl0 at pci1 dev 7 function 0
 tl0: Compaq ProLiant Integrated Netelligent 10/100 TX
 tl0: Ethernet address 00:50:8b:8b:48:e2
 tl0: interrupting at irq 5
 nsphy0 at tl0 phy 1: DP83840 10/100 media interface, rev. 1
 nsphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 tlphy0 at tl0 phy 31: ThunderLAN 10baseT media interface, rev. 5
 tlphy0: 10base2
 siop0 at pci1 dev 9 function 0: Symbios Logic 53c875 (ultra-wide scsi)
 siop0: using on-board RAM
 siop0: interrupting at irq 9
 scsibus0 at siop0: 16 targets, 8 luns per target
 siop1 at pci1 dev 9 function 1: Symbios Logic 53c875 (ultra-wide scsi)
 siop1: using on-board RAM
 siop1: interrupting at irq 10
 scsibus1 at siop1: 16 targets, 8 luns per target
 Compaq product 0xa0f0 (miscellaneous system) at pci0 dev 14 function 0 not configured
 fxp0 at pci0 dev 15 function 0: Intel i82557 Ethernet, rev 5
 fxp0: interrupting at irq 11
 fxp0: Ethernet address 00:50:8b:65:19:22, 10/100 Mb/s
 inphy0 at fxp0 phy 1: i82555 10/100 media interface, rev. 0
 inphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
 pcib0 at pci0 dev 20 function 0
 pcib0: Intel 82371AB PCI-to-ISA Bridge (PIIX4) (rev. 0x02)
 pciide0 at pci0 dev 20 function 1: Intel 82371AB IDE controller (PIIX4) (rev. 0x01)
 pciide0: bus-master DMA support present
 pciide0: primary channel wired to compatibility mode
 atapibus0 at pciide0 channel 0
 cd0 at atapibus0 drive 0: <COMPAQ XM-6402B, , 1723> type 5 cdrom removable
 cd0: 32-bit data port
 cd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2
 pciide0: primary channel interrupting at irq 14
 cd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 2 (using DMA data transfers)
 pciide0: secondary channel wired to compatibility mode
 pciide0: secondary channel ignored (disabled)
 uhci0 at pci0 dev 20 function 2: Intel 82371AB USB Host Controller (PIIX4) (rev. 0x01)
 uhci0: can't map i/o space
 Intel 82371AB Power Management Controller (PIIX4) (miscellaneous bridge, revision 0x02) at pci0 dev 20 function 3 not configured
 isa0 at pcib0
 com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
 com0: console
 com1 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
 pckbc0 at isa0 port 0x60-0x64
 pckbd0 at pckbc0 (kbd slot)
 pckbc0: using irq 1 for kbd slot
 wskbd0 at pckbd0
 pcppi0 at isa0 port 0x61
 sysbeep0 at pcppi0
 isapnp0 at isa0 port 0x279: ISA Plug 'n Play device support
 npx0 at isa0 port 0xf0-0xff: using exception 16
 fdc0 at isa0 port 0x3f0-0x3f7 irq 6 drq 2
 fd0 at fdc0 drive 0: 1.44MB, 80 cyl, 2 head, 18 sec
 isapnp0: no ISA Plug 'n Play devices found
 biomask f7c5 netmask ffe5 ttymask ffe7
 scsibus0: waiting 2 seconds for devices to settle...
 scsibus1: waiting 2 seconds for devices to settle...
 siop1: target 0 using tagged queuing
 sd0 at scsibus1 target 0 lun 0: <COMPAQ, BD009122C6, B016> SCSI2 0/direct fixed
 siop1: target 0 using 16bit transfers
 siop1: target 0 now synchronous at 20.0Mhz, offset 16
 sd0: 8678 MB, 5273 cyl, 20 head, 168 sec, 512 bytes/sect x 17773524 sectors
 siop1: target 1 using tagged queuing
 sd1 at scsibus1 target 1 lun 0: <COMPAQ, BD00911934, 3B00> SCSI2 0/direct fixed
 siop1: target 1 using 16bit transfers
 siop1: target 1 now synchronous at 20.0Mhz, offset 15
 sd1: 8678 MB, 5273 cyl, 20 head, 168 sec, 512 bytes/sect x 17773524 sectors
 siop1: target 2 using tagged queuing
 sd2 at scsibus1 target 2 lun 0: <COMPAQ, BD00911934, 3B00> SCSI2 0/direct fixed
 siop1: target 2 using 16bit transfers
 siop1: target 2 now synchronous at 20.0Mhz, offset 15
 sd2: 8678 MB, 5273 cyl, 20 head, 168 sec, 512 bytes/sect x 17773524 sectors
 IPsec: Initialized Security Association Processing.
 boot device: sd0
 root on sd0a dumps on sd0b
 root file system type: ffs
 swapctl: adding /dev/sd0b as swap device at priority 0



 --- CRASH---
 fatal page fault in supervisor mode
 trap type 6 code 0 eip c0183574 cs 8 eflags 10246 cr2 3c cpl d000f7c4
 panic: trap
 Begin traceback...
 trap() at trap+0x1ed
 --- trap (number 6) ---
 lockmgr(c04502e4,10012,c0450368) at lockmgr+0x78
 uvm_map(c04502e0,d2a96a6c,1000,c0450280,ffffffff) at uvm_map+0x79
 uvm_km_valloc(c04502e0,1000,c0440c80,c09fe680,c0a7ff00) at uvm_km_valloc+0x37
 _bus_dmamem_map(c0440c80,d2a96ae0,1,1000,c09fe68c) at _bus_dmamem_map+0x2e
 siop_morecbd(c095ba00) at siop_morecbd+0xf9
 siop_scsicmd(c097e094) at siop_scsicmd+0x52
 scsipi_execute_xs(c097e094,0,1009,c0959480,d2a96b98) at scsipi_execute_xs+0x36
 scsi_scsipi_cmd(c0959480,d2a96bec,a,ca65a000,2000) at scsi_scsipi_cmd+0xd3
 scsipi_command(c0959480,d2a96bec,a,ca65a000,2000) at scsipi_command+0x59
 sdstart(c0979400,d000f7c4,c4edc834,d2a96c2c,c02b072b) at sdstart+0x1ea
 scsipi_free_xs(c097e094,1) at scsipi_free_xs+0x8b
 scsipi_done(c097e094,c095ba00,ff00,1,1009) at scsipi_done+0x123
 siop_scsicmd_end(c097f800,c0965c60,d2a874bc,d2a874bc,c095ba00) at siop_scsicmd_end+0x35d
 siop_intr(c095ba00) at siop_intr+0x1370
 Xintr10() at Xintr10+0x7c
 --- interrupt ---
 idle(d2a874bc) at idle+0x21
 bpendtsleep(c4ebbaa8,11,c035fc43,0,0) at bpendtsleep
 getblk(d2a8f680,34b00,2000,0,0) at getblk+0x8c
 bread(d2a8f680,34b00,2000,ffffffff,d2a96df8) at bread+0x2d
 ffs_update(d2a96e2c,d2a8fea0,d2a96ef4,d2a8fdd0,0) at ffs_update+0x1bc
 ffs_full_fsync(d2a96ef4,d2a8fea0,d2a96ef4,d2a8fdd0,1) at ffs_full_fsync+0x224
 ffs_fsync(d2a96ef4) at ffs_fsync+0x3a
 ffs_sync(c098d200,3,c0959f80,d2a874bc) at ffs_sync+0xf3
 sync_fsync(d2a96f68) at sync_fsync+0x53
 sched_sync(d2a874bc) at sched_sync+0x119
 End traceback...
 syncing disks...sd2(siop1:2:0): command timeout
 sd2(siop1:2:0): command timeout
 sd2(siop1:2:0): command timeout
 sd1(siop1:1:0): command timeout
 sd1(siop1:1:0): command timeout
 sd1(siop1:1:0): command timeout
 sd1(siop1:1:0): command timeout
 sd0(siop1:0:0): command timeout
 sd0(siop1:0:0): command timeout
 sd0(siop1:0:0): command timeout
 sd0(siop1:0:0): command timeout
 [...many hours pass...]
 Stopped at      cpu_Debugger+0x4:       leave
 db> 
 db> 
 db> trace
 cpu_Debugger(c0965920,11,ffffffff,2c,c0a0f160) at cpu_Debugger+0x4
 comintr(c095b600) at comintr+0xcd
 Xintr4() at Xintr4+0x78
 --- interrupt ---
 ltsleep(c4ecaae8,11,c035fc9a,0,0) at ltsleep+0x4e
 biowait(c4ecaae8,20d5c0,d2ab0db0,c099b000,c040b9a0) at biowait+0x31
 bread(d2ab1698,20d5c0,2000,ffffffff,d2a967bc) at bread+0x95
 ffs_update(d2a967f0,d2caa924,d2a968b8,d2caa5e4,0) at ffs_update+0x1bc
 ffs_full_fsync(d2a968b8,d2caa924,d2a968b8,d2caa5e4,4) at ffs_full_fsync+0x224
 ffs_fsync(d2a968b8) at ffs_fsync+0x3a
 ffs_sync(c09eae00,2,c0959f80,c0464420,c09eae00) at ffs_sync+0xf3
 sys_sync(c0464420,0,0,100,c03749fb) at sys_sync+0x5c
 vfs_shutdown(d2a9696c,d2a96960,c0190635,100,0) at vfs_shutdown+0x64
 cpu_reboot(100,0,d2a969b0,0,6) at cpu_reboot+0x3b
 panic(c03749fb,c04502e4,0,10012,c02a4261) at panic+0xcd
 trap() at trap+0x1ed
 --- trap (number 6) ---
 lockmgr(c04502e4,10012,c0450368) at lockmgr+0x78
 uvm_map(c04502e0,d2a96a6c,1000,c0450280,ffffffff) at uvm_map+0x79
 uvm_km_valloc(c04502e0,1000,c0440c80,c09fe680,c0a7ff00) at uvm_km_valloc+0x37
 _bus_dmamem_map(c0440c80,d2a96ae0,1,1000,c09fe68c) at _bus_dmamem_map+0x2e
 siop_morecbd(c095ba00) at siop_morecbd+0xf9
 siop_scsicmd(c097e094) at siop_scsicmd+0x52
 scsipi_execute_xs(c097e094,0,1009,c0959480,d2a96b98) at scsipi_execute_xs+0x36
 scsi_scsipi_cmd(c0959480,d2a96bec,a,ca65a000,2000) at scsi_scsipi_cmd+0xd3
 scsipi_command(c0959480,d2a96bec,a,ca65a000,2000) at scsipi_command+0x59
 sdstart(c0979400,d000f7c4,c4edc834,d2a96c2c,c02b072b) at sdstart+0x1ea
 scsipi_free_xs(c097e094,1) at scsipi_free_xs+0x8b
 scsipi_done(c097e094,c095ba00,ff00,1,1009) at scsipi_done+0x123
 siop_scsicmd_end(c097f800,c0965c60,d2a874bc,d2a874bc,c095ba00) at siop_scsicmd_e
 nd+0x35d
 siop_intr(c095ba00) at siop_intr+0x1370
 Xintr10() at Xintr10+0x7c
 --- interrupt ---
 idle(d2a874bc) at idle+0x21
 bpendtsleep(c4ebbaa8,11,c035fc43,0,0) at bpendtsleep
 getblk(d2a8f680,34b00,2000,0,0) at getblk+0x8c
 bread(d2a8f680,34b00,2000,ffffffff,d2a96df8) at bread+0x2d
 ffs_update(d2a96e2c,d2a8fea0,d2a96ef4,d2a8fdd0,0) at ffs_update+0x1bc
 ffs_full_fsync(d2a96ef4,d2a8fea0,d2a96ef4,d2a8fdd0,1) at ffs_full_fsync+0x224
 ffs_fsync(d2a96ef4) at ffs_fsync+0x3a
 ffs_sync(c098d200,3,c0959f80,d2a874bc) at ffs_sync+0xf3
 sync_fsync(d2a96f68) at sync_fsync+0x53
 sched_sync(d2a874bc) at sched_sync+0x119
 db> sync

 dumping to dev 4,1 offset 500487
 dump siop1: scsi bus reset
 cmd 0xc097fa80 (target 0:0) in reset list
 cmd 0xc097f840 (target 0:0) in reset list
 cmd 0xc097f980 (target 0:0) in reset list
 cmd 0xc097f900 (target 0:0) in reset list
 cmd 0xc0aca000 (target 0:0) in reset list
 cmd 0xc097f8c0 (target 1:0) in reset list
 cmd 0xc097f9c0 (target 1:0) in reset list
 cmd 0xc097fa00 (target 1:0) in reset list
 cmd 0xc097fac0 (target 1:0) in reset list
 cmd 0xc097f940 (target 2:0) in reset list
 cmd 0xc097f880 (target 2:0) in reset list
 cmd 0xc097fa40 (target 2:0) in reset list
 cmd 0xc097f800 (target 2:0) in reset list
 cmd 0xc097fa80 (status 2) about to be processed
 cmd 0xc097f840 (status 2) about to be processed
 cmd 0xc097f980 (status 2) about to be processed
 cmd 0xc097f900 (status 2) about to be processed
 cmd 0xc0aca000 (status 2) about to be processed
 cmd 0xc097f8c0 (status 2) about to be processed
 cmd 0xc097f9c0 (status 2) about to be processed
 cmd 0xc097fa00 (status 2) about to be processed
 cmd 0xc097fac0 (status 2) about to be processed
 cmd 0xc097f940 (status 2) about to be processed
 cmd 0xc097f880 (status 2) about to be processed
 cmd 0xc097fa40 (status 2) about to be processed
 cmd 0xc097f800 (status 0) about to be processed
 siop1: target 0 using 16bit transfers
 siop1: target 0 now synchronous at 20.0Mhz, offset 16
 siop1: target 1 using 16bit transfers
 siop1: target 1 now synchronous at 20.0Mhz, offset 15
 siop1: target 2 using 16bit transfers
 siop1: target 2 now synchronous at 20.0Mhz, offset 15
 255 254 .................

 rebooting
 -------

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.