From owner-freebsd-current@FreeBSD.ORG Sat Jan 17 10:48:05 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7842616A4CE for ; Sat, 17 Jan 2004 10:48:05 -0800 (PST) Received: from smtp.mho.com (smtp.mho.net [64.58.4.6]) by mx1.FreeBSD.org (Postfix) with SMTP id 6E41543D48 for ; Sat, 17 Jan 2004 10:47:59 -0800 (PST) (envelope-from scottl@freebsd.org) Received: (qmail 4835 invoked by uid 1002); 17 Jan 2004 18:47:56 -0000 Received: from unknown (HELO freebsd.org) (64.58.1.252) by smtp.mho.net with SMTP; 17 Jan 2004 18:47:56 -0000 Message-ID: <400982E9.9010603@freebsd.org> Date: Sat, 17 Jan 2004 11:46:01 -0700 From: Scott Long User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.5) Gecko/20031103 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Peter Wood References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-current@freebsd.org Subject: Re: FreeBSD 5.2R+C: panic: kmem_malloc(4096): kmem_map too small X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jan 2004 18:48:05 -0000 Hi, Using the 'malloc' disk type is usually dubious and only works well for small allocations. The kernel has a rather small malloc pool (this is different from address space) that it can allocate from, and this pool was *never* meant to service 1.5GB worth of memory disks. In a case like this (which I also consider to be somewhat dubious), it is much more appropriate to use the 'swap' disk type of mdconfig. The pages that get dirtied by your test will be held in the buffer/cache until memory pressure forces them out to swap. The effect will be mostly the same as using a 'malloc' disk, but without the guaranteed panics. Scott Peter Wood wrote: > Good Evening, > > I have come accross a reproducable panic in bother 5.2-Release and 5.2-Current > (as it was an hour ago). To perform this, I create two 750Mb memory disks, > format them and mount them. The machine has 2Gb of RAM, of which no more then > 90mb is active. > > Then when I attempt to copy data to the first of the memory disk it causes a > panic after it's copied an amount of data onto the memory disk. I could be > missing some major kernel/sysctl configuration option here, but I'm not sure. > > [xenon:~]# mdconfig -a -t malloc -s 750m > md0 > [xenon:~]# mdconfig -a -t malloc -s 750m > md1 > [xenon:~]# newfs -U /dev/md0 > /dev/md0: 750.0MB (1536000 sectors) block size 16384, fragment size 2048 > using 5 cylinder groups of 183.77MB, 11761 blks, 23552 inodes. > with soft updates > super-block backups (for fsck -b #) at: > 160, 376512, 752864, 1129216, 1505568 > [xenon:~]# newfs -U /dev/md1 > /dev/md1: 750.0MB (1536000 sectors) block size 16384, fragment size 2048 > using 5 cylinder groups of 183.77MB, 11761 blks, 23552 inodes. > with soft updates > super-block backups (for fsck -b #) at: > 160, 376512, 752864, 1129216, 1505568 > [xenon:~]# cd /usr > [xenon:/usr]# mount /dev/md0 src > [xenon:/usr]# mount /dev/md1 obj > [xenon:/usr]# cd src > [xenon:/usr/src]# cp -Rp ../src-orig/* . > > The backtrace follows, I have saved the dump file, however it is 2Gb so that > negates me sending it to anyone. If you want to have a poke with gdb your > welcome to, contact me and I'll arrange for SSH/root access on the machine. > > panic messages: > --- > panic: kmem_malloc(4096): kmem_map too small: 275251200 total allocated > cpuid = 1; > panic: from debugger > cpuid = 1; > boot() called on cpu#1 > Uptime: 6m12s > Dumping 2047 MB > 16 32 48 64 80 96 112 128 144 160 176 192 208 224 240 256 272 288 304 320 336 > 352 368 384 400 416 432 448 464 480 496 512 528 544 560 576 592 608 624 640 > 656 672 688 704 720 736 752 768 784 800 816 832 848 864 880 896 912 928 944 > 960 976 992 1008 1024 1040 1056 1072 1088 1104 1120 1136 1152 1168 1184 1200 > 1216 1232 1248 1264 1280 1296 1312 1328 1344 1360 1376 1392 1408 1424 1440 > 1456 1472 1488 1504 1520 1536 1552 1568 1584 1600 1616 1632 1648 1664 1680 > 1696 1712 1728 1744 1760 1776 1792 1808 1824 1840 1856 1872 1888 1904 1920 > 1936 1952 1968 1984 2000 2016 2032 > --- > Reading symbols from > /usr/src/sys/i386/compile/XENON/modules/usr/src/sys/modules/acpi/acpi.ko...done. > Loaded symbols for > /usr/src/sys/i386/compile/XENON/modules/usr/src/sys/modules/acpi/acpi.ko > #0 doadump () at ../../../kern/kern_shutdown.c:240 > 240 dumping++; > (kgdb) bt > #0 doadump () at ../../../kern/kern_shutdown.c:240 > #1 0xc0530723 in boot (howto=260) at ../../../kern/kern_shutdown.c:372 > #2 0xc0530aff in panic () at ../../../kern/kern_shutdown.c:550 > #3 0xc0448032 in db_panic () at ../../../ddb/db_command.c:450 > #4 0xc0447faa in db_command (last_cmdp=0xc073d640, cmd_table=0x0, > aux_cmd_tablep=0xc06f150c, aux_cmd_tablep_end=0xc06f1510) > at ../../../ddb/db_command.c:346 > #5 0xc04480b8 in db_command_loop () at ../../../ddb/db_command.c:472 > #6 0xc044adf9 in db_trap (type=3, code=0) at ../../../ddb/db_trap.c:73 > #7 0xc06835c3 in kdb_trap (type=3, code=0, regs=0xe98aa7dc) > at ../../../i386/i386/db_interface.c:171 > #8 0xc06980ae in trap (frame= > {tf_fs = 24, tf_es = 16, tf_ds = 16, tf_edi = -1066509356, tf_esi = 1, > tf_ebp = -376788952, tf_isp = -376788984, tf_ebx = 0, tf_edx = 0, tf_ecx = 0, > tf_eax = 18, tf_trapno = 3, tf_err = 0, tf_eip = -1066911570, tf_cs = 8, > tf_eflags = 642, tf_esp = -1066493725, tf_ss = -1066584721}) > at ../../../i386/i386/trap.c:580 > #9 0xc0684ec8 in calltrap () at {standard input}:94 > #10 0xc0530a98 in panic ( > fmt=0xc06e5bd4 "kmem_malloc(%ld): kmem_map too small: %ld total > allocated") > at ../../../kern/kern_shutdown.c:534 > #11 0xc064f7e0 in kmem_malloc (map=0xc10330a0, size=4096, flags=258) > at ../../../vm/vm_kern.c:340 > #12 0xc0660197 in page_alloc (zone=0xc77b58c0, bytes=0, pflag=0x0, wait=0) > at ../../../vm/uma_core.c:842 > #13 0xc065fed1 in slab_zalloc (zone=0xc77b58c0, wait=258) > at ../../../vm/uma_core.c:750 > #14 0xc0660faf in uma_zone_slab (zone=0xc77b58c0, flags=2) > at ../../../vm/uma_core.c:1529 > #15 0xc06611df in uma_zalloc_bucket (zone=0xc77b58c0, flags=2) > at ../../../vm/uma_core.c:1625 > #16 0xc0660e6e in uma_zalloc_arg (zone=0xc77b58c0, udata=0x0, flags=2) > at ../../../vm/uma_core.c:1459 > #17 0xc063807f in ffs_vget (mp=0xc77aec00, ino=7140126, flags=2, > vpp=0xe98aaa4c) at ../../../vm/uma.h:234 > #18 0xc063fe86 in ufs_lookup (ap=0xe98aab10) > at ../../../ufs/ufs/ufs_lookup.c:603 > #19 0xc0646b38 in ufs_vnoperate (ap=0x0) at ../../../ufs/ufs/ufs_vnops.c:2793 > #20 0xc057da46 in vfs_cache_lookup (ap=0x0) at vnode_if.h:82 > #21 0xc0646b38 in ufs_vnoperate (ap=0x0) at ../../../ufs/ufs/ufs_vnops.c:2793 > #22 0xc0582a6a in lookup (ndp=0xe98aac28) at vnode_if.h:52 > #23 0xc0582495 in namei (ndp=0xe98aac28) at ../../../kern/vfs_lookup.c:183 > #24 0xc058f4b2 in lstat (td=0xc7a67690, uap=0xe98aad14) > at ../../../kern/vfs_syscalls.c:2036 > #25 0xc06989e2 in syscall (frame= > {tf_fs = 47, tf_es = 47, tf_ds = 47, tf_edi = 134862080, tf_esi = > 13486215---Type to continue, or q to quit--- > 2, tf_ebp = -1077942088, tf_isp = -376787596, tf_ebx = 672371564, tf_edx = > 134598656, tf_ecx = 0, tf_eax = 190, tf_trapno = 0, tf_err = 2, tf_eip = > 671869903, tf_cs = 31, tf_eflags = 582, tf_esp = -1077942244, tf_ss = 47}) > at ../../../i386/i386/trap.c:1010 > #26 0xc0684f1d in Xint0x80_syscall () at {standard input}:136 > ---Can't read userspace from dump, or kernel process--- > > (kgdb) up 11 > #11 0xc064f7e0 in kmem_malloc (map=0xc10330a0, size=4096, flags=258) at > ../../../vm/vm_kern.c:340 > 340 panic("kmem_malloc(%ld): kmem_map too small: > %ld total allocated", > > (kgdb) l > 335 printf("Consider increasing > NMBCLUSTERS\n"); > 336 } > 337 return (0); > 338 } > 339 if ((flags & M_NOWAIT) == 0) > 340 panic("kmem_malloc(%ld): kmem_map too small: > %ld total allocated", > 341 (long)size, (long)map->size); > 342 return (0); > 343 } > 344 offset = addr - VM_MIN_KERNEL_ADDRESS; > > Machine dmesg is as follows: > > Copyright (c) 1992-2004 The FreeBSD Project. > Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 > The Regents of the University of California. All rights reserved. > FreeBSD 5.2-CURRENT #3: Sat Jan 17 16:15:10 GMT 2004 > pa@xenon.talbot.lan:/usr/src/sys/i386/compile/XENON > Preloaded elf kernel "/boot/kernel/kernel" at 0xc087a000. > Preloaded elf module "/boot/kernel/acpi.ko" at 0xc087a294. > Timecounter "i8254" frequency 1193182 Hz quality 0 > CPU: AMD Athlon(tm) MP 2000+ (1666.74-MHz 686-class CPU) > Origin = "AuthenticAMD" Id = 0x662 Stepping = 2 > > Features=0x383fbff OV,PAT,PSE36,MMX,FXSR,SSE> > AMD Features=0xc0480000 > real memory = 2146959360 (2047 MB) > avail memory = 2095476736 (1998 MB) > ACPI APIC Table: > FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs > cpu0 (BSP): APIC ID: 1 > cpu1 (AP): APIC ID: 0 > ioapic0 irqs 0-23 on motherboard > Pentium Pro MTRR support enabled > npx0: [FAST] > npx0: on motherboard > npx0: INT 16 interface > acpi0: on motherboard > pcibios: BIOS version 2.10 > acpi0: Power Button (fixed) > acpi0: Sleep Button (fixed) > Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000 > acpi_timer0: <24-bit timer at 3.579545MHz> port 0x8008-0x800b on acpi0 > acpi_cpu0: port 0x530-0x537 on acpi0 > acpi_cpu1: port 0x530-0x537 on acpi0 > acpi_button0: on acpi0 > pcib0: port 0x8080-0x80ff,0x8000-0x807f,0xcf8-0xcff > iomem > 0xd8000-0xdbfff on acpi0 > pci0: on pcib0 > agp0: port 0x1010-0x1013 mem > 0xf1300000-0xf1300fff, > 0xf4000000-0xf7ffffff at device 0.0 on pci0 > pcib1: at device 1.0 on pci0 > pci1: on pcib1 > pci1: at device 5.0 (no driver attached) > isab0: at device 7.0 on pci0 > isa0: on isab0 > atapci0: port 0xf000-0xf00f at device 7.1 on pci0 > ata0: at 0x1f0 irq 14 on atapci0 > ata0: [MPSAFE] > ata1: at 0x170 irq 15 on atapci0 > ata1: [MPSAFE] > pci0: at device 7.3 (no driver attached) > pcib2: at device 9.0 on pci0 > pci2: on pcib2 > asr0: mem 0xf8000000-0xfbffffff irq 21 at device > 9.1 on pci0 > asr0: major=154 > asr0: ADAPTEC 2400A FW Rev. 370L, 4 channel, 256 CCBs, Protocol I2O > pcib3: at device 16.0 on pci0 > pci3: on pcib3 > pci3: at device 0.0 (no driver attached) > atapci1: port > 0x2480-0x248f,0x2490-0x2493, > 0x2498-0x249f,0x2494-0x2497,0x24a0-0x24a7 mem 0xf1000000-0xf1003fff irq 16 at > device 4.0 on pci3 > atapci1: [MPSAFE] > ata2: at 0x24a0 on atapci1 > ata2: [MPSAFE] > ata3: at 0x2498 on atapci1 > ata3: [MPSAFE] > ahc0: port 0x2000-0x20ff mem > 0xf100 > 5000-0xf1005fff irq 17 at device 5.0 on pci3 > ahc0: Host Adapter Bios disabled. Using default SCSI device parameters > aic7850: Single Channel A, SCSI Id=7, 3/253 SCBs > pcm0: port 0x2400-0x243f irq 18 at device 6.0 on pci3 > fxp0: port 0x2440-0x247f mem > 0xf1020000-0xf103fff > f,0xf1006000-0xf1006fff irq 19 at device 7.0 on pci3 > fxp0: Ethernet address 00:02:b3:b4:4c:bb > miibus0: on fxp0 > inphy0: on miibus0 > inphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto > atkbdc0: port 0x64,0x60 irq 1 on acpi0 > atkbd0: flags 0x1 irq 1 on atkbdc0 > kbd0 at atkbd0 > sio0 port 0x3f8-0x3ff irq 4 on acpi0 > sio0: type 16550A > sio1 port 0x2f8-0x2ff irq 3 on acpi0 > sio1: type 16550A > ppc0 port 0x778-0x77f,0x378-0x37f irq 7 drq 3 on acpi0 > ppc0: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode > ppc0: FIFO with 16/16/9 bytes threshold > ppbus0: on ppc0 > lpt0: on ppbus0 > lpt0: Interrupt-driven port > fdc0: port > 0x3f7,0x3f0-0 > x3f5 irq 6 drq 2 on acpi0 > fdc0: FIFO enabled, 8 bytes threshold > fd0: <1440-KB 3.5" drive> on fdc0 drive 0 > orm0: