NetBSD Problem Report #30194

From salo@Xtrmntr.org  Wed May 11 09:18:57 2005
Return-Path: <salo@Xtrmntr.org>
Received: from otaku.Xtrmntr.org (sauna.silcnet.org [147.175.66.205])
	by narn.netbsd.org (Postfix) with ESMTP id 0A6E763B104
	for <gnats-bugs@gnats.netbsd.org>; Wed, 11 May 2005 09:18:57 +0000 (UTC)
Message-Id: <20050511091840.BFE671D102@otaku.Xtrmntr.org>
Date: Wed, 11 May 2005 11:18:40 +0200 (CEST)
From: Lubomir Sedlacik <salo@Xtrmntr.org>
Reply-To: salo@Xtrmntr.org
To: gnats-bugs@netbsd.org
Subject: unrecoverable wd(4) error after suspend/resume
X-Send-Pr-Version: 3.95

>Number:         30194
>Category:       kern
>Synopsis:       unrecoverable wd(4) error after suspend/resume, disk hangs
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    bouyer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 11 09:19:00 +0000 2005
>Closed-Date:    Wed Jul 05 17:07:22 +0000 2006
>Last-Modified:  Wed Jul 05 17:07:22 +0000 2006
>Originator:     Lubomir Sedlacik
>Release:        NetBSD 3.99.3, sources as of May 10 2005
>Organization:

>Environment:
System: NetBSD 3.99.3
Architecture: i386
Machine: i386
Model: IBM ThinkPad X40
>Description:
i am unable to resume from suspend with APM in the kernel.  when resuming, the
system comes up but disk seems to be hung immediately (sometimes the disk
activity led is constantly on), processes hang in vnlock (sometimes in
getblk).  kernel prints error:

 atabus0: resuming...
 atabus1: resuming...
 wd0a: error writing fsbn 15042624 of 15042624-15042655 (wd0 bn 15042687; cn 14923 tn 4 sn 51), retrying
 wd0: (aborted command)

