diff options
author | Peter Wemm <peter@FreeBSD.org> | 2001-08-25 02:20:02 +0000 |
---|---|---|
committer | Peter Wemm <peter@FreeBSD.org> | 2001-08-25 02:20:02 +0000 |
commit | 268bdb43f9aa6eeebd44934b5ea7b5fb3dd452c9 (patch) | |
tree | 507801bec2b11b2c70916032367a1906891044d6 | |
parent | 61af19916888ce1a889585da3e41703716013aa1 (diff) |
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.
Notes
Notes:
svn path=/head/; revision=82309
30 files changed, 104 insertions, 62 deletions
diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c index ac664e8e880e..0704db773e85 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 c74e9cb95579..c1148e91f2e9 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 eaf508ccc284..d912e0c282a2 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 eaf508ccc284..d912e0c282a2 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 f6d0984f49fb..a8726221a3d0 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 8d47b5f8871f..23c1cdd72106 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 05efb4dfe11b..573c41b78115 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 420dff6e1ba5..4323127e8495 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 eaf508ccc284..d912e0c282a2 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 cda7b1e172e2..37388aa69349 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 405cbc28e845..0017be80b60e 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 6495c9c6b59a..bdcaf02c1198 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 135258262619..488eadb10d1e 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 420dff6e1ba5..4323127e8495 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 405cbc28e845..0017be80b60e 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 ac664e8e880e..0704db773e85 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 c74e9cb95579..c1148e91f2e9 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 eaf508ccc284..d912e0c282a2 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 eaf508ccc284..d912e0c282a2 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 f6d0984f49fb..a8726221a3d0 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 8d47b5f8871f..23c1cdd72106 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 05efb4dfe11b..573c41b78115 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 cda7b1e172e2..37388aa69349 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 eaf508ccc284..d912e0c282a2 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 624138944889..9f63c01f8a4f 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 cda7b1e172e2..37388aa69349 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 000000000000..496c4b637c11 --- /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 856d4ec8fad6..9994ad558bcd 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 09151fab05ad..c0d5eff9e8e3 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 09151fab05ad..c0d5eff9e8e3 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> |