Home | History | Annotate | Download | only in include
History log of /src/sys/arch/sparc64/include/vmparam.h
RevisionDateAuthorComments
 1.43  07-Feb-2023  hgutch Avoid using (1<<64)-1 for VM_MAX{,USER}_ADDRESS as rounding that up to
the next page boundary gives 0 and instead make the VA space end one
page earlier.

Fixes PR sparc64/57219.
 1.42  26-Feb-2021  simonb branches: 1.42.18;
Say what 1UL<<39 (MAXDSIZ value) is in the comment.
 1.41  06-Oct-2020  christos branches: 1.41.2;
GC unused MAXTSIZ32
 1.40  22-Jan-2020  ad Bump UBC defaults on sparc64 & aarch64, which already have a large pager_map.
 1.39  03-Sep-2018  riastradh branches: 1.39.4; 1.39.6;
Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.38  14-Nov-2017  martin branches: 1.38.2; 1.38.4;
Bump PAGER_MAP_DEFAULT_SIZE to 512 MB (like amd64 recently did).
 1.37  26-Mar-2016  martin branches: 1.37.10;
Fix comment
 1.36  22-Nov-2015  martin Reduce the "MAXDSIZ" limit for bottom-up-VA (i.e. old binaries) processes
to the old limit of 1 GB. Some old binaries can not deal with more.
 1.35  15-Nov-2015  martin PR 32999: adjust VM parameters for 64 bit kernel/userlands.
Limit old binaries (i.e. processes not using topdown VA layout) to 2 GB
data size.
Use the same limits as native sparc for netbsd32 emulation - we need to
revisit this, but currently automatic test runs in this environment
fail big time, so there is no easy way to verify any changes.
 1.34  14-Apr-2014  martin branches: 1.34.4;
Implement and enable TOPDOWN_VM. From Chuck Silvers.
 1.33  03-Jan-2013  martin branches: 1.33.2; 1.33.10;
Rearange VA layout for 64 bit kernels, as suggested by Lars Heidieker:
move the dynamic kernel memory past 4GB (basically unlimiting it) and
use the now freed address range past kernel data upto 2GB for modules.
 1.32  14-Nov-2010  uebayasi branches: 1.32.8; 1.32.18;
Move struct vm_page_md definition from vmparam.h to pmap.h, because
it's used only by pmap. vmparam.h has definitions for wider
audience.

All GENERIC kernels build tested, except ia64.

powerpc/include/booke/vmparam.h has one too, but it has no pmap.h,
so it's left as is.
 1.31  06-Nov-2010  uebayasi Remove incomplete, never worked dynamic run-time memory registration
(uvm_page_physload(9)). This functionality will be re-added later.
 1.30  06-Mar-2009  joerg branches: 1.30.2; 1.30.4;
Remove SHMMAXPGS from all kernel configs. Dynamically compute the
initial limit as 1/4 of the physical memory. Ensure the limit is at
least 1024 pages, the old default on most platforms.
 1.29  27-Jan-2006  cdi branches: 1.29.76; 1.29.84; 1.29.90;
Alter sparc64 bootstrap, catch up to ofwboot v1.9:

- Accept bootinfo structure passed down from ofwboot v1.9
- Drop kernel re-mapping code
- Use permanent 4MB mappings provided by the loader instead
- Change kernel entry address to point directly at the code instead of pointing
at the trap table's first slot. This allows the bootloader to detect
those kernels which are aware of the new boot scheme
- Due to the changes in kernel mapping code, alter secondary CPU bootstrap
code to use trampoline just like FreeBSD does (some FreeBSD code is used
here as well)
 1.28  11-Dec-2005  christos branches: 1.28.2;
merge ktrace-lwp.
 1.27  26-Mar-2005  fvdl branches: 1.27.2;
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.
 1.26  21-Oct-2003  kleink branches: 1.26.8; 1.26.10; 1.26.14;
Don't use NULL in integer-type assignments/comparisons.
 1.25  10-Aug-2003  chs remove some leftover cruft.
 1.24  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.23  01-Apr-2003  thorpej branches: 1.23.2;
