From owner-freebsd-bugs Sat Nov 18 10:20: 9 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id B993537B4C5 for ; Sat, 18 Nov 2000 10:20:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id KAA93761; Sat, 18 Nov 2000 10:20:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from innenfor.trondheim.fast.no (ext-gw.trd.fast.no [213.188.8.2]) by hub.freebsd.org (Postfix) with ESMTP id 4350037B479 for ; Sat, 18 Nov 2000 10:16:33 -0800 (PST) Received: from not.trondheim.fast.no (not.trondheim.fast.no [192.168.8.12]) by innenfor.trondheim.fast.no (8.9.3/8.9.3) with ESMTP id TAA61637 for ; Sat, 18 Nov 2000 19:16:31 +0100 (CET) (envelope-from tegge@not.trondheim.fast.no) Received: (from tegge@localhost) by not.trondheim.fast.no (8.11.1/8.8.8) id eAIIGVH00724; Sat, 18 Nov 2000 19:16:31 +0100 (CET) (envelope-from tegge@not.trondheim.fast.no) Message-Id: <200011181816.eAIIGVH00724@not.trondheim.fast.no> Date: Sat, 18 Nov 2000 19:16:31 +0100 (CET) From: tegge@trondheim.fast.no Reply-To: tegge@trondheim.fast.no To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: i386/22944: isa_dmainit fails on machines with 512MB memory or more Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 22944 >Category: i386 >Synopsis: isa_dmainit fails on machines with 512MB memory or more >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Nov 18 10:20:01 PST 2000 >Closed-Date: >Last-Modified: >Originator: Tor Egge >Release: FreeBSD 5.0-CURRENT i386 >Organization: Fast Search & Transfer ASA >Environment: System: FreeBSD not.trondheim.fast.no 5.0-CURRENT FreeBSD 5.0-CURRENT #9: Sat Nov 18 18:29:33 CET 2000 root@not.trondheim.fast.no:/usr/src/sys/compile/NOT_SMP i386 >Description: 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: 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 >How-To-Repeat: Use the floppy device on a -current machine with 512 MB or more memory. >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. Index: sys/i386/i386/machdep.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/machdep.c,v retrieving revision 1.420 diff -u -r1.420 machdep.c --- sys/i386/i386/machdep.c 2000/10/27 11:45:23 1.420 +++ sys/i386/i386/machdep.c 2000/11/18 18:09:15 @@ -120,6 +120,8 @@ #include #include +#include "isa.h" + extern void init386 __P((int first)); extern void dblfault_handler __P((void)); @@ -1807,6 +1811,31 @@ phys_avail[pa_indx] -= round_page(MSGBUF_SIZE); avail_end = phys_avail[pa_indx]; + +#if NISA > 0 +#define ISA_MEM_END (16 * 1024 * 1024) +#define ISA_MEM_CONSERVELIM (128 * 1024 * 1024) + if (pa_indx + 2 < PHYS_AVAIL_ARRAY_END) { + for (i = pa_indx; i >= 1; i -= 2) + if (phys_avail[i - 1] < ISA_MEM_END && + phys_avail[i] > ISA_MEM_CONSERVELIM) + break; + if (i >= 1) { + phys_avail[pa_indx + 4] = 0; + phys_avail[pa_indx + 3] = 0; + for (i = pa_indx; i >= 1; i-= 2) { + phys_avail[i + 2] = phys_avail[i]; + phys_avail[i + 1] = phys_avail[i -1]; + if (phys_avail[i - 1] < ISA_MEM_END && + phys_avail[i] > ISA_MEM_CONSERVELIM) { + phys_avail[i + 1] = ISA_MEM_END; + phys_avail[i] = ISA_MEM_END; + break; + } + } + } + } +#endif } void @@ -1943,7 +1972,6 @@ */ cninit(); -#include "isa.h" #if NISA >0 isa_defaultirq(); #endif Index: sys/vm/vm_page.c =================================================================== RCS file: /home/ncvs/src/sys/vm/vm_page.c,v retrieving revision 1.153 diff -u -r1.153 vm_page.c --- sys/vm/vm_page.c 2000/07/04 04:32:40 1.153 +++ sys/vm/vm_page.c 2000/11/18 17:29:30 @@ -161,7 +163,10 @@ m->flags = 0; m->pc = (pa >> PAGE_SHIFT) & PQ_L2_MASK; m->queue = m->pc + PQ_FREE; - TAILQ_INSERT_HEAD(&vm_page_queues[m->queue].pl, m, pageq); + if (((pa >> PAGE_SHIFT) & 1) == 0) + TAILQ_INSERT_HEAD(&vm_page_queues[m->queue].pl, m, pageq); + else + TAILQ_INSERT_TAIL(&vm_page_queues[m->queue].pl, m, pageq); vm_page_queues[m->queue].lcnt++; return (m); } >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message