Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Jan 2011 10:26:26 +0000 (UTC)
From:      Sergey Kandaurov <pluknet@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r217688 - in head/sys: amd64/amd64 arm/at91 arm/econa arm/mv arm/s3c2xx0 arm/xscale/i80321 arm/xscale/i8134x arm/xscale/ixp425 arm/xscale/pxa boot/common boot/forth i386/i386 i386/xen i...
Message-ID:  <201101211026.p0LAQQRo047220@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pluknet
Date: Fri Jan 21 10:26:26 2011
New Revision: 217688
URL: http://svn.freebsd.org/changeset/base/217688

Log:
  Make MSGBUF_SIZE kernel option a loader tunable kern.msgbufsize.
  
  Submitted by:	perryh pluto.rain.com (previous version)
  Reviewed by:	jhb
  Approved by:	kib (mentor)
  Tested by:	universe

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/arm/at91/at91_machdep.c
  head/sys/arm/econa/econa_machdep.c
  head/sys/arm/mv/mv_machdep.c
  head/sys/arm/s3c2xx0/s3c24x0_machdep.c
  head/sys/arm/xscale/i80321/ep80219_machdep.c
  head/sys/arm/xscale/i80321/iq31244_machdep.c
  head/sys/arm/xscale/i8134x/crb_machdep.c
  head/sys/arm/xscale/ixp425/avila_machdep.c
  head/sys/arm/xscale/pxa/pxa_machdep.c
  head/sys/boot/common/loader.8
  head/sys/boot/forth/loader.conf
  head/sys/i386/i386/machdep.c
  head/sys/i386/i386/pmap.c
  head/sys/i386/xen/pmap.c
  head/sys/ia64/ia64/machdep.c
  head/sys/kern/subr_param.c
  head/sys/mips/mips/machdep.c
  head/sys/mips/mips/pmap.c
  head/sys/pc98/pc98/machdep.c
  head/sys/powerpc/aim/machdep.c
  head/sys/powerpc/aim/mmu_oea.c
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/booke/machdep.c
  head/sys/powerpc/booke/pmap.c
  head/sys/sparc64/sparc64/machdep.c
  head/sys/sparc64/sparc64/pmap.c
  head/sys/sun4v/sun4v/machdep.c
  head/sys/sun4v/sun4v/pmap.c
  head/sys/sys/msgbuf.h
  head/sys/vm/vm_page.c

Modified: head/sys/amd64/amd64/machdep.c
==============================================================================
--- head/sys/amd64/amd64/machdep.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/amd64/amd64/machdep.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -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"
@@ -1504,7 +1503,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;
@@ -1513,7 +1512,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]);
@@ -1714,7 +1713,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: head/sys/arm/at91/at91_machdep.c
==============================================================================
--- head/sys/arm/at91/at91_machdep.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/arm/at91/at91_machdep.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -43,8 +43,6 @@
  * Created      : 17/09/94
  */
 
-#include "opt_msgbuf.h"
-
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
@@ -302,7 +300,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
@@ -347,7 +345,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,
@@ -430,7 +428,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;

Modified: head/sys/arm/econa/econa_machdep.c
==============================================================================
--- head/sys/arm/econa/econa_machdep.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/arm/econa/econa_machdep.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -35,8 +35,6 @@
  *
  */
 
-#include "opt_msgbuf.h"
-
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
@@ -251,7 +249,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
@@ -293,7 +291,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,
@@ -372,7 +370,7 @@ initarm(void *arg, void *arg2)
 	    &kernel_l1pt);
 
 	msgbufp = (void*)msgbufpv.pv_va;
-	msgbufinit(msgbufp, MSGBUF_SIZE);
+	msgbufinit(msgbufp, msgbufsize);
 
 	mutex_init();
 

Modified: head/sys/arm/mv/mv_machdep.c
==============================================================================
--- head/sys/arm/mv/mv_machdep.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/arm/mv/mv_machdep.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -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 "opt_platform.h"
 
@@ -427,7 +426,7 @@ 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);
+	valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE);
 
 	/*
 	 * Now we start construction of the L1 page table
@@ -575,7 +574,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();
 
 	/*

Modified: head/sys/arm/s3c2xx0/s3c24x0_machdep.c
==============================================================================
--- head/sys/arm/s3c2xx0/s3c24x0_machdep.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/arm/s3c2xx0/s3c24x0_machdep.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -43,7 +43,6 @@
  * Created      : 17/09/94
  */
 
