Bug 22944

Summary: [vm] [patch] isa_dmainit fails on machines with 512MB memory or more
Product: Base System Reporter: tegge <tegge>
Component: i386Assignee: Alan Cox <alc>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description tegge 2000-11-18 18:20:01 UTC
On machines with lots of memory (>= 512 MB), all of the ISA memory might be
allocated before the device probes has completed.  This causes ISA devices to
fail during DMA buffer allocation:

 isa_probe_children: probing non-PnP devices
 fdc0: <NEC 72065B or clone> at port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on isa0
 isa_dmainit(2, 1024) failed
 fdc0: FIFO enabled, 8 bytes threshold
 fd0: <1440-KB 3.5" drive> on fdc0 drive 0

The ISA memory has been used by

	kernel text, data, bss
	arrays allocated by vm_page_startup()
	memory allocated via kmem_alloc()
	memory allocated via malloc() with M_ZERO

Printing the number of free ISA memory pages at the end of vm_mem_init() showed
that with 512 MB memory and a standard kernel, only 165 pages were available at
that time.  Later during probing, the floppy driver failed to allocate ISA
memory.

Attempts to access the floppy device causes an instant panic:

not# dd if=/dev/rfd0a of=/dev/null bs=512 count=1
panic: isa_dmastart: bad bounce buffer

syncing disks... 1 1

Fix: Ensure that the largest memory region described by phys_avail[] doesn't
contain the ISA memory.  This increases the number of free ISA pages 
at end of vm_mem_init() from 165 to 2341.

Change vm_add_new_page to alternate between adding to the head and the
tail of the page queues.  This further increases the number of free ISA 
pages at end of vm_mem_init() from 2341 to 2789.
How-To-Repeat: 
Use the floppy device on a -current machine with 512 MB or more memory.
Comment 1 Poul-Henning Kamp 2000-11-18 22:00:39 UTC
Thanks!  I can confirm this one, with only 384 MB RAM.

>Attempts to access the floppy device causes an instant panic:
>
>not# dd if=/dev/rfd0a of=/dev/null bs=512 count=1
>panic: isa_dmastart: bad bounce buffer

We need somebody to hunt down that bug too.  We shouldn't panic
unless there is nothing else we can do.

--
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.
Comment 2 iedowse freebsd_committer freebsd_triage 2005-04-17 23:24:13 UTC
State Changed
From-To: open->feedback


Is this PR still relevant? 


Comment 3 iedowse freebsd_committer freebsd_triage 2005-04-17 23:24:13 UTC
Responsible Changed
From-To: freebsd-bugs->tegge


Assign to submitter.
Comment 4 David Kirchner 2005-06-08 18:32:28 UTC
Yes, this PR still appears to be relevant. FreeBSD 5.4-RELEASE, when
installing from the 3-floppy set (well, 4..), gives the isa_dmainit error
before eventually panicing the server when it tries to use an isa bounce
buffer. This is with 2GB of RAM in a modern P4 server (SuperMicro board).

Have not been able to get 5.4-RELEASE installed due to this and possibly
other issues, so I don't know if it can be fixed with a kernel config
modification.
Comment 5 David Kirchner 2005-06-08 18:35:07 UTC
As it's been 4.5 years, email addresses change. The submitter address
"tegge@trondheim.fast.no" now bounces. May want to update that so we can
get this bug resolved.
Comment 6 Mark Linimon freebsd_committer freebsd_triage 2005-10-23 19:33:56 UTC
State Changed
From-To: feedback->suspended

Feedback was received some time ago.  Mark as 'suspended' since nothing 
seems to have happened on this in a while.
Comment 7 Alan Cox freebsd_committer freebsd_triage 2007-11-22 21:44:17 UTC
State Changed
From-To: suspended->patched

This should be fixed by the new physical memory allocator 
in RELENG_7 and beyond.  However, I cannot foresee an MFC 
to earlier branches.
Comment 8 Remko Lodder freebsd_committer freebsd_triage 2007-12-09 20:36:58 UTC
Responsible Changed
From-To: tegge->alc

reassign to alc, who committed the update to -current and releng_7
Comment 9 Mark Linimon freebsd_committer freebsd_triage 2008-01-26 15:04:33 UTC
State Changed
From-To: patched->suspended

With bugmeister hat on, mark this one as suspended. 

The problem has been fixed by a rewrite in FreeBSD 7.X, but no MFC to 
6 is planned.  If someone is interested in trying to pick up the 
original patch from this and apply it to RELENG_6, it is worth 
keeping this PR around.  Otherwise, the correct response is probably 
to tell prospective users to consider upgrading to 7.0.
Comment 10 Bruce Cran freebsd_committer freebsd_triage 2011-02-17 19:59:31 UTC
State Changed
From-To: suspended->closed

Fixed in all supported releases.