We use 8K VM pages on Sun4U, so make PAGE_SIZE, PAGE_SHIFT, and PAGE_MASK
into compile-time constants.
 1.22  10-Dec-2002  thorpej Use __LDPGSZ (which must be == USRTEXT) as the text address for a.out
executables, and eliminate the USRTEXT constant, which was only used
by the a.out exec code.
 1.21  22-Sep-2002  chs many improvements:
- use struct vm_page_md for attaching pv entries to struct vm_page
- change pseg_set()'s return value to indicate whether the spare page
was used as an L2 or L3 PTP.
- use a pool for pv entries instead of malloc().
- put PTPs on a list attached to the pmap so we can free them
more efficiently (by just walking the list) in pmap_destroy().
- use the new pmap_remove_all() interface to avoid flushing the cache and TLB
for each pmap_remove() that's done as we are tearing down an address space.
- in pmap_enter(), handle replacing an existing mapping more efficiently
than just calling pmap_remove() on it. also, skip flushing the
TSB and TLB if there was no previous mapping, since there can't be
anything we need to flush. also, preload the TSB if we're pre-setting
the mod/ref bits.
- allocate hardware contexts like the MIPS pmap:
allocate them all sequentially without reuse, then once we run out
just invalidate all user TLB entries and flush the entire L1 dcache.
- fix pmap_extract() for the case where the va is not page-aligned and
nothing is mapped there.
- fix calculation of TSB size. it was comparing physmem (which is
in units of pages) to constants that only make sense if they are
in units of bytes.
- avoid sleeping in pmap_enter(), instead let the caller do it.
- use pmap_kenter_pa() instead of pmap_enter() where appropriate.
- remove code to handle impossible cases in various functions.
- tweak asm code to pipeline a little better.
- remove many unnecessary spls and membars.
- lots of code cleanup.
- no doubt other stuff that I've forgotten.

the result of all this is that a fork+exit microbenchmark is 34% faster
and a fork+exec+exit microbenchmark is 28% faster.
 1.20  03-Sep-2002  thorpej Increase the default stack limit to 2M (from 512K on sparc and 1M
on sparc64).
 1.19  15-Nov-2001  soren branches: 1.19.2; 1.19.12;
MAXSLP is defined to be a machine-independent scheduling parameter,
so move it into sys/param.h.
 1.18  01-May-2001  thorpej branches: 1.18.2;
Per discussion w/ chuck and chuck, restructure the md page stuff
to use a structure called "vm_page_md", and use __HAVE_VM_PAGE_MD
and __HAVE_PMAP_PHYSSEG.
 1.17  29-Apr-2001  thorpej Add a VM_MDPAGE_MEMBERS macro that defines pmap-specific data for
each vm_page structure. Add a VM_MDPAGE_INIT() macro to init this
data when pages are initialized by UVM. These macros are mandatory,
but ports may #define them to nothing if they are not needed/used.

This deprecates struct pmap_physseg. As a transitional measure,
allow a port to #define PMAP_PHYSSEG so that it can continue to
use it until its pmap is converted to use VM_MDPAGE_MEMBERS.