-#include "opt_msgbuf.h"
 #include "opt_ddb.h"
 
 #include <sys/cdefs.h>
@@ -298,7 +297,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
 	 * We start by mapping the L2 page tables into the L1.
@@ -338,7 +337,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) {
@@ -429,7 +428,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();
 
 	physmem = memsize / PAGE_SIZE;

Modified: head/sys/arm/xscale/i80321/ep80219_machdep.c
==============================================================================
--- head/sys/arm/xscale/i80321/ep80219_machdep.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/arm/xscale/i80321/ep80219_machdep.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -45,8 +45,6 @@
  * Created      : 17/09/94
  */
 
-#include "opt_msgbuf.h"
-
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
@@ -247,7 +245,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 +395,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: head/sys/arm/xscale/i80321/iq31244_machdep.c
==============================================================================
--- head/sys/arm/xscale/i80321/iq31244_machdep.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/arm/xscale/i80321/iq31244_machdep.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -45,8 +45,6 @@
  * Created      : 17/09/94
  */
 
-#include "opt_msgbuf.h"
-
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
@@ -247,7 +245,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 +401,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: head/sys/arm/xscale/i8134x/crb_machdep.c
==============================================================================
--- head/sys/arm/xscale/i8134x/crb_machdep.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/arm/xscale/i8134x/crb_machdep.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -45,8 +45,6 @@
  * Created      : 17/09/94
  */
 
-#include "opt_msgbuf.h"
-
 #include <sys/cdefs.h>
 __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: head/sys/arm/xscale/ixp425/avila_machdep.c
==============================================================================
--- head/sys/arm/xscale/ixp425/avila_machdep.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/arm/xscale/ixp425/avila_machdep.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -45,8 +45,6 @@
  * Created      : 17/09/94
  */
 
-#include "opt_msgbuf.h"
-
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
@@ -314,7 +312,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 +458,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: head/sys/arm/xscale/pxa/pxa_machdep.c
==============================================================================
--- head/sys/arm/xscale/pxa/pxa_machdep.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/arm/xscale/pxa/pxa_machdep.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -45,7 +45,6 @@
  * Created      : 17/09/94
  */
 
-#include "opt_msgbuf.h"
 #include "opt_ddb.h"
 
 #include <sys/cdefs.h>
@@ -229,7 +228,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 +392,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;

Modified: head/sys/boot/common/loader.8
==============================================================================
--- head/sys/boot/common/loader.8	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/boot/common/loader.8	Fri Jan 21 10:26:26 2011	(r217688)
@@ -609,6 +609,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: head/sys/boot/forth/loader.conf
==============================================================================
--- head/sys/boot/forth/loader.conf	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/boot/forth/loader.conf	Fri Jan 21 10:26:26 2011	(r217688)
@@ -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=""		# 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: head/sys/i386/i386/machdep.c
==============================================================================
--- head/sys/i386/i386/machdep.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/i386/i386/machdep.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -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"
 #include "opt_xbox.h"
@@ -2115,7 +2114,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
@@ -2466,7 +2465,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;
@@ -2475,10 +2474,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);
 
@@ -2689,7 +2688,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);
@@ -2947,7 +2946,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: head/sys/i386/i386/pmap.c
==============================================================================
--- head/sys/i386/i386/pmap.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/i386/i386/pmap.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -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"
 
@@ -437,7 +436,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: head/sys/i386/xen/pmap.c
==============================================================================
--- head/sys/i386/xen/pmap.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/i386/xen/pmap.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -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"
 
@@ -471,7 +470,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: head/sys/ia64/ia64/machdep.c
==============================================================================
--- head/sys/ia64/ia64/machdep.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/ia64/ia64/machdep.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -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 <sys/param.h>
@@ -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: head/sys/kern/subr_param.c
==============================================================================
--- head/sys/kern/subr_param.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/kern/subr_param.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -38,6 +38,7 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_param.h"
+#include "opt_msgbuf.h"
 #include "opt_maxusers.h"
 
 #include <sys/limits.h>
@@ -45,6 +46,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/sysctl.h>
+#include <sys/msgbuf.h>
 
 #include <vm/vm_param.h>
 
@@ -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: head/sys/mips/mips/machdep.c
==============================================================================
--- head/sys/mips/mips/machdep.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/mips/mips/machdep.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$");
 #include "opt_cputype.h"
 #include "opt_ddb.h"
 #include "opt_md.h"
-#include "opt_msgbuf.h"
 
 #include <sys/param.h>
 #include <sys/proc.h>