and:

 wm0: device timeout (txfree 4058 txsfree 35 txnext 280

but the network comes up few seconds later and e.g., ssh connection is
resumed.

i tested various BIOS settings (e.g., disabling PCI Power Management) and
apm(4) options (e.g.,  APM_DISABLE_INTERRUPTS=0, APM_NO_IDLE) without any
effect.

my setup is a bit nonstandard, the whole hard drive is a cgd(4) volume on top
of wd0a; if it matters.  kernel boots from usb and while i am in single-user
in md(4), suspend/resume seems to work without any problems (until the system
is booted into multi-user involving disk activity, up until then the hard
drive is not touched apart of kernel probing it at boot time).  unfortunately,
i can't test with plain file system due to the nature of my installation.

>How-To-Repeat:
try to suspend/resume -current on X40,
see disk hang immediately after resuming

>Fix:
n/a

- missing power hook somewhere in the piixide(4) or wd(4) code?
- could cgd(4) affect the situation?

>Release-Note:

>Audit-Trail:
From: Lubomir Sedlacik <salo@Xtrmntr.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/30194: unrecoverable wd(4) error after suspend/resume
Date: Wed, 11 May 2005 12:04:54 +0200

 --W/nzBZO5zC0uMSeA
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable

 i verified that cgd(4) is unrelated to the issue.  in single-user mode i
 newfs-ed swap partition (in multi-user it's also a cgd(4) volume),
 mounted it and created a couple of files on it and suspend/resumed.  no
 cgd devices were configured at that time.  the same error occured and
 disk hung.

 --=20
 -- Lubomir Sedlacik <salo@{NetBSD,Xtrmntr,silcnet}.org>   --

 --W/nzBZO5zC0uMSeA
 Content-Type: application/pgp-signature
 Content-Disposition: inline

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.6 (NetBSD)

 iD8DBQFCgdjFiwjDDlS8cmMRAljuAJ9GbK+EM7hi10jHvY6Mwpez/g0VxQCePfaF
 Cdrt45uICmdi97km767QaNA=
 =x5Fu
 -----END PGP SIGNATURE-----

 --W/nzBZO5zC0uMSeA--

From: Lubomir Sedlacik <salo@Xtrmntr.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/30194: unrecoverable wd(4) error after suspend/resume
Date: Wed, 11 May 2005 13:36:05 +0200

 --MfFXiAuoTsnnDAfZ
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 appending dmesg and kernel config.

 -- 
 -- Lubomir Sedlacik <salo@{NetBSD,Xtrmntr,silcnet}.org>   --

 --MfFXiAuoTsnnDAfZ
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=dmesg

 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
     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 3.99.3 (AURORA-SURREALIS) #3: Wed May 11 12:27:52 CEST 2005
 	salo@aurora-surrealis:/opt/obj/sys/arch/i386/compile/AURORA-SURREALIS
 total memory = 502 MB
 avail memory = 484 MB
 BIOS32 rev. 0 found at 0xfd740
 PCI BIOS rev. 2.1 found at 0xfd8c8
 PCI IRQ Routing Table rev. 1.0 found at 0xfdeb0, size 256 bytes (14 entries)
 PCI Interrupt Router at 000:31:0 (Intel 82371FB (PIIX) PCI-ISA Bridge compatible)
 pci_addr_fixup: 000:31:1 0x8086 0x24ca new address 0x00005800
 pci_addr_fixup: 000:31:1 0x8086 0x24ca new address 0x00005808
 pci_addr_fixup: 000:31:1 0x8086 0x24ca new address 0x00005810
 pci_addr_fixup: 000:31:1 0x8086 0x24ca new address 0x0000580c
 pci_addr_fixup: 000:31:1 0x8086 0x24ca new address 0x1f700000
 mainbus0 (root)
 cpu0 at mainbus0: (uniprocessor)
 cpu0: Intel Pentium M (Dothan) (686-class), 1395.53 MHz, id 0x6d6
 cpu0: features afe9fbbf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8,APIC,SEP,MTRR>
 cpu0: features afe9fbbf<PGE,MCA,CMOV,PAT,CFLUSH,DS,ACPI,MMX>
 cpu0: features afe9fbbf<FXSR,SSE,SSE2,SS,TM,SBF>
 cpu0: features2 180<EST,TM2>
 cpu0: "Intel(R) Pentium(R) M processor 1.40GHz"
 cpu0: using thermal monitor 2
 cpu0: Enhanced SpeedStep running at 1400 MHz (1116 mV)
 cpu0: Enhanced SpeedStep frequencies available (MHz): 1400 1300 1200 1100 1000 900 800 600
 pci0 at mainbus0 bus 0: configuration mode 1
 pci0: i/o space, memory space enabled, rd/line, rd/mult, wr/inv ok
 pchb0 at pci0 dev 0 function 0
 pchb0: Intel 82855GM Host-Hub Controller (rev. 0x02)
 agp0 at pchb0: detected 8060k stolen memory
 agp0: aperture at 0xe0000000, size 0x8000000
 Intel 82855GM GMCH Memory Controller (miscellaneous system, revision 0x02) at pci0 dev 0 function 1 not configured
 Intel 82855GM GMCH Configuration Process (miscellaneous system, revision 0x02) at pci0 dev 0 function 3 not configured
 vga0 at pci0 dev 2 function 0: Intel 82855GM GMCH Integrated Graphics Device (rev. 0x02)
 wsdisplay0 at vga0 kbdmux 1: console (80x25, vt100 emulation)
 wsmux1: connecting to wsdisplay0
 Intel 82855GM GMCH Integrated Graphics Device (miscellaneous display, revision 0x02) at pci0 dev 2 function 1 not configured
 uhci0 at pci0 dev 29 function 0: Intel 82801DB USB UHCI Controller (rev. 0x01)
 uhci0: interrupting at irq 9
 usb0 at uhci0: USB revision 1.0
 uhub0 at usb0
 uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
 uhub0: 2 ports with 2 removable, self powered
 uhci1 at pci0 dev 29 function 1: Intel 82801DB USB UHCI Controller (rev. 0x01)
 uhci1: interrupting at irq 11
 usb1 at uhci1: USB revision 1.0
 uhub1 at usb1
 uhub1: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
 uhub1: 2 ports with 2 removable, self powered
 uhci2 at pci0 dev 29 function 2: Intel 82801DB USB UHCI Controller (rev. 0x01)
 uhci2: interrupting at irq 10
 usb2 at uhci2: USB revision 1.0
 uhub2 at usb2
 uhub2: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
 uhub2: 2 ports with 2 removable, self powered
 ehci0 at pci0 dev 29 function 7: Intel 82801DB USB EHCI Controller (rev. 0x01)
 ehci0: interrupting at irq 9
 ehci0: EHCI version 1.0
 ehci0: companion controllers, 2 ports each: uhci0 uhci1 uhci2
 usb3 at ehci0: USB revision 2.0
 uhub3 at usb3
 uhub3: Intel EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
 uhub3: 6 ports with 6 removable, self powered
 ppb0 at pci0 dev 30 function 0: Intel 82801BAM Hub-PCI Bridge (rev. 0x81)
 pci1 at ppb0 bus 1
 pci1: i/o space, memory space enabled
 cbb0 at pci1 dev 0 function 0: Ricoh 5C476 PCI-CardBus bridge (rev. 0x8d)
 Ricoh product 0x0822 (system subclass 0x05, revision 0x13) at pci1 dev 0 function 1 not configured
 wm0 at pci1 dev 1 function 0: Intel i82541GI Mobile 1000BASE-T Ethernet, rev. 0
 wm0: interrupting at irq 4
 wm0: 32-bit 33MHz PCI bus
 wm0: 64 word (6 address bits) MicroWire EEPROM
 wm0: Ethernet address 00:0a:e4:2d:4d:21
 igphy0 at wm0 phy 1: Intel IGP01E1000 Gigabit PHY, rev. 0
 igphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
 iwi0 at pci1 dev 2 function 0: Intel PRO/Wireless LAN 2200BG Mini-PCI Adapter (rev. 0x05)
 iwi0: interrupting at irq 6
 iwi0: 802.11 address 00:0e:35:f1:2b:9a
 iwi0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
 iwi0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
 cbb0: interrupting at irq 9
 cardslot0 at cbb0 slot 0 flags 0
 cardbus0 at cardslot0: bus 2 device 0
 pcmcia0 at cardslot0
 pcib0 at pci0 dev 31 function 0
 pcib0: Intel 82801DB ISA Bridge (rev. 0x01)
 piixide0 at pci0 dev 31 function 1
 piixide0: Intel 82801DBM IDE Controller (ICH4-M) (rev. 0x01)
 piixide0: bus-master DMA support present
 piixide0: primary channel wired to compatibility mode
 piixide0: primary channel interrupting at irq 14
 atabus0 at piixide0 channel 0
 piixide0: secondary channel wired to compatibility mode
 piixide0: secondary channel interrupting at irq 15
 atabus1 at piixide0 channel 1
 Intel 82801DB SMBus Controller (SMBus serial bus, revision 0x01) at pci0 dev 31 function 3 not configured
 auich0 at pci0 dev 31 function 5: i82801DB/DBM (ICH4/ICH4M) AC-97 Audio
 auich0: interrupting at irq 5
 auich0: ac97: Analog Devices AD1981B codec; headphone, 20 bit DAC, no 3D stereo
 auich0: ac97: ext id 601<AC97_22,AMAP,VRA>
 Intel 82801DB AC97 Modem Controller (modem communications, revision 0x01) at pci0 dev 31 function 6 not configured
 isa0 at pcib0
 com0 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: console keyboard, using wsdisplay0
 pms0 at pckbc0 (aux slot)
 pckbc0: using irq 12 for aux slot
 wsmouse0 at pms0 mux 0
 attimer0 at isa0 port 0x40-0x43: AT Timer
 pcppi0 at isa0 port 0x61
 midi0 at pcppi0: PC speaker
 spkr0 at pcppi0
 sysbeep0 at pcppi0
 npx0 at isa0 port 0xf0-0xff: using exception 16
 pcppi0: attached to attimer0
 apm0 at mainbus0: Power Management spec V1.2
 apm0: battery life expectancy: 97%
 apm0: A/C state: on
 apm0: battery charge state: high
 auich0: measured ac97 link rate at 48003 Hz, will use 48000 Hz
 audio0 at auich0: full duplex, mmap, independent
 md0: internal 3000 KB image area
 IPsec: Initialized Security Association Processing.
 wd0 at atabus0 drive 0: <HITACHI_DK13FA-40B>
 wd0: drive supports 16-sector PIO transfers, LBA addressing
 wd0: 38154 MB, 77520 cyl, 16 head, 63 sec, 512 bytes/sect x 78140160 sectors
 wd0: 32-bit data port
 wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
 wd0(piixide0:0:0): using PIO mode 4, Ultra-DMA mode 5 (Ultra/100) (using DMA)
 boot device: <unknown>
 root on md0a dumps on md0b
 wsdisplay0: screen 1 added (80x25, vt100 emulation)
 wsdisplay0: screen 2 added (80x25, vt100 emulation)
 wsdisplay0: screen 3 added (80x25, vt100 emulation)
 wsdisplay0: screen 4 added (80x25, vt100 emulation)

 --MfFXiAuoTsnnDAfZ
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=AURORA-SURREALIS

 #	AURORA-SURREALIS -- IBM ThinkPad X40
 #

 include "arch/i386/conf/std.i386"

 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary

 # Enable the hooks used for initializing the root memory-disk.
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT		# force root on memory disk
 options 	MEMORY_DISK_SERVER=0		# no userspace memory disk support
 options 	MEMORY_DISK_ROOT_SIZE=6000	# size of memory disk, in blocks
 options 	MEMORY_RBFLAGS=0

 maxusers	64		# estimated number of users

 # CPU support.  At least one is REQUIRED.
 options 	I686_CPU
 # CPU-related options.
 options 	VM86		# virtual 8086 emulation
 options 	USER_LDT	# user-settable LDT; used by WINE
 # Enhanced SpeedStep Technology in the Pentium M
 options 	ENHANCED_SPEEDSTEP
 options 	MTRR		# memory-type range register syscall support

 # Standard system options
 options 	INSECURE	# disable kernel security levels - X needs this
 options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
 options 	NTP		# NTP phase/frequency locked loop
 options 	KTRACE		# system call tracing via ktrace(1)
 options 	SYSTRACE	# system call vetting via systrace(1)
 options 	SYSVMSG		# System V-like message queues
 options 	SYSVSEM		# System V-like semaphores
 options 	SYSVSHM		# System V-like memory sharing
 options 	SHMMAXPGS=65536	# 2048 pages is the default
 options 	P1003_1B_SEMAPHORE # p1003.1b semaphore support
 options 	LKM		# loadable kernel modules
 options 	USERCONF	# userconf(4) support
 options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel

 # Diagnostic/debugging support options
 options 	DDB		# in-kernel debugger
 options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB

 # Compatibility options
 options 	COMPAT_16	# NetBSD 1.6
 options 	COMPAT_20	# NetBSD 2.0
 options 	COMPAT_OSSAUDIO	# OSS (Voxware) audio driver compatibility
 options 	COMPAT_LINUX	# binary compatibility with Linux
 options		COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.

 # File systems
 file-system 	FFS		# UFS
 file-system 	EXT2FS		# second extended file system (linux)
 file-system 	LFS		# log-structured file system
 file-system 	MFS		# memory file system
 file-system 	NFS		# Network File System client
 file-system 	NTFS		# Windows/NT file system (experimental)
 file-system 	CD9660		# ISO 9660 + Rock Ridge file system
 file-system 	MSDOSFS		# MS-DOS file system
 file-system 	FDESC		# /dev/fd
 file-system 	KERNFS		# /kern
 file-system 	NULLFS		# loopback file system
 file-system 	OVERLAY		# overlay file system
 file-system 	PORTAL		# portal filesystem (still experimental)
 file-system 	PROCFS		# /proc
 file-system 	UMAPFS		# NULLFS + uid and gid remapping
 file-system 	UNION		# union file system
 file-system	SMBFS		# experimental - CIFS; also needs nsmb (below)
 file-system 	PTYFS		# pseudo-terminal filesystem

 # File system options
 options 	SOFTDEP		# FFS soft updates support.
 options 	NFSSERVER	# Network File System server

 # Networking options
 options 	GATEWAY		# packet forwarding
 options 	INET		# IP + ICMP + TCP + UDP
 options 	INET6		# IPV6
 options 	IPSEC		# IP security
 options 	IPSEC_ESP	# IP security (encryption part; define w/IPSEC)
 options 	PPP_BSDCOMP	# BSD-Compress compression support for PPP
 options 	PPP_DEFLATE	# Deflate compression support for PPP
 options 	PPP_FILTER	# Active filter support for PPP (requires bpf)
 options 	PFIL_HOOKS	# pfil(9) packet filter hooks
 options 	IPFILTER_LOG	# ipmon(8) log support

 # These options enable verbose messages for several subsystems.
 # Warning, these may compile large string tables into the kernel!
 options 	MIIVERBOSE	# verbose PHY autoconfig messages
 options 	PCIVERBOSE	# verbose PCI device autoconfig messages
 #options 	PCMCIAVERBOSE	# verbose PCMCIA configuration messages
 options 	SCSIVERBOSE	# human readable SCSI error messages
 options 	USBVERBOSE	# verbose USB device autoconfig messages
 options 	NFS_BOOT_DHCP,NFS_BOOT_BOOTPARAM

 # wscons options
 #
 # builtin terminal emulations
 options 	WSEMUL_VT100		# VT100 / VT220 emulation
 # customization of console and kernel output - see dev/wscons/wsdisplayvar.h
 options 	WSDISPLAY_CUSTOM_OUTPUT	# color customization from wsconsctl(8)
 options 	WS_KERNEL_FG=WSCOL_CYAN
 # customization of console border color
 options 	WSDISPLAY_CUSTOM_BORDER	# border customization from wsconsctl(8)
 # compatibility to other console drivers
 options 	WSDISPLAY_COMPAT_PCVT		# emulate some ioctls
 options 	WSDISPLAY_COMPAT_SYSCONS	# emulate some ioctls
 options 	WSDISPLAY_COMPAT_USL		# VT handling
 options 	WSDISPLAY_COMPAT_RAWKBD		# can get raw scancodes
 # use a large software cursor that doesn't blink
 options 	PCDISPLAY_SOFTCURSOR

 # Kernel root file system and dump configuration.
 config		netbsd	root on md0a type ffs

 #
 # Device configuration
 #

 mainbus0 at root

 cpu0 	at mainbus0

 apm0 	at mainbus0			# Advanced power management
 # Tuning for power management, see apm(4) for more details.
 options 	APM_NO_IDLE		# Don't call BIOS CPU idle function
 options 	APM_POWER_PRINT		# Print stats on the console
 options 	APM_DISABLE_INTERRUPTS=0 # Don't disable interrupts

 # Basic Bus Support
 #
 # PCI bus support
 pci*	at mainbus? bus ?
 pci*	at ppb? bus ?

 # Configure PCI using BIOS information
 options 	PCIBIOS			# PCI BIOS support
 #options 	PCIBIOSVERBOSE		# PCI BIOS verbose info
 options 	PCIBIOS_ADDR_FIXUP	# fixup PCI I/O addresses
 options 	PCIBIOS_BUS_FIXUP	# fixup PCI bus numbering
 options 	PCIBIOS_INTR_FIXUP	# fixup PCI interrupt routing
 #options 	PCIBIOS_IRQS_HINT=0x0a00 # PCI interrupts hint. IRQ 9 or 11
 #options 	PCIBIOS_INTR_GUESS	# see pcibios(4)
 #options 	PCIINTR_DEBUG		# super-verbose PCI interrupt fixup

 # PCI bridges
 pchb*	at pci? dev ? function ?	# PCI-Host bridges
 pcib*	at pci? dev ? function ?	# PCI-ISA bridges
 ppb*	at pci? dev ? function ?	# PCI-PCI bridges

 agp* 	at pchb?

 # ISA bus support
 isa0	at pcib?

 # CardBus bridge support
 cbb*		at pci? dev ? function ?
 cardslot*	at cbb?
 # CardBus bus support
 cardbus*	at cardslot?
 pcmcia* 	at cardslot?

 # Coprocessor Support
 #
 # Math Coprocessor support
 npx0	at isa? port 0xf0 irq 13	# x86 math coprocessor

 # Console Devices
 #
 # wscons
 pckbc0		at isa?			# pc keyboard controller
 pckbd*		at pckbc?		# PC keyboard
 pms*		at pckbc?		# PS/2 mouse for wsmouse
 vga*		at pci? dev ? function ?
 wsdisplay*	at vga? console ?
 wskbd* 		at pckbd? console ?
 wsmouse*	at pms? mux 0
 attimer0	at isa?
 pcppi0		at isa?
 sysbeep0	at pcppi?

 # Serial Devices
 #
 # PCMCIA serial interfaces
 com*	at pcmcia? function ?		# Modems and serial cards
 # CardBus serial interfaces
 com*	at cardbus? dev ? function ?	# Modems and serial cards
 # ISA serial interfaces
 com0	at isa? port 0x2f8 irq 3

 # SCSI Controllers and Devices
 #
 # SCSI bus support
 scsibus* at scsi?

 # SCSI devices
 sd*	at scsibus? target ? lun ?	# SCSI disk drives
 cd*	at scsibus? target ? lun ?	# SCSI CD-ROM drives
 uk*	at scsibus? target ? lun ?	# SCSI unknown

 # IDE and related devices
 #
 # PCI IDE controllers - see pciide(4) for supported hardware.
 # The 0x0001 flag force the driver to use DMA, even if the driver doesn't know
 # how to set up DMA modes for this chip. This may work, or may cause
 # a machine hang with some controllers.
 piixide* 	at pci? dev ? function ?	# Intel IDE controllers

 # ATA (IDE) bus support
 atabus* at ata?

 # IDE drives
 # Flags are used only with controllers that support DMA operations
 # and mode settings (e.g. some pciide controllers)
 # The lowest order four bits (rightmost digit) of the flags define the PIO
 # mode to use, the next set of four bits the DMA mode and the third set the
 # UltraDMA mode. For each set of four bits, the 3 lower bits define the mode
 # to use, and the last bit must be 1 for this setting to be used.
 # For DMA and UDMA, 0xf (1111) means 'disable'.
 # 0x0fac means 'use PIO mode 4, DMA mode 2, disable UltraDMA'.
 # (0xc=1100, 0xa=1010, 0xf=1111)
 # 0x0000 means "use whatever the drive claims to support".
 wd*	at atabus? drive ? flags 0x0000

 # ATAPI bus support
 atapibus* at atapi?
 # ATAPI devices
 #
 # flags have the same meaning as for IDE drives.
 cd*	at atapibus? drive ? flags 0x0000	# ATAPI CD-ROM drives
 sd*	at atapibus? drive ? flags 0x0000	# ATAPI disk drives
 uk*	at atapibus? drive ? flags 0x0000	# ATAPI unknown

 # Network Interfaces
 #
 # PCI network interfaces
 ath*	at pci? dev ? function ?	# Atheros 5210/5211/5212 802.11 
 iwi*	at pci? dev ? function ?	# Intel PRO/Wireless 2200BG
 wm*	at pci? dev ? function ?	# Intel 8254x gigabit

 # PCMCIA network interfaces
 an*	at pcmcia? function ?		# Aironet PC4500/PC4800 (802.11)
 awi*	at pcmcia? function ?		# BayStack 650/660 (802.11FH/DS)
 cnw*	at pcmcia? function ?		# Xircom/Netwave AirSurfer
 ray*	at pcmcia? function ?		# Raytheon Raylink (802.11)
 wi*	at pcmcia? function ?		# Lucent/Intersil WaveLan IEEE (802.11)

 # CardBus network cards
 ath*	at cardbus? dev ? function ?	# Atheros 5210/5211/5212 802.11
 atw*	at cardbus? dev ? function ?	# ADMtek ADM8211 (802.11)
 ex*	at cardbus? dev ? function ?	# 3Com 3C575TX
 fxp*	at cardbus? dev ? function ?	# Intel i8255x
 re*	at cardbus? dev ? function ?	# Realtek 8139C+/8169/8169S/8110S
 rtk*	at cardbus? dev ? function ?	# Realtek 8129/8139
 tlp*	at cardbus? dev ? function ?	# DECchip 21143

 # MII/PHY support
 brgphy*	at mii? phy ?			# Broadcom BCM5400-family PHYs
 dmphy*	at mii? phy ?			# Davicom DM9101 PHYs
 exphy*	at mii? phy ?			# 3Com internal PHYs
 icsphy*	at mii? phy ?			# Integrated Circuit Systems ICS189x
 igphy*	at mii? phy ?			# Intel IGP01E1000
 inphy*	at mii? phy ?			# Intel 82555 PHYs
 iophy*	at mii? phy ?			# Intel 82553 PHYs
 lxtphy*	at mii? phy ?			# Level One LXT-970 PHYs
 makphy*	at mii? phy ?			# Marvell Semiconductor 88E1000 PHYs
 nsphy*	at mii? phy ?			# NS83840 PHYs
 nsphyter* at mii? phy ?			# NS83843 PHYs
 qsphy*	at mii? phy ?			# Quality Semiconductor QS6612 PHYs
 rgephy*	at mii? phy ?			# Realtek 8169S/8110 internal PHYs
 sqphy*	at mii? phy ?			# Seeq 80220/80221/80223 PHYs
 tlphy*	at mii? phy ?			# ThunderLAN PHYs
 tqphy*	at mii? phy ?			# TDK Semiconductor PHYs
 ukphy*	at mii? phy ?			# generic unknown PHYs

 # USB Controller and Devices
 #
 # PCI USB controllers
 ehci*	at pci?	dev ? function ?	# Enhanced Host Controller
 uhci*	at pci?	dev ? function ?	# Universal Host Controller (Intel)

 # CardBus USB controllers
 ehci*	at cardbus? dev ? function ?	# Enhanced Host Controller
 ohci*	at cardbus? dev ? function ?	# Open Host Controller

 # USB bus support
 usb*	at ehci?
 usb*	at ohci?
 usb*	at uhci?

 # USB Hubs
 uhub*	at usb?
 uhub*	at uhub? port ? configuration ? interface ?

 # USB HID device
 uhidev*	at uhub? port ? configuration ? interface ?

 # USB Mice
 ums*	at uhidev? reportid ?
 wsmouse*	at ums? mux 0

 # USB Keyboards
 ukbd*	at uhidev? reportid ?
 wskbd*	at ukbd? console ? mux 1

 # USB Generic HID devices
 uhid*	at uhidev? reportid ?

 # USB Printer
 ulpt*	at uhub? port ? configuration ? interface ?

 # USB Modem
 umodem*	at uhub? port ? configuration ?
 ucom*	at umodem?

 # USB Mass Storage
 umass*	at uhub? port ? configuration ? interface ?
 wd*	at umass?

 # USB audio
 uaudio*	at uhub? port ? configuration ?

 # USB MIDI
 umidi* at uhub? port ? configuration ?

 # USB IrDA
 # USB-IrDA bridge spec
 uirda* at uhub? port ? configuration ? interface ?
 irframe* at uirda?

 # SigmaTel STIr4200 USB/IrDA Bridge
 ustir* at uhub? port ?
 irframe* at ustir?

 # USB Ethernet adapters
 aue*	at uhub? port ?		# ADMtek AN986 Pegasus based adapters
 axe*	at uhub? port ?		# ASIX AX88172 based adapters
 cue*	at uhub? port ?		# CATC USB-EL1201A based adapters
 kue*	at uhub? port ?		# Kawasaki LSI KL5KUSB101B based adapters
 url*	at uhub? port ?		# Realtek RTL8150L based adapters

 # Prolofic PL2301/PL2302 host-to-host adapter
 upl*	at uhub? port ?

 # Serial adapters
 #
 # FTDI FT8U100AX serial adapter
 uftdi*	at uhub? port ?
 ucom*	at uftdi? portno ?

 uplcom*	at uhub? port ?		# I/O DATA USB-RSAQ2 serial adapter
 ucom*	at uplcom? portno ?

 umct*	at uhub? port ?		# MCT USB-RS232 serial adapter
 ucom*	at umct? portno ?

 # USB Generic driver
 ugen*	at uhub? port ?

 # Audio Devices
 #
 # PCI audio devices
 auich*	at pci? dev ? function ?	# Intel ICH integrated AC'97 Audio

 # Audio support
 audio*	at audiobus?

 # MIDI support
 midi*	at midibus?
 midi*	at pcppi?		# MIDI interface to the PC speaker

 # The spkr driver provides a simple tone interface to the built in speaker.
 spkr0	at pcppi?		# PC speaker

 # Pseudo-Devices
 #
 # disk/mass storage pseudo-devices
 pseudo-device	ccd		4	# concatenated/striped disk devices
 pseudo-device	cgd		4	# cryptographic disk devices
 pseudo-device	fss		4	# file system snapshot device
 pseudo-device	md		1	# memory disk device (ramdisk)
 pseudo-device	vnd		4	# disk-like interface to files

 # network pseudo-devices
 pseudo-device	bpfilter	8	# Berkeley packet filter
 pseudo-device	ipfilter		# IP filter (firewall) and NAT
 pseudo-device	loop			# network loopback
 pseudo-device	ppp		2	# Point-to-Point Protocol
 pseudo-device	pppoe			# PPP over Ethernet (RFC 2516)
 pseudo-device	irframetty		# IrDA frame line discipline
 pseudo-device	tun		2	# network tunneling over tty
 pseudo-device	tap			# virtual Ethernet
 pseudo-device	gre		2	# generic L3 over IP tunnel
 pseudo-device	gif		4	# IPv[46] over IPv[46] tunnel (RFC1933)
 pseudo-device	vlan			# IEEE 802.1q encapsulation
 pseudo-device	bridge			# simple inter-network bridging

 # miscellaneous pseudo-devices
 pseudo-device	pty			# pseudo-terminals
 pseudo-device	sequencer	1	# MIDI sequencer
 pseudo-device	rnd			# /dev/random and in-kernel generator
 pseudo-device	clockctl		# user control of clock subsystem
 pseudo-device 	ksyms			# /dev/ksyms

 # a pseudo device needed for SMBFS
 pseudo-device	nsmb			# experimental - SMB requester

 # wscons pseudo-devices
 pseudo-device	wsmux			# mouse & keyboard multiplexor
 pseudo-device	wsfont

 --MfFXiAuoTsnnDAfZ--

From: Lubomir Sedlacik <salo@Xtrmntr.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/30194: unrecoverable wd(4) error after suspend/resume
Date: Thu, 12 May 2005 21:50:54 +0200

 more information:

 - it doesn't happen with 2.0.2
 - it doesn't happen with 3.0_BETA
 - it happens with the recent 200505090000Z snapshot of 3.99.3,
   these errors are printed out (netbsd-INSTALL_LAPTOP):

   piixide0:0:0: lost interrupt
           type: ata tc_bcount: 2040 tc_skip: 0
   piixide0:0:0: bus-master DMA error: missing interrupt, status=0x1

   and the drive activity LED is on, disk is hung.

 -- 
 -- Lubomir Sedlacik <salo@{NetBSD,Xtrmntr,silcnet}.org>   --

From: Lubomir Sedlacik <salo@Xtrmntr.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/30194: unrecoverable wd(4) error after suspend/resume
Date: Fri, 13 May 2005 11:39:01 +0200

 ok, spoke too soon.

 it actually hangs on all of netbsd-2-0, netbsd-2, netbsd-3 and -current
 if i leave it suspended for a longer time (e.g., 1 minute).

 i tried INSTALL_LAPTOP kernels from netbsd-2 (may 11th snapshot),
 netbsd-2-0 (2.0.2 release), netbsd-3 (may 6th) and various -current
 sources (may 12th, jan 25th, jan 1st - both INSTALL_LAPTOP and my custom
 configs).

 -- 
 -- Lubomir Sedlacik <salo@{NetBSD,Xtrmntr,silcnet}.org>   --

From: Manuel Bouyer <bouyer@antioche.eu.org>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@NetBSD.org, gnats-admin@NetBSD.org,
	netbsd-bugs@NetBSD.org
Subject: Re: kern/30194: unrecoverable wd(4) error after suspend/resume
Date: Mon, 16 May 2005 20:02:05 +0200

 --17pEHd4RhPHOinZp
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 > >Description:
 > i am unable to resume from suspend with APM in the kernel.  when resuming, the
 > system comes up but disk seems to be hung immediately (sometimes the disk
 > activity led is constantly on), processes hang in vnlock (sometimes in
 > getblk).  kernel prints error:
 > 
 >  atabus0: resuming...
 >  atabus1: resuming...
 >  wd0a: error writing fsbn 15042624 of 15042624-15042655 (wd0 bn 15042687; cn 14923 tn 4 sn 51), retrying
 >  wd0: (aborted command)

 Hi,
 can you try the attached patch ? I've not been able to reproduce your problem,
 but the atabus power hook needs to be smarter than it is actually.

 -- 
 Manuel Bouyer <bouyer@antioche.eu.org>
      NetBSD: 26 ans d'experience feront toujours la difference
 --

 --17pEHd4RhPHOinZp
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=diff

 Index: ata.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ata/ata.c,v
 retrieving revision 1.67
 diff -u -r1.67 ata.c
 --- ata.c	11 Apr 2005 04:24:54 -0000	1.67
 +++ ata.c	16 May 2005 17:42:45 -0000
 @@ -158,6 +158,7 @@

  	TAILQ_INIT(&chp->ch_queue->queue_xfer);
  	chp->ch_queue->queue_freeze = 0;
 +	chp->ch_queue->queue_flags = 0;
  	chp->ch_queue->active_xfer = NULL;

  	chp->atabus = config_found(&chp->ch_atac->atac_dev, chp, atabusprint);
 @@ -322,11 +323,7 @@
  	splx(s);

  	/* Configure the devices on the bus. */
 -	if (sc->sc_sleeping == 1) {
 -		printf("%s: resuming...\n", sc->sc_dev.dv_xname);
 -		sc->sc_sleeping = 0;
 -	} else
 -		atabusconfig(sc);
 +	atabusconfig(sc);

  	for (;;) {
  		s = splbio();
 @@ -430,7 +427,6 @@
  	config_pending_incr();
  	kthread_create(atabus_create_thread, sc);

 -	sc->sc_sleeping = 0;
  	sc->sc_powerhook = powerhook_establish(atabus_powerhook, sc);
  	if (sc->sc_powerhook == NULL)
  		printf("%s: WARNING: unable to establish power hook\n",
 @@ -699,6 +695,22 @@
  }

  /*
 + * freeze the queue and wait for the controller to be idle. Caller has to
 + * unfreeze/restart the queue
 + */
 +void
 +ata_queue_idle(struct ata_queue *queue)
 +{
 +	int s = splbio();
 +	queue->queue_freeze++;
 +	while (queue->active_xfer != NULL) {
 +		queue->queue_flags |= QF_IDLE_WAIT;
 +		tsleep(&queue->queue_flags, PRIBIO, "qidl", 0);
 +	}
 +	splx(s);
 +}
 +
 +/*
   * Add a command to the queue and start controller.
   *
   * MUST BE CALLED AT splbio()!
 @@ -772,6 +784,10 @@
  		return; /* channel aleady active */
  	}
  	if (__predict_false(chp->ch_queue->queue_freeze > 0)) {
 +		if (queue->queue_flags & QF_IDLE_WAIT) {
 +			queue->queue_flags &= ~QF_IDLE_WAIT;
 +			wakeup(&queue->queue_flags);
 +		}
  		return; /* queue froozen */
  	}
  	/*
 @@ -1422,17 +1438,17 @@
  	switch (why) {
  	case PWR_SOFTSUSPEND:
  	case PWR_SOFTSTANDBY:
 -		sc->sc_sleeping = 1;
 -		s = splbio();
 -		chp->ch_flags = ATACH_SHUTDOWN;
 -		splx(s);
 -		wakeup(&chp->ch_thread);
 -		while (chp->ch_thread != NULL)
 -			(void) tsleep((void *)&chp->ch_flags, PRIBIO,
 -			    "atadown", 0);
 +		/* freeze the queue and wait for the controller to be idle */
 +		ata_queue_idle(chp->ch_queue);
  		break;
  	case PWR_RESUME:
 -		atabus_create_thread(sc);
 +		printf("%s: resuming...\n", sc->sc_dev.dv_xname);
 +		s = splbio();
 +		KASSERT(chp->ch_queue->queue_freeze > 0);
 +		/* unfreeze the queue and reset drives (to wake them up) */
 +		chp->ch_queue->queue_freeze--;
 +		ata_reset_channel(chp, AT_WAIT);
 +		splx(s);
  		break;
  	case PWR_SUSPEND:
  	case PWR_STANDBY:
 Index: atavar.h
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/ata/atavar.h,v
 retrieving revision 1.67
 diff -u -r1.67 atavar.h
 --- atavar.h	27 Feb 2005 00:26:59 -0000	1.67
 +++ atavar.h	16 May 2005 17:42:45 -0000
 @@ -88,6 +88,8 @@
  	TAILQ_HEAD(, ata_xfer) queue_xfer; /* queue of pending commands */
  	int queue_freeze; /* freeze count for the queue */
  	struct ata_xfer *active_xfer; /* active command */
 +	int queue_flags;	/* flags for this queue */
 +#define QF_IDLE_WAIT   0x01    /* someone is wants the controller idle */
  };

  /* ATA bus instance state information. */
 @@ -97,7 +99,6 @@
  	int sc_flags;
  #define ATABUSCF_OPEN	0x01
  	void *sc_powerhook;
 -	int sc_sleeping;
  };

  /*
 @@ -441,6 +442,7 @@
  void	ata_probe_caps(struct ata_drive_datas *);

  void	ata_dmaerr(struct ata_drive_datas *, int);
 +void	ata_queue_idle(struct ata_queue *);
  #endif /* _KERNEL */

  #endif /* _DEV_ATA_ATAVAR_H_ */

 --17pEHd4RhPHOinZp--

