From owner-svn-src-stable@FreeBSD.ORG Tue Mar 15 08:21:00 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86C031065673; Tue, 15 Mar 2011 08:21:00 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 72EA58FC17; Tue, 15 Mar 2011 08:21:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2F8L0Mc026390; Tue, 15 Mar 2011 08:21:00 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2F8Kxex026359; Tue, 15 Mar 2011 08:20:59 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201103150820.p2F8Kxex026359@svn.freebsd.org> From: Sergey Kandaurov Date: Tue, 15 Mar 2011 08:20:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r219662 - in stable/8/sys: amd64/amd64 arm/at91 arm/mv arm/sa11x0 arm/xscale/i80321 arm/xscale/i8134x arm/xscale/ixp425 arm/xscale/pxa boot/common boot/forth i386/i386 i386/xen ia64/ia6... X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Mar 2011 08:21:00 -0000 Author: pluknet Date: Tue Mar 15 08:20:59 2011 New Revision: 219662 URL: http://svn.freebsd.org/changeset/base/219662 Log: MFC kern.msgbufsize: r217688-217689,r217709,r218666-218667,r218913. Note, that arm/{s3c2xx0,econa} exist only in head, thus not merged. r217688: Make MSGBUF_SIZE kernel option a loader tunable kern.msgbufsize. r217689: Add kern.msgbufsize default setting to /boot/defaults/loader.conf. r217709,218666-218667,218913 by marcel, cognet: Fix up for various arm subtargets: call init_param1() before we use msgbufsize, now that the size of the message buffer is a tunable. Reviewed by: marcel Approved by: avg (mentor) Modified: stable/8/sys/amd64/amd64/machdep.c stable/8/sys/arm/at91/at91_machdep.c stable/8/sys/arm/mv/mv_machdep.c stable/8/sys/arm/sa11x0/assabet_machdep.c stable/8/sys/arm/xscale/i80321/ep80219_machdep.c stable/8/sys/arm/xscale/i80321/iq31244_machdep.c stable/8/sys/arm/xscale/i8134x/crb_machdep.c stable/8/sys/arm/xscale/ixp425/avila_machdep.c stable/8/sys/arm/xscale/pxa/pxa_machdep.c stable/8/sys/boot/common/loader.8 stable/8/sys/boot/forth/loader.conf stable/8/sys/i386/i386/machdep.c stable/8/sys/i386/i386/pmap.c stable/8/sys/i386/xen/pmap.c stable/8/sys/ia64/ia64/machdep.c stable/8/sys/kern/subr_param.c stable/8/sys/mips/mips/machdep.c stable/8/sys/mips/mips/pmap.c stable/8/sys/pc98/pc98/machdep.c stable/8/sys/powerpc/aim/machdep.c stable/8/sys/powerpc/aim/mmu_oea.c stable/8/sys/powerpc/aim/mmu_oea64.c stable/8/sys/powerpc/booke/machdep.c stable/8/sys/powerpc/booke/pmap.c stable/8/sys/sparc64/sparc64/machdep.c stable/8/sys/sparc64/sparc64/pmap.c stable/8/sys/sun4v/sun4v/machdep.c stable/8/sys/sun4v/sun4v/pmap.c stable/8/sys/sys/msgbuf.h stable/8/sys/vm/vm_page.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/amd64/amd64/machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/machdep.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/amd64/amd64/machdep.c Tue Mar 15 08:20:59 2011 (r219662) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include "opt_isa.h" #include "opt_kstack_pages.h" #include "opt_maxmem.h" -#include "opt_msgbuf.h" #include "opt_perfmon.h" #include "opt_sched.h" #include "opt_kdtrace.h" @@ -1511,7 +1510,7 @@ do_next: * calculation, etc.). */ while (phys_avail[pa_indx - 1] + PAGE_SIZE + - round_page(MSGBUF_SIZE) >= phys_avail[pa_indx]) { + round_page(msgbufsize) >= phys_avail[pa_indx]) { physmem -= atop(phys_avail[pa_indx] - phys_avail[pa_indx - 1]); phys_avail[pa_indx--] = 0; phys_avail[pa_indx--] = 0; @@ -1520,7 +1519,7 @@ do_next: Maxmem = atop(phys_avail[pa_indx]); /* Trim off space for the message buffer. */ - phys_avail[pa_indx] -= round_page(MSGBUF_SIZE); + phys_avail[pa_indx] -= round_page(msgbufsize); /* Map the message buffer. */ msgbufp = (struct msgbuf *)PHYS_TO_DMAP(phys_avail[pa_indx]); @@ -1721,7 +1720,7 @@ hammer_time(u_int64_t modulep, u_int64_t /* now running on new page tables, configured,and u/iom is accessible */ - msgbufinit(msgbufp, MSGBUF_SIZE); + msgbufinit(msgbufp, msgbufsize); fpuinit(); /* transfer to user mode */ Modified: stable/8/sys/arm/at91/at91_machdep.c ============================================================================== --- stable/8/sys/arm/at91/at91_machdep.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/arm/at91/at91_machdep.c Tue Mar 15 08:20:59 2011 (r219662) @@ -43,8 +43,6 @@ * Created : 17/09/94 */ -#include "opt_msgbuf.h" - #include __FBSDID("$FreeBSD$"); @@ -230,6 +228,9 @@ initarm(void *arg, void *arg2) pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); + /* Do basic tuning, hz etc */ + init_param1(); + freemempos = (lastaddr + PAGE_MASK) & ~PAGE_MASK; /* Define a macro to simplify memory allocation */ #define valloc_pages(var, np) \ @@ -274,7 +275,7 @@ initarm(void *arg, void *arg2) valloc_pages(abtstack, ABT_STACK_SIZE); valloc_pages(undstack, UND_STACK_SIZE); valloc_pages(kernelstack, KSTACK_PAGES); - valloc_pages(msgbufpv, round_page(MSGBUF_SIZE) / PAGE_SIZE); + valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE); /* * Now we start construction of the L1 page table @@ -319,7 +320,7 @@ initarm(void *arg, void *arg2) pmap_map_chunk(l1pagetable, kernel_l1pt.pv_va, kernel_l1pt.pv_pa, L1_TABLE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE); pmap_map_chunk(l1pagetable, msgbufpv.pv_va, msgbufpv.pv_pa, - MSGBUF_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); + msgbufsize, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); for (loop = 0; loop < NUM_KERNEL_PTS; ++loop) { pmap_map_chunk(l1pagetable, kernel_pt_table[loop].pv_va, @@ -396,7 +397,7 @@ initarm(void *arg, void *arg2) KERNVIRTADDR + 3 * memsize, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; - msgbufinit(msgbufp, MSGBUF_SIZE); + msgbufinit(msgbufp, msgbufsize); mutex_init(); i = 0; @@ -408,8 +409,6 @@ initarm(void *arg, void *arg2) phys_avail[i++] = PHYSADDR + memsize; phys_avail[i++] = 0; phys_avail[i++] = 0; - /* Do basic tuning, hz etc */ - init_param1(); init_param2(physmem); kdb_init(); return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP - Modified: stable/8/sys/arm/mv/mv_machdep.c ============================================================================== --- stable/8/sys/arm/mv/mv_machdep.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/arm/mv/mv_machdep.c Tue Mar 15 08:20:59 2011 (r219662) @@ -35,7 +35,6 @@ * from: FreeBSD: //depot/projects/arm/src/sys/arm/at91/kb920x_machdep.c, rev 45 */ -#include "opt_msgbuf.h" #include "opt_ddb.h" #include @@ -491,7 +490,10 @@ initarm(void *mdp, void *unused __unused valloc_pages(abtstack, ABT_STACK_SIZE); valloc_pages(undstack, UND_STACK_SIZE); valloc_pages(kernelstack, KSTACK_PAGES); - valloc_pages(msgbufpv, round_page(MSGBUF_SIZE) / PAGE_SIZE); + + init_param1(); + + valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE); /* * Now we start construction of the L1 page table @@ -620,7 +622,7 @@ initarm(void *mdp, void *unused __unused pmap_bootstrap(freemempos, pmap_bootstrap_lastaddr, &kernel_l1pt); msgbufp = (void *)msgbufpv.pv_va; - msgbufinit(msgbufp, MSGBUF_SIZE); + msgbufinit(msgbufp, msgbufsize); mutex_init(); /* @@ -631,7 +633,6 @@ initarm(void *mdp, void *unused __unused physmap_init((mdp != NULL) ? 0 : 1); /* Do basic tuning, hz etc */ - init_param1(); init_param2(physmem); kdb_init(); return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP - Modified: stable/8/sys/arm/sa11x0/assabet_machdep.c ============================================================================== --- stable/8/sys/arm/sa11x0/assabet_machdep.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/arm/sa11x0/assabet_machdep.c Tue Mar 15 08:20:59 2011 (r219662) @@ -227,6 +227,9 @@ initarm(void *arg, void *arg2) pcpu_init(pc, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); + /* Do basic tuning, hz etc */ + init_param1(); + physical_start = (vm_offset_t) KERNBASE; physical_end = lastaddr; physical_freestart = (((vm_offset_t)physical_end) + PAGE_MASK) & ~PAGE_MASK; @@ -409,8 +412,6 @@ initarm(void *arg, void *arg2) mutex_init(); pmap_bootstrap(freemempos, 0xd0000000, &kernel_l1pt); - /* Do basic tuning, hz etc */ - init_param1(); init_param2(physmem); kdb_init(); return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP - Modified: stable/8/sys/arm/xscale/i80321/ep80219_machdep.c ============================================================================== --- stable/8/sys/arm/xscale/i80321/ep80219_machdep.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/arm/xscale/i80321/ep80219_machdep.c Tue Mar 15 08:20:59 2011 (r219662) @@ -45,8 +45,6 @@ * Created : 17/09/94 */ -#include "opt_msgbuf.h" - #include __FBSDID("$FreeBSD$"); @@ -212,6 +210,9 @@ initarm(void *arg, void *arg2) (var) = freemempos; \ memset((char *)(var), 0, ((np) * PAGE_SIZE)); + /* Do basic tuning, hz etc */ + init_param1(); + while (((freemempos - L1_TABLE_SIZE) & (L1_TABLE_SIZE - 1)) != 0) freemempos -= PAGE_SIZE; valloc_pages(kernel_l1pt, L1_TABLE_SIZE / PAGE_SIZE); @@ -247,7 +248,7 @@ initarm(void *arg, void *arg2) valloc_pages(undstack, UND_STACK_SIZE); valloc_pages(kernelstack, KSTACK_PAGES); alloc_pages(minidataclean.pv_pa, 1); - valloc_pages(msgbufpv, round_page(MSGBUF_SIZE) / PAGE_SIZE); + valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE); #ifdef ARM_USE_SMALL_ALLOC freemempos -= PAGE_SIZE; freemem_pt = trunc_page(freemem_pt); @@ -397,7 +398,7 @@ initarm(void *arg, void *arg2) pmap_bootstrap(pmap_curmaxkvaddr, 0xd0000000, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; - msgbufinit(msgbufp, MSGBUF_SIZE); + msgbufinit(msgbufp, msgbufsize); mutex_init(); i = 0; @@ -413,8 +414,6 @@ initarm(void *arg, void *arg2) phys_avail[i++] = 0; phys_avail[i] = 0; - /* Do basic tuning, hz etc */ - init_param1(); init_param2(physmem); kdb_init(); return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP - Modified: stable/8/sys/arm/xscale/i80321/iq31244_machdep.c ============================================================================== --- stable/8/sys/arm/xscale/i80321/iq31244_machdep.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/arm/xscale/i80321/iq31244_machdep.c Tue Mar 15 08:20:59 2011 (r219662) @@ -45,8 +45,6 @@ * Created : 17/09/94 */ -#include "opt_msgbuf.h" - #include __FBSDID("$FreeBSD$"); @@ -202,6 +200,9 @@ initarm(void *arg, void *arg2) pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); + /* Do basic tuning, hz etc */ + init_param1(); + freemempos = 0xa0200000; /* Define a macro to simplify memory allocation */ #define valloc_pages(var, np) \ @@ -247,7 +248,7 @@ initarm(void *arg, void *arg2) valloc_pages(undstack, UND_STACK_SIZE); valloc_pages(kernelstack, KSTACK_PAGES); alloc_pages(minidataclean.pv_pa, 1); - valloc_pages(msgbufpv, round_page(MSGBUF_SIZE) / PAGE_SIZE); + valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE); #ifdef ARM_USE_SMALL_ALLOC freemempos -= PAGE_SIZE; freemem_pt = trunc_page(freemem_pt); @@ -403,7 +404,7 @@ initarm(void *arg, void *arg2) pmap_bootstrap(pmap_curmaxkvaddr, 0xd0000000, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; - msgbufinit(msgbufp, MSGBUF_SIZE); + msgbufinit(msgbufp, msgbufsize); mutex_init(); i = 0; @@ -419,8 +420,6 @@ initarm(void *arg, void *arg2) phys_avail[i++] = 0; phys_avail[i] = 0; - /* Do basic tuning, hz etc */ - init_param1(); init_param2(physmem); kdb_init(); return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP - Modified: stable/8/sys/arm/xscale/i8134x/crb_machdep.c ============================================================================== --- stable/8/sys/arm/xscale/i8134x/crb_machdep.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/arm/xscale/i8134x/crb_machdep.c Tue Mar 15 08:20:59 2011 (r219662) @@ -45,8 +45,6 @@ * Created : 17/09/94 */ -#include "opt_msgbuf.h" - #include __FBSDID("$FreeBSD$"); @@ -242,7 +240,7 @@ initarm(void *arg, void *arg2) valloc_pages(abtstack, ABT_STACK_SIZE); valloc_pages(undstack, UND_STACK_SIZE); valloc_pages(kernelstack, KSTACK_PAGES); - valloc_pages(msgbufpv, round_page(MSGBUF_SIZE) / PAGE_SIZE); + valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE); #ifdef ARM_USE_SMALL_ALLOC freemempos -= PAGE_SIZE; freemem_pt = trunc_page(freemem_pt); @@ -375,7 +373,7 @@ initarm(void *arg, void *arg2) pmap_bootstrap(pmap_curmaxkvaddr, 0xd0000000, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; - msgbufinit(msgbufp, MSGBUF_SIZE); + msgbufinit(msgbufp, msgbufsize); mutex_init(); i = 0; Modified: stable/8/sys/arm/xscale/ixp425/avila_machdep.c ============================================================================== --- stable/8/sys/arm/xscale/ixp425/avila_machdep.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/arm/xscale/ixp425/avila_machdep.c Tue Mar 15 08:20:59 2011 (r219662) @@ -45,8 +45,6 @@ * Created : 17/09/94 */ -#include "opt_msgbuf.h" - #include __FBSDID("$FreeBSD$"); @@ -247,6 +245,9 @@ initarm(void *arg, void *arg2) pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); + /* Do basic tuning, hz etc */ + init_param1(); + /* * We allocate memory downwards from where we were loaded * by RedBoot; first the L1 page table, then NUM_KERNEL_PTS @@ -314,7 +315,7 @@ initarm(void *arg, void *arg2) valloc_pages(undstack, UND_STACK_SIZE); valloc_pages(kernelstack, KSTACK_PAGES); alloc_pages(minidataclean.pv_pa, 1); - valloc_pages(msgbufpv, round_page(MSGBUF_SIZE) / PAGE_SIZE); + valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE); #ifdef ARM_USE_SMALL_ALLOC freemempos -= PAGE_SIZE; freemem_pt = trunc_page(freemem_pt); @@ -460,7 +461,7 @@ initarm(void *arg, void *arg2) pmap_bootstrap(pmap_curmaxkvaddr, 0xd0000000, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; - msgbufinit(msgbufp, MSGBUF_SIZE); + msgbufinit(msgbufp, msgbufsize); mutex_init(); i = 0; @@ -476,8 +477,6 @@ initarm(void *arg, void *arg2) phys_avail[i++] = 0; phys_avail[i] = 0; - /* Do basic tuning, hz etc */ - init_param1(); init_param2(physmem); kdb_init(); Modified: stable/8/sys/arm/xscale/pxa/pxa_machdep.c ============================================================================== --- stable/8/sys/arm/xscale/pxa/pxa_machdep.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/arm/xscale/pxa/pxa_machdep.c Tue Mar 15 08:20:59 2011 (r219662) @@ -45,7 +45,6 @@ * Created : 17/09/94 */ -#include "opt_msgbuf.h" #include "opt_ddb.h" #include @@ -183,6 +182,9 @@ initarm(void *arg, void *arg2) pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); + /* Do basic tuning, hz etc */ + init_param1(); + freemempos = 0xa0200000; /* Define a macro to simplify memory allocation */ #define valloc_pages(var, np) \ @@ -229,7 +231,7 @@ initarm(void *arg, void *arg2) valloc_pages(undstack, UND_STACK_SIZE); valloc_pages(kernelstack, KSTACK_PAGES); alloc_pages(minidataclean.pv_pa, 1); - valloc_pages(msgbufpv, round_page(MSGBUF_SIZE) / PAGE_SIZE); + valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE); #ifdef ARM_USE_SMALL_ALLOC freemempos -= PAGE_SIZE; freemem_pt = trunc_page(freemem_pt); @@ -393,7 +395,7 @@ initarm(void *arg, void *arg2) dump_avail[i] = 0; pmap_bootstrap(pmap_curmaxkvaddr, 0xd0000000, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; - msgbufinit(msgbufp, MSGBUF_SIZE); + msgbufinit(msgbufp, msgbufsize); mutex_init(); i = 0; @@ -425,8 +427,6 @@ initarm(void *arg, void *arg2) phys_avail[0] = round_page(virtual_avail - KERNBASE + phys_avail[0]); #endif - /* Do basic tuning, hz etc */ - init_param1(); init_param2(physmem); kdb_init(); return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP - Modified: stable/8/sys/boot/common/loader.8 ============================================================================== --- stable/8/sys/boot/common/loader.8 Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/boot/common/loader.8 Tue Mar 15 08:20:59 2011 (r219662) @@ -615,6 +615,14 @@ Note that the NBUF parameter will override this limit. Modifies .Dv VM_BCACHE_SIZE_MAX . +.It Va kern.msgbufsize +Sets the size of the kernel message buffer. +The default limit of 64KB is usually sufficient unless +large amounts of trace data need to be collected +between opportunities to examine the buffer or +dump it to a file. +Overrides kernel option +.Dv MSGBUF_SIZE . .It Va machdep.disable_mtrrs Disable the use of i686 MTRRs (x86 only). .It Va net.inet.tcp.tcbhashsize Modified: stable/8/sys/boot/forth/loader.conf ============================================================================== --- stable/8/sys/boot/forth/loader.conf Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/boot/forth/loader.conf Tue Mar 15 08:20:59 2011 (r219662) @@ -99,6 +99,7 @@ module_path="/boot/modules" # Set the mo #kern.maxswzone="" # Set the max swmeta KVA storage #kern.maxtsiz="" # Set the max text size #kern.maxusers="32" # Set size of various static tables +#kern.msgbufsize="65536" # Set size of kernel message buffer #kern.nbuf="" # Set the number of buffer headers #kern.ncallout="" # Set the maximum # of timer events #kern.ngroups="1023" # Set the maximum # of supplemental groups Modified: stable/8/sys/i386/i386/machdep.c ============================================================================== --- stable/8/sys/i386/i386/machdep.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/i386/i386/machdep.c Tue Mar 15 08:20:59 2011 (r219662) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include "opt_isa.h" #include "opt_kstack_pages.h" #include "opt_maxmem.h" -#include "opt_msgbuf.h" #include "opt_npx.h" #include "opt_perfmon.h" #include "opt_xbox.h" @@ -2116,7 +2115,7 @@ getmemsize(int first) physmem = Maxmem; basemem = 0; physmap[0] = init_first << PAGE_SHIFT; - physmap[1] = ptoa(Maxmem) - round_page(MSGBUF_SIZE); + physmap[1] = ptoa(Maxmem) - round_page(msgbufsize); physmap_idx = 0; #else #ifdef XBOX @@ -2467,7 +2466,7 @@ do_next: * calculation, etc.). */ while (phys_avail[pa_indx - 1] + PAGE_SIZE + - round_page(MSGBUF_SIZE) >= phys_avail[pa_indx]) { + round_page(msgbufsize) >= phys_avail[pa_indx]) { physmem -= atop(phys_avail[pa_indx] - phys_avail[pa_indx - 1]); phys_avail[pa_indx--] = 0; phys_avail[pa_indx--] = 0; @@ -2476,10 +2475,10 @@ do_next: Maxmem = atop(phys_avail[pa_indx]); /* Trim off space for the message buffer. */ - phys_avail[pa_indx] -= round_page(MSGBUF_SIZE); + phys_avail[pa_indx] -= round_page(msgbufsize); /* Map the message buffer. */ - for (off = 0; off < round_page(MSGBUF_SIZE); off += PAGE_SIZE) + for (off = 0; off < round_page(msgbufsize); off += PAGE_SIZE) pmap_kenter((vm_offset_t)msgbufp + off, phys_avail[pa_indx] + off); @@ -2690,7 +2689,7 @@ init386(first) /* now running on new page tables, configured,and u/iom is accessible */ - msgbufinit(msgbufp, MSGBUF_SIZE); + msgbufinit(msgbufp, msgbufsize); /* transfer to user mode */ _ucodesel = GSEL(GUCODE_SEL, SEL_UPL); @@ -2951,7 +2950,7 @@ init386(first) /* now running on new page tables, configured,and u/iom is accessible */ - msgbufinit(msgbufp, MSGBUF_SIZE); + msgbufinit(msgbufp, msgbufsize); /* make a call gate to reenter kernel with */ gdp = &ldt[LSYS5CALLS_SEL].gd; Modified: stable/8/sys/i386/i386/pmap.c ============================================================================== --- stable/8/sys/i386/i386/pmap.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/i386/i386/pmap.c Tue Mar 15 08:20:59 2011 (r219662) @@ -105,7 +105,6 @@ __FBSDID("$FreeBSD$"); #include "opt_cpu.h" #include "opt_pmap.h" -#include "opt_msgbuf.h" #include "opt_smp.h" #include "opt_xbox.h" @@ -452,7 +451,7 @@ pmap_bootstrap(vm_paddr_t firstaddr) /* * msgbufp is used to map the system message buffer. */ - SYSMAP(struct msgbuf *, unused, msgbufp, atop(round_page(MSGBUF_SIZE))) + SYSMAP(struct msgbuf *, unused, msgbufp, atop(round_page(msgbufsize))) /* * KPTmap is used by pmap_kextract(). Modified: stable/8/sys/i386/xen/pmap.c ============================================================================== --- stable/8/sys/i386/xen/pmap.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/i386/xen/pmap.c Tue Mar 15 08:20:59 2011 (r219662) @@ -107,7 +107,6 @@ __FBSDID("$FreeBSD$"); #include "opt_cpu.h" #include "opt_pmap.h" -#include "opt_msgbuf.h" #include "opt_smp.h" #include "opt_xbox.h" @@ -470,7 +469,7 @@ pmap_bootstrap(vm_paddr_t firstaddr) /* * msgbufp is used to map the system message buffer. */ - SYSMAP(struct msgbuf *, unused, msgbufp, atop(round_page(MSGBUF_SIZE))) + SYSMAP(struct msgbuf *, unused, msgbufp, atop(round_page(msgbufsize))) /* * ptemap is used for pmap_pte_quick Modified: stable/8/sys/ia64/ia64/machdep.c ============================================================================== --- stable/8/sys/ia64/ia64/machdep.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/ia64/ia64/machdep.c Tue Mar 15 08:20:59 2011 (r219662) @@ -31,7 +31,6 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" #include "opt_ddb.h" #include "opt_kstack_pages.h" -#include "opt_msgbuf.h" #include "opt_sched.h" #include @@ -888,8 +887,8 @@ ia64_init(void) /* * Initialize error message buffer (at end of core). */ - msgbufp = (struct msgbuf *)pmap_steal_memory(MSGBUF_SIZE); - msgbufinit(msgbufp, MSGBUF_SIZE); + msgbufp = (struct msgbuf *)pmap_steal_memory(msgbufsize); + msgbufinit(msgbufp, msgbufsize); proc_linkup0(&proc0, &thread0); /* Modified: stable/8/sys/kern/subr_param.c ============================================================================== --- stable/8/sys/kern/subr_param.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/kern/subr_param.c Tue Mar 15 08:20:59 2011 (r219662) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include "opt_param.h" +#include "opt_msgbuf.h" #include "opt_maxusers.h" #include @@ -45,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -83,6 +85,7 @@ int maxproc; /* maximum # of processes int maxprocperuid; /* max # of procs per user */ int maxfiles; /* sys. wide open files limit */ int maxfilesperproc; /* per-proc open files limit */ +int msgbufsize; /* size of kernel message buffer */ int ncallout; /* maximum # of timer events */ int nbuf; int ngroups_max; /* max # groups per process */ @@ -106,6 +109,8 @@ SYSCTL_INT(_kern, OID_AUTO, nbuf, CTLFLA "Number of buffers in the buffer cache"); SYSCTL_INT(_kern, OID_AUTO, nswbuf, CTLFLAG_RDTUN, &nswbuf, 0, "Number of swap buffers"); +SYSCTL_INT(_kern, OID_AUTO, msgbufsize, CTLFLAG_RDTUN, &msgbufsize, 0, + "Size of the kernel message buffer"); SYSCTL_LONG(_kern, OID_AUTO, maxswzone, CTLFLAG_RDTUN, &maxswzone, 0, "Maximum memory for swap metadata"); SYSCTL_LONG(_kern, OID_AUTO, maxbcache, CTLFLAG_RDTUN, &maxbcache, 0, @@ -218,6 +223,8 @@ init_param1(void) maxbcache = VM_BCACHE_SIZE_MAX; #endif TUNABLE_LONG_FETCH("kern.maxbcache", &maxbcache); + msgbufsize = MSGBUF_SIZE; + TUNABLE_INT_FETCH("kern.msgbufsize", &msgbufsize); maxtsiz = MAXTSIZ; TUNABLE_ULONG_FETCH("kern.maxtsiz", &maxtsiz); Modified: stable/8/sys/mips/mips/machdep.c ============================================================================== --- stable/8/sys/mips/mips/machdep.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/mips/mips/machdep.c Tue Mar 15 08:20:59 2011 (r219662) @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include "opt_cputype.h" #include "opt_ddb.h" #include "opt_md.h" -#include "opt_msgbuf.h" #include #include Modified: stable/8/sys/mips/mips/pmap.c ============================================================================== --- stable/8/sys/mips/mips/pmap.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/mips/mips/pmap.c Tue Mar 15 08:20:59 2011 (r219662) @@ -68,7 +68,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_msgbuf.h" #include "opt_ddb.h" #include @@ -553,8 +552,8 @@ again: /* * Steal the message buffer from the beginning of memory. */ - msgbufp = (struct msgbuf *)pmap_steal_memory(MSGBUF_SIZE); - msgbufinit(msgbufp, MSGBUF_SIZE); + msgbufp = (struct msgbuf *)pmap_steal_memory(msgbufsize); + msgbufinit(msgbufp, msgbufsize); /* * Steal thread0 kstack. Modified: stable/8/sys/pc98/pc98/machdep.c ============================================================================== --- stable/8/sys/pc98/pc98/machdep.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/pc98/pc98/machdep.c Tue Mar 15 08:20:59 2011 (r219662) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include "opt_isa.h" #include "opt_kstack_pages.h" #include "opt_maxmem.h" -#include "opt_msgbuf.h" #include "opt_npx.h" #include "opt_perfmon.h" @@ -2055,7 +2054,7 @@ do_next: * calculation, etc.). */ while (phys_avail[pa_indx - 1] + PAGE_SIZE + - round_page(MSGBUF_SIZE) >= phys_avail[pa_indx]) { + round_page(msgbufsize) >= phys_avail[pa_indx]) { physmem -= atop(phys_avail[pa_indx] - phys_avail[pa_indx - 1]); phys_avail[pa_indx--] = 0; phys_avail[pa_indx--] = 0; @@ -2064,10 +2063,10 @@ do_next: Maxmem = atop(phys_avail[pa_indx]); /* Trim off space for the message buffer. */ - phys_avail[pa_indx] -= round_page(MSGBUF_SIZE); + phys_avail[pa_indx] -= round_page(msgbufsize); /* Map the message buffer. */ - for (off = 0; off < round_page(MSGBUF_SIZE); off += PAGE_SIZE) + for (off = 0; off < round_page(msgbufsize); off += PAGE_SIZE) pmap_kenter((vm_offset_t)msgbufp + off, phys_avail[pa_indx] + off); } @@ -2282,7 +2281,7 @@ init386(first) /* now running on new page tables, configured,and u/iom is accessible */ - msgbufinit(msgbufp, MSGBUF_SIZE); + msgbufinit(msgbufp, msgbufsize); /* make a call gate to reenter kernel with */ gdp = &ldt[LSYS5CALLS_SEL].gd; Modified: stable/8/sys/powerpc/aim/machdep.c ============================================================================== --- stable/8/sys/powerpc/aim/machdep.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/powerpc/aim/machdep.c Tue Mar 15 08:20:59 2011 (r219662) @@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" #include "opt_ddb.h" #include "opt_kstack_pages.h" -#include "opt_msgbuf.h" #include #include @@ -516,7 +515,7 @@ powerpc_init(u_int startkernel, u_int en pc->pc_curpcb = thread0.td_pcb; /* Initialise the message buffer. */ - msgbufinit(msgbufp, MSGBUF_SIZE); + msgbufinit(msgbufp, msgbufsize); #ifdef KDB if (boothowto & RB_KDB) Modified: stable/8/sys/powerpc/aim/mmu_oea.c ============================================================================== --- stable/8/sys/powerpc/aim/mmu_oea.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/powerpc/aim/mmu_oea.c Tue Mar 15 08:20:59 2011 (r219662) @@ -961,10 +961,10 @@ moea_bootstrap(mmu_t mmup, vm_offset_t k /* * Allocate virtual address space for the message buffer. */ - pa = msgbuf_phys = moea_bootstrap_alloc(MSGBUF_SIZE, PAGE_SIZE); + pa = msgbuf_phys = moea_bootstrap_alloc(msgbufsize, PAGE_SIZE); msgbufp = (struct msgbuf *)virtual_avail; va = virtual_avail; - virtual_avail += round_page(MSGBUF_SIZE); + virtual_avail += round_page(msgbufsize); while (va < virtual_avail) { moea_kenter(mmup, va, pa); pa += PAGE_SIZE; Modified: stable/8/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- stable/8/sys/powerpc/aim/mmu_oea64.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/powerpc/aim/mmu_oea64.c Tue Mar 15 08:20:59 2011 (r219662) @@ -1018,10 +1018,10 @@ moea64_bridge_bootstrap(mmu_t mmup, vm_o /* * Allocate virtual address space for the message buffer. */ - pa = msgbuf_phys = moea64_bootstrap_alloc(MSGBUF_SIZE, PAGE_SIZE); + pa = msgbuf_phys = moea64_bootstrap_alloc(msgbufsize, PAGE_SIZE); msgbufp = (struct msgbuf *)virtual_avail; va = virtual_avail; - virtual_avail += round_page(MSGBUF_SIZE); + virtual_avail += round_page(msgbufsize); while (va < virtual_avail) { moea64_kenter(mmup, va, pa); pa += PAGE_SIZE; Modified: stable/8/sys/powerpc/booke/machdep.c ============================================================================== --- stable/8/sys/powerpc/booke/machdep.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/powerpc/booke/machdep.c Tue Mar 15 08:20:59 2011 (r219662) @@ -84,7 +84,6 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" #include "opt_ddb.h" #include "opt_kstack_pages.h" -#include "opt_msgbuf.h" #include #include @@ -450,7 +449,7 @@ e500_init(u_int32_t startkernel, u_int32 pc->pc_curpcb = thread0.td_pcb; /* Initialise the message buffer. */ - msgbufinit(msgbufp, MSGBUF_SIZE); + msgbufinit(msgbufp, msgbufsize); /* Enable Machine Check interrupt. */ mtmsr(mfmsr() | PSL_ME); Modified: stable/8/sys/powerpc/booke/pmap.c ============================================================================== --- stable/8/sys/powerpc/booke/pmap.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/powerpc/booke/pmap.c Tue Mar 15 08:20:59 2011 (r219662) @@ -984,7 +984,7 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset /* Allocate space for the message buffer. */ msgbufp = (struct msgbuf *)data_end; - data_end += MSGBUF_SIZE; + data_end += msgbufsize; debugf(" msgbufp at 0x%08x end = 0x%08x\n", (uint32_t)msgbufp, data_end); Modified: stable/8/sys/sparc64/sparc64/machdep.c ============================================================================== --- stable/8/sys/sparc64/sparc64/machdep.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/sparc64/sparc64/machdep.c Tue Mar 15 08:20:59 2011 (r219662) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" #include "opt_ddb.h" #include "opt_kstack_pages.h" -#include "opt_msgbuf.h" #include #include @@ -581,7 +580,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l * buffer (after setting the trap table). */ dpcpu_init(dpcpu0, 0); - msgbufinit(msgbufp, MSGBUF_SIZE); + msgbufinit(msgbufp, msgbufsize); /* * Initialize mutexes. Modified: stable/8/sys/sparc64/sparc64/pmap.c ============================================================================== --- stable/8/sys/sparc64/sparc64/pmap.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/sparc64/sparc64/pmap.c Tue Mar 15 08:20:59 2011 (r219662) @@ -66,7 +66,6 @@ __FBSDID("$FreeBSD$"); */ #include "opt_kstack_pages.h" -#include "opt_msgbuf.h" #include "opt_pmap.h" #include @@ -399,7 +398,7 @@ pmap_bootstrap(u_int cpu_impl) /* * Allocate and map the message buffer. */ - pa = pmap_bootstrap_alloc(MSGBUF_SIZE, colors); + pa = pmap_bootstrap_alloc(msgbufsize, colors); msgbufp = (struct msgbuf *)TLB_PHYS_TO_DIRECT(pa); /* Modified: stable/8/sys/sun4v/sun4v/machdep.c ============================================================================== --- stable/8/sys/sun4v/sun4v/machdep.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/sun4v/sun4v/machdep.c Tue Mar 15 08:20:59 2011 (r219662) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include "opt_compat.h" #include "opt_ddb.h" #include "opt_kstack_pages.h" -#include "opt_msgbuf.h" #include #include @@ -503,7 +502,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l */ BVPRINTF("initialize msgbuf\n"); dpcpu_init(dpcpu0, 0); - msgbufinit(msgbufp, MSGBUF_SIZE); + msgbufinit(msgbufp, msgbufsize); BVPRINTF("initialize mutexes\n"); mutex_init(); Modified: stable/8/sys/sun4v/sun4v/pmap.c ============================================================================== --- stable/8/sys/sun4v/sun4v/pmap.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/sun4v/sun4v/pmap.c Tue Mar 15 08:20:59 2011 (r219662) @@ -29,7 +29,6 @@ __FBSDID("$FreeBSD$"); #include "opt_kstack_pages.h" -#include "opt_msgbuf.h" #include "opt_pmap.h" #include "opt_trap_trace.h" @@ -779,7 +778,7 @@ skipshuffle: /* * Allocate and map the message buffer. */ - msgbuf_phys = pmap_bootstrap_alloc(MSGBUF_SIZE); + msgbuf_phys = pmap_bootstrap_alloc(msgbufsize); msgbufp = (struct msgbuf *)TLB_PHYS_TO_DIRECT(msgbuf_phys); /* Modified: stable/8/sys/sys/msgbuf.h ============================================================================== --- stable/8/sys/sys/msgbuf.h Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/sys/msgbuf.h Tue Mar 15 08:20:59 2011 (r219662) @@ -52,6 +52,7 @@ struct msgbuf { #define MSGBUF_SEQSUB(mbp, seq1, seq2) (MSGBUF_SEQNORM((mbp), (seq1) - (seq2))) #ifdef _KERNEL +extern int msgbufsize; extern int msgbuftrigger; extern struct msgbuf *msgbufp; Modified: stable/8/sys/vm/vm_page.c ============================================================================== --- stable/8/sys/vm/vm_page.c Tue Mar 15 07:15:46 2011 (r219661) +++ stable/8/sys/vm/vm_page.c Tue Mar 15 08:20:59 2011 (r219662) @@ -100,7 +100,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_msgbuf.h" #include "opt_vm.h" #include @@ -322,7 +321,7 @@ vm_page_startup(vm_offset_t vaddr) * through the direct map, they are not automatically included. */ pa = DMAP_TO_PHYS((vm_offset_t)msgbufp->msg_ptr); - last_pa = pa + round_page(MSGBUF_SIZE); + last_pa = pa + round_page(msgbufsize); while (pa < last_pa) { dump_add_page(pa); pa += PAGE_SIZE;