Modified: head/sys/mips/mips/pmap.c
==============================================================================
--- head/sys/mips/mips/pmap.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/mips/mips/pmap.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -68,7 +68,6 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include "opt_msgbuf.h"
 #include "opt_ddb.h"
 
 #include <sys/param.h>
@@ -546,8 +545,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: head/sys/pc98/pc98/machdep.c
==============================================================================
--- head/sys/pc98/pc98/machdep.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/pc98/pc98/machdep.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -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"
 
@@ -2066,7 +2065,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;
@@ -2075,10 +2074,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);
 }
@@ -2293,7 +2292,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: head/sys/powerpc/aim/machdep.c
==============================================================================
--- head/sys/powerpc/aim/machdep.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/powerpc/aim/machdep.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$");
 #include "opt_compat.h"
 #include "opt_ddb.h"
 #include "opt_kstack_pages.h"
-#include "opt_msgbuf.h"
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -555,7 +554,7 @@ powerpc_init(vm_offset_t startkernel, vm
 	pc->pc_curpcb = thread0.td_pcb;
 
 	/* Initialise the message buffer. */
-	msgbufinit(msgbufp, MSGBUF_SIZE);
+	msgbufinit(msgbufp, msgbufsize);
 
 #ifdef KDB
 	if (boothowto & RB_KDB)

Modified: head/sys/powerpc/aim/mmu_oea.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/powerpc/aim/mmu_oea.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -921,10 +921,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: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/powerpc/aim/mmu_oea64.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -950,10 +950,10 @@ moea64_late_bootstrap(mmu_t mmup, vm_off
 	/*
 	 * 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: head/sys/powerpc/booke/machdep.c
==============================================================================
--- head/sys/powerpc/booke/machdep.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/powerpc/booke/machdep.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -84,7 +84,6 @@ __FBSDID("$FreeBSD$");
 #include "opt_compat.h"
 #include "opt_ddb.h"
 #include "opt_kstack_pages.h"
-#include "opt_msgbuf.h"
 #include "opt_platform.h"
 
 #include <sys/cdefs.h>
@@ -420,7 +419,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: head/sys/powerpc/booke/pmap.c
==============================================================================
--- head/sys/powerpc/booke/pmap.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/powerpc/booke/pmap.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -979,7 +979,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: head/sys/sparc64/sparc64/machdep.c
==============================================================================
--- head/sys/sparc64/sparc64/machdep.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/sparc64/sparc64/machdep.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
 #include "opt_compat.h"
 #include "opt_ddb.h"
 #include "opt_kstack_pages.h"
-#include "opt_msgbuf.h"
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -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: head/sys/sparc64/sparc64/pmap.c
==============================================================================
--- head/sys/sparc64/sparc64/pmap.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/sparc64/sparc64/pmap.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -66,7 +66,6 @@ __FBSDID("$FreeBSD$");
  */
 
 #include "opt_kstack_pages.h"
-#include "opt_msgbuf.h"
 #include "opt_pmap.h"
 
 #include <sys/param.h>
@@ -439,7 +438,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: head/sys/sun4v/sun4v/machdep.c
==============================================================================
--- head/sys/sun4v/sun4v/machdep.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/sun4v/sun4v/machdep.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
 #include "opt_compat.h"
 #include "opt_ddb.h"
 #include "opt_kstack_pages.h"
-#include "opt_msgbuf.h"
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -504,7 +503,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: head/sys/sun4v/sun4v/pmap.c
==============================================================================
--- head/sys/sun4v/sun4v/pmap.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/sun4v/sun4v/pmap.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -29,7 +29,6 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_kstack_pages.h"
-#include "opt_msgbuf.h"
 #include "opt_pmap.h"
 #include "opt_trap_trace.h"
 
@@ -782,7 +781,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: head/sys/sys/msgbuf.h
==============================================================================
--- head/sys/sys/msgbuf.h	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/sys/msgbuf.h	Fri Jan 21 10:26:26 2011	(r217688)
@@ -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;
 extern struct	mtx msgbuf_lock;

Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c	Fri Jan 21 07:28:48 2011	(r217687)
+++ head/sys/vm/vm_page.c	Fri Jan 21 10:26:26 2011	(r217688)
@@ -100,7 +100,6 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include "opt_msgbuf.h"
 #include "opt_vm.h"
 
 #include <sys/param.h>
@@ -375,7 +374,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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101211026.p0LAQQRo047220>