Subject: kern/2218: Bug in config
To: None <gnats-bugs@NetBSD.ORG>
From: None <oskar@ping.de>
List: netbsd-bugs
Date: 03/15/1996 18:58:01
>Number:         2218
>Category:       kern
>Synopsis:       config fails on specific configurations.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 15 13:20:03 1996
>Last-Modified:
>Originator:     Jan-Hinrich Fessel
>Organization:
Jan-Hinrich Fessel	fessel@quantum.de		oskar@unna.ping.de
"There are two major products that come out of Berkeley: LSD and BSD UNIX.
 We don't believe this to be a coincidence."
	- Andrew Bulhak (acb@yoyo.cc.monash.edu.au)
>Release:        14.Mar.96
>Environment:
	
System: NetBSD zappa.unna.Ping.DE 1.1A NetBSD 1.1A (ZAPPA) #43: Sun Feb 4 13:06:56 MET 1996 oskar@zappa.unna.Ping.DE:/usr/src/sys/arch/i386/compile/ZAPPA i386


>Description:
>From Chris G. Demetriou:

From: Chris G Demetriou <Chris_G_Demetriou@UX2.SP.CS.CMU.EDU>

I started trimming things of your kernel config file, to match your
actual hardware configuration.  First thing i did was trim all of the
other SCSI drivers, since you only have the one ahb.

When i did that, config said:

ZAPPA:140: scsibus0 at ahb0 is orphaned
 (no ahb0 declared)
*** Stop.

That's a proper error; you had:

ahb*    at eisa? slot ?                 # Adaptec 174[024] SCSI controllers
scsibus0 at ahb0

and 'ahb0' was never declared, so scsibus0 couldn't attach to it.


however, there's a bug in the way config handles attachment via
attributes.  It's been there Forever, as far as i can tell, but i
discovered it last weekend...  8-)

what's happening is that:
	ahb* is exporting a 'scsi' attribute,
	scsibus0 wants to attach to a ahb0

but instead of config asking "are there any devices of type 'ahb' with
unit zero?" it's asking "are there any devices which export a 'scsi'
attribute with unit zero?"

it gets a 'yes', and ends up building a bogus ioconf.c, things get
confused when ahb* tries to attach its child, and all goes to hell.




you can get a really interesting demonstration of what's going on here
by commenting out all other SCSI host adapters and scsibus units than
the ones for aha0, ahb*, and the scsibus0 at ahb0.  configure your
kernel.  save the generated ioconf.c.  comment out the aha0.
configure your kernel (and note that it fails).  fix up the
ahb/scsibus lines as described above.  configured your kernel.
compare the two versions of ioconf.c



Jan-Hinrich, could you please submit a PR that:
	(1) points out that there's a bug in config,
	(2) includes your kernel configuration file,
	(3) includes this mail (as an analysis).

Jason, you'll note that my config diffs that i sent you the other day
mark where this bug is...  I don't know how to fix it easily.


chris
>How-To-Repeat:
use this config-file:
# based on parts of
#	$NetBSD: GENERIC,v 1.32 1996/03/05 01:32:14 thorpej Exp $
#	$NetBSD: GENERIC,v 1.8 1995/01/11 20:59:50 mycroft Exp $
#
#	GENERIC -- everything that's currently supported
#

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

# Some BIOSes don't get the size of extended memory right.  If you
# have a broken BIOS, uncomment the following and set the value
# properly for your system.
#options	EXTMEM_SIZE=...	# size of extended memory

options		DUMMY_NOPS	# speed hack; recommanded
options		XSERVER,UCONSOLE
options		MACHINE_NONCONTIG
options		PCVT_INHIBIT_NUMLOCK
options		INSECURE
options		SETUIDSCRIPTS

maxusers	64		# estimated number of users

# getting more initial mem limits
options		DFLDSIZ=0x4000000	# 64 MB Data
# options		DFLSSIZ=0x200000	# 2 MB Stack
options		DFLSSIZ=0x1000	# 4 k Stack

# options		MAXUPRC	1044 

options		TIMEZONE=-60	# time zone to adjust RTC time by
options		DST=1		# daylight savings time used by RTC

#options		AHBDEBUG,SCSIDEBUG

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

#options		DDB		# in-kernel debugger
#makeoptions	DEBUG="-g"	# compile full symbol table
options		DIAGNOSTIC	# internally 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_LINUX	# to run doom
options		COMPAT_FREEBSD  # binary compatibility with FreeBSD
# 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_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 NMBCLUSTERS=2048
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 sd0 swap on sd0 and sd1
# options		GENERIC

mainbus0 at root

isa0	at mainbus0
eisa0	at mainbus0
pci0	at mainbus0 bus ?

ppb*	at pci? dev ? function ?	# PCI-PCI bridges
pci*	at ppb? bus ?

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
com5	at isa? port 0x2f8 irq 3
ast0	at isa? port 0x1a0 irq 5	# AST 4-port serial cards
com1	at ast? slave ? flags 1
com2	at ast? slave ? flags 1
com3	at ast? slave ? flags 1
com4	at ast? slave ? flags 1

lpt0	at isa? port 0x378 irq 7	# standard PC parallel ports

ahb*	at eisa? slot ?			# Adaptec 174[024] SCSI controllers
scsibus0 at ahb0

sd0	at scsibus0 target 0 lun ?	# SCSI disk drives
sd1	at scsibus0 target 1 lun ?	# SCSI disk drives
sd2	at scsibus0 target 2 lun ?	# SCSI disk drives
sd3	at scsibus0 target 3 lun ?	# SCSI disk drives
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
fd0	at fdc? drive ?

wdc0	at isa? port 0x1f0 irq 14	# ST506, ESDI, and IDE controllers
wd0	at wdc? drive ?

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

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

pseudo-device	pty	128		# pseudo-terminals
pseudo-device	vnd	1		# paging to files

>Fix:
you can fix this by changing the your config file to say:

ahb0	at eisa? slot ?
scsibus0 at ahb0

or:

ahb*	at eisa? slot ?
scsibus0 at ahb?

(or scsibus* at ahb? ...  8-)
>Audit-Trail:
>Unformatted: