Re: svn commit: r251709 - head/sys/vm
On Sat, 15 Jun 2013 11:35:03 +0100 Andrew Turner and...@fubar.geek.nz wrote: On Thu, 13 Jun 2013 21:05:38 + (UTC) Jeff Roberson j...@freebsd.org wrote: Author: jeff Date: Thu Jun 13 21:05:38 2013 New Revision: 251709 URL: http://svnweb.freebsd.org/changeset/base/251709 Log: - Convert the slab free item list from a linked array of indices to a bitmap using sys/bitset. This is much simpler, has lower space overhead and is cheaper in most cases. - Use a second bitmap for invariants asserts and improve the quality of the asserts as well as the number of erroneous conditions that we will catch. - Drastically simplify sizing code. Special case refcnt zones since they will be going away. - Update stale comments. This broke booting for my on the Raspberry Pi for me. If I revert just this change the board boots as expected. Kernel output from the boot failure follows. As Andrew pointed out some time ago, this broke armv6 with: panic: lock vm map (user) 0xc09cc050 already initialized I put in some debug printfs and verified that this is actually the first time that vm_map_zinit is called. So I don't think the lock is actually being re-initialized; rather I think it's a problem with uninitialized memory. The following seems to fix it for me: Index: sys/vm/vm_map.c === --- sys/vm/vm_map.c (revision 253514) +++ sys/vm/vm_map.c (working copy) @@ -239,8 +239,7 @@ vm_map_t map; map = (vm_map_t)mem; - map-nentries = 0; - map-size = 0; + memset(map, 0, sizeof(*map)); mtx_init(map-system_mtx, vm map (system), NULL, MTX_DEF | MTX_DUPOK); sx_init(map-lock, vm map (user)); return (0); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r251709 - head/sys/vm
On Sat, 15 Jun 2013 11:35:03 +0100 Andrew Turner and...@fubar.geek.nz wrote: On Thu, 13 Jun 2013 21:05:38 + (UTC) Jeff Roberson j...@freebsd.org wrote: Author: jeff Date: Thu Jun 13 21:05:38 2013 New Revision: 251709 URL: http://svnweb.freebsd.org/changeset/base/251709 Log: - Convert the slab free item list from a linked array of indices to a bitmap using sys/bitset. This is much simpler, has lower space overhead and is cheaper in most cases. - Use a second bitmap for invariants asserts and improve the quality of the asserts as well as the number of erroneous conditions that we will catch. - Drastically simplify sizing code. Special case refcnt zones since they will be going away. - Update stale comments. This broke booting for my on the Raspberry Pi for me. If I revert just this change the board boots as expected. Kernel output from the boot failure follows. This is still a problem. Is there anything I can look into to get the board to boot with your UMA changes? Andrew KDB: debugger backends: ddb KDB: current backend: ddb Copyright (c) 1992-2013 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 is a registered trademark of The FreeBSD Foundation. FreeBSD 10.0-CURRENT #40 r251712:251749M: Fri Jun 14 17:33:49 BST 2013 andrew@bender:/usr/obj/arm.armv6/usr/home/andrew/freebsd/repo/head/sys/RPI-B arm FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610 panic: lock vm map (user) 0xc05c1050 already initialized KDB: enter: panic [ thread pid 0 tid 0 ] Stopped at 0xc0261894: ldrbr15, [r15, r15, ror r15]! db ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
Re: svn commit: r251709 - head/sys/vm
On Thu, 13 Jun 2013 21:05:38 + (UTC) Jeff Roberson j...@freebsd.org wrote: Author: jeff Date: Thu Jun 13 21:05:38 2013 New Revision: 251709 URL: http://svnweb.freebsd.org/changeset/base/251709 Log: - Convert the slab free item list from a linked array of indices to a bitmap using sys/bitset. This is much simpler, has lower space overhead and is cheaper in most cases. - Use a second bitmap for invariants asserts and improve the quality of the asserts as well as the number of erroneous conditions that we will catch. - Drastically simplify sizing code. Special case refcnt zones since they will be going away. - Update stale comments. This broke booting for my on the Raspberry Pi for me. If I revert just this change the board boots as expected. Kernel output from the boot failure follows. Andrew KDB: debugger backends: ddb KDB: current backend: ddb Copyright (c) 1992-2013 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 is a registered trademark of The FreeBSD Foundation. FreeBSD 10.0-CURRENT #40 r251712:251749M: Fri Jun 14 17:33:49 BST 2013 andrew@bender:/usr/obj/arm.armv6/usr/home/andrew/freebsd/repo/head/sys/RPI-B arm FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610 panic: lock vm map (user) 0xc05c1050 already initialized KDB: enter: panic [ thread pid 0 tid 0 ] Stopped at 0xc0261894: ldrbr15, [r15, r15, ror r15]! db ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org
svn commit: r251709 - head/sys/vm
Author: jeff Date: Thu Jun 13 21:05:38 2013 New Revision: 251709 URL: http://svnweb.freebsd.org/changeset/base/251709 Log: - Convert the slab free item list from a linked array of indices to a bitmap using sys/bitset. This is much simpler, has lower space overhead and is cheaper in most cases. - Use a second bitmap for invariants asserts and improve the quality of the asserts as well as the number of erroneous conditions that we will catch. - Drastically simplify sizing code. Special case refcnt zones since they will be going away. - Update stale comments. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/vm/uma_core.c head/sys/vm/uma_dbg.c head/sys/vm/uma_int.h Modified: head/sys/vm/uma_core.c == --- head/sys/vm/uma_core.c Thu Jun 13 21:03:23 2013(r251708) +++ head/sys/vm/uma_core.c Thu Jun 13 21:05:38 2013(r251709) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2002-2005, 2009 Jeffrey Roberson j...@freebsd.org + * Copyright (c) 2002-2005, 2009, 2013 Jeffrey Roberson j...@freebsd.org * Copyright (c) 2004, 2005 Bosko Milekic bmile...@freebsd.org * Copyright (c) 2004-2006 Robert N. M. Watson * All rights reserved. @@ -63,6 +63,7 @@ __FBSDID($FreeBSD$); #include sys/param.h #include sys/systm.h +#include sys/bitset.h #include sys/kernel.h #include sys/types.h #include sys/queue.h @@ -145,8 +146,13 @@ static int booted = 0; #defineUMA_STARTUP22 /* Maximum number of allowed items-per-slab if the slab header is OFFPAGE */ -static u_int uma_max_ipers; -static u_int uma_max_ipers_ref; +static const u_int uma_max_ipers = SLAB_SETSIZE; + +/* + * Only mbuf clusters use ref zones. Just provide enough references + * to support the one user. New code should not use the ref facility. + */ +static const u_int uma_max_ipers_ref = PAGE_SIZE / MCLBYTES; /* * This is the handle used to schedule events that need to happen @@ -208,7 +214,7 @@ static uint8_t bucket_size[BUCKET_ZONES] /* * Flags and enumerations to be passed to internal functions. */ -enum zfreeskip { SKIP_NONE, SKIP_DTOR, SKIP_FINI }; +enum zfreeskip { SKIP_NONE = 0, SKIP_DTOR, SKIP_FINI }; #defineZFREE_STATFAIL 0x0001 /* Update zone failure statistic. */ #defineZFREE_STATFREE 0x0002 /* Update zone free statistic. */ @@ -885,18 +891,15 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t slab-us_keg = keg; slab-us_data = mem; slab-us_freecount = keg-uk_ipers; - slab-us_firstfree = 0; slab-us_flags = flags; - + BIT_FILL(SLAB_SETSIZE, slab-us_free); +#ifdef INVARIANTS + BIT_ZERO(SLAB_SETSIZE, slab-us_debugfree); +#endif if (keg-uk_flags UMA_ZONE_REFCNT) { slabref = (uma_slabrefcnt_t)slab; - for (i = 0; i keg-uk_ipers; i++) { - slabref-us_freelist[i].us_refcnt = 0; - slabref-us_freelist[i].us_item = i+1; - } - } else { for (i = 0; i keg-uk_ipers; i++) - slab-us_freelist[i].us_item = i+1; + slabref-us_refcnt[i] = 0; } if (keg-uk_init != NULL) { @@ -1148,31 +1151,32 @@ keg_small_init(uma_keg_t keg) keg-uk_ppera = 1; } + /* +* Calculate the size of each allocation (rsize) according to +* alignment. If the requested size is smaller than we have +* allocation bits for we round it up. +*/ rsize = keg-uk_size; - + if (rsize keg-uk_slabsize / SLAB_SETSIZE) + rsize = keg-uk_slabsize / SLAB_SETSIZE; if (rsize keg-uk_align) rsize = (rsize ~keg-uk_align) + (keg-uk_align + 1); - if (rsize keg-uk_slabsize / 256) - rsize = keg-uk_slabsize / 256; - keg-uk_rsize = rsize; KASSERT((keg-uk_flags UMA_ZONE_PCPU) == 0 || keg-uk_rsize sizeof(struct pcpu), (%s: size %u too large, __func__, keg-uk_rsize)); - if (keg-uk_flags UMA_ZONE_OFFPAGE) { + if (keg-uk_flags UMA_ZONE_REFCNT) + rsize += sizeof(uint32_t); + + if (keg-uk_flags UMA_ZONE_OFFPAGE) shsize = 0; - } else if (keg-uk_flags UMA_ZONE_REFCNT) { - rsize += UMA_FRITMREF_SZ; /* linkage refcnt */ - shsize = sizeof(struct uma_slab_refcnt); - } else { - rsize += UMA_FRITM_SZ; /* Account for linkage */ + else shsize = sizeof(struct uma_slab); - } keg-uk_ipers = (keg-uk_slabsize - shsize) / rsize; - KASSERT(keg-uk_ipers 0 keg-uk_ipers = 256, + KASSERT(keg-uk_ipers 0 keg-uk_ipers = SLAB_SETSIZE, (%s: keg-uk_ipers %u, __func__, keg-uk_ipers)); memused = keg-uk_ipers * rsize + shsize; @@ -1189,10 +1193,18 @@