From vs@foldr.org  Tue Jun  4 00:01:10 2002
Return-Path: <vs@foldr.org>
Received: from lambda.foldr.org (lambda.foldr.org [198.78.66.36])
	by hub.freebsd.org (Postfix) with ESMTP id C0E5037B401
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  4 Jun 2002 00:01:08 -0700 (PDT)
Received: from theater.dyndns.org (pD9008C8C.dip.t-dialin.net [217.0.140.140])
	by lambda.foldr.org (8.12.3/8.11.6) with ESMTP id g54716u4098923
	(using TLSv1/SSLv3 with cipher EDH-RSA-DES-CBC3-SHA (168 bits) verified OK)
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 4 Jun 2002 09:01:08 +0200 (CEST)
	(envelope-from vs@foldr.org)
Received: from monster.ikea.net (monster.ikea.net [IPv6:3ffe:b80:2de:1:240:5ff:fea6:fc01])
	by theater.dyndns.org (8.12.3/8.12.3) with ESMTP id g5471LYM075374
	(version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 4 Jun 2002 09:01:22 +0200 (CEST)
	(envelope-from vs@monster.ikea.net)
Received: (from vs@localhost)
	by monster.ikea.net (8.12.3/8.12.3/Submit) id g5470rDX049440;
	Tue, 4 Jun 2002 09:00:53 +0200 (CEST)
	(envelope-from vs)
Message-Id: <200206040700.g5470rDX049440@monster.ikea.net>
Date: Tue, 4 Jun 2002 09:00:53 +0200 (CEST)
From: Volker Stolz <vs@foldr.org>
Reply-To: Volker Stolz <vs@foldr.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: 'kldload bktr' stuck in state swwrt, exercising the disk
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         38883
>Category:       kern
>Synopsis:       'kldload bktr' stuck in state swwrt, exercising the disk
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 04 00:10:01 PDT 2002
>Closed-Date:    Mon Jul 14 03:31:09 PDT 2003
>Last-Modified:  Mon Jul 14 03:31:09 PDT 2003
>Originator:     Volker Stolz
>Release:        FreeBSD 4.6-RC i386
>Organization:
>Environment:
System: FreeBSD monster.ikea.net 4.6-RC FreeBSD 4.6-RC #9: Sun Jun 2 17:57:53 CEST 2002 root@monster.ikea.net:/usr/src/sys/compile/MONSTER i386


>Description:
If I try to kldload bktr, the kldload process gets stuck in state swwrt and exercises the disk
(it doesn't seem to fill the disk though). Only the first line of the detected devices show
up in the kernel log. Here the boot-dmesg and the output after kldloading:

FreeBSD 4.6-RC #9: Sun Jun  2 17:57:53 CEST 2002
    root@monster.ikea.net:/usr/src/sys/compile/MONSTER
Timecounter "i8254"  frequency 1193182 Hz
CPU: Pentium III/Pentium III Xeon/Celeron (751.71-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0x683  Stepping = 3
  Features=0x383fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE>
real memory  = 134152192 (131008K bytes)
avail memory = 125857792 (122908K bytes)
Programming 24 pins in IOAPIC #0
IOAPIC #0 intpin 2 -> irq 0
FreeBSD/SMP: Multiprocessor motherboard
 cpu0 (BSP): apic id:  0, version: 0x00040011, at 0xfee00000
 cpu1 (AP):  apic id:  1, version: 0x00040011, at 0xfee00000
 io0 (APIC): apic id:  2, version: 0x00178011, at 0xfec00000
Preloaded elf kernel "kernel" at 0xc0496000.
Preloaded elf module "linux.ko" at 0xc049609c.
Preloaded elf module "agp.ko" at 0xc049613c.
Preloaded elf module "drm.ko" at 0xc04961d8.
ccd0-3: Concatenated disk drivers
Pentium Pro MTRR support enabled
md0: Malloc disk
Using $PIR table, 8 entries at 0xc00fdd20
apm0: <APM BIOS> on motherboard
apm: found APM BIOS v1.2, connected at v1.2
npx0: <math processor> on motherboard
npx0: INT 16 interface
pcib0: <Host to PCI bridge> on motherboard
pci0: <PCI bus> on pcib0
agp0: <VIA 82C691 (Apollo Pro) host to PCI bridge> mem 0xe8000000-0xefffffff at device 0.0 on pci0
pcib1: <VIA 82C598MVP (Apollo MVP3) PCI-PCI (AGP) bridge> at device 1.0 on pci0
pci1: <PCI bus> on pcib1
pci1: <3Dfx Voodoo 3 graphics accelerator> at 0.0 irq 5
isab0: <VIA 82C686 PCI-ISA bridge> at device 7.0 on pci0
isa0: <ISA bus> on isab0
atapci0: <VIA 82C686 ATA100 controller> port 0xd000-0xd00f at device 7.1 on pci0
ata0: at 0x1f0 irq 14 on atapci0
ata1: at 0x170 irq 15 on atapci0
uhci0: <VIA 83C572 USB controller> port 0xd400-0xd41f irq 10 at device 7.2 on pci0
usb0: <VIA 83C572 USB controller> on uhci0
usb0: USB revision 1.0
uhub0: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
uhci1: <VIA 83C572 USB controller> port 0xd800-0xd81f irq 10 at device 7.3 on pci0
usb1: <VIA 83C572 USB controller> on uhci1
usb1: USB revision 1.0
uhub1: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1: 2 ports with 2 removable, self powered
pci0: <unknown card> (vendor=0x1106, dev=0x3057) at 7.4
sym0: <810a> port 0xdc00-0xdcff mem 0xf7001000-0xf70010ff irq 11 at device 9.0 on pci0
sym0: No NVRAM, ID 7, Fast-10, SE, parity checking
de0: <Digital 21041 Ethernet> port 0xe000-0xe07f mem 0xf7000000-0xf700007f irq 10 at device 10.0 on pci0
de0: 21041 [10Mb/s] pass 2.1
de0: address 00:40:05:a6:fc:01
pcm0: <Creative EMU10K1> port 0xe400-0xe41f irq 5 at device 11.0 on pci0
pci0: <unknown card> (vendor=0x109e, dev=0x036e) at 12.0 irq 11
pci0: <unknown card> (vendor=0x109e, dev=0x0878) at 12.1 irq 11
orm0: <Option ROM> at iomem 0xc0000-0xc9fff on isa0
fdc0: <NEC 72065B or clone> at port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on isa0
fdc0: FIFO enabled, 8 bytes threshold
fd0: <1440-KB 3.5" drive> on fdc0 drive 0
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
atkbd0: <AT Keyboard> flags 0x1 irq 1 on atkbdc0
kbd0 at atkbd0
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: model IntelliMouse, device ID 3
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
sio0 at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0
sio0: type 16550A
sio1 at port 0x2f8-0x2ff irq 3 on isa0
sio1: type 16550A
ppc0: <Parallel port> at port 0x378-0x37f irq 7 on isa0
ppc0: Generic chipset (EPP/NIBBLE) in COMPATIBLE mode
plip0: <PLIP network interface> on ppbus0
lpt0: <Printer> on ppbus0
lpt0: Interrupt-driven port
ppi0: <Parallel I/O> on ppbus0
APIC_IO: Testing 8254 interrupt delivery
APIC_IO: routing 8254 via IOAPIC #0 intpin 2
IPsec: Initialized Security Association Processing.
IP Filter: v3.4.27 initialized.  Default = pass all, Logging = enabled
SMP: AP CPU #1 Launched!

=================================

bktr_mem: memory holder loaded
bktr0: <BrookTree 878> mem 0xf7002000-0xf7002fff irq 11 at device 12.0 on pci0

However, the remaining lines make it into the log when shutting down the machine!
The bktr deviceo is not usable in this state.

>How-To-Repeat:
On this particular machine 100% reliably reproducible. Just kldload bktr_mem and
then bktr.
>Fix:
Build bktr into the kernel.


>Release-Note:
>Audit-Trail:

From: "Simon 'corecode' Schubert" <corecode@corecode.ath.cx>
To: Volker Stolz <vs@foldr.org>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: kern/38883: 'kldload bktr' stuck in state swwrt, exercising the disk
Date: Mon, 10 Jun 2002 02:05:10 +0200

 --=.knKoPQ'kWuM.n1
 Content-Type: text/plain; charset=US-ASCII
 Content-Transfer-Encoding: 7bit
 
 i got simmilar problems, tho this is not 100% reproduceable here.
 most of the time (say 70%) kldloading bktr will hang - but sometimes it
 will load ok.
 
 if somebody wants to run some tests i'd be glad to help.
 
 the machine is an Athlon 500 on a Irongate (v4?) chipset.
 
 cheerz
   simon
 
 -- 
 /"\   http://corecode.ath.cx/#donate
 \ /
  \     ASCII Ribbon Campaign
 / \  Against HTML Mail and News
 
 --=.knKoPQ'kWuM.n1
 Content-Type: application/pgp-signature
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.0.7 (FreeBSD)
 
 iD8DBQE9A+08r5S+dk6z85oRAncfAKCZsfPUP4htGWtO5uV+mWlbmNvDXACg+X/H
 6vHL0lo7QjBDBeZYuJ3AKVc=
 =4iaG
 -----END PGP SIGNATURE-----
 
 --=.knKoPQ'kWuM.n1--
 

From: "Simon 'corecode' Schubert" <corecode@corecode.ath.cx>
To: Volker Stolz <vs@foldr.org>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: kern/38883: 'kldload bktr' stuck in state swwrt, exercising the disk
Date: Wed, 12 Jun 2002 11:57:24 +0200

 --sct.=.NQ3=YX(f1+
 Content-Type: text/plain; charset=US-ASCII
 Content-Transfer-Encoding: 7bit
 
 i've tracked the problem down a bit and found out that loading bktr_mem
 can be the problem.
 
 if everything works ok, it runs somehow like this
 
 # kldload bktr_mem
 bktr_mem memory holder loaded [or something like this]
 #
 
 if that message appears bktr will load OK.
 
 though most of the time it won't spit out the message and trying to load
 bktr results in described process hang.
 
 i noticed that loading bktr_mem right after the start (before login into
 wdm) it will result most of the time.
 now that i have already loged in and run several programs, bktr_mem
 seems not to be able to reserve the needed memory or something like
 that.
 
 cheerz
   simon
 
 
 -- 
 /"\   http://corecode.ath.cx/#donate
 \ /
  \     ASCII Ribbon Campaign
 / \  Against HTML Mail and News
 
 --sct.=.NQ3=YX(f1+
 Content-Type: application/pgp-signature
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.0.7 (FreeBSD)
 
 iD8DBQE9BxsIr5S+dk6z85oRAqXVAKC5a/wD5f9XEp4yK2Wz6FWc9peb6wCg2UnH
 5Bm44YVEK7ek4UvlnsXs64w=
 =AN7R
 -----END PGP SIGNATURE-----
 
 --sct.=.NQ3=YX(f1+--
 
Responsible-Changed-From-To: freebsd-bugs->roger 
Responsible-Changed-By: johan 
Responsible-Changed-When: Tue Aug 20 14:20:53 PDT 2002 
Responsible-Changed-Why:  
Over to bktr maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=38883 
Responsible-Changed-From-To: roger->freebsd-bugs 
Responsible-Changed-By: roger 
Responsible-Changed-When: Tue Oct 8 01:03:32 PDT 2002 
Responsible-Changed-Why:  
It is not a bug wih the bktr driver. The bug lies in the kernel's 
contiguous memory allocation function which never returns. 

There is no way to check in advance if the contiguous memory 
callocation will pass or fail. When the bktr driver loads, it asks for 
contiguous memory. 
Contiguous memory is memory which is not fragmented and so you only 
get contiguous memory at boot time, or shortly after booting before large 
programs have run. 
So, on my own machines, I can boot, run a few small programs 
and then kldload the bktr driver. 
But if I start X and then quit X, I cannot load it because memory 
is fragmented. 

So, the problem is the kernel's memory allocation routine failing to 
return memory or an error. 
There is nothing the bktr driver can do. 



http://www.freebsd.org/cgi/query-pr.cgi?pr=38883 
State-Changed-From-To: open->closed 
State-Changed-By: kris 
State-Changed-When: Mon Jul 14 03:30:19 PDT 2003 
State-Changed-Why:  
As explained by roger, this is due to kldloading the 
module after the system is already in operation. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=38883 
>Unformatted:
