Subject: System instabilities when using >1 IDE controller
To: None <port-i386@NetBSD.ORG>
From: None <Mark_Weaver@brown.edu>
List: port-i386
Date: 04/01/1995 11:28:09
I suspect there's a bug in the wd driver when using more than one
IDE controller.  I have:

Gateway 2000 486dx2/66 vlb 16m ram
Two on-board IDE controllers
Ultrastor 34F VLB
wd0: Western Digital Caviar ac2340h (340m)
wd1: Western Digital Caviar ac2540h (540m)
sd0: Imprimis im94601 (1.2g)
...

Currently I'm running both IDE drives on the same controller, and
the system is extremely stable.  However, if I give each IDE drive
its own controller, I literally cannot compile a new kernel without
the system spontaneously rebooting (no panic).  In case it matters,
none of my drives had any bad blocks the last time I checked (not
long ago), at least not from the controller's point of view.

This bug was introduced sometime during 1.0Alpha or 1.0Beta.  If
you need a more exact date, I'm should be able to pin it down fairly
accurately since I posted about it several times and was supping
relatively frequently.

When it was introduced, I was able to remove the problem (or GREATLY
reduce it) by undoing some of mycroft's changes to the tty code
(which admittedly look extremely innocent) and recompiling a kernel
(while running a saved kernel binary).  I know it sounds bizarre,
but it really is true.  At the time, no one was able to help me, so
I was forced to switch OSes for a while.

When I switched back to NetBSD 1.0 release, the problem seemed fixed
because I was only using one IDE controller.  But the other day when
I set up NetBSD for a friend and needed the other controller, I noticed
the exact same kind of instability all over again.

The quirks of the instability are exactly the same as before.  If I
don't do any compiling, the system seems to stay up fairly well.  But
if I try to recompile a new kernel from scratch, the system almost
invariably reboots in the middle.

I should also note that the kernel that crashed was the exact same
kernel binary that's stable when there are no drives on the second
controller.  The kernel has had the second drive configured all along,
but "wdc1" doesn't even get a line during autoconfig if there's no
drive on it.

I'm using pcvt now, but I've seen the instabilities with both pcvt
(1.0 alpha days) and pccons (recently).

Here's my config, which is _almost_ the same as the last one that
crashed:

----------------------------------------
#
#	WEAVER -- kernel for mark's 486 box
#

machine		i386		# architecture, used by config; REQUIRED

#options	I386_CPU	# CPU classes; at least one is REQUIRED
options		I486_CPU
options		I586_CPU
#options	MATH_EMULATE	# floating point emulation

options		DUMMY_NOPS	# speed hack; recommended
options		XSERVER,UCONSOLE
options		MACHINE_NONCONTIG

maxusers	24		# estimated number of users
options		TIMEZONE=0	# time zone to adjust RTC time by
options		DST=0		# daylight savings time used by RTC

options		SWAPPAGER	# paging; REQUIRED
options		VNODEPAGER	# mmap() of files
options		DEVPAGER	# mmap() of devices

options		DDB		# in-kernel debugger
options		DIAGNOSTIC	# internal consistency checks
options		KTRACE		# system call tracing, a la ktrace(1)

options		SYSVMSG		# System V-like message queues
options		SYSVSEM		# System V-like semaphores
options		SYSVSHM		# System V-like memory sharing
options		SHMMAXPGS=1024	# 1024 pages is the default

options		COMPAT_NOMID	# compatibility with 386BSD, BSDI, NetBSD 0.8,
options		COMPAT_09	# NetBSD 0.9,
options		COMPAT_10	# NetBSD 1.0,
options		COMPAT_43	# and 4.3BSD
options		TCP_COMPAT_42	# TCP bug compatibility with 4.2BSD

options		COMPAT_LINUX	# Linux a.out binary compatibility

options		COMPAT_SVR4	# binary compatibility with SVR4
options		COMPAT_IBCS2	# binary compatibility with SCO and ISC

options		USER_LDT	# user-settable LDT; used by WINE
options		LKM		# loadable kernel modules

options		FFS #,QUOTA	# UFS and quotas
#options	LFS		# log-structured file system
options		MFS		# memory file system

options		NFSCLIENT	# Network File System client
#options	NFSSERVER	# Network File System server

options		CD9660		# ISO 9660 + Rock Ridge file system
options		MSDOSFS		# MS-DOS file system
#options	FDESC		# /dev/fd
options		FIFO		# FIFOs; RECOMMENDED
#options	KERNFS		# /kern
options		NULLFS		# loopback file system
#options	PORTAL		# ?
#options	PROCFS		# /proc
#options	UMAPFS		# NULLFS + uid and gid remapping
#options	UNION		# union file system

#options	GATEWAY		# packet forwarding
options		INET		# IP + ICMP + TCP + UDP
#options	NS		# XNS
#options	ISO,TPIP	# OSI
#options	EON		# OSI tunneling over IP
#options	CCITT,LLC,HDLC	# X.25

