summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2001-08-25 02:20:02 +0000
committerpeter <peter@FreeBSD.org>2001-08-25 02:20:02 +0000
commit70aca15c211e6081406e6a0b661a41594a64187a (patch)
tree507801bec2b11b2c70916032367a1906891044d6
parentd244a653e5b56edafe3e4993347279dff7000cff (diff)
downloadFreeBSD-src-70aca15c211e6081406e6a0b661a41594a64187a.zip
FreeBSD-src-70aca15c211e6081406e6a0b661a41594a64187a.tar.gz
Optionize UPAGES for the i386. As part of this I split some of the low
level implementation stuff out of machine/globaldata.h to avoid exposing UPAGES to lots more places. The end result is that we can double the kernel stack size with 'options UPAGES=4' etc. This is mainly being done for the benefit of a MFC to RELENG_4 at some point. -current doesn't really need this so much since each interrupt runs on its own kstack.
-rw-r--r--sys/amd64/amd64/genassym.c2
-rw-r--r--sys/amd64/amd64/machdep.c4
-rw-r--r--sys/amd64/amd64/mp_machdep.c2
-rw-r--r--sys/amd64/amd64/mptable.c2
-rw-r--r--sys/amd64/amd64/pmap.c1
-rw-r--r--sys/amd64/amd64/sys_machdep.c2
-rw-r--r--sys/amd64/amd64/vm_machdep.c1
-rw-r--r--sys/amd64/conf/GENERIC4
-rw-r--r--sys/amd64/include/mptable.h2
-rw-r--r--sys/amd64/include/pcpu.h20
-rw-r--r--sys/conf/NOTES1
-rw-r--r--sys/conf/options.i3861
-rw-r--r--sys/conf/options.pc981
-rw-r--r--sys/i386/conf/GENERIC4
-rw-r--r--sys/i386/conf/NOTES1
-rw-r--r--sys/i386/i386/genassym.c2
-rw-r--r--sys/i386/i386/machdep.c4
-rw-r--r--sys/i386/i386/mp_machdep.c2
-rw-r--r--sys/i386/i386/mptable.c2
-rw-r--r--sys/i386/i386/pmap.c1
-rw-r--r--sys/i386/i386/sys_machdep.c2
-rw-r--r--sys/i386/i386/vm_machdep.c1
-rw-r--r--sys/i386/include/globaldata.h20
-rw-r--r--sys/i386/include/mptable.h2
-rw-r--r--sys/i386/include/param.h3
-rw-r--r--sys/i386/include/pcpu.h20
-rw-r--r--sys/i386/include/privatespace.h49
-rw-r--r--sys/kern/imgact_aout.c2
-rw-r--r--sys/pc98/i386/machdep.c4
-rw-r--r--sys/pc98/pc98/machdep.c4
30 files changed, 104 insertions, 62 deletions
diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c
index ac664e8..0704db7 100644
--- a/sys/amd64/amd64/genassym.c
+++ b/sys/amd64/amd64/genassym.c
@@ -37,6 +37,8 @@
* $FreeBSD$
*/
+#include "opt_upages.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/assym.h>
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index c74e9cb..c1148e9 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -49,6 +49,7 @@
#include "opt_msgbuf.h"
#include "opt_npx.h"
#include "opt_perfmon.h"
+#include "opt_upages.h"
/* #include "opt_userconfig.h" */
#include <sys/param.h>
@@ -106,6 +107,9 @@
#ifdef PERFMON
#include <machine/perfmon.h>
#endif
+#ifdef SMP
+#include <machine/privatespace.h>
+#endif
#include <i386/isa/icu.h>
#include <i386/isa/intr_machdep.h>
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index eaf508c..d912e0c 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -26,6 +26,7 @@
*/
#include "opt_cpu.h"
+#include "opt_upages.h"
#ifdef SMP
#include <machine/smptests.h>
@@ -70,6 +71,7 @@
#include <machine/tss.h>
#include <machine/specialreg.h>
#include <machine/globaldata.h>
+#include <machine/privatespace.h>
#if defined(APIC_IO)
#include <machine/md_var.h> /* setidt() */
diff --git a/sys/amd64/amd64/mptable.c b/sys/amd64/amd64/mptable.c
index eaf508c..d912e0c 100644
--- a/sys/amd64/amd64/mptable.c
+++ b/sys/amd64/amd64/mptable.c
@@ -26,6 +26,7 @@
*/
#include "opt_cpu.h"
+#include "opt_upages.h"
#ifdef SMP
#include <machine/smptests.h>
@@ -70,6 +71,7 @@
#include <machine/tss.h>
#include <machine/specialreg.h>
#include <machine/globaldata.h>
+#include <machine/privatespace.h>
#if defined(APIC_IO)
#include <machine/md_var.h> /* setidt() */
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index f6d0984..a872622 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -71,6 +71,7 @@
#include "opt_disable_pse.h"
#include "opt_pmap.h"
#include "opt_msgbuf.h"
+#include "opt_upages.h"
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/amd64/amd64/sys_machdep.c b/sys/amd64/amd64/sys_machdep.c
index 8d47b5f..23c1cdd 100644
--- a/sys/amd64/amd64/sys_machdep.c
+++ b/sys/amd64/amd64/sys_machdep.c
@@ -35,6 +35,8 @@
*
*/
+#include "opt_upages.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/lock.h>
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index 05efb4d..573c41b 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -47,6 +47,7 @@
#endif
#include "opt_reset.h"
#include "opt_isa.h"
+#include "opt_upages.h"
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC
index 420dff6..4323127 100644
--- a/sys/amd64/conf/GENERIC
+++ b/sys/amd64/conf/GENERIC
@@ -25,7 +25,7 @@ ident GENERIC
maxusers 32
#To statically compile in device wiring instead of /boot/device.hints
-#hints "GENERIC.hints" #Default places to look for devices.
+hints "GENERIC.hints" #Default places to look for devices.
makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols
@@ -58,6 +58,8 @@ options DDB
options INVARIANTS
options INVARIANT_SUPPORT
options WITNESS
+options UPAGES=4
+options CPU_ENABLE_SSE
# To make an SMP kernel, the next two are needed
#options SMP # Symmetric MultiProcessor Kernel
diff --git a/sys/amd64/include/mptable.h b/sys/amd64/include/mptable.h
index eaf508c..d912e0c 100644
--- a/sys/amd64/include/mptable.h
+++ b/sys/amd64/include/mptable.h
@@ -26,6 +26,7 @@
*/
#include "opt_cpu.h"
+#include "opt_upages.h"
#ifdef SMP
#include <machine/smptests.h>
@@ -70,6 +71,7 @@
#include <machine/tss.h>
#include <machine/specialreg.h>
#include <machine/globaldata.h>
+#include <machine/privatespace.h>
#if defined(APIC_IO)
#include <machine/md_var.h> /* setidt() */
diff --git a/sys/amd64/include/pcpu.h b/sys/amd64/include/pcpu.h
index cda7b1e..37388aa 100644
--- a/sys/amd64/include/pcpu.h
+++ b/sys/amd64/include/pcpu.h
@@ -74,26 +74,6 @@ struct globaldata {
#endif
};
-#ifdef SMP
-/*
- * This is the upper (0xff800000) address space layout that is per-cpu.
- * It is setup in locore.s and pmap.c for the BSP and in mp_machdep.c for
- * each AP. genassym helps export this to the assembler code.
- */
-struct privatespace {
- /* page 0 - data page */
- struct globaldata globaldata;
- char __filler0[PAGE_SIZE - sizeof(struct globaldata)];
-
- /* page 1 - idle stack (UPAGES pages) */
- char idlestack[UPAGES * PAGE_SIZE];
- /* page 1+UPAGES... */
-};
-
-extern struct privatespace SMP_prvspace[];
-
-#endif
-
#endif /* _KERNEL */
#endif /* ! _MACHINE_GLOBALDATA_H_ */
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index 405cbc2..0017be8 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -84,6 +84,7 @@ options BLKDEV_IOSIZE=8192
# Options for the VM subsystem
options PQ_CACHESIZE=512 # color for 512k/16k cache
+options UPAGES=3 # number of 4k stack pages per process
# Deprecated options supported for backwards compatibility
#options PQ_NOOPT # No coloring
#options PQ_LARGECACHE # color for 512k/16k cache
diff --git a/sys/conf/options.i386 b/sys/conf/options.i386
index 6495c9c..bdcaf02 100644
--- a/sys/conf/options.i386
+++ b/sys/conf/options.i386
@@ -21,6 +21,7 @@ WLCACHE opt_wavelan.h
WLDEBUG opt_wavelan.h
COMPAT_OLDISA
BROKEN_KEYBOARD_RESET opt_reset.h
+UPAGES
# Options for emulators. These should only be used at config time, so
# they are handled like options for static file systems
diff --git a/sys/conf/options.pc98 b/sys/conf/options.pc98
index 1352582..488eadb 100644
--- a/sys/conf/options.pc98
+++ b/sys/conf/options.pc98
@@ -21,6 +21,7 @@ WLCACHE opt_wavelan.h
WLDEBUG opt_wavelan.h
COMPAT_OLDISA
BROKEN_KEYBOARD_RESET opt_reset.h
+UPAGES
# Options for emulators. These should only be used at config time, so
# they are handled like options for static file systems
diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC
index 420dff6..4323127 100644
--- a/sys/i386/conf/GENERIC
+++ b/sys/i386/conf/GENERIC
@@ -25,7 +25,7 @@ ident GENERIC
maxusers 32
#To statically compile in device wiring instead of /boot/device.hints
-#hints "GENERIC.hints" #Default places to look for devices.
+hints "GENERIC.hints" #Default places to look for devices.
makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols
@@ -58,6 +58,8 @@ options DDB
options INVARIANTS
options INVARIANT_SUPPORT
options WITNESS
+options UPAGES=4
+options CPU_ENABLE_SSE
# To make an SMP kernel, the next two are needed
#options SMP # Symmetric MultiProcessor Kernel
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index 405cbc2..0017be8 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -84,6 +84,7 @@ options BLKDEV_IOSIZE=8192
# Options for the VM subsystem
options PQ_CACHESIZE=512 # color for 512k/16k cache
+options UPAGES=3 # number of 4k stack pages per process
# Deprecated options supported for backwards compatibility
#options PQ_NOOPT # No coloring
#options PQ_LARGECACHE # color for 512k/16k cache
diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c
index ac664e8..0704db7 100644
--- a/sys/i386/i386/genassym.c
+++ b/sys/i386/i386/genassym.c
@@ -37,6 +37,8 @@
* $FreeBSD$
*/
+#include "opt_upages.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/assym.h>
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index c74e9cb..c1148e9 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -49,6 +49,7 @@
#include "opt_msgbuf.h"
#include "opt_npx.h"
#include "opt_perfmon.h"
+#include "opt_upages.h"
/* #include "opt_userconfig.h" */
#include <sys/param.h>
@@ -106,6 +107,9 @@
#ifdef PERFMON
#include <machine/perfmon.h>
#endif
+#ifdef SMP
+#include <machine/privatespace.h>
+#endif
#include <i386/isa/icu.h>
#include <i386/isa/intr_machdep.h>
diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c
index eaf508c..d912e0c 100644
--- a/sys/i386/i386/mp_machdep.c
+++ b/sys/i386/i386/mp_machdep.c
@@ -26,6 +26,7 @@
*/
#include "opt_cpu.h"
+#include "opt_upages.h"
#ifdef SMP
#include <machine/smptests.h>
@@ -70,6 +71,7 @@
#include <machine/tss.h>
#include <machine/specialreg.h>
#include <machine/globaldata.h>
+#include <machine/privatespace.h>
#if defined(APIC_IO)
#include <machine/md_var.h> /* setidt() */
diff --git a/sys/i386/i386/mptable.c b/sys/i386/i386/mptable.c
index eaf508c..d912e0c 100644
--- a/sys/i386/i386/mptable.c
+++ b/sys/i386/i386/mptable.c
@@ -26,6 +26,7 @@
*/
#include "opt_cpu.h"
+#include "opt_upages.h"
#ifdef SMP
#include <machine/smptests.h>
@@ -70,6 +71,7 @@
#include <machine/tss.h>
#include <machine/specialreg.h>
#include <machine/globaldata.h>
+#include <machine/privatespace.h>
#if defined(APIC_IO)
#include <machine/md_var.h> /* setidt() */
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
index f6d0984..a872622 100644
--- a/sys/i386/i386/pmap.c
+++ b/sys/i386/i386/pmap.c
@@ -71,6 +71,7 @@
#include "opt_disable_pse.h"
#include "opt_pmap.h"
#include "opt_msgbuf.h"
+#include "opt_upages.h"
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/i386/i386/sys_machdep.c b/sys/i386/i386/sys_machdep.c
index 8d47b5f..23c1cdd 100644
--- a/sys/i386/i386/sys_machdep.c
+++ b/sys/i386/i386/sys_machdep.c
@@ -35,6 +35,8 @@
*
*/
+#include "opt_upages.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/lock.h>
diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c
index 05efb4d..573c41b 100644
--- a/sys/i386/i386/vm_machdep.c
+++ b/sys/i386/i386/vm_machdep.c
@@ -47,6 +47,7 @@
#endif
#include "opt_reset.h"
#include "opt_isa.h"
+#include "opt_upages.h"
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/i386/include/globaldata.h b/sys/i386/include/globaldata.h
index cda7b1e..37388aa 100644
--- a/sys/i386/include/globaldata.h
+++ b/sys/i386/include/globaldata.h
@@ -74,26 +74,6 @@ struct globaldata {
#endif
};
-#ifdef SMP
-/*
- * This is the upper (0xff800000) address space layout that is per-cpu.
- * It is setup in locore.s and pmap.c for the BSP and in mp_machdep.c for
- * each AP. genassym helps export this to the assembler code.
- */
-struct privatespace {
- /* page 0 - data page */
- struct globaldata globaldata;
- char __filler0[PAGE_SIZE - sizeof(struct globaldata)];
-
- /* page 1 - idle stack (UPAGES pages) */
- char idlestack[UPAGES * PAGE_SIZE];
- /* page 1+UPAGES... */
-};
-
-extern struct privatespace SMP_prvspace[];
-
-#endif
-
#endif /* _KERNEL */
#endif /* ! _MACHINE_GLOBALDATA_H_ */
diff --git a/sys/i386/include/mptable.h b/sys/i386/include/mptable.h
index eaf508c..d912e0c 100644
--- a/sys/i386/include/mptable.h
+++ b/sys/i386/include/mptable.h
@@ -26,6 +26,7 @@
*/
#include "opt_cpu.h"
+#include "opt_upages.h"
#ifdef SMP
#include <machine/smptests.h>
@@ -70,6 +71,7 @@
#include <machine/tss.h>
#include <machine/specialreg.h>
#include <machine/globaldata.h>
+#include <machine/privatespace.h>
#if defined(APIC_IO)
#include <machine/md_var.h> /* setidt() */
diff --git a/sys/i386/include/param.h b/sys/i386/include/param.h
index 6241389..9f63c01 100644
--- a/sys/i386/include/param.h
+++ b/sys/i386/include/param.h
@@ -110,7 +110,10 @@
#define MAXDUMPPGS (DFLTPHYS/PAGE_SIZE)
#define IOPAGES 2 /* pages of i/o permission bitmap */
+
+#ifndef UPAGES
#define UPAGES 2 /* pages of u-area */
+#endif
/*
* Ceiling on amount of swblock kva space.
diff --git a/sys/i386/include/pcpu.h b/sys/i386/include/pcpu.h
index cda7b1e..37388aa 100644
--- a/sys/i386/include/pcpu.h
+++ b/sys/i386/include/pcpu.h
@@ -74,26 +74,6 @@ struct globaldata {
#endif
};
-#ifdef SMP
-/*
- * This is the upper (0xff800000) address space layout that is per-cpu.
- * It is setup in locore.s and pmap.c for the BSP and in mp_machdep.c for
- * each AP. genassym helps export this to the assembler code.
- */
-struct privatespace {
- /* page 0 - data page */
- struct globaldata globaldata;
- char __filler0[PAGE_SIZE - sizeof(struct globaldata)];
-
- /* page 1 - idle stack (UPAGES pages) */
- char idlestack[UPAGES * PAGE_SIZE];
- /* page 1+UPAGES... */
-};
-
-extern struct privatespace SMP_prvspace[];
-
-#endif
-
#endif /* _KERNEL */
#endif /* ! _MACHINE_GLOBALDATA_H_ */
diff --git a/sys/i386/include/privatespace.h b/sys/i386/include/privatespace.h
new file mode 100644
index 0000000..496c4b6
--- /dev/null
+++ b/sys/i386/include/privatespace.h
@@ -0,0 +1,49 @@
+/*-
+ * Copyright (c) Peter Wemm <peter@netplex.com.au>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_PRIVATESPACE_H_
+#define _MACHINE_PRIVATESPACE_H_
+
+/*
+ * This is the upper (0xff800000) address space layout that is per-cpu.
+ * It is setup in locore.s and pmap.c for the BSP and in mp_machdep.c for
+ * each AP. This is only applicable to the x86 SMP kernel.
+ */
+struct privatespace {
+ /* page 0 - data page */
+ struct globaldata globaldata;
+ char __filler0[PAGE_SIZE - sizeof(struct globaldata)];
+
+ /* page 1 - idle stack (UPAGES pages) */
+ char idlestack[UPAGES * PAGE_SIZE];
+ /* page 1+UPAGES... */
+};
+
+extern struct privatespace SMP_prvspace[];
+
+#endif /* ! _MACHINE_PRIVATESPACE_H_ */
diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c
index 856d4ec..9994ad5 100644
--- a/sys/kern/imgact_aout.c
+++ b/sys/kern/imgact_aout.c
@@ -26,6 +26,8 @@
* $FreeBSD$
*/
+#include "opt_upages.h"
+
#include <sys/param.h>
#include <sys/exec.h>
#include <sys/fcntl.h>
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c
index 09151fa..c0d5eff 100644
--- a/sys/pc98/i386/machdep.c
+++ b/sys/pc98/i386/machdep.c
@@ -49,6 +49,7 @@
#include "opt_msgbuf.h"
#include "opt_npx.h"
#include "opt_perfmon.h"
+#include "opt_upages.h"
/* #include "opt_userconfig.h" */
#include <sys/param.h>
@@ -106,6 +107,9 @@
#ifdef PERFMON
#include <machine/perfmon.h>
#endif
+#ifdef SMP
+#include <machine/privatespace.h>
+#endif
#include <i386/isa/icu.h>
#include <i386/isa/intr_machdep.h>
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index 09151fa..c0d5eff 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -49,6 +49,7 @@
#include "opt_msgbuf.h"
#include "opt_npx.h"
#include "opt_perfmon.h"
+#include "opt_upages.h"
/* #include "opt_userconfig.h" */
#include <sys/param.h>
@@ -106,6 +107,9 @@
#ifdef PERFMON
#include <machine/perfmon.h>
#endif
+#ifdef SMP
+#include <machine/privatespace.h>
+#endif
#include <i386/isa/icu.h>
#include <i386/isa/intr_machdep.h>
OpenPOWER on IntegriCloud