From: Lubomir Sedlacik <salo@Xtrmntr.org>
To: Manuel Bouyer <bouyer@antioche.eu.org>
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/30194: unrecoverable wd(4) error after suspend/resume
Date: Mon, 16 May 2005 22:28:46 +0200

 --9wW02hG+pBvRTRBg
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable

 hi,

 On Mon, May 16, 2005 at 08:02:05PM +0200, Manuel Bouyer wrote:
 > can you try the attached patch ? I've not been able to reproduce your
 > problem, but the atabus power hook needs to be smarter than it is
 > actually.

 whooa!  this made a whole lot of a difference (after fixing your patch
 to compile :).  i am now able to suspend/resume without disk losing
 interrupts and hanging.  thanks a lot!

 patch for your patch (i also fixed a typo in a comment):

 --- ata.diff.orig	2005-05-16 20:34:50.000000000 +0200
 +++ ata.diff	2005-05-16 22:17:06.000000000 +0200
 @@ -57,17 +57,19 @@
    * Add a command to the queue and start controller.
    *
    * MUST BE CALLED AT splbio()!
 -@@ -772,6 +784,10 @@
 +@@ -772,7 +784,11 @@
   		return; /* channel aleady active */
   	}
   	if (__predict_false(chp->ch_queue->queue_freeze > 0)) {
 -+		if (queue->queue_flags & QF_IDLE_WAIT) {
 -+			queue->queue_flags &=3D ~QF_IDLE_WAIT;
 -+			wakeup(&queue->queue_flags);
 +-		return; /* queue froozen */
 ++		if (chp->ch_queue->queue_flags & QF_IDLE_WAIT) {
 ++			chp->ch_queue->queue_flags &=3D ~QF_IDLE_WAIT;
 ++			wakeup(&chp->ch_queue->queue_flags);
  +		}
 - 		return; /* queue froozen */
 ++		return; /* queue frozen */
   	}
   	/*
 + 	 * if someone is waiting for the command to be active, wake it up
  @@ -1422,17 +1438,17 @@
   	switch (why) {
   	case PWR_SOFTSUSPEND:

 --=20
 - Lubomir Sedlacik <salo@{NetBSD,Xtrmntr,silcnet}.org>   --

 --9wW02hG+pBvRTRBg
 Content-Type: application/pgp-signature
 Content-Disposition: inline

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.6 (NetBSD)

 iD8DBQFCiQJ+iwjDDlS8cmMRAmDGAJsE0QdHSv2OHhsGpUvb6ERSXKNqrwCfeigD
 ZQdfpMG2x9Q4ggoTzlTJdvI=
 =nERy
 -----END PGP SIGNATURE-----

 --9wW02hG+pBvRTRBg--

From: Manuel Bouyer <bouyer@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/30194 CVS commit: src/sys/dev/ata
Date: Mon, 16 May 2005 21:43:33 +0000 (UTC)

 Module Name:	src
 Committed By:	bouyer
 Date:		Mon May 16 21:43:33 UTC 2005

 Modified Files:
 	src/sys/dev/ata: ata.c atavar.h

 Log Message:
 Add a ata_queue_idle() function, which freeze a queue and tsleep() until the
 controller is idle.
 Change the powerhook function to call ata_queue_idle() on standby/suspend,
 and ata_reset_channel() on resume (to wake up the disks and start from a
 clean state).
 Fix PR kern/30194 by Lubomir Sedlacik.


 To generate a diff of this commit:
 cvs rdiff -r1.67 -r1.68 src/sys/dev/ata/ata.c src/sys/dev/ata/atavar.h

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

From: Manuel Bouyer <bouyer@antioche.eu.org>
To: Lubomir Sedlacik <salo@Xtrmntr.org>
Cc: gnats-bugs@netbsd.org
Subject: Re: kern/30194: unrecoverable wd(4) error after suspend/resume
Date: Mon, 16 May 2005 23:44:46 +0200

 On Mon, May 16, 2005 at 10:28:46PM +0200, Lubomir Sedlacik wrote:
 > hi,
 > 
 > On Mon, May 16, 2005 at 08:02:05PM +0200, Manuel Bouyer wrote:
 > > can you try the attached patch ? I've not been able to reproduce your
 > > problem, but the atabus power hook needs to be smarter than it is
 > > actually.
 > 
 > whooa!  this made a whole lot of a difference (after fixing your patch
 > to compile :).

 Ops, I sent you an older version of the patch, I fixed theses to
 test on my laptop. Sorry for this.

 > i am now able to suspend/resume without disk losing
 > interrupts and hanging.  thanks a lot!

 OK, I commited this, and will request pullups to 3.0_BETA in the next few
 days.

 -- 
 Manuel Bouyer <bouyer@antioche.eu.org>
      NetBSD: 26 ans d'experience feront toujours la difference
 --

Responsible-Changed-From-To: kern-bug-people->bouyer
Responsible-Changed-By: bouyer@netbsd.org
Responsible-Changed-When: Mon, 16 May 2005 21:45:56 +0000
Responsible-Changed-Why:
I commited a fix for this, will request a pullup to 3.0_BETA in the next
few days.


From: Jeff Rizzo <riz@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/30194 CVS commit: [netbsd-3] src/sys/dev/ata
Date: Fri, 27 May 2005 23:10:52 +0000 (UTC)

 Module Name:	src
 Committed By:	riz
 Date:		Fri May 27 23:10:52 UTC 2005

 Modified Files:
 	src/sys/dev/ata [netbsd-3]: ata.c atavar.h

 Log Message:
 Pull up revision 1.68 (requested by bouyer in ticket #328):
 Add a ata_queue_idle() function, which freeze a queue and tsleep() until the
 controller is idle.
 Change the powerhook function to call ata_queue_idle() on standby/suspend,
 and ata_reset_channel() on resume (to wake up the disks and start from a
 clean state).
 Fix PR kern/30194 by Lubomir Sedlacik.


 To generate a diff of this commit:
 cvs rdiff -r1.66 -r1.66.2.1 src/sys/dev/ata/ata.c
 cvs rdiff -r1.67 -r1.67.2.1 src/sys/dev/ata/atavar.h

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

State-Changed-From-To: open->closed
State-Changed-By: bouyer@netbsd.org
State-Changed-When: Wed, 05 Jul 2006 17:07:22 +0000
State-Changed-Why:
Fix has been commited and pulled up a long time ago.


>Unformatted:

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.