config		netbsd	root on wd0 swap on wd0 and wd1 and sd0

isa0	at root

npx0	at isa? port 0xf0 irq 13	# math coprocessor

#pc0	at isa? port 0x60 irq 1		# generic PC console device
vt0	at isa? port 0x60 irq 1

com0	at isa? port 0x3f8 irq 4	# standard PC serial ports
com1	at isa? port 0x2f8 irq 5
com2	at isa? port 0x3e8 irq 9

lpt0	at isa? port 0x3bc

uha0	at isa? port 0x330 irq ? drq ?	# UltraStor [13]4f SCSI controllers
scsibus* at uha?
sd*	at scsibus? target ? lun ?	# SCSI disk drives
st*	at scsibus? target ? lun ?	# SCSI tape drives
cd*	at scsibus? target ? lun ?	# SCSI CD-ROM drives

fdc0	at isa? port 0x3f0 irq 6 drq 2	# standard PC floppy controllers
fd*	at fdc? drive ?

wdc0	at isa? port 0x1f0 irq 14	# ST506, ESDI, and IDE controllers
wdc1	at isa? port 0x170 irq 15
wd*	at wdc? drive ?

ed0	at isa? port 0x280 iomem 0xd0000 irq 3	# WD/SMC, 3C503, and NE[12]000

#sb0	at isa? port 0x220 irq 7 drq 1	# SoundBlaster
pas0	at isa? port 0x220 irq 7 drq 1	# ProAudio Spectrum
#spkr0	at isa? ...

pseudo-device	loop	1		# network loopback
#pseudo-device	bpfilter 4		# packet filter
pseudo-device	sl	2		# CSLIP
pseudo-device	ppp	2		# PPP
#pseudo-device	tun	2		# network tunneling over tty

pseudo-device	pty	32		# pseudo-terminals
#pseudo-device	tb	1		# tablet line discipline
pseudo-device	vnd	4		# paging to files
----------------------------------------

Here's my dmesg when both drives are on the first controller:

----------------------------------------
NetBSD 1.0A (WEAVER) #1: Thu Mar 30 14:20:24 EST 1995
    mhw@weaver.tsq-b.brown.edu:/usr/src/sys/arch/i386/compile/WEAVER
CPU: i486DX (486-class CPU)
real mem  = 16121856
avail mem = 13791232
using 222 buffers containing 909312 bytes of memory
isa0 (root)
npx0 at isa0 port 0xf0-0xff: using exception 16
vt0 at isa0 port 0x60-0x6f irq 1: generic, 80 col, color, 8 scr, mf2-kbd, [R3.00]
com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
com1 at isa0 port 0x2f8-0x2ff irq 5: ns16550a, working fifo
com2 at isa0 port 0x3e8-0x3ef irq 9: ns16550a, working fifo
lpt0 at isa0 port 0x3bc-0x3c3: polled
uha0 at isa0 port 0x330-0x33f irq 11
scsibus0 at uha0
uha0 targ 0 lun 0: <IMPRIMIS, 94601-15, 4614> SCSI1 0/direct fixed
sd0 at scsibus0: 992MB, 1931 cyl, 15 head, 70 sec, 512 bytes/sec
uha0 targ 1 lun 0: <ARCHIVE, VIPER 2525 25462, -007> SCSI1 1/sequential removable
st0 at scsibus0: rogue, drive empty
uha0 targ 2 lun 0: <NEC, CD-ROM DRIVE:501, 2.2> SCSI2 5/cdrom removable
cd0 at scsibus0: cd present, 318280 x 2048 byte records
fdc0 at isa0 port 0x3f0-0x3f7 irq 6 drq 2
fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
fd1 at fdc0 drive 1: 1.2MB 80 cyl, 2 head, 15 sec
wdc0 at isa0 port 0x1f0-0x1f7 irq 14
wd0 at wdc0 drive 0: 325MB, 1010 cyl, 12 head, 55 sec, 512 bytes/sec <WDC AC2340H>
wd0: using 16-sector 16-bit pio transfers, chs addressing
wd1 at wdc0 drive 1: 515MB, 1048 cyl, 16 head, 63 sec, 512 bytes/sec <WDC AC2540H>
wd1: using 16-sector 16-bit pio transfers, lba addressing
ed0 at isa0 port 0x280-0x29f iomem 0xd0000-0xd3fff irq 3: address 00:00:c0:95:9a:73, type SMC8216/SMC8216C (16-bit) aui
pas0 at isa0 port 0x220-0x22f irq 7 drq 1 ProAudio Spectrum 16 [rev 255] : dsp v2.0
root device eisa not configured
root device pci not configured
biomask 48c0 netmask 23a ttymask 232

 Aperture driver for XFree86 version 1.2
----------------------------------------

Any ideas?

	Mark
--------------------------------------------------------------------
Email: Mark_Weaver@brown.edu           | Brown University
PGP Key: finger mhw@cs.brown.edu       | Dept of Computer Science