Home | History | Annotate | Download | only in uvm
History log of /src/sys/uvm/uvm_swap.c
RevisionDateAuthorComments
 1.209  22-Feb-2025  mlelstv Keep b_resid consistent on I/O errors.
 1.208  09-Apr-2023  riastradh branches: 1.208.6;
uvm(9): KASSERT(A && B) -> KASSERT(A); KASSERT(B)
 1.207  21-Dec-2022  chs swap: disallow user opens of swap block device

the swap/drum block device was never intended to allow user opens,
but when the internal VOP_OPEN() in uvm_swap_init() was added
back in rev 1.135, the d_open method was changed from always-fail
to always-succeed in order to allow the new initial internal open.
this had the side effect of incorrectly allowing user opens too.
fix this by replacing the swap_bdevsw d_open with one that succeeds
for the first call but fails for all subsequent calls.

Reported-by: syzbot+90a23d2f19e5a0a302b3@syzkaller.appspotmail.com
 1.206  23-Aug-2021  hannken branches: 1.206.4;
Return immediately from uvm_swap_shutdown() if there are
no (more) swap devices configured.
 1.205  03-Jun-2021  riastradh uvm(9): Enable swap encryption by default.

For machines where the performance impact of swapping before the
system has an opportunity to process `vm.swap_encrypt=0' in
/etc/sysctl.conf, you can disable it again by adding

options VMSWAP_DEFAULT_PLAINTEXT

to the kernel config.
 1.204  23-May-2021  mrg branches: 1.204.2;
avoid taking locks that aren't initialised.

fixes panic when typing 'reboot' at the askroot prompt.
 1.203  13-Mar-2021  skrll branches: 1.203.4; 1.203.6;
Consistently use %#jx instead of 0x%jx or just %jx in UVMHIST_LOG formats
 1.202  19-Feb-2021  hannken When turning off swap during reboot we have to lock with LK_RETRY
as regular files got reclaimed during unmount.

Adresses PR kern/54969 (Disk cache is no longer flushed on shutdown)
 1.201  16-Feb-2021  hannken Reorganize uvm_swap_shutdown() a bit, make sure the vnode gets
locked and referenced across the call to swap_off() and finally
use it from vfs_unmountall1() to remove swap after unmounting
the last file system.

Adresses PR kern/54969 (Disk cache is no longer flushed on shutdown)
 1.200  07-Oct-2020  chs branches: 1.200.2;
Add a new, more aggressive allocator for uvm_pglistalloc() to allocate
contiguous physical pages, and try this new allocator if the existing
one fails. The existing contig allocator only tries to allocate pages
that are already free, which works fine shortly after boot but rarely
works after the system has been up for a while. The new allocator uses
the pagedaemon to evict pages from memory in the hope that this will
free up a range of pages that satisfies the constraits of the request.
This should help with things like plugging in a USB device, which often
fails for some USB controllers because they can't get contigous memory.
 1.199  29-Sep-2020  msaitoh s/parition/partition/
 1.198  25-Jul-2020  riastradh Split aes_cbc_* and aes_xts_* into their own header files.

aes.h will remain just for key setup; any particular construction using
AES can have its own header file so we can have many of them without
rebuilding everything AES-related whenever one of them changes.

(Planning to add AES-CCM and AES-GCM too.)
 1.197  09-Jul-2020  skrll Consistently use UVMHIST(__func__)

Convert UVMHIST_{CALLED,LOG} into UVMHIST_CALLARGS
 1.196  08-Jul-2020  skrll Trailing whitespace
 1.195  29-Jun-2020  riastradh uvm: Make sure swap encryption IV is 128-bit-aligned on stack.

Will help hardware-assisted AES.
 1.194  29-Jun-2020  riastradh uvm(9): Switch from legacy rijndael API to new aes API.
 1.193  24-May-2020  jdolecek fix KASAN PoolUseAfterFree for async write - can't read bp after VOP_STRATEGY()

problem found and fix provided by Paul Ripke
 1.192  22-May-2020  jdolecek DRY code in uvm_swap_io() for the write loop
 1.191  21-May-2020  riastradh Let's not waste time decrypting garbage, shall we?

Skip to the end if the transfer failed.
 1.190  20-May-2020  riastradh Make swap encryption MP-safe.

Not entirely sure the rest of the swap system is MP-safe, but let's
not make it worse!

XXX Why is swap_syscall_lock an rwlock? We don't seem to take the
reader lock ever.
 1.189  10-May-2020  riastradh Rename things so the symbol better matches the sysctl name.

No functional change intended, except that the symbol that was
previously `uvm_swap_encryption' is now `uvm_swap_encrypt', backing
the sysctl knob `vm.swap_encrypt'.
 1.188  09-May-2020  riastradh Avoid overflow if a very large number of pages are swapped at once.

Unlikely, but let's make sure we don't hit this ever.
 1.187  09-May-2020  riastradh Implement swap encryption.

Enabled by sysctl -w vm.swap_encrypt=1. Key is generated lazily when
we first need to swap a page. Key is chosen independently for each
swap device. The ith swap page is encrypted with AES256-CBC using
AES256_k(le32enc(i) || 0^96) as the initialization vector. Can be
changed at any time; no need for compatibility with on-disk formats.
Costs one bit of memory per page in each swapdev, plus a few hundred
bytes per swapdev to store the expanded AES key.

Shoulda done this decades ago! Plan to enable this by default;
performance impact is unlikely to matter because it only happens when
you're already swapping anyway. Much easier to set up than cgd, so
we can rip out all the documentation about carefully setting up
random-keyed cgd at the right time.
 1.186  18-Feb-2020  chs remove the aiodoned thread. I originally added this to provide a thread context
for doing page cache iodone work, but since then biodone() has changed to
hand off all iodone work to a softint thread, so we no longer need the
special-purpose aiodoned thread.
 1.185  27-Dec-2019  msaitoh branches: 1.185.2;
s/transfered/transferred/
 1.184  14-Dec-2019  ad Update uvmexp.nswget with atomics.
 1.183  01-Dec-2019  uwe Add missing #include <sys/atomic.h>
 1.182  01-Dec-2019  ad - Adjust uvmexp.swpgonly with atomics, and make uvm_swap_data_lock static.
- A bit more __cacheline_aligned on mutexes.
 1.181  06-Oct-2019  mlelstv Defer to synchronous I/O before the aiodone work queue exists.
 1.180  27-Jan-2019  kre Remove end of line spaces - one (two in one line) added during recent merge,
one older.
 1.179  27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.178  15-Nov-2018  maxv Woah man, fix enormous leak.

Possible info leak: [len=1056, leaked=931]
#0 0xffffffff80bad351 in kleak_copyout
#1 0xffffffff80b2cf64 in uvm_swap_stats.part.1
#2 0xffffffff80b2d38d in uvm_swap_stats
#3 0xffffffff80b2d43c in sys_swapctl
#4 0xffffffff80259b82 in syscall
 1.177  15-Mar-2018  christos branches: 1.177.2;
finish moving the compat code out.
 1.176  15-Mar-2018  christos Untangle the swapctl compat code mess. Welcome to lucky 13.
 1.175  28-Oct-2017  pgoyette branches: 1.175.2;
Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...

(As proposed on tech-kern@ with additional changes and enhancements.)

Details of changes:

* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)

* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.

* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.

* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."

* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.

* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).

* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).

* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.

* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.

[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3) format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".

[2] I've tried very hard to find "all [the] existing users of kernhist(9)"
but it is possible that I've missed some of them. I would be glad to
update any stragglers that anyone identifies.
 1.174  08-Jul-2016  skrll branches: 1.174.2; 1.174.8; 1.174.10;
Remove '\n' from UVMHIST_LOG format - it is not needed.
 1.173  30-Jul-2015  maxv Lock before calling uvm_swap_stats(). Otherwise a race condition could
corrupt memory.
 1.172  25-Jul-2014  dholland branches: 1.172.2; 1.172.4; 1.172.6; 1.172.10;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.171  25-Jul-2014  dholland Add d_discard to all struct bdevsw instances I could find.

I've set them all to nodiscard. Some of them (wd, dk, vnd, ld,
raidframe, maybe cgd) should be implemented for real.
 1.170  28-Jun-2014  maxv This KASSERT can trigger a panic too easily, if SCARG(uap, cmd)=SWAP_OFF and
SCARG(uap, arg)=NULL. The same KASSERT is already in the SWAP_ON switch case,
so just delete it here.
 1.169  22-Jun-2014  maxv Sync swapctl() with netbsd32. Return EINVAL when misc<0, and 0 when misc=0
or uvmexp.nswapdev=0.
 1.168  16-Mar-2014  dholland branches: 1.168.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.167  22-Feb-2014  mlelstv Drop empty priority lists, not the full ones. Fixes kern/48611.
 1.166  03-Feb-2014  manu Properly translate struct swapent for COMPAT_NETBSD32
 1.165  23-Nov-2013  christos fix circleq comments
 1.164  23-Nov-2013  christos convert from CIRCLEQ to TAILQ
add uvm_swap_shutdown(), unused
 1.163  07-May-2013  riastradh branches: 1.163.4;
Set bp->b_resid to bp->b_bcount on error in swstrategy as required.
 1.162  27-Nov-2012  jakllsch Until such time as the swap subsystem can be converted to use The One True
Allocator, prevent panics if (MAXPHYS/PAGE_SIZE) > BLIST_MAX_ALLOC.
From Wolfgang Stukenbrock in PR#41765.
 1.161  05-Feb-2012  rmind branches: 1.161.2; 1.161.6;
- sys_swapctl: validate the number of swap devices argument for SWAP_STATS.
- uvm_swap_stats: fix a buffer overrun, add some asserts.

Reviewed by mrg@
 1.160  28-Jan-2012  rmind pool_page_alloc, pool_page_alloc_meta: avoid extra compare, use const.
ffs_mountfs,sys_swapctl: replace memset with kmem_zalloc.
sys_swapctl: move kmem_free outside the lock path.
uvm_init: fix comment, remove pointless numeration of steps.
uvm_map_enter: remove meflagval variable.
Fix some indentation.
 1.159  27-Jan-2012  para extending vmem(9) to be able to allocated resources for it's own needs.
simplifying uvm_map handling (no special kernel entries anymore no relocking)
make malloc(9) a thin wrapper around kmem(9)
(with private interface for interrupt safety reasons)

releng@ acknowledged
 1.158  12-Dec-2011  mrg implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.
 1.157  02-Sep-2011  dyoung branches: 1.157.2; 1.157.6;
Report vmem(9) errors out-of-band so that we can use vmem(9) to manage
ranges that include the least and the greatest vmem_addr_t. Update
vmem(9) uses throughout the kernel. Slightly expand on the tests in
subr_vmem.c, which still pass. I've been running a kernel with this
patch without any trouble.
 1.156  12-Jun-2011  rmind Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
 1.155  27-Apr-2011  rmind branches: 1.155.2;
Remove public uvm_swap_stats() routine, keep it internal.
 1.154  23-Apr-2011  rmind Replace "malloc" in comments, remove unnecessary header inclusions.
 1.153  19-Nov-2010  dholland branches: 1.153.2;
Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
 1.152  09-Jul-2010  hannken Replace vget() with vref()/vn_lock(), this node already has a reference.
 1.151  24-Jun-2010  hannken Clean up vnode lock operations pass 2:

VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
 1.150  02-Mar-2010  pooka branches: 1.150.2;
For the nfs throttling kludge, test against v_tag == VT_NFS instead
of v_op (the latter imposes linkage).
 1.149  07-Feb-2010  mlelstv branches: 1.149.2;
Use filesystem blocks to address filesystem objects. f_iosize just
happens to be the same for current filesystems.
 1.148  02-Feb-2010  wiz Missing 'if defined COMPAT13 or COMPAT50' in uvm_swap.c found by cppcheck
and reported by Henning Petersen in PR 42721.
 1.147  21-Oct-2009  rmind Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
 1.146  13-Sep-2009  pooka Wipe out the last vestiges of POOL_INIT with one swift stroke. In
most cases, use a proper constructor. For proplib, give a local
equivalent of POOL_INIT for the kernel object implementation. This
way the code structure can be preserved, and a local link set is
not hazardous anyway (unless proplib is split to several modules,
but that'll be the day).

tested by booting a kernel in qemu and compile-testing i386/ALL
 1.145  01-Mar-2009  mrg fix some messages function names that are wrong by using __func__.
 1.144  14-Jan-2009  mrg branches: 1.144.2;
catch up with dev_t becoming 64 bit:

- move struct oswapent into uvm_swap.c proper, calling it swapent13
- introduce a new struct swapent50, also only in uvm_swap.c
- stop using struct oswapent inside struct swapent, or struct swapdev
- rename SWAP_OSTATS SWAP_STATS13
- rename SWAP_STATS SWAP_STATS50
- add new SWAP_STATS
- rewrite the handling for SWAP_STATS13, SWAP_STATS50 and SWAP_STATS
 1.143  13-Jan-2009  yamt g/c BUFQ_FOO() macros and use bufq_foo() directly.
 1.142  17-Dec-2008  cegger kill MALLOC and FREE macros.
 1.141  13-Dec-2008  ad PR kern/40027 pagedaemon loops on memory shortage

uvm_swapisfull: don't count some small portion as it may be inaccessible to
us at any given moment, for example if there is lock contention or if pages
are busy.
 1.140  23-Sep-2008  ad branches: 1.140.2; 1.140.4;
Move test for __SWAP_BROKEN here.
 1.139  29-May-2008  mrg branches: 1.139.4;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.138  11-May-2008  kardel keep dumpcdev and dumpdev consistent
allows savecore.c@1.72 to find the right dumpdev in case it was changed
from the default - hi ad@
 1.137  29-Feb-2008  yamt branches: 1.137.2; 1.137.4; 1.137.6;
uvm_swap_io: if pagedaemon, don't wait for iobuf.
 1.136  30-Jan-2008  hannken branches: 1.136.2; 1.136.6;
Lock swapdev_vp for VOP_OPEN.

From: YAMAMOTO Takashi <yamt@netbsd.org>
 1.135  27-Jan-2008  hannken uvm_swap_init(): Call VOP_OPEN() on swapdev_vp to make I/O through the
swap device work with specnodes.

Ok: Andrew Doran <ad@netbsd.org>
 1.134  02-Jan-2008  ad Merge vmlocking2 to head.
 1.133  20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.132  08-Dec-2007  pooka branches: 1.132.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
 1.131  26-Nov-2007  pooka branches: 1.131.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
 1.130  15-Oct-2007  hannken branches: 1.130.4;
When swapping to a regular file use a workqueue to signal I/O completion.

VOP_STRATEGY() no longer gets called from interrupt context via
biodone() -> sw_reg_iodone() -> sw_reg_start().

Removes a deadlock condition reported in PR 37109.

Ok: YAMAMOTO Takashi <yamt@netbsd.org>
 1.129  29-Jul-2007  ad branches: 1.129.4; 1.129.6; 1.129.8; 1.129.10;
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.128  24-Jul-2007  ad In order to pacify assertions, make uao_list_lock + uvm_swap_data_lock
spinlocks for the time being.
 1.127  21-Jul-2007  ad Merge unobtrusive locking changes from the vmlocking branch.
 1.126  09-Jul-2007  ad branches: 1.126.2;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.125  15-Jun-2007  ad Add a sysctl to disable swapout of kernel stacks. Discussed on tech-kern@.
 1.124  22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.123  12-Mar-2007  ad branches: 1.123.2;
Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
 1.122  04-Mar-2007  christos branches: 1.122.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.121  22-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.120  22-Feb-2007  matt Fix lossage from boolean_t -> bool and updated x86 bus_dma.
 1.119  21-Feb-2007  thorpej Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.118  19-Feb-2007  ad uvm_kick_scheduler(): do nothing until the swap subsystem is initialized.
 1.117  15-Feb-2007  ad branches: 1.117.2;
Add uvm_kick_scheduler() (MP safe) to replace wakeup(&proc0).
 1.116  09-Feb-2007  ad Merge newlock2 to head.
 1.115  07-Dec-2006  elad Back out uvm_is_swap_device().
 1.114  02-Dec-2006  elad We are required to hold uvm.swap_data_lock here too.
 1.113  01-Dec-2006  elad branches: 1.113.2;
Introduce uvm_is_swap_device(), to check if the passed struct vnode * is
used as a swap device or not.

Okay mrg@.
 1.112  01-Nov-2006  yamt remove some __unused from function parameters.
 1.111  27-Oct-2006  yamt revert malloc -> kmem_alloc part of uvm_swap.c rev.1.110 because
the current implementation of kmem_free can sleep.
 1.110  22-Oct-2006  yamt extent/malloc -> vmem_alloc/kmem_alloc.
 1.109  21-Oct-2006  mrg in cpu_dumpconf(), don't panic() if we can't bdevsw_lookup() the
dumpdev. this occurs when we try to set the dumpdev to a device
with no driver loaded. this fixes PR#34872.

in sys_swapctl, if bdevsw_lookup() fails, set dumpdev = NODEV
before calling cpu_dumpconf(). (this also fixes PR#34872.)

XXX: cpu_dumpconf() should probably be changed to take a dumpdev
XXX: and return an error in such cases, but that is a much more
XXX: intrusive change.

XXX2: this is only run-tested on sparc64 and compile tested on a
XXX2: couple of platforms.
 1.108  12-Oct-2006  thorpej uvm_swap_stats_locked(): Consume the cmd argument even if COMPAT_13 is
not defined.
 1.107  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.106  08-Sep-2006  elad branches: 1.106.2;
First take at security model abstraction.

- Add a few scopes to the kernel: system, network, and machdep.

- Add a few more actions/sub-actions (requests), and start using them as
opposed to the KAUTH_GENERIC_ISSUSER place-holders.

- Introduce a basic set of listeners that implement our "traditional"
security model, called "bsd44". This is the default (and only) model we
have at the moment.

- Update all relevant documentation.

- Add some code and docs to help folks who want to actually use this stuff:

* There's a sample overlay model, sitting on-top of "bsd44", for
fast experimenting with tweaking just a subset of an existing model.

This is pretty cool because it's *really* straightforward to do stuff
you had to use ugly hacks for until now...

* And of course, documentation describing how to do the above for quick
reference, including code samples.

All of these changes were tested for regressions using a Python-based
testsuite that will be (I hope) available soon via pkgsrc. Information
about the tests, and how to write new ones, can be found on:

http://kauth.linbsd.org/kauthwiki

NOTE FOR DEVELOPERS: *PLEASE* don't add any code that does any of the
following:

- Uses a KAUTH_GENERIC_ISSUSER kauth(9) request,
- Checks 'securelevel' directly,
- Checks a uid/gid directly.

(or if you feel you have to, contact me first)

This is still work in progress; It's far from being done, but now it'll
be a lot easier.

Relevant mailing list threads:

http://mail-index.netbsd.org/tech-security/2006/01/25/0011.html
http://mail-index.netbsd.org/tech-security/2006/03/24/0001.html
http://mail-index.netbsd.org/tech-security/2006/04/18/0000.html
http://mail-index.netbsd.org/tech-security/2006/05/15/0000.html
http://mail-index.netbsd.org/tech-security/2006/08/01/0000.html
http://mail-index.netbsd.org/tech-security/2006/08/25/0000.html

Many thanks to YAMAMOTO Takashi, Matt Thomas, and Christos Zoulas for help
stablizing kauth(9).

Full credit for the regression tests, making sure these changes didn't break
anything, goes to Matt Fleming and Jaime Fournier.

Happy birthday Randi! :)
 1.105  03-Sep-2006  christos branches: 1.105.2;
add missing initializers
 1.104  22-Aug-2006  martin Add a new swapctl(2) command to unset the dump device.
 1.103  21-Jul-2006  ad - Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.102  13-Jun-2006  christos prevent uninitialized variable.
 1.101  12-Jun-2006  christos Don't allocate > 1K on the stack.
 1.100  14-May-2006  elad branches: 1.100.2;
integrate kauth.
 1.99  21-Jan-2006  matt branches: 1.99.2; 1.99.4; 1.99.6; 1.99.8; 1.99.10;
Fix u_int64_t -> uint64_t stragglers.
 1.98  04-Jan-2006  yamt - add simple functions to allocate/free a buffer for i/o.
- make bufpool static.
 1.97  11-Dec-2005  christos branches: 1.97.2;
merge ktrace-lwp.
 1.96  15-Oct-2005  yamt - change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
from sys/bufq.h to sys/bufq_impl.h.
(is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c. (not tested)
 1.95  17-Sep-2005  yamt - make uvm_swap_stats acquire swap_syscall_lock by itsself
so that callers don't need to acquire it beforehand.
- make swap_syscall_lock static.
 1.94  27-Jun-2005  thorpej branches: 1.94.2;
Sprinkle some static.
 1.93  27-Jun-2005  thorpej Use ANSI function decls.
 1.92  29-May-2005  christos avoid shadow variables.
remove unneeded casts.
 1.91  11-May-2005  yamt allocate anons on-demand, rather than reserving static amount of
them on boot/swapon.
 1.90  06-Apr-2005  yamt switch swap space allocation code to use blist instead of extent(9).
fix "warning: resource shortage: %d pages of swap lost".

extent(9) has some undesirable characteristics for swap allocation:
- it involves alloc-to-free.
- its operational cost is O(n*n) where n is number of entries.
 1.89  28-Oct-2004  yamt branches: 1.89.4; 1.89.10;
move buffer queue related stuffs from buf.h to their own header, bufq.h.
 1.88  14-May-2004  christos don't accept a negative number of swap devices; it will attempt to malloc
something very large and might crash the kernel; From Evgeny Demidov
 1.87  25-Apr-2004  simonb Initialise (most) pools from a link set instead of explicit calls
to pool_init. Untouched pools are ones that either in arch-specific
code, or aren't initialiased during initial system startup.

Convert struct session, ucred and lockf to pools.
 1.86  21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.85  24-Mar-2004  junyoung branches: 1.85.2;
- Nuke __P().
- Drop trailing spaces.
 1.84  25-Jan-2004  hannken Make VOP_STRATEGY(bp) a real VOP as discussed on tech-kern.

VOP_STRATEGY(bp) is replaced by one of two new functions:

- VOP_STRATEGY(vp, bp) Call the strategy routine of vp for bp.
- DEV_STRATEGY(bp) Call the d_strategy routine of bp->b_dev for bp.

DEV_STRATEGY(bp) is used only for block-to-block device situations.
 1.83  10-Jan-2004  yamt store a i/o priority hint in struct buf for buffer queue discipline.
 1.82  28-Aug-2003  pk When retiring a swap device with marked bad blocks on it we should update
the `# swap page in use' and `# swap page only' counters. However, at the
time of swap device removal we can no longer figure out how many of the
bad swap pages are actually also `swap only' pages.

So, on swap I/O errors arrange things to not include the bad swap pages in
the `swpgonly' counter as follows: uvm_swap_markbad() decrements `swpgonly'
by the number of bad pages, and the various VM object deallocation routines
do not decrement `swpgonly' for swap slots marked as SWSLOT_BAD.
 1.81  11-Aug-2003  pk Introduce uvm_swapisfull(), which computes the available swap space by
taking into account swap devices that are in the process of being removed.
 1.80  29-Jun-2003  fvdl branches: 1.80.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.79  29-Jun-2003  thorpej Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget(). Turns out
that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
just to appease the above.
 1.78  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.77  25-Feb-2003  thorpej Add a new BUF_INIT() macro which initializes b_dep and b_interlock, and
use it. This fixes a few places where either b_dep or b_interlock were
not properly initialized.
 1.76  05-Feb-2003  pk Make the buffer cache code MP-safe.
 1.75  01-Feb-2003  thorpej Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant. Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
 1.74  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.73  02-Nov-2002  perry /*CONTCOND*/ while (0)'ed macros
 1.72  27-Oct-2002  chs examine the B_ERROR flag instead of the b_error field to determine
whether or not an error has occured. pointed out by Stephan Uphoff.
 1.71  23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.70  27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.69  06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.68  31-Aug-2002  drochner call cpu_dumpconf() after dumpdev change, so that
the global dumpsize/dumplo get updated
 1.67  27-Jul-2002  chs allocate the bufq after zeroing the swapdev structure, not before.
 1.66  21-Jul-2002  hannken Rename bufq_init() to bufq_alloc().
Add bufq_free() to remove a buffer queue.
Avoid MALLOC while holding a spinlock.

From Chuck Silvers.
 1.65  19-Jul-2002  hannken Convert to new device buffer queue interface.
 1.64  09-May-2002  fredette branches: 1.64.2; 1.64.4;
When preparing to swap to a miniroot partition, add a little
padding to our estimate of the miniroot's size, to avoid
overwriting it.
 1.63  01-Apr-2002  manu Updated comment to reflect the creation of uvm_swap_stats()
 1.62  26-Mar-2002  manu Don't allocate struct swapent when we only need a struct oswapent.
 1.61  18-Mar-2002  manu Move swapctl(SWAP_STATS) implementation to a separate function called
uvm_swap_stats(). This is done in order to allow COMPAT_* swapctl()
emulation to use it directly without going through sys_swapctl().

The problem with using sys_swapctl() there is that it involves
copying the swapent array to the stackgap, and this array's size
is not known at build time. Hence it would not be possible to
ensure it would fit in the stackgap in any case.
 1.60  09-Mar-2002  thorpej branches: 1.60.2;
Remove PR_MALLOCOK.
 1.59  08-Mar-2002  thorpej Pool deals fairly well with physical memory shortage, but it doesn't
deal with shortages of the VM maps where the backing pages are mapped
(usually kmem_map). Try to deal with this:

* Group all information about the backend allocator for a pool in a
separate structure. The pool references this structure, rather than
the individual fields.
* Change the pool_init() API accordingly, and adjust all callers.
* Link all pools using the same backend allocator on a list.
* The backend allocator is responsible for waiting for physical memory
to become available, but will still fail if it cannot callocate KVA
space for the pages. If this happens, carefully drain all pools using
the same backend allocator, so that some KVA space can be freed.
* Change pool_reclaim() to indicate if it actually succeeded in freeing
some pages, and use that information to make draining easier and more
efficient.
* Get rid of PR_URGENT. There was only one use of it, and it could be
dealt with by the caller.

From art@openbsd.org.
 1.58  16-Dec-2001  enami G/C no longer used saved credential for file i/o.
 1.57  10-Nov-2001  lukem add RCSIDs, and in some cases, slightly cleanup #include order
 1.56  06-Nov-2001  chs add an assert and rename some variables.
 1.55  01-Nov-2001  chs allow SWAP_GETDUMPDEV for all users.
use {LIST,TAILQ}_FOREACH where appropriate.
 1.54  15-Sep-2001  chs branches: 1.54.2;
a whole bunch of changes to improve performance and robustness under load:

- remove special treatment of pager_map mappings in pmaps. this is
required now, since I've removed the globals that expose the address range.
pager_map now uses pmap_kenter_pa() instead of pmap_enter(), so there's
no longer any need to special-case it.
- eliminate struct uvm_vnode by moving its fields into struct vnode.
- rewrite the pageout path. the pager is now responsible for handling the
high-level requests instead of only getting control after a bunch of work
has already been done on its behalf. this will allow us to UBCify LFS,
which needs tighter control over its pages than other filesystems do.
writing a page to disk no longer requires making it read-only, which
allows us to write wired pages without causing all kinds of havoc.
- use a new PG_PAGEOUT flag to indicate that a page should be freed
on behalf of the pagedaemon when it's unlocked. this flag is very similar
to PG_RELEASED, but unlike PG_RELEASED, PG_PAGEOUT can be cleared if the
pageout fails due to eg. an indirect-block buffer being locked.
this allows us to remove the "version" field from struct vm_page,
and together with shrinking "loan_count" from 32 bits to 16,
struct vm_page is now 4 bytes smaller.
- no longer use PG_RELEASED for swap-backed pages. if the page is busy
because it's being paged out, we can't release the swap slot to be
reallocated until that write is complete, but unlike with vnodes we
don't keep a count of in-progress writes so there's no good way to
know when the write is done. instead, when we need to free a busy
swap-backed page, just sleep until we can get it busy ourselves.
- implement a fast-path for extending writes which allows us to avoid
zeroing new pages. this substantially reduces cpu usage.
- encapsulate the data used by the genfs code in a struct genfs_node,
which must be the first element of the filesystem-specific vnode data
for filesystems which use genfs_{get,put}pages().
- eliminate many of the UVM pagerops, since they aren't needed anymore
now that the pager "put" operation is a higher-level operation.
- enhance the genfs code to allow NFS to use the genfs_{get,put}pages
instead of a modified copy.
- clean up struct vnode by removing all the fields that used to be used by
the vfs_cluster.c code (which we don't use anymore with UBC).
- remove kmem_object and mb_object since they were useless.
instead of allocating pages to these objects, we now just allocate
pages with no object. such pages are mapped in the kernel until they
are freed, so we can use the mapping to find the page to free it.
this allows us to remove splvm() protection in several places.

The sum of all these changes improves write throughput on my
decstation 5000/200 to within 1% of the rate of NetBSD 1.5
and reduces the elapsed time for "make release" of a NetBSD 1.5
source tree on my 128MB pc to 10% less than a 1.5 kernel took.
 1.53  26-Aug-2001  chs branches: 1.53.2;
don't mess with vnode holds or buffer lists for swap i/os.
fixes problems with leaked vnode holds.
 1.52  26-May-2001  chs branches: 1.52.2;
replace {simple_,}lock{_data,}_t with struct {simple,}lock {,*}.
 1.51  25-May-2001  chs remove trailing whitespace.
 1.50  15-May-2001  ross Eliminate lhs cast (incorrectly accepted by gcc)
 1.49  09-May-2001  thorpej Use pool_init() rather than pool_create().
 1.48  09-May-2001  fvdl Avoid potential cases of sleeping while holding a spinlock. Pay attention
to SWF_FAKE when finding a swap device. GC swapdrum_add; it was only
a few lines long and called once, so just inline the code there.
 1.47  10-Mar-2001  chs eliminate the VM_PAGER_* error codes in favor of the traditional E* codes.
the mapping is:

VM_PAGER_OK 0
VM_PAGER_BAD <unused>
VM_PAGER_FAIL <unused>
VM_PAGER_PEND 0 (see below)
VM_PAGER_ERROR EIO
VM_PAGER_AGAIN EAGAIN
VM_PAGER_UNLOCK EBUSY
VM_PAGER_REFAULT ERESTART

for async i/o requests, it used to be possible for the request to
be convert to sync, and the pager would return VM_PAGER_OK or VM_PAGER_PEND
to indicate whether the caller should perform post-i/o cleanup.
this is no longer allowed; pagers must now return 0 to indicate that
the async i/o was successfully started, and the caller never needs to
worry about doing the post-i/o cleanup.
 1.46  18-Feb-2001  chs branches: 1.46.2;
clean up DIAGNOSTIC checks, use KASSERT().
 1.45  12-Feb-2001  pk SWAP_DUMPDEV,SWAP_OFF cases: make sure to release the vnode being operated on.
 1.44  04-Jan-2001  enami Use cast where appropriate to avoid integer overflow.
 1.43  27-Dec-2000  chs when we fail to allocate anons to represent new swap space,
just return an error rather than panicing.
 1.42  23-Dec-2000  enami Place a name of extent in a struct swapdev instead of dynamically
allocating it.
 1.41  27-Nov-2000  chs Initial integration of the Unified Buffer Cache project.
 1.40  17-Nov-2000  mrg add SWAP_GETDUMPDEV command support.
 1.39  13-Nov-2000  chs in swap_off(), reverse the order of vrele() and VOP_CLOSE() so that
devices will actually be notified if this is the last close.
this allows raidframe swap devices to be marked clean.
also, move the corresponding vref() into swap_on() for symmetry
and improve some comments.
 1.38  27-Jun-2000  mrg remove include of <vm/vm.h>
 1.37  19-May-2000  thorpej branches: 1.37.4;
Tell uvm_pagermapin() the direction of the I/O so that it can map
with only the protection that it needs.
 1.36  15-Apr-2000  mrg remove <vm/vm_swap.h> and <vm/vm_conf.h>
 1.35  07-Apr-2000  chs restore a brelvp() that I removed in a moment of overzealousness.
Debugged by: Brian Grayson <bgrayson@netbsd.org>
 1.34  07-Feb-2000  thorpej Fix a bug in disksort_*() which caused non-optimal ordering when multiple
active partitions were on a single spindle. Add a b_rawblkno member to
struct buf which contains the non-partition-relative block number to sort
by.
 1.33  21-Jan-2000  thorpej Update for sys/buf.h/disksort_*() changes.
 1.32  11-Jan-2000  chs add support for ``swapctl -d'' (removing swap space).
improve handling of i/o errors in swap space.

reviewed by: Chuck Cranor
 1.31  04-Jan-2000  wrstuden Revert rev 1.28 -> 1.29. The VOP_CLOSE call was happeneing with the vnode
already locked, so don't lock it here.
 1.30  15-Nov-1999  fvdl Add Kirk McKusick's soft updates code to the trunk. Not enabled by
default, as the copyright on the main file (ffs_softdep.c) is such
that is has been put into gnusrc. options SOFTDEP will pull this
in. This code also contains the trickle syncer.

Bump version number to 1.4O
 1.29  16-Oct-1999  wrstuden branches: 1.29.2; 1.29.4;
In spec_close(), if we're not doing a non-blocking close and VXLOCK is
not set, unlock the vnode before calling the device's close routine and
relock it after it returns. tty close routines will sleep waiting for
buffers to drain, which won't happen often times as the other side needs
to grab the vnode lock first.

Make all unmount routines lock the device vnode before calling VOP_CLOSE().
 1.28  22-Jul-1999  thorpej branches: 1.28.2;
Garbage collect thread_sleep()/thread_wakeup() left over from the old
Mach VM code. Also nuke iprintf(), which was no longer used anywhere.

Add proclist locking where appropriate.
 1.27  30-Mar-1999  chs branches: 1.27.2; 1.27.4;
remove some old #if 0'd-out debugging code.
 1.26  26-Mar-1999  chs add uvmexp.swpgonly and use it to detect out-of-swap conditions.
 1.25  18-Mar-1999  chs VHOLD() must be called at splbio() since HOLDRELE() is called
from the iodone handler.
 1.24  23-Feb-1999  mrg handle SWAP_DUMPDEV
 1.23  26-Dec-1998  marc When a reference is made to a hole in a swap file, panic. The optimal
thing would be to allocate the block, but I don't know how to do this.
The panic is preferable to the random memory corruption the old code
was causing.
 1.22  08-Nov-1998  mycroft branches: 1.22.2;
Clear B_NOCACHE when we're done with the buffer -- although this is probably
pointless.
 1.21  08-Nov-1998  mycroft Set the B_NOCACHE bit so that NFSv3 will not try to do async writes.
 1.20  18-Oct-1998  chs shift by PAGE_SHIFT instead of multiplying or dividing by PAGE_SIZE.
 1.19  06-Sep-1998  pk Panic instead failing the syscall on an impossible condition (from Robert Elz).
Plug possible memory leakage with the recently added device path stuff.
 1.18  30-Aug-1998  enami Define `len' as size_t rather than int so that correct type is passed
