summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpluknet <pluknet@FreeBSD.org>2011-01-21 10:26:26 +0000
committerpluknet <pluknet@FreeBSD.org>2011-01-21 10:26:26 +0000
commit5f536fc1d3dfb28e75a18d60bddcfacdf3f22617 (patch)
tree7eea8c732d50e7ebda3498e40f7ccad228cc1453
parent8309d738784bb61d488dbea96837e5d407437cfc (diff)
downloadFreeBSD-src-5f536fc1d3dfb28e75a18d60bddcfacdf3f22617.zip
FreeBSD-src-5f536fc1d3dfb28e75a18d60bddcfacdf3f22617.tar.gz
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
-rw-r--r--sys/amd64/amd64/machdep.c7
-rw-r--r--sys/arm/at91/at91_machdep.c8
-rw-r--r--sys/arm/econa/econa_machdep.c8
-rw-r--r--sys/arm/mv/mv_machdep.c5
-rw-r--r--sys/arm/s3c2xx0/s3c24x0_machdep.c7
-rw-r--r--sys/arm/xscale/i80321/ep80219_machdep.c6
-rw-r--r--sys/arm/xscale/i80321/iq31244_machdep.c6
-rw-r--r--sys/arm/xscale/i8134x/crb_machdep.c6
-rw-r--r--sys/arm/xscale/ixp425/avila_machdep.c6
-rw-r--r--sys/arm/xscale/pxa/pxa_machdep.c5
-rw-r--r--sys/boot/common/loader.88
-rw-r--r--sys/boot/forth/loader.conf1
-rw-r--r--sys/i386/i386/machdep.c13
-rw-r--r--sys/i386/i386/pmap.c3
-rw-r--r--sys/i386/xen/pmap.c3
-rw-r--r--sys/ia64/ia64/machdep.c5
-rw-r--r--sys/kern/subr_param.c7
-rw-r--r--sys/mips/mips/machdep.c1
-rw-r--r--sys/mips/mips/pmap.c5
-rw-r--r--sys/pc98/pc98/machdep.c9
-rw-r--r--sys/powerpc/aim/machdep.c3
-rw-r--r--sys/powerpc/aim/mmu_oea.c4
-rw-r--r--sys/powerpc/aim/mmu_oea64.c4
-rw-r--r--sys/powerpc/booke/machdep.c3
-rw-r--r--sys/powerpc/booke/pmap.c2
-rw-r--r--sys/sparc64/sparc64/machdep.c3
-rw-r--r--sys/sparc64/sparc64/pmap.c3
-rw-r--r--sys/sun4v/sun4v/machdep.c3
-rw-r--r--sys/sun4v/sun4v/pmap.c3
-rw-r--r--sys/sys/msgbuf.h1
-rw-r--r--sys/vm/vm_page.c3
31 files changed, 69 insertions, 82 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 3e0e7bb..7cc93d7 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -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 physfree)
/* now running on new page tables, configured,and u/iom is accessible */
- msgbufinit(msgbufp, MSGBUF_SIZE);
+ msgbufinit(msgbufp, msgbufsize);
fpuinit();
/* transfer to user mode */
diff --git a/sys/arm/at91/at91_machdep.c b/sys/arm/at91/at91_machdep.c
index bf686eb..5445450 100644
--- a/sys/arm/at91/at91_machdep.c
+++ b/sys/arm/at91/at91_machdep.c
@@ -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;
diff --git a/sys/arm/econa/econa_machdep.c b/sys/arm/econa/econa_machdep.c
index c4e9806..bbd615f 100644
--- a/sys/arm/econa/econa_machdep.c
+++ b/sys/arm/econa/econa_machdep.c
@@ -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();
diff --git a/sys/arm/mv/mv_machdep.c b/sys/arm/mv/mv_machdep.c
index b2ec33b..4981d22 100644
--- a/sys/arm/mv/mv_machdep.c
+++ b/sys/arm/mv/mv_machdep.c
@@ -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();
/*
diff --git a/sys/arm/s3c2xx0/s3c24x0_machdep.c b/sys/arm/s3c2xx0/s3c24x0_machdep.c
index 899222f..008d9399 100644
--- a/sys/arm/s3c2xx0/s3c24x0_machdep.c
+++ b/sys/arm/s3c2xx0/s3c24x0_machdep.c
@@ -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;
diff --git a/sys/arm/xscale/i80321/ep80219_machdep.c b/sys/arm/xscale/i80321/ep80219_machdep.c
index ed77995..016da7f 100644
--- a/sys/arm/xscale/i80321/ep80219_machdep.c
+++ b/sys/arm/xscale/i80321/ep80219_machdep.c
@@ -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;
diff --git a/sys/arm/xscale/i80321/iq31244_machdep.c b/sys/arm/xscale/i80321/iq31244_machdep.c
index cc89008..f417016 100644
--- a/sys/arm/xscale/i80321/iq31244_machdep.c
+++ b/sys/arm/xscale/i80321/iq31244_machdep.c
@@ -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;
diff --git a/sys/arm/xscale/i8134x/crb_machdep.c b/sys/arm/xscale/i8134x/crb_machdep.c
index 8c57cc1..fd8aadd 100644
--- a/sys/arm/xscale/i8134x/crb_machdep.c
+++ b/sys/arm/xscale/i8134x/crb_machdep.c
@@ -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;
diff --git a/sys/arm/xscale/ixp425/avila_machdep.c b/sys/arm/xscale/ixp425/avila_machdep.c
index 9ea4f4d..63ac46c 100644
--- a/sys/arm/xscale/ixp425/avila_machdep.c
+++ b/sys/arm/xscale/ixp425/avila_machdep.c
@@ -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;
diff --git a/sys/arm/xscale/pxa/pxa_machdep.c b/sys/arm/xscale/pxa/pxa_machdep.c
index e6d8bf4..c060596 100644
--- a/sys/arm/xscale/pxa/pxa_machdep.c
+++ b/sys/arm/xscale/pxa/pxa_machdep.c
@@ -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;
diff --git a/sys/boot/common/loader.8 b/sys/boot/common/loader.8
index 56c5199..94b4e6a 100644
--- a/sys/boot/common/loader.8
+++ b/sys/boot/common/loader.8
@@ -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
diff --git a/sys/boot/forth/loader.conf b/sys/boot/forth/loader.conf
index ee60bae..785c6a3 100644
--- a/sys/boot/forth/loader.conf
+++ b/sys/boot/forth/loader.conf
@@ -99,6 +99,7 @@ module_path="/boot/modules" # Set the module search path
#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
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index b0f5bc2..3dca8cd 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -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;
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
index 7085186..e48f83e 100644
--- a/sys/i386/i386/pmap.c
+++ b/sys/i386/i386/pmap.c
@@ -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().
diff --git a/sys/i386/xen/pmap.c b/sys/i386/xen/pmap.c
index 4416f1b..eb3c803 100644
--- a/sys/i386/xen/pmap.c
+++ b/sys/i386/xen/pmap.c
@@ -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
diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c
index b5b409a..01a3497 100644
--- a/sys/ia64/ia64/machdep.c
+++ b/sys/ia64/ia64/machdep.c
@@ -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);
/*
diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c
index f4d0003..bf72a64 100644
--- a/sys/kern/subr_param.c
+++ b/sys/kern/subr_param.c
@@ -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, CTLFLAG_RDTUN, &nbuf, 0,
"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);
diff --git a/sys/mips/mips/machdep.c b/sys/mips/mips/machdep.c
index 9ddec73..4be1307 100644
--- a/sys/mips/mips/machdep.c
+++ b/sys/mips/mips/machdep.c
@@ -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>
diff --git a/sys/mips/mips/pmap.c b/sys/mips/mips/pmap.c
index 8530c6e..3b858de 100644
--- a/sys/mips/mips/pmap.c
+++ b/sys/mips/mips/pmap.c
@@ -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.
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index 045f8e4..826bcc8 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -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;
diff --git a/sys/powerpc/aim/machdep.c b/sys/powerpc/aim/machdep.c
index 87aa482..efcfaac 100644
--- a/sys/powerpc/aim/machdep.c
+++ b/sys/powerpc/aim/machdep.c
@@ -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_offset_t endkernel,
pc->pc_curpcb = thread0.td_pcb;
/* Initialise the message buffer. */
- msgbufinit(msgbufp, MSGBUF_SIZE);
+ msgbufinit(msgbufp, msgbufsize);
#ifdef KDB
if (boothowto & RB_KDB)
diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c
index 4978420..3b47d54 100644
--- a/sys/powerpc/aim/mmu_oea.c
+++ b/sys/powerpc/aim/mmu_oea.c
@@ -921,10 +921,10 @@ moea_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend)
/*
* 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;
diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c
index a400662..7e555da 100644
--- a/sys/powerpc/aim/mmu_oea64.c
+++ b/sys/powerpc/aim/mmu_oea64.c
@@ -950,10 +950,10 @@ moea64_late_bootstrap(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend
/*
* 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;
diff --git a/sys/powerpc/booke/machdep.c b/sys/powerpc/booke/machdep.c
index 2601e23..f2dbacf 100644
--- a/sys/powerpc/booke/machdep.c
+++ b/sys/powerpc/booke/machdep.c
@@ -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_t endkernel, void *mdp)
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);
diff --git a/sys/powerpc/booke/pmap.c b/sys/powerpc/booke/pmap.c
index abe8ad5..2fffa3f 100644
--- a/sys/powerpc/booke/pmap.c
+++ b/sys/powerpc/booke/pmap.c
@@ -979,7 +979,7 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_offset_t kernelend)
/* 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);
diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c
index 0a40bad..e9a1102 100644
--- a/sys/sparc64/sparc64/machdep.c
+++ b/sys/sparc64/sparc64/machdep.c
@@ -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_long o2, u_long o3, ofw_vec_t *vec)
* buffer (after setting the trap table).
*/
dpcpu_init(dpcpu0, 0);
- msgbufinit(msgbufp, MSGBUF_SIZE);
+ msgbufinit(msgbufp, msgbufsize);
/*
* Initialize mutexes.
diff --git a/sys/sparc64/sparc64/pmap.c b/sys/sparc64/sparc64/pmap.c
index a52d53e..317df3b 100644
--- a/sys/sparc64/sparc64/pmap.c
+++ b/sys/sparc64/sparc64/pmap.c
@@ -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);
/*
diff --git a/sys/sun4v/sun4v/machdep.c b/sys/sun4v/sun4v/machdep.c
index 43496e3..9475933 100644
--- a/sys/sun4v/sun4v/machdep.c
+++ b/sys/sun4v/sun4v/machdep.c
@@ -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_long o2, u_long o3, ofw_vec_t *vec)
*/
BVPRINTF("initialize msgbuf\n");
dpcpu_init(dpcpu0, 0);
- msgbufinit(msgbufp, MSGBUF_SIZE);
+ msgbufinit(msgbufp, msgbufsize);
BVPRINTF("initialize mutexes\n");
mutex_init();
diff --git a/sys/sun4v/sun4v/pmap.c b/sys/sun4v/sun4v/pmap.c
index db4c245..502da80 100644
--- a/sys/sun4v/sun4v/pmap.c
+++ b/sys/sun4v/sun4v/pmap.c
@@ -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);
/*
diff --git a/sys/sys/msgbuf.h b/sys/sys/msgbuf.h
index 23bce08..8435c68 100644
--- a/sys/sys/msgbuf.h
+++ b/sys/sys/msgbuf.h
@@ -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;
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 303c4a9..562483d 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -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;
OpenPOWER on IntegriCloud