Use all this stuff to eliminate a lot of extra work in the Alpha
pmap module (it's smaller and faster now). Changes to other pmap
modules will follow.
 1.16  16-Feb-2001  eeh branches: 1.16.2;
Define VM_MASUSER_ADDRESS32.
 1.15  11-Feb-2001  eeh Increase limits slightly. We're still not using all 32 address bits yet,
let alone 64.....
 1.14  18-Dec-2000  mrg - rename 32bit USRSTACK32, and define USRSTACK to that if !__arch64__, so that
64bit code can see USRSTACK32
- bump the limits
 1.13  28-Sep-2000  eeh Separate user and kernel address spaces and move the kernel down to
0x0000000001000000 -- 0x00000000f0000000, below the PROM where the
PROM thinks we should be.
 1.12  31-Aug-2000  eeh Add support for multiple memory segments.
 1.11  13-Jul-2000  mrg remove old (bogus) comment.
 1.10  11-Feb-2000  thorpej branches: 1.10.4;
Update for the NKMEMPAGES changes.
 1.9  26-Jan-2000  tsutsui Remove obsoleted macros.
 1.8  04-Dec-1999  ragge CL* discarding.
 1.7  20-Nov-1999  eeh Limit buffers to 1/4 of the kernel address space.
 1.6  26-Apr-1999  thorpej branches: 1.6.2; 1.6.8;
Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.
 1.5  16-Jan-1999  chuck branches: 1.5.4;
MNN is no longer optional, remove dead code
 1.4  13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.3  08-Jul-1998  thorpej branches: 1.3.2;
Define one page free list, and put all pages on it.
 1.2  20-Jun-1998  mrg merge comment fix.
 1.1  20-Jun-1998  eeh branches: 1.1.1;
Initial revision
 1.1.1.1  20-Jun-1998  eeh Import of sparc64.
 1.3.2.1  30-Jul-1998  eeh Split vm_offset_t and vm_size_t into paddr_t, psize_t, vaddr_t, and vsize_t.
 1.5.4.2  06-Aug-1999  chs take an initial guess at UBC parameters.
 1.5.4.1  21-Jun-1999  thorpej Sync w/ -current.
 1.6.8.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.2.4  12-Mar-2001  bouyer Sync with HEAD.
 1.6.2.3  11-Feb-2001  bouyer Sync with HEAD.
 1.6.2.2  05-Jan-2001  bouyer Sync with HEAD
 1.6.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.10.4.2  18-Oct-2000  tv Pullup by patch [eeh]:
Move KERNBASE from 0xf1000000 to 0x01000000.
 1.10.4.1  18-Jul-2000  mrg pullup the contents of -current arch/sparc64. this gives us significant
ultrasparc PCI support (ultra5, ultra10, AXi, and E250 tested so far),
plus many other small fixes. netbooting is now supported.
 1.16.2.1  21-Jun-2001  nathanw Catch up to -current.
 1.18.2.3  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.18.2.2  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.18.2.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.19.12.1  30-Nov-2002  he Pull up revision 1.20 (requested by thorpej in ticket #763):
Increase the default stack limit to 2M (from 512K on sparc
and 1M on sparc64).
 1.19.2.8  11-Dec-2002  thorpej Sync with HEAD.
 1.19.2.7  18-Oct-2002  nathanw Catch up to -current.
 1.19.2.6  17-Sep-2002  nathanw Catch up to -current.
 1.19.2.5  17-Apr-2002  nathanw Catch up to -current.
 1.19.2.4  08-Jan-2002  nathanw Catch up to -current.
 1.19.2.3  04-Jan-2002  eeh Cleanup.
 1.19.2.2  03-Jan-2002  petrov make kernel compile
 1.19.2.1  15-Nov-2001  petrov file vmparam.h was added on branch nathanw_sa on 2002-01-03 06:42:33 +0000
 1.23.2.4  01-Apr-2005  skrll Sync with HEAD.
 1.23.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.23.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.23.2.1  03-Aug-2004  skrll Sync with HEAD
 1.26.14.1  18-Sep-2005  tron Pull up following revision(s) (requested by fvdl in ticket #798):
sys/compat/sunos/sunos_exec.c: revision 1.47
sys/compat/pecoff/pecoff_emul.c: revision 1.11
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.45
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.12
sys/sys/proc.h: revision 1.198
sys/compat/mach/mach_exec.c: revision 1.56
sys/compat/freebsd/freebsd_exec.c: revision 1.27
sys/arch/sparc64/include/vmparam.h: revision 1.27
sys/kern/kern_resource.c: revision 1.91
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.88
sys/compat/osf1/osf1_exec.c: revision 1.39
sys/compat/svr4_32/svr4_32_resource.c: revision 1.5
sys/compat/ultrix/ultrix_misc.c: revision 1.99
sys/compat/svr4_32/svr4_32_exec.h: revision 1.9
sys/kern/exec_elf32.c: revision 1.103
sys/compat/aoutm68k/aoutm68k_exec.c: revision 1.19
sys/compat/sunos32/sunos32_exec.c: revision 1.20
sys/compat/hpux/hpux_exec.c: revision 1.46
sys/compat/darwin/darwin_exec.c: revision 1.40
sys/kern/sysv_shm.c: revision 1.83
sys/uvm/uvm_extern.h: revision 1.99
sys/uvm/uvm_mmap.c: revision 1.89
sys/kern/kern_exec.c: revision 1.195
sys/compat/netbsd32/netbsd32.h: revision 1.31
sys/arch/sparc64/sparc64/svr4_32_machdep.c: revision 1.20
sys/compat/svr4/svr4_exec.c: revision 1.56
sys/compat/irix/irix_exec.c: revision 1.41
sys/compat/ibcs2/ibcs2_exec.c: revision 1.63
sys/compat/svr4_32/svr4_32_exec.c: revision 1.16
sys/arch/amd64/include/vmparam.h: revision 1.8
sys/compat/linux/common/linux_exec.c: revision 1.73
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.
* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2
Tested on amd64, compile-tested on sparc64.
 1.26.10.1  26-Mar-2005  yamt sync with head.
 1.26.8.1  29-Apr-2005  kent sync with -current
 1.27.2.1  21-Jun-2006  yamt sync with head.
 1.28.2.1  01-Feb-2006  yamt sync with head.
 1.29.90.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.29.84.1  28-Apr-2009  skrll Sync with HEAD.
 1.29.76.1  04-May-2009  yamt sync with head.
 1.30.4.1  05-Mar-2011  rmind sync with head
 1.30.2.3  16-Nov-2010  uebayasi Sync with HEAD.
 1.30.2.2  26-Apr-2010  uebayasi Remove the unfinished code to add a memory segment after uvm_page_init().
It doesn't even compile.

(In the future, we should allocate struct vm_page [] on the added memory
segment for NUMA's sake.)
 1.30.2.1  23-Feb-2010  uebayasi Convert all VM_MDPAGE_INIT()'s to take struct vm_page_md * and paddr_t.
 1.32.18.3  03-Dec-2017  jdolecek update from HEAD
 1.32.18.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.32.18.1  25-Feb-2013  tls resync with head
 1.32.8.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.32.8.1  23-Jan-2013  yamt sync with head
 1.33.10.1  10-Aug-2014  tls Rebase.
 1.33.2.1  18-May-2014  rmind sync with head
 1.34.4.2  22-Apr-2016  skrll Sync with HEAD
 1.34.4.1  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.37.10.1  11-Apr-2018  martin Pull up following revision(s) (requested by mrg in ticket #733):

sys/arch/amd64/include/vmparam.h: revision 1.44
sys/arch/amd64/include/vmparam.h: revision 1.45
sys/arch/sparc64/include/vmparam.h: revision 1.38

bump PAGER_MAP_DEFAULT_SIZE to 512MB. this should allow more
concurrent IOs to be possible, and i'm unable to see pager_map
contention any more.

other larger platforms should probably do this too.
ok chs@.

Remove superfluous word in comment. Noted by Geoff Wing.

Bump PAGER_MAP_DEFAULT_SIZE to 512 MB (like amd64 recently did).
 1.38.4.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.38.4.1  10-Jun-2019  christos Sync with HEAD
 1.38.2.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.39.6.1  25-Jan-2020  ad Sync with head.
 1.39.4.1  08-Feb-2023  martin Pull up following revision(s) (requested by hgutch in ticket #1588):

sys/arch/sparc64/include/vmparam.h: revision 1.43

Avoid using (1<<64)-1 for VM_MAX{,USER}_ADDRESS as rounding that up to
the next page boundary gives 0 and instead make the VA space end one
page earlier.

Fixes PR sparc64/57219.
 1.41.2.1  03-Apr-2021  thorpej Sync with HEAD.
 1.42.18.1  08-Feb-2023  martin Pull up following revision(s) (requested by hgutch in ticket #71):

sys/arch/sparc64/include/vmparam.h: revision 1.43

Avoid using (1<<64)-1 for VM_MAX{,USER}_ADDRESS as rounding that up to
the next page boundary gives 0 and instead make the VA space end one
page earlier.

Fixes PR sparc64/57219.

RSS XML Feed