as fourth argument of copystr.
 1.17  29-Aug-1998  mrg move <vm/vm_swap.h> to <sys/swap.h>. <vm/vm_swap.h> still works for now (goes away later)
 1.16  29-Aug-1998  mrg add a `char se_path[PATH_MAX]' member to struct swapent, that
the pathname of the swap device is saved into. add a char *swd_path
member to struct swapdev, that contains a copy of the pathname
(using malloc(9)). rename swapctl(2)'s SWAP_STATS to SWAP_OSTATS,
and add a new SWAP_STATS command (number). make swapctl(SWAP_STATS,
...) [new version] copy the path out. if COMPAT_13, also include
support for SWAP_OSTATS. also fix a minor bug in swapctl(2).

the point of this is that swapfiles are now shown in `swapctl -l'.
 1.15  13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.14  09-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.13  24-Jul-1998  thorpej branches: 1.13.2;
Put back swap_data_lock, which was apparently deleted accidentally during
the last round of changes. (I noticed it because I run my kernels w/
LOCKDEBUG.)
 1.12  23-Jul-1998  pk Use memory pools to allocate swap buffers. Allocations are all dynamic;
in particular `nswbuf' is gone, as is the private "struct buf" list that
was previously maintained in here.
 1.11  08-Jul-1998  pk Make sure to release buffers only once.
 1.10  17-Jun-1998  ross Correct an expression that tried to compute the swap size in bytes using
an int object, this sometimes prevented swap_on() of a dev/file > 2^31 bytes.
 1.9  01-May-1998  mrg fix a problem with swapping to files where a new variable introduced was not
later incremented correctedly, causing the wrong data to be paged out, which
then caused general lossage later when the data was paged in and the process
tried to use it. found by pk.
 1.8  09-Mar-1998  mrg KNF.
 1.7  01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.6  19-Feb-1998  thorpej Include the NFS option header.
 1.5  10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.4  08-Feb-1998  mrg move pdhist initialisation to the same place as maphist. also, declare
the history buffers are "struct uvm_history_ent" to ensure proper
alignment (eg, alpha). this fixes a boottime panic when the pdhist was
used before it had been initialised.
 1.3  07-Feb-1998  mrg restore rcsids
 1.2  06-Feb-1998  thorpej RCS ID police.
 1.1  05-Feb-1998  mrg branches: 1.1.1;
Initial revision
 1.1.1.1  05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the UVM kernel code portion.


this will be KNF'd shortly. :-)
 1.13.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.22.2.4  30-May-1999  chs in uvm_swap_io()'s async case, set the aio flags to indicate whether
or not the i/o is being started by the pagedaemon.
 1.22.2.3  09-Apr-1999  chs swapbuf aiodones now handled by aiodone daemon, not pagedaemon.
 1.22.2.2  25-Feb-1999  chs remove sw_sq from swapbuf, it's unused.
in uvm_swap_get(), use VM_PAGER_OK instead of 0.
thread_wakeup() -> wakeup().
 1.22.2.1  09-Nov-1998  chs initial snapshot. lots left to do.
 1.27.4.3  31-Jul-1999  chs in uvm_swap_io(), initialize some more buf fields that we now use.
 1.27.4.2  04-Jul-1999  chs remove swapbufs, plain ol' bufs are sufficient now.
remove uvm_swap_*iodone().
 1.27.4.1  07-Jun-1999  chs merge everything from chs-ubc branch.
 1.27.2.2  08-Jan-2000  he Pull up revision 1.31 (requested by wrstuden):
Revert a previous change regarding spec_close handling. The
vnode being closed was already locked, so do not try to re-lock.
The result before this fix was that failed attempts at "swapon"
would panic the machine.
 1.27.2.1  18-Oct-1999  cgd pull up rev 1.29 from trunk (requested by wrstuden):
In spec_close(), call the device's close routine with the vnode
unlocked if the call might block. Force a non-blocking close if
VXLOCK is set. This eliminates a potential deadlock situation, and
should eliminate the dirty buffers on reboot issue.
 1.28.2.2  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.28.2.1  21-Dec-1999  wrstuden Initial commit of recent changes to make DEV_BSIZE go away.

Runs on i386, needs work on other arch's. Main kernel routines should be
fine, but a number of the stand programs need help.

cd, fd, ccd, wd, and sd have been updated. sd has been tested with non-512
byte block devices. vnd, raidframe, and lfs need work.

Non 2**n block support is automatic for LKM's and conditional for kernels
on "options NON_PO2_BLOCKS".
 1.29.4.1  19-Oct-1999  fvdl Bring in Kirk McKusick's FFS softdep code on a branch.
 1.29.2.5  12-Mar-2001  bouyer Sync with HEAD.
 1.29.2.4  05-Jan-2001  bouyer Sync with HEAD
 1.29.2.3  08-Dec-2000  bouyer Sync with HEAD.
 1.29.2.2  22-Nov-2000  bouyer Sync with HEAD.
 1.29.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.37.4.3  30-Sep-2002  itojun sys/uvm/uvm_swap.c 1.68

Call cpu_dumpconf() after dumpdev change, so that the global
dumpsize/dumplo get updated.

(drochner)
 1.37.4.2  14-Feb-2002  he Pull up revision 1.43 (requested by chs):
Make memory allocation failures during ``swapctl -a'' return an error
instead of causing a panic.
 1.37.4.1  13-Nov-2000  tv Pullup 1.39 [chs]:
in swap_off(), reverse the order of vrele() and VOP_CLOSE() so that
devices will actually be notified if this is the last close.
this allows raidframe swap devices to be marked clean.
also, move the corresponding vref() into swap_on() for symmetry
and improve some comments.
 1.46.2.15  11-Nov-2002  nathanw Catch up to -current
 1.46.2.14  18-Oct-2002  nathanw Catch up to -current.
 1.46.2.13  17-Sep-2002  nathanw Catch up to -current.
 1.46.2.12  01-Aug-2002  nathanw Catch up to -current.
 1.46.2.11  12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.46.2.10  20-Jun-2002  nathanw Catch up to -current.
 1.46.2.9  29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.46.2.8  17-Apr-2002  nathanw Catch up to -current.
 1.46.2.7  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.46.2.6  08-Jan-2002  nathanw Catch up to -current.
 1.46.2.5  14-Nov-2001  nathanw Catch up to -current.
 1.46.2.4  21-Sep-2001  nathanw Catch up to -current.
 1.46.2.3  21-Jun-2001  nathanw Catch up to -current.
 1.46.2.2  09-Apr-2001  nathanw Catch up with -current.
 1.46.2.1  05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.52.2.6  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.52.2.5  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.52.2.4  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.52.2.3  16-Mar-2002  jdolecek Catch up with -current.
 1.52.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.52.2.1  13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.53.2.3  01-Oct-2001  fvdl Catch up with -current.
 1.53.2.2  18-Sep-2001  fvdl Various changes to make cloning devices possible:

* Add an extra argument (struct vnode **) to VOP_OPEN. If it is
not NULL, specfs will create a cloned (aliased) vnode during
the call, and return it there. The caller should release and
unlock the original vnode if a new vnode was returned. The
new vnode is returned locked.

* Add a flag field to the cdevsw and bdevsw structures.
DF_CLONING indicates that it wants a new vnode for each
open (XXX is there a better way? devprop?)

* If a device is cloning, always call the close entry
point for a VOP_CLOSE.


Also, rewrite cons.c to do the right thing with vnodes. Use VOPs
rather then direct device entry calls. Suggested by mycroft@

Light to moderate testing done an i386 system (arch doesn't matter
though, these are MI changes).
 1.53.2.1  07-Sep-2001  thorpej Commit my "devvp" changes to the thorpej-devvp branch. This
replaces the use of dev_t in most places with a struct vnode *.

This will form the basic infrastructure for real cloning device
support (besides being architecurally cleaner -- it'll be good
to get away from using numbers to represent objects).
 1.54.2.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.60.2.1  11-Mar-2002  thorpej Convert swap_syscall_lock and uvm.swap_data_lock to adaptive mutexes,
and rename them apporpriately.
 1.64.4.1  02-Oct-2002  lukem Pull up revision 1.68 (requested by drochner in ticket #876):
call cpu_dumpconf() after dumpdev change, so that
the global dumpsize/dumplo get updated
 1.64.2.3  29-Aug-2002  gehenna catch up with -current.
 1.64.2.2  20-Jul-2002  gehenna catch up with -current.
 1.64.2.1  16-May-2002  gehenna Add bdevsw/cdevsw for swap device.
Replace with devsw APIs.
 1.80.2.7  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.80.2.6  02-Nov-2004  skrll Sync with HEAD.
 1.80.2.5  21-Sep-2004  skrll Fix the sync with head I botched.
 1.80.2.4  18-Sep-2004  skrll Sync with HEAD.
 1.80.2.3  24-Aug-2004  skrll Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget(). Turns out
that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
just to appease the above.
 1.80.2.2  03-Aug-2004  skrll Sync with HEAD
 1.80.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.85.2.1  15-May-2004  tron Pull up revision 1.88 (requested by christos in ticket #338):
don't accept a negative number of swap devices; it will attempt to malloc
something very large and might crash the kernel; From Evgeny Demidov
 1.89.10.2  06-Apr-2006  tron Backout ticket #1241 because it requires the blist framework which
is not available in NetBSD 3.x.
 1.89.10.1  06-Apr-2006  tron Pull up following revision(s) (requested by jld in ticket #1241):
sys/uvm/uvm_swap.c: revision 1.90
switch swap space allocation code to use blist instead of extent(9).
fix "warning: resource shortage: %d pages of swap lost".
extent(9) has some undesirable characteristics for swap allocation:
- it involves alloc-to-free.
- its operational cost is O(n*n) where n is number of entries.
 1.89.4.1  29-Apr-2005  kent sync with -current
 1.94.2.9  17-Mar-2008  yamt sync with head.
 1.94.2.8  04-Feb-2008  yamt sync with head.
 1.94.2.7  21-Jan-2008  yamt sync with head
 1.94.2.6  07-Dec-2007  yamt sync with head
 1.94.2.5  27-Oct-2007  yamt sync with head.
 1.94.2.4  03-Sep-2007  yamt sync with head.
 1.94.2.3  26-Feb-2007  yamt sync with head.
 1.94.2.2  30-Dec-2006  yamt sync with head.
 1.94.2.1  21-Jun-2006  yamt sync with head.
 1.97.2.2  01-Feb-2006  yamt sync with head.
 1.97.2.1  15-Jan-2006  yamt sync with head.
 1.99.10.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.99.8.3  06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.99.8.2  10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.99.8.1  08-Mar-2006  elad Adapt to kernel authorization changes.
 1.99.6.5  14-Sep-2006  yamt sync with head.
 1.99.6.4  03-Sep-2006  yamt sync with head.
 1.99.6.3  11-Aug-2006  yamt sync with head
 1.99.6.2  26-Jun-2006  yamt sync with head.
 1.99.6.1  24-May-2006  yamt sync with head.
 1.99.4.1  01-Jun-2006  kardel Sync with head.
 1.99.2.1  09-Sep-2006  rpaulo sync with head
 1.100.2.1  19-Jun-2006  chap Sync with head.
 1.105.2.3  30-Jan-2007  ad Remove support for SA. Ok core@.
 1.105.2.2  12-Jan-2007  ad Sync with head.
 1.105.2.1  18-Nov-2006  ad Sync with head.
 1.106.2.2  10-Dec-2006  yamt sync with head.
 1.106.2.1  22-Oct-2006  yamt sync with head
 1.113.2.2  09-Dec-2006  bouyer Pull up following revision(s) (requested by elad in ticket #261):
sys/uvm/uvm_extern.h: revision 1.123
sys/uvm/uvm_swap.c: revision 1.115
share/man/man9/uvm.9: revision 1.79
Back out uvm_is_swap_device().
 1.113.2.1  02-Dec-2006  bouyer Pull up following revision(s) (requested by elad in ticket #241):
sys/uvm/uvm_swap.c: revision 1.114
We are required to hold uvm.swap_data_lock here too.
 1.117.2.4  07-May-2007  yamt sync with head.
 1.117.2.3  24-Mar-2007  yamt sync with head.
 1.117.2.2  12-Mar-2007  rmind Sync with HEAD.
 1.117.2.1  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.122.2.15  25-Oct-2007  ad Fix swap to block devices.
 1.122.2.14  23-Oct-2007  ad Sync with head.
 1.122.2.13  28-Aug-2007  yamt fix swapping after buffer locking changes. (on regular files, at least)
 1.122.2.12  24-Aug-2007  ad Sync with buffer cache locking changes. See buf.h/vfs_bio.c for details.
Some minor portions are incomplete and needs to be verified as a whole.
 1.122.2.11  19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.122.2.10  15-Jul-2007  ad Sync with head.
 1.122.2.9  23-Jun-2007  ad - Lock v_cleanblkhd, v_dirtyblkhd, v_numoutput with the vnode's interlock.
Get rid of global_v_numoutput_lock. Partially incomplete as the buffer
cache locking doesn't work very well and needs an overhaul.
- Some changes to try and make softdep MP safe. Untested.
 1.122.2.8  17-Jun-2007  ad - Increase the number of thread priorities from 128 to 256. How the space
is set up is to be revisited.
- Implement soft interrupts as kernel threads. A generic implementation
is provided, with hooks for fast-path MD code that can run the interrupt
threads over the top of other threads executing in the kernel.
- Split vnode::v_flag into three fields, depending on how the flag is
locked (by the interlock, by the vnode lock, by the file system).
- Miscellaneous locking fixes and improvements.
 1.122.2.7  08-Jun-2007  ad Sync with head.
 1.122.2.6  13-May-2007  ad - Pass the error number and residual count to biodone(), and let it handle
setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.
 1.122.2.5  09-Apr-2007  ad - Add two new arguments to kthread_create1: pri_t pri, bool mpsafe.
- Fork kthreads off proc0 as new LWPs, not new processes.
 1.122.2.4  08-Apr-2007  ad Correct a comment.
 1.122.2.3  21-Mar-2007  ad - Replace more simple_locks, and fix up in a few places.
- Use condition variables.
- LOCK_ASSERT -> KASSERT.
 1.122.2.2  13-Mar-2007  ad Pull in the initial set of changes for the vmlocking branch.
 1.122.2.1  13-Mar-2007  ad Sync with head.
 1.123.2.1  11-Jul-2007  mjf Sync with head.
 1.126.2.1  15-Aug-2007  skrll Sync with HEAD.
 1.129.10.2  29-Jul-2007  ad It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.129.10.1  29-Jul-2007  ad file uvm_swap.c was added on branch matt-mips64 on 2007-07-29 13:31:19 +0000
 1.129.8.1  18-Oct-2007  yamt sync with head.
 1.129.6.3  23-Mar-2008  matt sync with HEAD
 1.129.6.2  09-Jan-2008  matt sync with HEAD
 1.129.6.1  06-Nov-2007  matt sync with HEAD
 1.129.4.3  09-Dec-2007  jmcneill Sync with HEAD.
 1.129.4.2  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.129.4.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.130.4.3  18-Feb-2008  mjf Sync with HEAD.
 1.130.4.2  27-Dec-2007  mjf Sync with HEAD.
 1.130.4.1  08-Dec-2007  mjf Sync with HEAD.
 1.131.2.2  26-Dec-2007  ad Sync with head.
 1.131.2.1  04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.132.4.1  02-Jan-2008  bouyer Sync with HEAD
 1.136.6.5  17-Jan-2009  mjf Sync with HEAD.
 1.136.6.4  28-Sep-2008  mjf Sync with HEAD.
 1.136.6.3  02-Jun-2008  mjf Sync with HEAD.
 1.136.6.2  03-Apr-2008  mjf Sync with HEAD.
 1.136.6.1  29-Mar-2008  mjf - etc/devfsd.conf: Add some rules to give nodes like /dev/tty and
/dev/null better default modes, i.e. 0666.

- sbin/init: Run devfsd -s before going to multiuser.

- sys/arch: Provide arm32, i386, sparc with a mem_init() function to request
device nodes for /dev/null, /dev/zero, etc.

- sys/dev: Convert rnd, wd, agp, raid, cd, sd, wsdisplay, wskbd, wsmouse,
wsmux, tty, bpf, swap to devfs New World Order.

- sys/fs/devfs: Make the visibility attribute of device nodes configurable.
Also provide a function to mount a devfs on boot.

- sys/kern: Add a new boot flag, -n. This disables devfs support. Unless
the -n flag is specified the kernel will mount a devfs file
system on boot.
 1.136.2.1  24-Mar-2008  keiichi sync with head.
 1.137.6.4  10-Oct-2008  skrll Sync with HEAD.
 1.137.6.3  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.137.6.2  14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.137.6.1  10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.137.4.5  11-Aug-2010  yamt sync with head.
 1.137.4.4  11-Mar-2010  yamt sync with head
 1.137.4.3  16-Sep-2009  yamt sync with head
 1.137.4.2  04-May-2009  yamt sync with head.
 1.137.4.1  16-May-2008  yamt sync with head.
 1.137.2.2  04-Jun-2008  yamt sync with head
 1.137.2.1  18-May-2008  yamt sync with head.
 1.139.4.1  19-Oct-2008  haad Sync with HEAD.
 1.140.4.1  27-Dec-2008  snj branches: 1.140.4.1.4;
Pull up following revision(s) (requested by bouyer in ticket #211):
sys/uvm/uvm_swap.c: revision 1.141
PR kern/40027 pagedaemon loops on memory shortage
uvm_swapisfull: don't count some small portion as it may be inaccessible to
us at any given moment, for example if there is lock contention or if pages
are busy.
 1.140.4.1.4.1  04-Apr-2012  matt Move the uvm_scheduler_mutex and cv init to uvm_init since they are
independent of VMSWAP.
 1.140.2.2  03-Mar-2009  skrll Sync with HEAD.
 1.140.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.144.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.149.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.149.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.150.2.4  31-May-2011  rmind sync with head
 1.150.2.3  05-Mar-2011  rmind sync with head
 1.150.2.2  03-Jul-2010  rmind sync with head
 1.150.2.1  16-Mar-2010  rmind Change struct uvm_object::vmobjlock to be dynamically allocated with
mutex_obj_alloc(). It allows us to share the locks among UVM objects.
 1.153.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.155.2.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.157.6.1  18-Feb-2012  mrg merge to -current.
 1.157.2.3  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.157.2.2  16-Jan-2013  yamt sync with (a bit old) head
 1.157.2.1  17-Apr-2012  yamt sync with head
 1.161.6.4  03-Dec-2017  jdolecek update from HEAD
 1.161.6.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.161.6.2  23-Jun-2013  tls resync from head
 1.161.6.1  25-Feb-2013  tls resync with head
 1.161.2.2  27-Oct-2014  msaitoh Pull up following revision(s) (requested by riastradh in ticket #1133):
sys/uvm/uvm_swap.c: revision 1.163
Set bp->b_resid to bp->b_bcount on error in swstrategy as required.
 1.161.2.1  18-Mar-2014  msaitoh Pull up following revision(s) (requested by manu in ticket #1025):
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.184
sys/uvm/uvm_swap.c: revision 1.166
sys/uvm/uvm_swap.h: revision 1.20
sys/compat/netbsd32/netbsd32.h: revision 1.99
Properly translate struct swapent for COMPAT_NETBSD32
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)
 1.163.4.1  18-May-2014  rmind sync with head
 1.168.2.1  10-Aug-2014  tls Rebase.
 1.172.10.1  25-Dec-2018  martin Apply patch, requested by maxv in ticket #1666:
Fix similar to:

sys/uvm/uvm_swap.c: revision 1.178

Woah man, fix enormous leak.

Possible info leak: [len=1056, leaked=931]
#0 0xffffffff80bad351 in kleak_copyout
#1 0xffffffff80b2cf64 in uvm_swap_stats.part.1
#2 0xffffffff80b2d38d in uvm_swap_stats
#3 0xffffffff80b2d43c in sys_swapctl
#4 0xffffffff80259b82 in syscall
 1.172.6.1  25-Dec-2018  martin Apply patch, requested by maxv in ticket #1666:
Fix similar to:

sys/uvm/uvm_swap.c: revision 1.178

Woah man, fix enormous leak.

Possible info leak: [len=1056, leaked=931]
#0 0xffffffff80bad351 in kleak_copyout
#1 0xffffffff80b2cf64 in uvm_swap_stats.part.1
#2 0xffffffff80b2d38d in uvm_swap_stats
#3 0xffffffff80b2d43c in sys_swapctl
#4 0xffffffff80259b82 in syscall
 1.172.4.2  09-Jul-2016  skrll Sync with HEAD
 1.172.4.1  22-Sep-2015  skrll Sync with HEAD
 1.172.2.1  25-Dec-2018  martin Apply patch, requested by maxv in ticket #1666:
Fix similar to:

sys/uvm/uvm_swap.c: revision 1.178

Woah man, fix enormous leak.

Possible info leak: [len=1056, leaked=931]
#0 0xffffffff80bad351 in kleak_copyout
#1 0xffffffff80b2cf64 in uvm_swap_stats.part.1
#2 0xffffffff80b2d38d in uvm_swap_stats
#3 0xffffffff80b2d43c in sys_swapctl
#4 0xffffffff80259b82 in syscall
 1.174.10.2  25-Dec-2018  martin Apply patch, requested by maxv in ticket #1142:
Similar to:

sys/uvm/uvm_swap.c: revision 1.178

Fix kernel info leak in swapctl(2).

Possible info leak: [len=1056, leaked=931]
#0 0xffffffff80bad351 in kleak_copyout
#1 0xffffffff80b2cf64 in uvm_swap_stats.part.1
#2 0xffffffff80b2d38d in uvm_swap_stats
#3 0xffffffff80b2d43c in sys_swapctl
#4 0xffffffff80259b82 in syscall
 1.174.10.1  02-Nov-2017  snj Pull up following revision(s) (requested by pgoyette in ticket #335):
share/man/man9/kernhist.9: 1.5-1.8
sys/arch/acorn26/acorn26/pmap.c: 1.39
sys/arch/arm/arm32/fault.c: 1.105 via patch
sys/arch/arm/arm32/pmap.c: 1.350, 1.359
sys/arch/arm/broadcom/bcm2835_bsc.c: 1.7
sys/arch/arm/omap/if_cpsw.c: 1.20
sys/arch/arm/omap/tiotg.c: 1.7
sys/arch/evbarm/conf/RPI2_INSTALL: 1.3
sys/dev/ic/sl811hs.c: 1.98
sys/dev/usb/ehci.c: 1.256
sys/dev/usb/if_axe.c: 1.83
sys/dev/usb/motg.c: 1.18
sys/dev/usb/ohci.c: 1.274
sys/dev/usb/ucom.c: 1.119
sys/dev/usb/uhci.c: 1.277
sys/dev/usb/uhub.c: 1.137
sys/dev/usb/umass.c: 1.160-1.162
sys/dev/usb/umass_quirks.c: 1.100
sys/dev/usb/umass_scsipi.c: 1.55
sys/dev/usb/usb.c: 1.168
sys/dev/usb/usb_mem.c: 1.70
sys/dev/usb/usb_subr.c: 1.221
sys/dev/usb/usbdi.c: 1.175
sys/dev/usb/usbdi_util.c: 1.67-1.70
sys/dev/usb/usbroothub.c: 1.3
sys/dev/usb/xhci.c: 1.75
sys/external/bsd/drm2/dist/drm/i915/i915_gem.c: 1.34
sys/kern/kern_history.c: 1.15
sys/kern/kern_xxx.c: 1.74
sys/kern/vfs_bio.c: 1.275-1.276
sys/miscfs/genfs/genfs_io.c: 1.71
sys/sys/kernhist.h: 1.21
sys/ufs/ffs/ffs_balloc.c: 1.63
sys/ufs/lfs/lfs_vfsops.c: 1.361
sys/ufs/lfs/ulfs_inode.c: 1.21
sys/ufs/lfs/ulfs_vnops.c: 1.52
sys/ufs/ufs/ufs_inode.c: 1.102
sys/ufs/ufs/ufs_vnops.c: 1.239
sys/uvm/pmap/pmap.c: 1.37-1.39
sys/uvm/pmap/pmap_tlb.c: 1.22
sys/uvm/uvm_amap.c: 1.108
sys/uvm/uvm_anon.c: 1.64
sys/uvm/uvm_aobj.c: 1.126
sys/uvm/uvm_bio.c: 1.91
sys/uvm/uvm_device.c: 1.66
sys/uvm/uvm_fault.c: 1.201
sys/uvm/uvm_km.c: 1.144
sys/uvm/uvm_loan.c: 1.85
sys/uvm/uvm_map.c: 1.353
sys/uvm/uvm_page.c: 1.194
sys/uvm/uvm_pager.c: 1.111
sys/uvm/uvm_pdaemon.c: 1.109
sys/uvm/uvm_swap.c: 1.175
sys/uvm/uvm_vnode.c: 1.103
usr.bin/vmstat/vmstat.c: 1.219
Reorder to test for null before null deref in debug code
--
Reorder to test for null before null deref in debug code
--
KNF
--
No need for '\n' in UVMHIST_LOG
--
normalise a BIOHIST log message
--
Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...
(As proposed on tech-kern@ with additional changes and enhancements.)
Details of changes:
* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)
* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.
* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.
* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."
* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.
* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).
* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).
* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.
* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.
[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3)
format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".
[2] I've tried very hard to find "all [the] existing users of
kernhist(9)"
but it is possible that I've missed some of them. I would be glad
to
update any stragglers that anyone identifies.
--
For some reason this single kernel seems to have outgrown its declared
size as a result of the kernhist(9) changes. Bump the size.
XXX The amount of increase may be excessive - anyone with more detailed
XXX knowledge please feel free to further adjust the value
appropriately.
--
Misssed one cast of pointer --> uintptr_t in previous kernhist(9) commit
--
And yet another one. :(
--
Use correct mark-up for NetBSD version.
--
More improvements in grammar and readability.
--
Remove a stray '"' (obvious typo) and add a couple of casts that are
probably needed.
--
And replace an instance of "%p" conversion with "%#jx"
--
Whitespace fix. Give Bl tag table a width. Fix Xr.
 1.174.8.1  27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.174.2.1  20-Jul-2016  pgoyette Adapt machine-independant code to the new {b,c}devsw reference-counting
(using localcount(9)). All callers of {b,c}devsw_lookup() now call
{b,c}devsw_lookup_acquire() which retains a reference on the 'struct
{b,c}devsw'. This reference must be released by the caller once it is
finished with the structure's content (or other data that would disappear
if the 'struct {b,c}devsw' were to disappear).
 1.175.2.5  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.175.2.4  15-Mar-2018  pgoyette Resolve conflicts from sync-with-HEAD
 1.175.2.3  15-Mar-2018  pgoyette Synch with HEAD
 1.175.2.2  13-Mar-2018  pgoyette Properly detect 'compat handler for SWAP_STATSxx not present' and return
EINVAL as we would for any other unsupported command.
 1.175.2.1  13-Mar-2018  pgoyette Move the swapstats compat code into the compat_netbsd module.

Without this, a kernel configured without COMPAT_13 and/or COMPAT_50
could not execute the compat swapstats code, even if the compat_netbsd
module had been loaded.
 1.177.2.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.177.2.1  10-Jun-2019  christos Sync with HEAD
 1.185.2.1  29-Feb-2020  ad Sync with head.
 1.200.2.1  03-Apr-2021  thorpej Sync with HEAD.
 1.203.6.1  31-May-2021  cjep sync with head
 1.203.4.1  17-Jun-2021  thorpej Sync w/ HEAD.
 1.204.2.1  06-Jun-2021  cjep sync with head
 1.206.4.1  21-Dec-2022  martin Pull up following revision(s) (requested by chs in ticket #13):

sys/uvm/uvm_swap.c: revision 1.207

swap: disallow user opens of swap block device

the swap/drum block device was never intended to allow user opens,
but when the internal VOP_OPEN() in uvm_swap_init() was added
back in rev 1.135, the d_open method was changed from always-fail
to always-succeed in order to allow the new initial internal open.
this had the side effect of incorrectly allowing user opens too.
fix this by replacing the swap_bdevsw d_open with one that succeeds
for the first call but fails for all subsequent calls.
 1.208.6.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed