Home | History | Annotate | only in /src/sys/rump/librump/rumpkern
History log of /src/sys/rump/librump/rumpkern
RevisionDateAuthorComments
 1.2 21-Aug-2015  christos Remove KERN.ioconf, ksyms does not really need it.
 1.1 20-Aug-2015  christos generate ioconf.h for pseudo-device attach prototype
 1.3 17-Dec-2019  ad Rump is living up to its name
 1.2 16-Dec-2019  ad - Extend the per-CPU counters matt@ did to include all of the hot counters
in UVM, excluding uvmexp.free, which needs special treatment and will be
done with a separate commit. Cuts system time for a build by 20-25% on
a 48 CPU machine w/DIAGNOSTIC.

- Avoid 64-bit integer divide on every fault (for rnd_add_uint32).
 1.1 13-May-2019  bad branches: 1.1.2;
On the one thousand and ninth day rump's mainbus was moved from
rumpdev to rumpkern, liberating all rumpnet users from the need to
-lrumpdev -lrumpvfs just because a loopback interface is mandatory.

Rename rumpdev/autoconf.c to rumpkern/rump_autoconf.c to avoid
accidentally picking up e.g. sys/arch/amd64/amd64/autoconf.c through
make's .PATH.
Move rumpdev/MAINBUS.ioconf to rumpkern.
 1.1.2.2 10-Jun-2019  christos Sync with HEAD
 1.1.2.1 13-May-2019  christos file MAINBUS.ioconf was added on branch phil-wifi on 2019-06-10 22:09:53 +0000
 1.43 29-Jul-2008  pooka Install rump libraries and utilities to the base system and remove the
private non-installed build infrastructure from sys/rump.

breakdown of commit:
* install relevant headers into /usr/include/rump
* build sys/rump/librump/rumpuser and sys/rump/librump/rumpkern
from src/lib and install as librumpuser and librump, respectively
+ this retains the ability to test a librump build with just the
kernel sources at hand
* move sys/rump/fs/lib/libukfs and sys/rump/fs/lib/libp2k to src/lib
for general consumption, they are not kernel-space dwellers anyway
* build and install sys/rump/fs/lib/lib$fs as librumpfs_$fs
* add chapter 3 manual pages for rump, rumpuser, ukfs and p2k
* build and install userspace kernel file system daemons if MKPUFFS=yes
is spexified
* retire fsconsole for now, it will make a comeback with an actually
implemented version shortly
 1.42 28-Jul-2008  pooka blkset.S is needed on vax by some macros, so include it in the build.
 1.41 20-Jul-2008  pooka You must untypo what you have typoed: rumpnode_if.h -> rumpvnode_if.h
 1.40 16-Jul-2008  pooka vfs_subr2 has lost its will to live. vfs_subr was originally split
into two parts so that some of the routines could be used by rump.
Now that rump uses both vfs_subr and vfs_subr2 and there is no
reason to keep two files lying around, re-unite them.
 1.39 02-Jul-2008  he branches: 1.39.2;
Add dependencies on the input files + Makefile for the auto-generated
files rumpdefs.h, rumpnode_if.h, and rumpvnode_if.c. This is so that
an UPDATE build has a chance of succeeding.

Discussed with pooka@, and he wasn't totally against adding this...
 1.38 01-Jul-2008  pooka Fixes to build rump utilities as host binaries on Linux by removing
sys namespace pollution which has crept in.

Submitted in private mail by takemura, domain ca2.so-net.ne.jp
 1.37 30-Jun-2008  matt Don't build rb.c anymore since it's in libc now.
 1.36 25-Jun-2008  pooka Don't compile kern_lock for rump any more, it's no longer required.
Allows us to get rid of the incorrect _RUMPKERNEL ifdefs outside sys/rump.
 1.35 05-Jun-2008  ad branches: 1.35.2;
Make it build again.
 1.34 29-May-2008  pooka Specify RUMP_WITHOUT_THREADS only in one place.
 1.33 04-May-2008  ad branches: 1.33.2;
Pull in the kernel module stuff so that rump can set up built-in modules.
 1.32 21-Mar-2008  ad branches: 1.32.2; 1.32.4;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.31 11-Mar-2008  pooka Compile rump_syscalls, use them in a few places.
 1.30 11-Mar-2008  pooka Backup some fixes for recent breakage from local tree. Also some
other improvements such as exporting the real kernel namei and
using that in ukfs instead of the homegrown heap'o hacks namei.
"etcetc".
 1.29 28-Jan-2008  pooka branches: 1.29.2; 1.29.6;
compile genfs_vfsops.c (hi dh2 ;)
 1.28 27-Jan-2008  pooka Use vfs_subr.c from sys/kern. This brings differences in the vnode
life cycle between rump and a real kernel to a minimum.
 1.27 25-Jan-2008  pooka Include vfs_getcwd.c too. It isn't used currently, but it's linked.
 1.26 24-Jan-2008  pooka Use namei() etc. from kernel sources instead of a reimplementation.
To accommodate, give the rootvnode its own vnode op vector with a
simple lookup operation. This is used for looking up the file
system's device vnode instead of doing that directly in a homesmoked
namei().
 1.25 02-Jan-2008  pooka Add the ability to run puffs in userspace. This means that puffs
can now be developed in userspace using puffs for development
(I hate emulators, they are annoyingly clumsy).

To e.g. mount psshfs using puffs-on-puffs, run fs/bin/syspuffs/syspuffs
with the regular mount_psshfs command line as an argument:

golem> ./syspuffs /usr/sbin/mount_psshfs ftp.netbsd.org:/pub /puffs

This will make the mount appear as usual, with the exception that the
requests will be passed through puffs both in the kernel and userspace:

ftp.netbsd.org:/pub on /puffs type puffs|p2k|puffs|psshfs
 1.24 02-Jan-2008  ad Build intr.c.
 1.23 30-Dec-2007  pooka pull in atomic ops from vmlocking2
 1.22 30-Nov-2007  dsl branches: 1.22.2; 1.22.6;
Temporarily make 'atomic_add_int()' a non-atomic add so the build suceeds.
At some point the functions will (presumably) make their way into either
libc or libutil.
 1.21 31-Oct-2007  pooka branches: 1.21.2;
Include bufq priority implementations also and link librump with
--whole-archive since the bufq priorities use link sets.
 1.20 31-Oct-2007  pooka Make it possible to run rumps multithreaded. This brings real
locking and makes it possible to run file systems which create
threads. It also makes rump file system behaviour better match
file system behaviour in the kernel.
 1.19 26-Oct-2007  pooka branches: 1.19.2;
RUMUSEROBJDIR -> RUMPUSEROBJDIR (those cold-blooded old times ...)
 1.18 17-Oct-2007  pooka branches: 1.18.2;
Compile most genfs routines directly out of the kernel sources.
Move special I/O routines to genfs_io.c to mirror kernel naming.
 1.17 11-Sep-2007  pooka branches: 1.17.2;
create generated files before running makedepend
 1.16 10-Sep-2007  pooka no need to include param.c twice in the source list
 1.15 26-Aug-2007  pooka branches: 1.15.2; 1.15.4;
split implemented lock stuff out of lock_stub.c into lock.c
 1.14 25-Aug-2007  pooka Don't play rename & typecast games with kauth_cred_t, but rather
declare the type in rump.h only if necessary with the help of ifdef
magic.
 1.13 21-Aug-2007  pooka Implement credentials. Access control is now similar to if the file
system were run in the kernel.
 1.12 20-Aug-2007  pooka branches: 1.12.2;
Hide NetBSD kernel headers completely from ukfs. This includes creating
accessors for:
* struct mount & VFS ops
* struct uio
* struct vnode
* struct vattr

and some namespace games for:
* namei flags
* VOPs
* enum vtype

Also, split rump services into two categories: library private and public
(rump_private.h and rump.h, respectively).

As a result, it is now possible to compile and use the NetBSD kernel
file systems on Linux (and probably other systems too with very
little work), although the makefiles need a bit of work to make it
a pleasureable experience.
 1.11 19-Aug-2007  pooka Namespace management: do not call VOP_FOO directly from ukfs or
p2k, but rather make the calls go through librump. This avoids
having to include NetBSD kernel headers in userspace programs.
Stay tuned for some more mods of the same sort ...
 1.10 16-Aug-2007  pooka jump through rename hoops (hi ad!)
 1.9 14-Aug-2007  pooka branches: 1.9.2;
Kill handrolled buffercache and use vfs_bio from the kernel. This is
mostly to get the flag jungle in sync with the kernel.
 1.8 14-Aug-2007  pooka compile in clock_subr.c
 1.7 13-Aug-2007  pooka Use supermarket variety vfs_vnops.c instead of homecooked routines
(that's actually a good thing here).
 1.6 13-Aug-2007  pooka compile in libkern __assert.c, argument order differs from libc model
 1.5 09-Aug-2007  pooka Play catchup with ufs/ffs changes: compile subr_specificdata.c
and emulate kmem_foo() to support the prior.
 1.4 09-Aug-2007  pooka * compile subr_time.c from kern/
* some pmap stubs
 1.3 08-Aug-2007  pooka * compile param.c
* move opts to a separate directory
 1.2 07-Aug-2007  pooka flip order of includes to get NETBSDSRCDIR. from agc
 1.1 05-Aug-2007  pooka branches: 1.1.2;
Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.2 05-Aug-2007  pooka Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.1 05-Aug-2007  pooka file Makefile was added on branch matt-mips64 on 2007-08-05 22:28:08 +0000
 1.9.2.3 03-Sep-2007  skrll Sync with HEAD.
 1.9.2.2 15-Aug-2007  skrll Sync with HEAD.
 1.9.2.1 14-Aug-2007  skrll file Makefile was added on branch nick-csl-alignment on 2007-08-15 13:50:35 +0000
 1.12.2.5 23-Oct-2007  ad Sync with head.
 1.12.2.4 12-Oct-2007  ad Fix merge errors.
 1.12.2.3 09-Oct-2007  ad Sync with head.
 1.12.2.2 20-Aug-2007  ad Sync with HEAD.
 1.12.2.1 20-Aug-2007  ad file Makefile was added on branch vmlocking on 2007-08-20 22:07:26 +0000
 1.15.4.9 24-Mar-2008  yamt sync with head.
 1.15.4.8 17-Mar-2008  yamt sync with head.
 1.15.4.7 04-Feb-2008  yamt sync with head.
 1.15.4.6 21-Jan-2008  yamt sync with head
 1.15.4.5 07-Dec-2007  yamt sync with head
 1.15.4.4 15-Nov-2007  yamt sync with head.
 1.15.4.3 27-Oct-2007  yamt sync with head.
 1.15.4.2 03-Sep-2007  yamt sync with head.
 1.15.4.1 26-Aug-2007  yamt file Makefile was added on branch yamt-lazymbuf on 2007-09-03 14:45:24 +0000
 1.15.2.3 23-Mar-2008  matt sync with HEAD
 1.15.2.2 09-Jan-2008  matt sync with HEAD
 1.15.2.1 06-Nov-2007  matt sync with HEAD
 1.17.2.1 18-Oct-2007  yamt sync with head.
 1.18.2.1 13-Nov-2007  bouyer Sync with HEAD
 1.19.2.3 03-Dec-2007  joerg Sync with HEAD.
 1.19.2.2 31-Oct-2007  joerg Sync with HEAD.
 1.19.2.1 26-Oct-2007  joerg file Makefile was added on branch jmcneill-pm on 2007-10-31 23:14:15 +0000
 1.21.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.21.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.22.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.22.2.1 28-Dec-2007  ad Make rump build.
 1.29.6.6 28-Sep-2008  mjf Sync with HEAD.
 1.29.6.5 02-Jul-2008  mjf Sync with HEAD.
 1.29.6.4 29-Jun-2008  mjf Sync with HEAD.
 1.29.6.3 05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.29.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.29.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.29.2.1 24-Mar-2008  keiichi sync with head.
 1.32.4.2 04-May-2009  yamt sync with head.
 1.32.4.1 16-May-2008  yamt sync with head.
 1.32.2.3 17-Jun-2008  yamt sync with head.
 1.32.2.2 04-Jun-2008  yamt sync with head
 1.32.2.1 18-May-2008  yamt sync with head.
 1.33.2.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.33.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.35.2.7 31-Jul-2008  simonb Sync with head.
 1.35.2.6 21-Jul-2008  simonb Sync with head.
 1.35.2.5 18-Jul-2008  simonb Sync with head.
 1.35.2.4 03-Jul-2008  simonb Sync with head.
 1.35.2.3 01-Jul-2008  matt More rb.c / wapbl fallout cleanup.
 1.35.2.2 27-Jun-2008  simonb Sync with head.
 1.35.2.1 10-Jun-2008  simonb Initial commit of Wasabi System's WAPBL (Write Ahead Physical Block
Logging) journaling code. Originally written by Darrin B. Jewell
while at Wasabi and updated to -current by Antti Kantee, Andy Doran,
Greg Oster and Simon Burge.

Still a number of issues - look in doc/BRANCHES for "simonb-wapbl"
for more info.
 1.39.2.1 19-Oct-2008  haad Sync with HEAD.
 1.192 22-Dec-2024  riastradh kern: Move some purely arithmetic routines to subr_time_arith.c.

Preparation for testing and fixing:

PR kern/58922: itimer(9): arithmetic overflow
PR kern/58925: itimer(9) responds erratically to clock wound back
PR kern/58926: itimer(9) integer overflow in overrun counting
PR kern/58927: itimer(9): overrun accounting is broken
 1.191 03-Jun-2023  lukem branches: 1.191.6;
bsd.own.mk: rename GCC_NO_* to CC_WNO_*

Rename compiler-warning-disable variables from
GCC_NO_warning
to
CC_WNO_warning
where warning is the full warning name as used by the compiler.

GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
 1.190 22-Apr-2023  riastradh rump: Move vnode_if.c from rumpkern to rumpvfs.

This has become increasingly less of a `fully dynamic interface', and
the need for it in the rest of sys/kern/ has been obviated, so let's
put it where it belongs in rumpvfs.
 1.189 22-Apr-2023  riastradh secmodel_extensions: Split vfs part into separate .c file.

This way we can provide weak rumpkern stubs that don't require
rumpvfs for things that are relevant to vfs, but if you do link
rumpvfs then you get the same logic in secmodel extensions.
 1.188 28-Mar-2022  christos include the extensions secmodel
 1.187 27-Aug-2020  riastradh Sort includes, nix trailing whitespace, fix comment.
 1.186 27-Aug-2020  riastradh Move address hashing from init_main.c to kern_sysctl.c.

This way rump gets it automatically. Make sure blake2s is in
librumpkern.so, not just in librumpkern_crypto.so, for this to work.
 1.185 14-Aug-2020  riastradh New system call getrandom() compatible with Linux and others.

Three ways to call:

getrandom(p, n, 0) Blocks at boot until full entropy.
Returns up to n bytes at p; guarantees
up to 256 bytes even if interrupted
after blocking. getrandom(0,0,0)
serves as an entropy barrier: return
only after system has full entropy.

getrandom(p, n, GRND_INSECURE) Never blocks. Guarantees up to 256
bytes even if interrupted. Equivalent
to /dev/urandom. Safe only after
successful getrandom(...,0),
getrandom(...,GRND_RANDOM), or read
from /dev/random.

getrandom(p, n, GRND_RANDOM) May block at any time. Returns up to n
bytes at p, but no guarantees about how
many -- may return as short as 1 byte.
Equivalent to /dev/random. Legacy.
Provided only for source compatibility
with Linux.

Can also use flags|GRND_NONBLOCK to fail with EWOULDBLOCK/EAGAIN
without producing any output instead of blocking.

- The combination GRND_INSECURE|GRND_NONBLOCK is the same as
GRND_INSECURE, since GRND_INSECURE never blocks anyway.

- The combinations GRND_INSECURE|GRND_RANDOM and
GRND_INSECURE|GRND_RANDOM|GRND_NONBLOCK are nonsensical and fail
with EINVAL.

As proposed on tech-userlevel, tech-crypto, tech-security, and
tech-kern, and subsequently adopted by core (minus the getentropy part
of the proposal, because other operating systems and participants in
the discussion couldn't come to an agreement about getentropy and
blocking semantics):

https://mail-index.netbsd.org/tech-userlevel/2020/05/02/msg012333.html
 1.184 28-Jul-2020  riastradh Rewrite cprng_fast in terms of new ChaCha API.
 1.183 30-Apr-2020  riastradh Rewrite entropy subsystem.

Primary goals:

1. Use cryptography primitives designed and vetted by cryptographers.
2. Be honest about entropy estimation.
3. Propagate full entropy as soon as possible.
4. Simplify the APIs.
5. Reduce overhead of rnd_add_data and cprng_strong.
6. Reduce side channels of HWRNG data and human input sources.
7. Improve visibility of operation with sysctl and event counters.

Caveat: rngtest is no longer used generically for RND_TYPE_RNG
rndsources. Hardware RNG devices should have hardware-specific
health tests. For example, checking for two repeated 256-bit outputs
works to detect AMD's 2019 RDRAND bug. Not all hardware RNGs are
necessarily designed to produce exactly uniform output.

ENTROPY POOL

- A Keccak sponge, with test vectors, replaces the old LFSR/SHA-1
kludge as the cryptographic primitive.

- `Entropy depletion' is available for testing purposes with a sysctl
knob kern.entropy.depletion; otherwise it is disabled, and once the
system reaches full entropy it is assumed to stay there as far as
modern cryptography is concerned.

- No `entropy estimation' based on sample values. Such `entropy
estimation' is a contradiction in terms, dishonest to users, and a
potential source of side channels. It is the responsibility of the
driver author to study the entropy of the process that generates
the samples.

- Per-CPU gathering pools avoid contention on a global queue.

- Entropy is occasionally consolidated into global pool -- as soon as
it's ready, if we've never reached full entropy, and with a rate
limit afterward. Operators can force consolidation now by running
sysctl -w kern.entropy.consolidate=1.

- rndsink(9) API has been replaced by an epoch counter which changes
whenever entropy is consolidated into the global pool.
. Usage: Cache entropy_epoch() when you seed. If entropy_epoch()
has changed when you're about to use whatever you seeded, reseed.
. Epoch is never zero, so initialize cache to 0 if you want to reseed
on first use.
. Epoch is -1 iff we have never reached full entropy -- in other
words, the old rnd_initial_entropy is (entropy_epoch() != -1) --
but it is better if you check for changes rather than for -1, so
that if the system estimated its own entropy incorrectly, entropy
consolidation has the opportunity to prevent future compromise.

- Sysctls and event counters provide operator visibility into what's
happening:
. kern.entropy.needed - bits of entropy short of full entropy
. kern.entropy.pending - bits known to be pending in per-CPU pools,
can be consolidated with sysctl -w kern.entropy.consolidate=1
. kern.entropy.epoch - number of times consolidation has happened,
never 0, and -1 iff we have never reached full entropy

CPRNG_STRONG

- A cprng_strong instance is now a collection of per-CPU NIST
Hash_DRBGs. There are only two in the system: user_cprng for
/dev/urandom and sysctl kern.?random, and kern_cprng for kernel
users which may need to operate in interrupt context up to IPL_VM.

(Calling cprng_strong in interrupt context does not strike me as a
particularly good idea, so I added an event counter to see whether
anything actually does.)

- Event counters provide operator visibility into when reseeding
happens.

INTEL RDRAND/RDSEED, VIA C3 RNG (CPU_RNG)

- Unwired for now; will be rewired in a subsequent commit.
 1.182 15-Jan-2020  ad Merge from yamt-pagecache (after much testing):

- Reduce unnecessary page scan in putpages esp. when an object has a ton of
pages cached but only a few of them are dirty.

- Reduce the number of pmap operations by tracking page dirtiness more
precisely in uvm layer.
 1.181 20-Dec-2019  ad branches: 1.181.2;
Split subr_cpu.c out of kern_cpu.c, to contain routines shared with rump.
 1.180 16-Dec-2019  ad - Extend the per-CPU counters matt@ did to include all of the hot counters
in UVM, excluding uvmexp.free, which needs special treatment and will be
done with a separate commit. Cuts system time for a build by 20-25% on
a 48 CPU machine w/DIAGNOSTIC.

- Avoid 64-bit integer divide on every fault (for rnd_add_uint32).
 1.179 15-Dec-2019  ad Merge from yamt-pagecache:

- do gang lookup of pages using radixtree.
- remove now unused uvm_object::uo_memq and vm_page::listq.queue.
 1.178 12-Dec-2019  pgoyette Eliminate per-hook duplication of common code as suggested by
(and with major contributions from) riastradh@

Welcome to 9.99.23
 1.177 13-Oct-2019  mrg introduce some common variables for use in GCC warning disables:

GCC_NO_FORMAT_TRUNCATION -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints. many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
 1.176 02-Sep-2019  riastradh Switch from NIST CTR_DRBG with AES to NIST Hash_DRBG with SHA-256.

Benefits:

- larger seeds -- a 128-bit key alone is not enough for `128-bit security'
- better resistance to timing side channels than AES
- a better-understood security story (https://eprint.iacr.org/2018/349)
- no loss in compliance with US government standards that nobody ever
got fired for choosing, at least in the US-dominated western world
- no dirty endianness tricks
- self-tests

Drawbacks:

- performance hit: throughput is reduced to about 1/3 in naive measurements
=> possible to mitigate by using hardware SHA-256 instructions
=> all you really need is 32 bytes to seed a userland PRNG anyway
=> if we just used ChaCha this would go away...

XXX pullup-7
XXX pullup-8
XXX pullup-9
 1.175 13-May-2019  bad branches: 1.175.2;
On the one thousand and ninth day rump's mainbus was moved from
rumpdev to rumpkern, liberating all rumpnet users from the need to
-lrumpdev -lrumpvfs just because a loopback interface is mandatory.

Rename rumpdev/autoconf.c to rumpkern/rump_autoconf.c to avoid
accidentally picking up e.g. sys/arch/amd64/amd64/autoconf.c through
make's .PATH.
Move rumpdev/MAINBUS.ioconf to rumpkern.
 1.174 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.173 24-Dec-2018  thorpej Add threadpool(9), an abstraction that provides shared pools of kernel
threads running at specific priorities, with support for unbound pools
and per-cpu pools.

Written by riastradh@, and based on the May 2014 draft, with a few changes
by me:
- Working on the assumption that a relative few priorities will actually
be used, reduce the memory footprint by using linked lists, rather than
2 large (and mostly empty) tables. The performance impact is essentially
nil, since these lists are consulted only when pools are created (and
destroyed, for DIAGNOSTIC checks), and the lists will have at most 225
entries.
- Make threadpool job object, which the caller must allocate storage for,
really opaque.
- Use typedefs for the threadpool types, to reduce the verbosity of the
API somewhat.
- Fix a bunch of pool / worker thread / job object lifecycle bugs.

Also include an ATF unit test, written by me, that exercises the basics
of the API by loading a kernel module that exposes several sysctls that
allow the ATF test script to create and destroy threadpools, schedule a
basic job, and verify that it ran.

And thus NetBSD 8.99.29 has arrived.
 1.172 16-Dec-2018  rmind Import thmap -- a concurrent trie-hash map, combining the elements of
hashing and radix trie. It supports lock-free lookups and concurrent
inserts/deletes. It is designed to be optimal as a general purpose
*concurrent* associative array.

Upstream: https://github.com/rmind/thmap
Discussed on tech-kern@
 1.171 14-Sep-2018  mrg retire kern_xxx.c. long live kern_xxx.c.

split it into kern_reboot.c and kern_scdebug.c. while here,
add my copyright to kern_scdebug.c as it was largely rewritten
for kernhist support.
 1.170 25-Jul-2017  ozaki-r branches: 1.170.2; 1.170.4;
Add localcount to rump kernels
 1.169 08-Apr-2017  christos branches: 1.169.4; 1.169.6;
adjust flag.
 1.168 20-Aug-2016  christos branches: 1.168.2;
need kern_ssp.c for a full SSP build.
 1.167 11-Apr-2016  ozaki-r branches: 1.167.2;
Add psref to rump kernel
 1.166 26-Jan-2016  pooka nuke a few missed -Ifactiondir CPPFLAGSitions.
 1.165 19-Oct-2015  pooka Add a COMMENT describing what each component roughly does.

"make describe" prints the comment.

Requested/inspired by Vincent Schwarzer on rumpkernel-users
 1.164 15-Sep-2015  pooka Use the more widely accepted version of alphabetical order.
 1.163 31-Aug-2015  ozaki-r Allow rumpkernel to use rw_obj_*
 1.162 21-Aug-2015  christos Remove KERN.ioconf, ksyms does not really need it.
 1.161 20-Aug-2015  christos generate ioconf.h for pseudo-device attach prototype
 1.160 17-Jun-2015  pooka Remove unreal allocators, unconditionally use subr_{kmem,pool}.

Will, with other work, allow to tighten the memory allocation hypercall
specification to page-granularity allocations in the future.
 1.159 23-Apr-2015  pooka Rename RUMP_COMPAT to RUMP_NBCOMBAT to better signify what the
variable does.
 1.158 23-Apr-2015  pooka g/c the never-used and never-useful hyperstubs.c
 1.157 22-Apr-2015  pooka Build compat code only when specified by RUMP_COMPAT
 1.156 22-Apr-2015  pooka Include kern_clock.c in rump kernels.
 1.155 14-Apr-2015  riastradh Fix rump build: rndpseudo_50.c now needed by kernel, not rnd device.
 1.154 04-Feb-2015  pooka default newvers.sh parameters to reproducible build
 1.153 07-Jan-2015  pooka Move sysproxy support into a separate component, rumpkern_sysproxy,
instead of it being always provided by the rump kernel base. This
move accomplishes two things:

1) it is no longer necessary to provide sysproxy hypercall stubs for
platforms which do not want to use sysproxy
2) it is easier to reason about the security aspects, since configurations
not linking the sysproxy component simply do not support remote
system calls

discussed on rumpkernel-users
 1.152 03-Jan-2015  pooka Put all sysproxy routines to their own C module, sysproxy.c
 1.151 02-Dec-2014  pooka Remove shlib_version files and just use Makefile SHLIB_MAJOR/MINOR,
with the default provided by Makefile.rump (they're all 0.0 anyway)
 1.150 09-Nov-2014  pooka branches: 1.150.2;
Move rump kernel man pages from various sources to sys/rump

namely:
* src/lib is used only when building for POSIX'y platforms, but
the man pages have their use for all platforms
* rumpuser.3 is a function of the rump kernel, not one of the of
the POSIX'y implementation hosted in src/lib/librumpuser

no functional change
 1.149 11-Aug-2014  matt Add MKCOMPAT support for aarch64 (COMPAT_MACHINE_CPU)
 1.148 10-Aug-2014  tls branches: 1.148.2; 1.148.4; 1.148.8;
Merge tls-earlyentropy branch into HEAD.
 1.147 05-Jun-2014  rmind librump: include pcq(9) interface.
 1.146 27-Apr-2014  pooka Eliminate weak symbols from rump kernel syscall handlers, part 7:

Build component constructors which establish syscalls at boottime.
 1.145 25-Apr-2014  pooka gardenize rump.c: move data structure helper routines to accessors.c
 1.144 25-Apr-2014  pooka Move the etfs linkage from rumpvfs to rumpkern, and replace the
weak alias show with an honest pointer indirection.

No client-visible change. (apart from this version working e.g.
on musl w/ dlopen)
 1.143 04-Apr-2014  njoly branches: 1.143.2;
Add compat 50 time syscalls, needed by rump sys_linux.
 1.142 02-Apr-2014  pooka Put nanosleep() and folks in librump instead of maintaining them in
the separate rumpkern_time component. Keeping time-related routines
elsewhere lead to some illogical behavior if you didn't think of linking
in rumpkern_time (hands up everyone who checks the return value of
nanosleep()).

Add warnings if rumpkern_time is linked or used. I'll remove it in a
month or two instead of now since it was part of a buildrump.sh snapshot
and it's nicer if trying to use it gives a warning instead of an error
in the next snapshot.

"everything should be as modular as possible, but no more modular than that"
 1.141 15-Mar-2014  pooka Use uniprocessor-optimized locking in RUMP_LOCKS_UP=yes (default: no)
 1.140 13-Mar-2014  pooka Allow multiple "rumpcomp_user" source modules to be specified by
introducing RUMPCOMP_USER_SRCS. Make RUMPCOMP_USER issue a deprecation
warning, but for compat make it set RUMPCOMP_USER_SRCS=rumpcomp_user.c
for now.
 1.139 10-Mar-2014  pooka Move the "is arch capable of loading native kernel modules into
rump kernel" clauses from bsd.own.mk to Makefile.rump. Also,
add a rump_nativeabi_p() call to determine if rump kernel is
compiled with native ABI support.
 1.138 28-Feb-2014  matt Use the new FEAT_LDREX to replace ARMV6/ARMV7
 1.137 18-Feb-2014  pooka Use same uvm_swap_shutdown() stub for !vmswap kernels and rump kernels.
 1.136 12-Feb-2014  pooka Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.135 17-Jan-2014  pooka Use subr_cprng.c instead of stub implementation. Rijndael migrates from
rumpkern_crypto to rumpkern due to it being mandatory for cprng.
 1.134 09-Dec-2013  pooka Make ktrace a compile-time option
 1.133 09-Dec-2013  pooka Support ktrace for rump kernels.

Requested by Justin Cormack on rumpkernel-users.
 1.132 07-Sep-2013  pooka Add an initial console device and open fd's 0/1/2 for initproc. This is
again useful in standalone-type environments such as Xen, where all
printf/etc calls go through the rump kernel.
 1.131 03-Sep-2013  pooka + don't rename rump_syscalls.*o
+ support RUMP_KERNEL_IS_LIBC
 1.130 22-Aug-2013  matt Teach this about ARMV7
 1.129 18-Jul-2013  matt Coldfire uses atomic_cas_generic.c
 1.128 23-Jun-2013  riastradh branches: 1.128.2; 1.128.4;
Rework rndsink(9) abstraction and adapt arc4random(9) and cprng(9).

rndsink(9):
- Simplify API.
- Simplify locking scheme.
- Add a man page.
- Avoid races in destruction.
- Avoid races in requesting entropy now and scheduling entropy later.

Periodic distribution of entropy to sinks reduces the need for the
last one, but this way we don't need to rely on periodic distribution
(e.g., in a future tickless NetBSD).

rndsinks_lock should probably eventually merge with the rndpool lock,
but we'll put that off for now.

cprng(9):
- Make struct cprng_strong opaque.
- Move rndpseudo.c parts that futz with cprng guts to subr_cprng.c.
- Fix kevent locking. (Is kevent locking documented anywhere?)
- Stub out rump cprng further until we can rumpify rndsink instead.
- Strip code to grovel through struct cprng_strong in fstat.
 1.127 01-May-2013  pooka Actually, there's no point in unconditionally compiling in weak stubs
which will never be used in the NetBSD build. Comment hyperstubs.c
out from SRCS, but retain the source module as documentation.
 1.126 30-Apr-2013  pooka weak stubs for optional hypercalls
 1.125 27-Apr-2013  pooka * treat kern_malloc.c as an unreal allocator (it's so lightweight)
* get rid of the rumpuser_realloc() hypercall
* pass size to rumpuser_free()
 1.124 15-Mar-2013  pooka Allow Makefile.rump to append to SRCS.
 1.123 10-Mar-2013  pooka Use kern_malloc.c instead of the relegated allocators in memalloc.c.
Previously this didn't make sense due to the use of kmem_map, but the
new malloc is more dynamic and puts sense into using it.
 1.122 10-Mar-2013  pooka Always include subr_vmem.c, even with RUMP_UNREAL_ALLOCATORS=yes
(previously it was just missing in that case).

Record wchan to unreal pool_init() to avoid memory leak warning.
 1.121 30-Dec-2012  pooka Take into account armv6 hacks from common/lib/libc/arch/arm/atomic to
allow this to build with -march=armv6k
 1.120 04-Nov-2012  apb Add references to ${_NETBSD_VERSION_DEPENDS} for files that
need to be re-created when the NetBSD version changes. They
will also be re-created when any build settings are changed.
 1.119 20-Jul-2012  pooka branches: 1.119.2;
Make it possible to select between real and unreal allocators from
make. Plus some gratuitous renaming.
 1.118 22-Jun-2012  rmind rumpkern:
- Add subr_kcpuset.c and subr_pserialize.c modules.
- Add kcpuset_{running,attached} for RUMP env.
 1.117 29-Apr-2012  rmind G/C kern_malloc_stdtype.c
 1.116 10-Mar-2012  joerg P1003_1B_SEMAPHORE is no longer optional.
 1.115 02-Feb-2012  tls branches: 1.115.2;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.114 04-Dec-2011  jym Implement the register/deregister/evaluation API for secmodel(9). It
allows registration of callbacks that can be used later for
cross-secmodel "safe" communication.

When a secmodel wishes to know a property maintained by another
secmodel, it has to submit a request to it so the other secmodel can
proceed to evaluating the request. This is done through the
secmodel_eval(9) call; example:

bool isroot;
error = secmodel_eval("org.netbsd.secmodel.suser", "is-root",
cred, &isroot);
if (error == 0 && !isroot)
result = KAUTH_RESULT_DENY;

This one asks the suser module if the credentials are assumed to be root
when evaluated by suser module. If the module is present, it will
respond. If absent, the call will return an error.

Args and command are arbitrarily defined; it's up to the secmodel(9) to
document what it expects.

Typical example is securelevel testing: when someone wants to know
whether securelevel is raised above a certain level or not, the caller
has to request this property to the secmodel_securelevel(9) module.
Given that securelevel module may be absent from system's context (thus
making access to the global "securelevel" variable impossible or
unsafe), this API can cope with this absence and return an error.

We are using secmodel_eval(9) to implement a secmodel_extensions(9)
module, which plugs with the bsd44, suser and securelevel secmodels
to provide the logic behind curtain, usermount and user_set_cpu_affinity
modes, without adding hooks to traditional secmodels. This solves a
real issue with the current secmodel(9) code, as usermount or
user_set_cpu_affinity are not really tied to secmodel_suser(9).

The secmodel_eval(9) is also used to restrict security.models settings
when securelevel is above 0, through the "is-securelevel-above"
evaluation:
- curtain can be enabled any time, but cannot be disabled if
securelevel is above 0.
- usermount/user_set_cpu_affinity can be disabled any time, but cannot
be enabled if securelevel is above 0.

Regarding sysctl(7) entries:
curtain and usermount are now found under security.models.extensions
tree. The security.curtain and vfs.generic.usermount are still
accessible for backwards compat.

Documentation is incoming, I am proof-reading my writings.

Written by elad@, reviewed and tested (anita test + interact for rights
tests) by me. ok elad@.

See also
http://mail-index.netbsd.org/tech-security/2011/11/29/msg000422.html

XXX might consider va0 mapping too.

XXX Having a secmodel(9) specific printf (like aprint_*) for reporting
secmodel(9) errors might be a good idea, but I am not sure on how
to design such a function right now.
 1.113 27-Nov-2011  tsutsui branches: 1.113.2;
Revert "stopcap fix" for rump by christos, which causes build failure on
most non-x86 ports and seems unnecessary. (caused by wrong rump_namei.h?)
 1.112 25-Nov-2011  christos Add subr_open_disk.c for getdiskinfo(). Once we get rid of getdiskinfo,
this will not be needed.
 1.111 19-Nov-2011  tls First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.110 12-Jun-2011  mrg branches: 1.110.2;
include uvm_object.c in the rump kernel for the new uvm_obj* functions.
don't build the uvm_object.c uvm_object_printit() for _RUMPKERNEL. (XXX)
add empty panic() stubs for uvm_loanbreak() and ubc_purge().

fixes some more 5.99.53 rump build issues.
 1.109 19-May-2011  joerg branches: 1.109.2;
Spell --fatal-warnings with two hyphens
 1.108 21-Mar-2011  joerg Include bsd.own.mk before making decisions based on mk.conf.
 1.107 17-Jan-2011  pooka use compat code from sys/compat/common
 1.106 06-Jan-2011  pooka branches: 1.106.2;
Support LOCKDEBUG. To use it, compile sys/rump with RUMP_LOCKDEBUG=yes.

requested by martin (sparc64 gdb cannot reliably produce a stack trace)
 1.105 04-Jan-2011  pooka Add SMP support for all architectures.

tested on sparc64 by martin
 1.104 17-Dec-2010  joerg Support MKREPRO
 1.103 26-Nov-2010  pooka Duh, it's x86_64, not amd64. This should make the races which
require SMP trigger in the amd64/qemu runs again.
 1.102 22-Nov-2010  pooka rename atomic_cas_up to rump_atomic_cas_up to avoid collisions
 1.101 21-Nov-2010  pooka Encode smp-capability into the makefile so that it can be used to
avoid potential screwups.
 1.100 21-Nov-2010  pooka Add a lockless uniprocessor version of atomic_cas_generic.c, which
is currently used by all the archs that previously used cas_generic.
 1.99 21-Nov-2010  pooka Realize the >1yo comment above rump_reboot and retire them to make
room for sys_reboot.
 1.98 27-Oct-2010  pooka "i build dead files". ok, so let's not.
 1.97 06-Sep-2010  pooka Use standard uvm aobj pager. Most of the kernel aobj pager complexity
comes from swap handling, but that is included only with VMSWAP.
 1.96 01-Sep-2010  pooka Implement rump_lwproc: the new lwp/proc management routines for
rump. These move the management of the pid/lwpid space from the
application into the kernel, make code more robust, and make it
possible to attach multiple lwp's to non-proc0 processes.
 1.95 30-Aug-2010  pooka Include kern_prot.c for setuid etc.
 1.94 30-Aug-2010  pooka Use one line per sys/kern source module. no functional change.
 1.93 21-Aug-2010  pgoyette Add the new kern_cfglock.c to rump.
 1.92 19-Jul-2010  pooka * move stat syscalls to newstyle compat
* implement compat for pollts
 1.91 16-Jun-2010  pooka Reinstate the blanket pmap.h for archs which do not conform to the
kernel ABI (i.e. not i386 or amd64). Due to the "half function,
half macro, all noodles" nature of pmap.h, it's too entangling and
too brittle to keep up with an ifdeffy MI implementation.
 1.90 13-Jun-2010  pooka Fix previous in emul.c -- only numbers are operands for cpp comparisons.
Apparently non-numbers logically produce arch-dependent behaviour.
 1.89 10-Jun-2010  pooka Use kern_proc.c instead of a collection of stubs. But what we
really wanted from this commit was the support for proc_specificdata.

TODO: make creating a new process actually use kern_proc and
maybe even add an interface which starts a process with
"any pid you don't like"
 1.88 06-Jun-2010  njoly Make vers.c depend on sys/param.h too, to ensure that this file is
regenerated for on kernel version bump. Avoids __NetBSD_Version__ and
osrelease out of sync problem for mkupdate builds.

ok from pooka@.
 1.87 18-May-2010  pooka Whoops, default to MP locking.
 1.86 18-May-2010  pooka Add uniprocessor versions of mutex/rw/cv. They work only on virtual
unicpu configurations (i.e. RUMP_NCPU==1), but are massively faster
than the multiprocessor versions since the fast path does not have
to perform any cache coherent operations. _Applications_ with
lock-happy kernel paths, i.e. _not_ lock microbenchmarks, measure
up to tens of percents speedup on my Core2 Duo. Every globally
atomic state required by normal locks/atomic ops implies a hideous
speed penalty even for the fast path.

While this requires a unicpu configuration, it should be noted that
we are talking about a virtual unicpu configuration. The host can
have as many processors as it desires, and the speed benefit of
virtual unicpu is still there. It's pretty obvious that in terms
of scalability simple workload partitioning and replication into
multiple kernels wins hands down over complicated locking or
locklessing algorithms which depend on globally atomic state.
 1.85 18-May-2010  pooka Move routines related to kernel locking and scheduling from
locks.c to klock.c.

No functional change.
 1.84 11-May-2010  pooka Actually, push defining _RUMPKERNEL down to libkern, since it's
not needed elsewhere.
 1.83 11-May-2010  pooka Limit visibility of _RUMPKERNEL to prevent abuse.
 1.82 30-Apr-2010  pooka Include devsw_conv0 from an i386 kernel compilation (no, we don't
care about the arch as long as all the devices we care about are
present). The file should be autogenerated, but that requires some
more changes to config(1).
 1.81 26-Apr-2010  pooka Implement kobj_renamespace() for rump. Support for a few archs is
missing, but that doesn't really matter, since they are living in
their own "everything is a macro" happyland and don't support the
native kernel ABI anyway.
 1.80 21-Apr-2010  pooka Move sys_module from vfs to kern -- while modules cannot be loaded,
there's not forbidden about querying the list of (builtin) modules
even when running without vfs.
 1.79 21-Apr-2010  pooka support kern_resource
 1.78 21-Apr-2010  pooka Move all signal-related from emul.c to signals.c. Additionally,
define a few alternate signal models for the rump kernel, including
ones where signals are ignored or sent to host processes.
 1.77 14-Apr-2010  pooka Use kern_syscall.c instead of homegrown syscall dis/establishment routines.
 1.76 14-Apr-2010  pooka Include kern_tc and use a timecounter driver instead of homerolled
kern_tc implementation.
 1.75 12-Apr-2010  pooka support lwp specificdata
 1.74 16-Feb-2010  pooka branches: 1.74.2;
Globally define -Wno-pointer-sign, as it has become a pointless
exercise of "add it to every Makefile individually".

XXX: should autosynchronize with the rest of the kernel buildflags
in sys/conf/Makefile.kern.inc.
 1.73 31-Jan-2010  pooka branches: 1.73.2;
Include newly-created subr_device.c and remove few special case
device accessor copypastes. This makes it possible to link static
binaries which use -lrumpdev.
 1.72 31-Jan-2010  pooka include kern_hook.c
 1.71 15-Jan-2010  pooka Use subr_percpu.c instead of homegrown implementation. ...except
when using malloc(3)-relegated allocators (happens in production
e.g. on Linux), since subr_percpu.c uses vmem and i don't want to
reimplement vmem.
 1.70 16-Dec-2009  pooka update to newnewvers.sh usage
 1.69 16-Dec-2009  pooka Generate vers.c and include it in the kernel component.
 1.68 14-Dec-2009  matt Make librump play with mips nicely. Define ARCH_ELFSIZE for mips to be 32.
This works for N64 kernels because objcopy them to be 32bit to the bootloaders
can handle them.
 1.67 13-Dec-2009  mrg rename LD32DIR to MLIBDIR.
 1.66 01-Dec-2009  pooka Include cpu crosscall support (instead of stubbing it out).
 1.65 27-Nov-2009  pooka Now that Makefile.rump was changed and everything gets built in
update builds too, flip the allocator define to prefer the kernel
pool/kmem instead of malloc(3). Use malloc(3) only if
RUMP_USE_UNREAL_ALLOCATORS is defined.
 1.64 26-Nov-2009  pooka include sys_pipe.c
 1.63 06-Nov-2009  pooka Enable kernel kmem/vmem/pool/pool_cache by default again instead
of malloc(3) allocators.
 1.62 04-Nov-2009  pooka misc_stub and emul have been the same thing for a looong time now,
so just move the few remaining routines in misc_stub to emul.
 1.61 04-Nov-2009  pooka Give the kthread->pthread interface emulation its own module.
 1.60 04-Nov-2009  pooka Pull all relegating memory allocators under a common roof in memalloc.c
 1.59 04-Nov-2009  pooka move copy-related routines to their own module
 1.58 04-Nov-2009  pooka Use std. uiomove() & friends.
 1.57 04-Nov-2009  pooka Use kern_mutex_obj.c directly instead of copypasting code.
 1.56 03-Nov-2009  pooka move module to SRCS where it logically belongs. no functional change.
 1.55 20-Oct-2009  pooka Actually, put uvm_readahead into rumpkern, since while it's
technically vfs stuff, sys_descrip depends on it and readahead
itself uses only the pager interface.
 1.54 19-Oct-2009  christos treat sun2 like the other losing platforms.
 1.53 16-Oct-2009  pooka Include sys_select.c for proper select()/poll() support.
 1.52 15-Oct-2009  pooka Add initial work on a rump virtual cpu scheduler. This is necessary
for kernel code which has been written to avoid MP contention by
using cpu-local storage (most prominently, select and pool_cache).

Instead of always assuming rump_cpu, the scheduler must now be run
(and unrun) on all entry points into rump. Likewise, rumpuser
unruns and re-runs the scheduler around each potentially blocking
operation. As an optimization, I modified some locking primitives
to try to get the lock without blocking before releasing the cpu.

Also, ltsleep was modified to assume that it is never called without
the biglock held and made to use the biglock as the sleep interlock.
Otherwise there is just too much drama with deadlocks. If some
kernel code wants to call ltsleep without the biglock, then, *snif*,
it's no longer supported and rump and should be modified to support
newstyle locks anyway.
 1.51 14-Oct-2009  pooka Adjust rump sources for external/internal interfaces.
No functional change.
 1.50 02-Oct-2009  elad First part of secmodel cleanup and other misc. changes:

- Separate the suser part of the bsd44 secmodel into its own secmodel
and directory, pending even more cleanups. For revision history
purposes, the original location of the files was

src/sys/secmodel/bsd44/secmodel_bsd44_suser.c
src/sys/secmodel/bsd44/suser.h

- Add a man-page for secmodel_suser(9) and update the one for
secmodel_bsd44(9).

- Add a "secmodel" module class and use it. Userland program and
documentation updated.

- Manage secmodel count (nsecmodels) through the module framework.
This eliminates the need for secmodel_{,de}register() calls in
secmodel code.

- Prepare for secmodel modularization by adding relevant module bits.
The secmodels don't allow auto unload. The bsd44 secmodel depends
on the suser and securelevel secmodels. The overlay secmodel depends
on the bsd44 secmodel. As the module class is only cosmetic, and to
prevent ambiguity, the bsd44 and overlay secmodels are prefixed with
"secmodel_".

- Adapt the overlay secmodel to recent changes (mainly vnode scope).

- Stop using link-sets for the sysctl node(s) creation.

- Keep sysctl variables under nodes of their relevant secmodels. In
other words, don't create duplicates for the suser/securelevel
secmodels under the bsd44 secmodel, as the latter is merely used
for "grouping".

- For the suser and securelevel secmodels, "advertise presence" in
relevant sysctl nodes (sysctl.security.models.{suser,securelevel}).

- Get rid of the LKM preprocessor stuff.

- As secmodels are now modules, there's no need for an explicit call
to secmodel_start(); it's handled by the module framework. That
said, the module framework was adjusted to properly load secmodels
early during system startup.

- Adapt rump to changes: Instead of using empty stubs for securelevel,
simply use the suser secmodel. Also replace secmodel_start() with a
call to secmodel_suser_start().

- 5.99.20.

Testing was done on i386 ("release" build). Spearated module_init()
changes were tested on sparc and sparc64 as well by martin@ (thanks!).

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/09/25/msg006135.html
 1.49 02-Oct-2009  pooka Include humanize and extent support in rumpkern.
 1.48 16-Sep-2009  pooka include init_sysctl_base.c
 1.47 06-Sep-2009  pooka Run rump_dev_init() where available.
 1.46 02-Jun-2009  pooka include syscalls.c
 1.45 02-May-2009  pooka branches: 1.45.2;
Do not include securelevel, it includes too many dependencies on
vfs in its current form.
 1.44 29-Apr-2009  pooka Add proof-of-concept code for enabling system calls to rump virtual
kernels running in other processes on the same machine or on an
entirely different host. I wrote this a while ago and am now
committing it mainly to avoid losing it. It works, but could do
with a little tuning here and there.

What this will hopefully eventually buy us is the ability to use
standard userland tools to configure rump kernels, e.g. ifconfig(8)
and route(8) could be used to configure the networking stack provided
by a rump kernel. Also some distributed OS implications may apply.

fun fact: a system call which just does copyin/copyout takes >1000x
longer when made over the LAN as compared to when made on the same
machine.
 1.43 16-Apr-2009  pooka When I switched to real kauth, I forgot to include a secmodel.
Fix this oversight by including bsd44. Makes permissions for p2k
work again.
 1.42 29-Mar-2009  pooka include subr_evcnt
 1.41 18-Mar-2009  pooka Support kqueue in the rump virtual kernel.
 1.40 30-Jan-2009  pooka branches: 1.40.2;
Turn of real allocators and fall back to malloc(3) for the time
being. Since we have many threads but pretend to have only one
cpu, the pool code runs into concurrency trouble for cpu-private
data.
 1.39 23-Jan-2009  pooka Add a compile-time option to use kmem/vmem/pools from the kernel
sources instead of homegrown allocators. Default to "on", even
though they appear to be a few percent slower at least on short
jobs (e.g. untar to tmpfs).
 1.38 18-Jan-2009  he Change the use of formally undocumented features, which have now been
made to fail. Specifically, change
.ifdef(SYMBOL) -> .ifdef SYMBOL or .if defined(SYMBOL),
and corresponding for .ifndef.

Also correct one error in lib/libm/Makefile (.ifdef (${MKCOMPLEX} != "no")?!?).
 1.37 14-Jan-2009  pooka Do rump kernel symbol protection for vax. All archs support it now.
 1.36 12-Jan-2009  pooka * Add adapted version of the userspace atomic_cas ops for platforms
lacking special instructions. We always use the spinlocked version
(could use RAS on UP NetBSD host, but it's not portable).
* Add platform-based symbol quirk tables for selectively not renaming
toolchain symbols for some platforms. Although, this should really
depend on the (toolchain,platform)-tuple and not just the platform.

This allows arm, hppa, mips and sh3 to build succesfully with an
isolated rump kernel namespace. ... now, one arch remains: vax.
you must compile vax. then, only then will you MI be.
 1.35 08-Jan-2009  pooka Remove vax MD source which is now brought in automatically via libkern.
 1.34 06-Jan-2009  pooka adjust LD32DIR comment. per discussion with mrg
 1.33 05-Jan-2009  pooka Rename malloc() to kern_malloc() to avoid name conflict with libc.
Now it is possible to use the kernel linker with rump.
 1.32 05-Jan-2009  pooka Assemble with _LOCORE.
 1.31 04-Jan-2009  pooka Include libkern contents in librump.
 1.30 02-Jan-2009  pooka Add kludge to allow amd64 compat to build. This is not a proper
fix which most likely requires some compat lib build infra toggle.
 1.29 02-Jan-2009  pooka Include kernel printf routines in rump instead of relying on the
magic libc symbol. This also allows to bid farewell to subr_prf2.c
and merge the contents back to subr_prf.c. The host kernel bridging
is now done via rumpuser_putchar().
 1.28 01-Jan-2009  pooka Purge multiple kernel opt files.
 1.27 01-Jan-2009  pooka Define MODULAR for rump core components. This enables module
loading via the kernel module framework (instead of dlopen()).
For now it only works on amd64 and i386, but for the rest it should
just be a matter of including the relevant kobj_machdep.c modules
from the kernel sources.
 1.26 31-Dec-2008  pooka Include rb.c instead of relying on it being in libc.
 1.25 30-Dec-2008  pooka -I${RUMPTOP}/librump/rumpkern so that build from src/lib works.

noted by Geoff Wing on current-users
 1.24 29-Dec-2008  pooka Switch i386 away from rump/include/machine. This means that rump
on i386 now uses the native kernel ABI. This in turn means that
rump modules and kernel modules are binary equivalent and can be
used interchangeably.
 1.23 29-Dec-2008  pooka include subr_devsw in rumpkern
 1.22 18-Dec-2008  pooka include snprintb
 1.21 18-Dec-2008  pooka .PATH maintenance
 1.20 19-Nov-2008  pooka Split vfs out of rumpkern into rumpvfs. Non-fs rumps no longer
include the file system code. File system rumps explicitly need
to include rumpvfs from now on.
 1.19 18-Nov-2008  pooka cwd is logically a vfs concept, so take it out from the bosom of
kern_descrip and into vfs_cwd. No functional change.
 1.18 17-Nov-2008  pooka Move rump public headers to include/rump
 1.17 25-Oct-2008  apb branches: 1.17.2; 1.17.4;
Use ${TOOL_SED} instead if plain sed in Makefiles.
 1.16 15-Oct-2008  pooka branches: 1.16.2;
Add support bits necessary for rumpnet functionality.
 1.15 11-Oct-2008  pooka Move uidinfo to its own module in kern_uidinfo.c and include in rump.
No functional change to uidinfo.
 1.14 10-Oct-2008  pooka Add a simple percpu implementation (which isn't actually percpu at
all, since we don't currently have the notion of "real" cpu in
rump...but that's beyond the point).
 1.13 10-Oct-2008  pooka Support callouts and call callout_hardclock() from the timer
interrupt thread.

The sleepq implementation required for callouts is horrible, kludged
only for callouts, and generally unacceptable. It needs revisiting,
but I'm not sure yet should rump or kern_timeout be improved. It's
almost untested as of now, but committing this will give me some
maneuvering space while letting application compile.
 1.12 09-Oct-2008  pooka add kern_rate, subr_iostat and subr_once
 1.11 09-Oct-2008  pooka Reorganize SRCS+= into smaller chunks to make adding new files
easier. No functional change.
 1.10 09-Oct-2008  pooka No point in having our private atomic ops, just use the ones now
available in libc.
 1.9 30-Sep-2008  pooka Switch to std kern_auth.
 1.8 27-Sep-2008  pooka branches: 1.8.2;
Help out reinoud a bit with the challenge of adding vfs_dirhash.c here
 1.7 25-Sep-2008  pooka Move global malloc types from kern_malloc into a separate module.
 1.6 04-Aug-2008  pooka branches: 1.6.2;
Add support for using real kmem/vmem. Don't enable it by default,
though, since it a) is a lot of unnecessary indirection in rump
b) requires callouts which are so far unimplemented.
 1.5 02-Aug-2008  simonb sort sys/kern SRCS alphabetically.
 1.4 01-Aug-2008  pooka support real sysctls
 1.3 31-Jul-2008  simonb Merge the simonb-wapbl branch. From the original branch commit:

Add Wasabi System's WAPBL (Write Ahead Physical Block Logging)
journaling code. Originally written by Darrin B. Jewell while
at Wasabi and updated to -current by Antti Kantee, Andy Doran,
Greg Oster and Simon Burge.

OK'd by core@, releng@.
 1.2 30-Jul-2008  oster branches: 1.2.2;
Fix race during creation of rumpdefs.h, rumpvnode_if.h, and rumpvnode_if.c.
Patch from pooka@ with tweak from me.

Approved by: pooka
 1.1 29-Jul-2008  pooka Install rump libraries and utilities to the base system and remove the
private non-installed build infrastructure from sys/rump.

breakdown of commit:
* install relevant headers into /usr/include/rump
* build sys/rump/librump/rumpuser and sys/rump/librump/rumpkern
from src/lib and install as librumpuser and librump, respectively
+ this retains the ability to test a librump build with just the
kernel sources at hand
* move sys/rump/fs/lib/libukfs and sys/rump/fs/lib/libp2k to src/lib
for general consumption, they are not kernel-space dwellers anyway
* build and install sys/rump/fs/lib/lib$fs as librumpfs_$fs
* add chapter 3 manual pages for rump, rumpuser, ukfs and p2k
* build and install userspace kernel file system daemons if MKPUFFS=yes
is spexified
* retire fsconsole for now, it will make a comeback with an actually
implemented version shortly
 1.2.2.2 31-Jul-2008  simonb Sync with head.
 1.2.2.1 30-Jul-2008  simonb file Makefile.rumpkern was added on branch simonb-wapbl on 2008-07-31 04:51:05 +0000
 1.6.2.3 10-Oct-2008  skrll Sync with HEAD.
 1.6.2.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.6.2.1 04-Aug-2008  wrstuden file Makefile.rumpkern was added on branch wrstuden-revivesa on 2008-09-18 04:37:04 +0000
 1.8.2.4 17-Jan-2009  mjf Sync with HEAD.
 1.8.2.3 05-Oct-2008  mjf Sync with HEAD.
 1.8.2.2 28-Sep-2008  mjf Sync with HEAD.
 1.8.2.1 27-Sep-2008  mjf file Makefile.rumpkern was added on branch mjf-devfs2 on 2008-09-28 10:41:03 +0000
 1.16.2.3 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.16.2.2 19-Oct-2008  haad Sync with HEAD.
 1.16.2.1 15-Oct-2008  haad file Makefile.rumpkern was added on branch haad-dm on 2008-10-19 22:18:06 +0000
 1.17.4.1 15-Jul-2011  riz Pull up following revision(s) (requested by manu in ticket #1604):
sys/fs/puffs/puffs_msgif.c: revision 1.84
Apply patch from PR kern/44093 by yamt:
Interrupt server wait only on certain signals (same set at nfs -i)
instead of all signals. According to the PR this helps with
"git clone" run on a puffs file system.
 1.17.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.17.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.17.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.40.2.2 23-Jul-2009  jym Sync with HEAD.
 1.40.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.45.2.7 09-Oct-2010  yamt sync with head
 1.45.2.6 11-Aug-2010  yamt sync with head.
 1.45.2.5 11-Mar-2010  yamt sync with head
 1.45.2.4 16-Sep-2009  yamt sync with head
 1.45.2.3 20-Jun-2009  yamt sync with head
 1.45.2.2 04-May-2009  yamt sync with head.
 1.45.2.1 02-May-2009  yamt file Makefile.rumpkern was added on branch yamt-nfs-mp on 2009-05-04 08:14:29 +0000
 1.73.2.4 06-Nov-2010  uebayasi Sync with HEAD.
 1.73.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.73.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.73.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.74.2.5 31-May-2011  rmind sync with head
 1.74.2.4 21-Apr-2011  rmind sync with head
 1.74.2.3 05-Mar-2011  rmind sync with head
 1.74.2.2 03-Jul-2010  rmind sync with head
 1.74.2.1 30-May-2010  rmind sync with head
 1.106.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.109.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.110.2.7 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.110.2.6 23-Jan-2013  yamt sync with head
 1.110.2.5 16-Jan-2013  yamt sync with (a bit old) head
 1.110.2.4 30-Oct-2012  yamt sync with head
 1.110.2.3 23-May-2012  yamt sync with head.
 1.110.2.2 17-Apr-2012  yamt sync with head
 1.110.2.1 02-Nov-2011  yamt page cache related changes

- maintain object pages in radix tree rather than rb tree.
- reduce unnecessary page scan in putpages. esp. when an object has a ton of
pages cached but only a few of them are dirty.
- reduce the number of pmap operations by tracking page dirtiness more
precisely in uvm layer.
- fix nfs commit range tracking.
- fix nfs write clustering. XXX hack
 1.113.2.3 29-Apr-2012  mrg sync to latest -current.
 1.113.2.2 11-Mar-2012  mrg sync to latest -current
 1.113.2.1 18-Feb-2012  mrg merge to -current.
 1.115.2.1 26-Jun-2012  riz branches: 1.115.2.1.2;
Pull up following revision(s) (requested by rmind in ticket #365):
sys/rump/librump/rumpkern/rumpcpu_generic.c: revision 1.4
sys/net/npf/npf_session.c: revision 1.13
sys/net/npf/npf_tableset.c: revision 1.11
sys/net/npf/npf_state_tcp.c: revision 1.7
sys/net/npf/npf_inet.c: revision 1.12
sys/net/npf/npf.h: revision 1.17
sys/net/npf/npf_instr.c: revision 1.11
usr.sbin/npf/npftest/libnpftest/npf_table_test.c: revision 1.2
sys/net/npf/npf_state.c: revision 1.8
sys/net/npf/npf_log.c: revision 1.4
sys/net/npf/npf_alg.c: revision 1.4
sys/rump/librump/rumpkern/Makefile.rumpkern: revision 1.118
sys/net/npf/npf_nat.c: revision 1.13
sys/net/npf/npf.c: revision 1.11
sys/net/npf/npf_sendpkt.c: revision 1.11
sys/net/npf/npf_impl.h: revision 1.16
sys/rump/librump/rumpkern/scheduler.c: revision 1.28
rumpkern:
- Add subr_kcpuset.c and subr_pserialize.c modules.
- Add kcpuset_{running,attached} for RUMP env.
NPF:
- Rename some functions for consistency and de-inline them.
- Fix few invalid asserts (add regressoin test).
- Use pserialize(9) for ALG interface.
- Minor fixes, sprinkle many comments.
 1.115.2.1.2.1 06-Dec-2012  matt Only add atomic_cas_generic.c to SRCS if there isn't already some
atomic_cas_* already in SRCS.
 1.119.2.5 03-Dec-2017  jdolecek update from HEAD
 1.119.2.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.119.2.3 23-Jun-2013  tls resync from head
 1.119.2.2 25-Feb-2013  tls resync with head
 1.119.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.128.4.1 23-Jul-2013  riastradh sync with HEAD
 1.128.2.2 18-May-2014  rmind sync with head
 1.128.2.1 28-Aug-2013  rmind sync with head
 1.143.2.2 10-Aug-2014  tls Rebase.
 1.143.2.1 09-Aug-2014  tls Replace "ccrand" ChaCha implementation of cprng_fast with Taylor's smaller
and somewhat simpler one. Fix rump builds so we can build a distribution.
 1.148.8.1 03-Sep-2019  martin Pull up following revision(s) (requested by riastradh in ticket #1705):

sys/crypto/nist_hash_drbg/nist_hash_drbg.c: revision 1.1
sys/crypto/nist_hash_drbg/nist_hash_drbg.h: revision 1.1
sys/rump/kern/lib/libcrypto/Makefile: revision 1.5
sys/crypto/nist_hash_drbg/files.nist_hash_drbg: revision 1.1
sys/rump/librump/rumpkern/Makefile.rumpkern: revision 1.176
sys/crypto/nist_ctr_drbg/nist_ctr_drbg_aes256.h: file removal
sys/crypto/nist_ctr_drbg/nist_ctr_drbg_config.h: file removal
sys/conf/files: revision 1.1238
sys/dev/rndpseudo.c: revision 1.38
sys/crypto/nist_ctr_drbg/nist_ctr_drbg.c: file removal
sys/sys/cprng.h: revision 1.13 - 1.15
sys/crypto/nist_ctr_drbg/nist_ctr_drbg.h: file removal
sys/crypto/nist_ctr_drbg/nist_ctr_aes_rijndael.h: file removal
sys/crypto/nist_ctr_drbg/files.nist_ctr_drbg: file removal
sys/kern/subr_cprng.c: revision 1.31
sys/crypto/nist_ctr_drbg/nist_ctr_drbg_aes128.h: file removal

cprng.h: use static __inline for consistency with other include
headers and remove an unused function.

-

Switch from NIST CTR_DRBG with AES to NIST Hash_DRBG with SHA-256.

Benefits:
- larger seeds -- a 128-bit key alone is not enough for `128-bit security'
- better resistance to timing side channels than AES
- a better-understood security story (<a rel="nofollow" href="https://eprint.iacr.org/2018/349">https://eprint.iacr.org/2018/349</a>)
- no loss in compliance with US government standards that nobody ever
got fired for choosing, at least in the US-dominated western world
- no dirty endianness tricks
- self-tests

Drawbacks:
- performance hit: throughput is reduced to about 1/3 in naive measurements
=> possible to mitigate by using hardware SHA-256 instructions
=> all you really need is 32 bytes to seed a userland PRNG anyway
=> if we just used ChaCha this would go away...
 1.148.4.1 03-Sep-2019  martin Pull up following revision(s) (requested by riastradh in ticket #1705):

sys/crypto/nist_hash_drbg/nist_hash_drbg.c: revision 1.1
sys/crypto/nist_hash_drbg/nist_hash_drbg.h: revision 1.1
sys/rump/kern/lib/libcrypto/Makefile: revision 1.5
sys/crypto/nist_hash_drbg/files.nist_hash_drbg: revision 1.1
sys/rump/librump/rumpkern/Makefile.rumpkern: revision 1.176
sys/crypto/nist_ctr_drbg/nist_ctr_drbg_aes256.h: file removal
sys/crypto/nist_ctr_drbg/nist_ctr_drbg_config.h: file removal
sys/conf/files: revision 1.1238
sys/dev/rndpseudo.c: revision 1.38
sys/crypto/nist_ctr_drbg/nist_ctr_drbg.c: file removal
sys/sys/cprng.h: revision 1.13 - 1.15
sys/crypto/nist_ctr_drbg/nist_ctr_drbg.h: file removal
sys/crypto/nist_ctr_drbg/nist_ctr_aes_rijndael.h: file removal
sys/crypto/nist_ctr_drbg/files.nist_ctr_drbg: file removal
sys/kern/subr_cprng.c: revision 1.31
sys/crypto/nist_ctr_drbg/nist_ctr_drbg_aes128.h: file removal

cprng.h: use static __inline for consistency with other include
headers and remove an unused function.

-

Switch from NIST CTR_DRBG with AES to NIST Hash_DRBG with SHA-256.

Benefits:
- larger seeds -- a 128-bit key alone is not enough for `128-bit security'
- better resistance to timing side channels than AES
- a better-understood security story (<a rel="nofollow" href="https://eprint.iacr.org/2018/349">https://eprint.iacr.org/2018/349</a>)
- no loss in compliance with US government standards that nobody ever
got fired for choosing, at least in the US-dominated western world
- no dirty endianness tricks
- self-tests

Drawbacks:
- performance hit: throughput is reduced to about 1/3 in naive measurements
=> possible to mitigate by using hardware SHA-256 instructions
=> all you really need is 32 bytes to seed a userland PRNG anyway
=> if we just used ChaCha this would go away...
 1.148.2.1 03-Sep-2019  martin Pull up following revision(s) (requested by riastradh in ticket #1705):

sys/crypto/nist_hash_drbg/nist_hash_drbg.c: revision 1.1
sys/crypto/nist_hash_drbg/nist_hash_drbg.h: revision 1.1
sys/rump/kern/lib/libcrypto/Makefile: revision 1.5
sys/crypto/nist_hash_drbg/files.nist_hash_drbg: revision 1.1
sys/rump/librump/rumpkern/Makefile.rumpkern: revision 1.176
sys/crypto/nist_ctr_drbg/nist_ctr_drbg_aes256.h: file removal
sys/crypto/nist_ctr_drbg/nist_ctr_drbg_config.h: file removal
sys/conf/files: revision 1.1238
sys/dev/rndpseudo.c: revision 1.38
sys/crypto/nist_ctr_drbg/nist_ctr_drbg.c: file removal
sys/sys/cprng.h: revision 1.13 - 1.15
sys/crypto/nist_ctr_drbg/nist_ctr_drbg.h: file removal
sys/crypto/nist_ctr_drbg/nist_ctr_aes_rijndael.h: file removal
sys/crypto/nist_ctr_drbg/files.nist_ctr_drbg: file removal
sys/kern/subr_cprng.c: revision 1.31
sys/crypto/nist_ctr_drbg/nist_ctr_drbg_aes128.h: file removal

cprng.h: use static __inline for consistency with other include
headers and remove an unused function.

-

Switch from NIST CTR_DRBG with AES to NIST Hash_DRBG with SHA-256.

Benefits:
- larger seeds -- a 128-bit key alone is not enough for `128-bit security'
- better resistance to timing side channels than AES
- a better-understood security story (<a rel="nofollow" href="https://eprint.iacr.org/2018/349">https://eprint.iacr.org/2018/349</a>)
- no loss in compliance with US government standards that nobody ever
got fired for choosing, at least in the US-dominated western world
- no dirty endianness tricks
- self-tests

Drawbacks:
- performance hit: throughput is reduced to about 1/3 in naive measurements
=> possible to mitigate by using hardware SHA-256 instructions
=> all you really need is 32 bytes to seed a userland PRNG anyway
=> if we just used ChaCha this would go away...
 1.150.2.8 28-Aug-2017  skrll Sync with HEAD
 1.150.2.7 05-Oct-2016  skrll Sync with HEAD
 1.150.2.6 22-Apr-2016  skrll Sync with HEAD
 1.150.2.5 19-Mar-2016  skrll Sync with HEAD
 1.150.2.4 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.150.2.3 22-Sep-2015  skrll Sync with HEAD
 1.150.2.2 06-Jun-2015  skrll Sync with HEAD
 1.150.2.1 06-Apr-2015  skrll Sync with HEAD
 1.167.2.2 26-Apr-2017  pgoyette Sync with HEAD
 1.167.2.1 16-Jul-2016  pgoyette Make sure we include the localcount routines in the rump libraries
 1.168.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.169.6.2 03-Sep-2019  martin Pull up following revision(s) (requested by riastradh in ticket #1365):

sys/crypto/nist_hash_drbg/nist_hash_drbg.c: revision 1.1
sys/crypto/nist_hash_drbg/nist_hash_drbg.h: revision 1.1
sys/rump/kern/lib/libcrypto/Makefile: revision 1.5
sys/crypto/nist_hash_drbg/files.nist_hash_drbg: revision 1.1
sys/rump/librump/rumpkern/Makefile.rumpkern: revision 1.176
sys/crypto/nist_ctr_drbg/nist_ctr_drbg_aes256.h: file removal
sys/crypto/nist_ctr_drbg/nist_ctr_drbg_config.h: file removal
sys/conf/files: revision 1.1238
sys/dev/rndpseudo.c: revision 1.38
sys/crypto/nist_ctr_drbg/nist_ctr_drbg.c: file removal
sys/sys/cprng.h: revision 1.13 - 1.15
sys/crypto/nist_ctr_drbg/nist_ctr_drbg.h: file removal
sys/crypto/nist_ctr_drbg/nist_ctr_aes_rijndael.h: file removal
sys/crypto/nist_ctr_drbg/files.nist_ctr_drbg: file removal
sys/kern/subr_cprng.c: revision 1.31
sys/crypto/nist_ctr_drbg/nist_ctr_drbg_aes128.h: file removal

cprng.h: use static __inline for consistency with other include
headers and remove an unused function.

-

Switch from NIST CTR_DRBG with AES to NIST Hash_DRBG with SHA-256.

Benefits:
- larger seeds -- a 128-bit key alone is not enough for `128-bit security'
- better resistance to timing side channels than AES
- a better-understood security story (<a rel="nofollow" href="https://eprint.iacr.org/2018/349">https://eprint.iacr.org/2018/349</a>)
- no loss in compliance with US government standards that nobody ever
got fired for choosing, at least in the US-dominated western world
- no dirty endianness tricks
- self-tests

Drawbacks:
- performance hit: throughput is reduced to about 1/3 in naive measurements
=> possible to mitigate by using hardware SHA-256 instructions
=> all you really need is 32 bytes to seed a userland PRNG anyway
=> if we just used ChaCha this would go away...
 1.169.6.1 21-Oct-2017  snj Pull up following revision(s) (requested by ozaki-r in ticket #300):
crypto/dist/ipsec-tools/src/setkey/parse.y: 1.19
crypto/dist/ipsec-tools/src/setkey/token.l: 1.20
distrib/sets/lists/tests/mi: 1.754, 1.757, 1.759
doc/TODO.smpnet: 1.12-1.13
sys/net/pfkeyv2.h: 1.32
sys/net/raw_cb.c: 1.23-1.24, 1.28
sys/net/raw_cb.h: 1.28
sys/net/raw_usrreq.c: 1.57-1.58
sys/net/rtsock.c: 1.228-1.229
sys/netinet/in_proto.c: 1.125
sys/netinet/ip_input.c: 1.359-1.361
sys/netinet/tcp_input.c: 1.359-1.360
sys/netinet/tcp_output.c: 1.197
sys/netinet/tcp_var.h: 1.178
sys/netinet6/icmp6.c: 1.213
sys/netinet6/in6_proto.c: 1.119
sys/netinet6/ip6_forward.c: 1.88
sys/netinet6/ip6_input.c: 1.181-1.182
sys/netinet6/ip6_output.c: 1.193
sys/netinet6/ip6protosw.h: 1.26
sys/netipsec/ipsec.c: 1.100-1.122
sys/netipsec/ipsec.h: 1.51-1.61
sys/netipsec/ipsec6.h: 1.18-1.20
sys/netipsec/ipsec_input.c: 1.44-1.51
sys/netipsec/ipsec_netbsd.c: 1.41-1.45
sys/netipsec/ipsec_output.c: 1.49-1.64
sys/netipsec/ipsec_private.h: 1.5
sys/netipsec/key.c: 1.164-1.234
sys/netipsec/key.h: 1.20-1.32
sys/netipsec/key_debug.c: 1.18-1.21
sys/netipsec/key_debug.h: 1.9
sys/netipsec/keydb.h: 1.16-1.20
sys/netipsec/keysock.c: 1.59-1.62
sys/netipsec/keysock.h: 1.10
sys/netipsec/xform.h: 1.9-1.12
sys/netipsec/xform_ah.c: 1.55-1.74
sys/netipsec/xform_esp.c: 1.56-1.72
sys/netipsec/xform_ipcomp.c: 1.39-1.53
sys/netipsec/xform_ipip.c: 1.50-1.54
sys/netipsec/xform_tcp.c: 1.12-1.16
sys/rump/librump/rumpkern/Makefile.rumpkern: 1.170
sys/rump/librump/rumpnet/net_stub.c: 1.27
sys/sys/protosw.h: 1.67-1.68
tests/net/carp/t_basic.sh: 1.7
tests/net/if_gif/t_gif.sh: 1.11
tests/net/if_l2tp/t_l2tp.sh: 1.3
tests/net/ipsec/Makefile: 1.7-1.9
tests/net/ipsec/algorithms.sh: 1.5
tests/net/ipsec/common.sh: 1.4-1.6
tests/net/ipsec/t_ipsec_ah_keys.sh: 1.2
tests/net/ipsec/t_ipsec_esp_keys.sh: 1.2
tests/net/ipsec/t_ipsec_gif.sh: 1.6-1.7
tests/net/ipsec/t_ipsec_l2tp.sh: 1.6-1.7
tests/net/ipsec/t_ipsec_misc.sh: 1.8-1.18
tests/net/ipsec/t_ipsec_sockopt.sh: 1.1-1.2
tests/net/ipsec/t_ipsec_tcp.sh: 1.1-1.2
tests/net/ipsec/t_ipsec_transport.sh: 1.5-1.6
tests/net/ipsec/t_ipsec_tunnel.sh: 1.9
tests/net/ipsec/t_ipsec_tunnel_ipcomp.sh: 1.1-1.2
tests/net/ipsec/t_ipsec_tunnel_odd.sh: 1.3
tests/net/mcast/t_mcast.sh: 1.6
tests/net/net/t_ipaddress.sh: 1.11
tests/net/net_common.sh: 1.20
tests/net/npf/t_npf.sh: 1.3
tests/net/route/t_flags.sh: 1.20
tests/net/route/t_flags6.sh: 1.16
usr.bin/netstat/fast_ipsec.c: 1.22
Do m_pullup before mtod

It may fix panicks of some tests on anita/sparc and anita/GuruPlug.
---
KNF
---
Enable DEBUG for babylon5
---
Apply C99-style struct initialization to xformsw
---
Tweak outputs of netstat -s for IPsec

- Get rid of "Fast"
- Use ipsec and ipsec6 for titles to clarify protocol
- Indent outputs of sub protocols

Original outputs were organized like this:

(Fast) IPsec:
IPsec ah:
IPsec esp:
IPsec ipip:
IPsec ipcomp:
(Fast) IPsec:
IPsec ah:
IPsec esp:
IPsec ipip:
IPsec ipcomp:

New outputs are organized like this:

ipsec:
ah:
esp:
ipip:
ipcomp:
ipsec6:
ah:
esp:
ipip:
ipcomp:
---
Add test cases for IPComp
---
Simplify IPSEC_OSTAT macro (NFC)
---
KNF; replace leading whitespaces with hard tabs
---
Introduce and use SADB_SASTATE_USABLE_P
---
KNF
---
Add update command for testing

Updating an SA (SADB_UPDATE) requires that a process issuing
SADB_UPDATE is the same as a process issued SADB_ADD (or SADB_GETSPI).
This means that update command must be used with add command in a
configuration of setkey. This usage is normally meaningless but
useful for testing (and debugging) purposes.
---
Add test cases for updating SA/SP

The tests require newly-added udpate command of setkey.
---
PR/52346: Frank Kardel: Fix checksumming for NAT-T
See XXX for improvements.
---
Remove codes for PACKET_TAG_IPSEC_IN_CRYPTO_DONE

It seems that PACKET_TAG_IPSEC_IN_CRYPTO_DONE is for network adapters
that have IPsec accelerators; a driver sets the mtag to a packet
when its device has already encrypted the packet.

Unfortunately no driver implements such offload features for long
years and seems unlikely to implement them soon. (Note that neither
FreeBSD nor Linux doesn't have such drivers.) Let's remove related
(unused) codes and simplify the IPsec code.
---
Fix usages of sadb_msg_errno
---
Avoid updating sav directly

On SADB_UPDATE a target sav was updated directly, which was unsafe.
Instead allocate another sav, copy variables of the old sav to
the new one and replace the old one with the new one.
---
Simplify; we can assume sav->tdb_xform cannot be NULL while it's valid
---
Rename key_alloc* functions (NFC)

We shouldn't use the term "alloc" for functions that just look up
data and actually don't allocate memory.
---
Use explicit_memset to surely zero-clear key_auth and key_enc
---
Make sure to clear keys on error paths of key_setsaval
---
Add missing KEY_FREESAV
---
Make sure a sav is inserted to a sah list after its initialization completes
---
Remove unnecessary zero-clearing codes from key_setsaval

key_setsaval is now used only for a newly-allocated sav. (It was
used to reset variables of an existing sav.)
---
Correct wrong assumption of sav->refcnt in key_delsah

A sav in a list is basically not to be sav->refcnt == 0. And also
KEY_FREESAV assumes sav->refcnt > 0.
---
Let key_getsavbyspi take a reference of a returning sav
---
Use time_mono_to_wall (NFC)
---
Separate sending message routine (NFC)
---
Simplify; remove unnecessary zero-clears

key_freesaval is used only when a target sav is being destroyed.
---
Omit NULL checks for sav->lft_c

sav->lft_c can be NULL only when initializing or destroying sav.
---
Omit unnecessary NULL checks for sav->sah
---
Omit unnecessary check of sav->state

key_allocsa_policy picks a sav of either MATURE or DYING so we
don't need to check its state again.
---
Simplify; omit unnecessary saidx passing

- ipsec_nextisr returns a saidx but no caller uses it
- key_checkrequest is passed a saidx but it can be gotton by
another argument (isr)
---
Fix splx isn't called on some error paths
---
Fix header size calculation of esp where sav is NULL
---
Fix header size calculation of ah in the case sav is NULL

This fix was also needed for esp.
---
Pass sav directly to opencrypto callback

In a callback, use a passed sav as-is by default and look up a sav
only if the passed sav is dead.
---
Avoid examining freshness of sav on packet processing

If a sav list is sorted (by lft_c->sadb_lifetime_addtime) in advance,
we don't need to examine each sav and also don't need to delete one
on the fly and send up a message. Fortunately every sav lists are sorted
as we need.

Added key_validate_savlist validates that each sav list is surely sorted
(run only if DEBUG because it's not cheap).
---
Add test cases for SAs with different SPIs
---
Prepare to stop using isr->sav

isr is a shared resource and using isr->sav as a temporal storage
for each packet processing is racy. And also having a reference from
isr to sav makes the lifetime of sav non-deterministic; such a reference
is removed when a packet is processed and isr->sav is overwritten by
new one. Let's have a sav locally for each packet processing instead of
using shared isr->sav.

However this change doesn't stop using isr->sav yet because there are
some users of isr->sav. isr->sav will be removed after the users find
a way to not use isr->sav.
---
Fix wrong argument handling
---
fix printf format.
---
Don't validate sav lists of LARVAL or DEAD states

We don't sort the lists so the validation will always fail.

Fix PR kern/52405
---
Make sure to sort the list when changing the state by key_sa_chgstate
---
Rename key_allocsa_policy to key_lookup_sa_bysaidx
---
Separate test files
---
Calculate ah_max_authsize on initialization as well as esp_max_ivlen
---
Remove m_tag_find(PACKET_TAG_IPSEC_PENDING_TDB) because nobody sets the tag
---
Restore a comment removed in previous

The comment is valid for the below code.
---
Make tests more stable

sleep command seems to wait longer than expected on anita so
use polling to wait for a state change.
---
Add tests that explicitly delete SAs instead of waiting for expirations
---
Remove invalid M_AUTHIPDGM check on ESP isr->sav

M_AUTHIPDGM flag is set to a mbuf in ah_input_cb. An sav of ESP can
have AH authentication as sav->tdb_authalgxform. However, in that
case esp_input and esp_input_cb are used to do ESP decryption and
AH authentication and M_AUTHIPDGM never be set to a mbuf. So
checking M_AUTHIPDGM of a mbuf on isr->sav of ESP is meaningless.
---
Look up sav instead of relying on unstable sp->req->sav

This code is executed only in an error path so an additional lookup
doesn't matter.
---
Correct a comment
---
Don't release sav if calling crypto_dispatch again
---
Remove extra KEY_FREESAV from ipsec_process_done

It should be done by the caller.
---
Don't bother the case of crp->crp_buf == NULL in callbacks
---
Hold a reference to an SP during opencrypto processing

An SP has a list of isr (ipsecrequest) that represents a sequence
of IPsec encryption/authentication processing. One isr corresponds
to one opencrypto processing. The lifetime of an isr follows its SP.

We pass an isr to a callback function of opencrypto to continue
to a next encryption/authentication processing. However nobody
guaranteed that the isr wasn't freed, i.e., its SP wasn't destroyed.

In order to avoid such unexpected destruction of isr, hold a reference
to its SP during opencrypto processing.
---
Don't make SAs expired on tests that delete SAs explicitly
---
Fix a debug message
---
Dedup error paths (NFC)
---
Use pool to allocate tdb_crypto

For ESP and AH, we need to allocate an extra variable space in addition
to struct tdb_crypto. The fixed size of pool items may be larger than
an actual requisite size of a buffer, but still the performance
improvement by replacing malloc with pool wins.
---
Don't use unstable isr->sav for header size calculations

We may need to optimize to not look up sav here for users that
don't need to know an exact size of headers (e.g., TCP segmemt size
caclulation).
---
Don't use sp->req->sav when handling NAT-T ESP fragmentation

In order to do this we need to look up a sav however an additional
look-up degrades performance. A sav is later looked up in
ipsec4_process_packet so delay the fragmentation check until then
to avoid an extra look-up.
---
Don't use key_lookup_sp that depends on unstable sp->req->sav

It provided a fast look-up of SP. We will provide an alternative
method in the future (after basic MP-ification finishes).
---
Stop setting isr->sav on looking up sav in key_checkrequest
---
Remove ipsecrequest#sav
---
Stop setting mtag of PACKET_TAG_IPSEC_IN_DONE because there is no users anymore
---
Skip ipsec_spi_*_*_preferred_new_timeout when running on qemu

Probably due to PR 43997
---
Add localcount to rump kernels
---
Remove unused macro
---
Fix key_getcomb_setlifetime

The fix adjusts a soft limit to be 80% of a corresponding hard limit.

I'm not sure the fix is really correct though, at least the original
code is wrong. A passed comb is zero-cleared before calling
key_getcomb_setlifetime, so
comb->sadb_comb_soft_addtime = comb->sadb_comb_soft_addtime * 80 / 100;
is meaningless.
---
Provide and apply key_sp_refcnt (NFC)

It simplifies further changes.
---
Fix indentation

Pointed out by knakahara@
---
Use pslist(9) for sptree
---
Don't acquire global locks for IPsec if NET_MPSAFE

Note that the change is just to make testing easy and IPsec isn't MP-safe yet.
---
Let PF_KEY socks hold their own lock instead of softnet_lock

Operations on SAD and SPD are executed via PF_KEY socks. The operations
include deletions of SAs and SPs that will use synchronization mechanisms
such as pserialize_perform to wait for references to SAs and SPs to be
released. It is known that using such mechanisms with holding softnet_lock
causes a dead lock. We should avoid the situation.
---
Make IPsec SPD MP-safe

We use localcount(9), not psref(9), to make the sptree and secpolicy (SP)
entries MP-safe because SPs need to be referenced over opencrypto
processing that executes a callback in a different context.

SPs on sockets aren't managed by the sptree and can be destroyed in softint.
localcount_drain cannot be used in softint so we delay the destruction of
such SPs to a thread context. To do so, a list to manage such SPs is added
(key_socksplist) and key_timehandler_spd deletes dead SPs in the list.

For more details please read the locking notes in key.c.

Proposed on tech-kern@ and tech-net@
---
Fix updating ipsec_used

- key_update_used wasn't called in key_api_spddelete2 and key_api_spdflush
- key_update_used wasn't called if an SP had been added/deleted but
a reply to userland failed
---
Fix updating ipsec_used; turn on when SPs on sockets are added
---
Add missing IPsec policy checks to icmp6_rip6_input

icmp6_rip6_input is quite similar to rip6_input and the same checks exist
in rip6_input.
---
Add test cases for setsockopt(IP_IPSEC_POLICY)
---
Don't use KEY_NEWSP for dummy SP entries

By the change KEY_NEWSP is now not called from softint anymore
and we can use kmem_zalloc with KM_SLEEP for KEY_NEWSP.
---
Comment out unused functions
---
Add test cases that there are SPs but no relevant SAs
---
Don't allow sav->lft_c to be NULL

lft_c of an sav that was created by SADB_GETSPI could be NULL.
---
Clean up clunky eval strings

- Remove unnecessary \ at EOL
- This allows to omit ; too
- Remove unnecessary quotes for arguments of atf_set
- Don't expand $DEBUG in eval
- We expect it's expanded on execution

Suggested by kre@
---
Remove unnecessary KEY_FREESAV in an error path

sav should be freed (unreferenced) by the caller.
---
Use pslist(9) for sahtree
---
Use pslist(9) for sah->savtree
---
Rename local variable newsah to sah

It may not be new.
---
MP-ify SAD slightly

- Introduce key_sa_mtx and use it for some list operations
- Use pserialize for some list iterations
---
Introduce KEY_SA_UNREF and replace KEY_FREESAV with it where sav will never be actually freed in the future

KEY_SA_UNREF is still key_freesav so no functional change for now.

This change reduces diff of further changes.
---
Remove out-of-date log output

Pointed out by riastradh@
---
Use KDASSERT instead of KASSERT for mutex_ownable

Because mutex_ownable is too heavy to run in a fast path
even for DIAGNOSTIC + LOCKDEBUG.

Suggested by riastradh@
---
Assemble global lists and related locks into cache lines (NFCI)

Also rename variable names from *tree to *list because they are
just lists, not trees.

Suggested by riastradh@
---
Move locking notes
---
Update the locking notes

- Add locking order
- Add locking notes for misc lists such as reglist
- Mention pserialize, key_sp_ref and key_sp_unref on SP operations

Requested by riastradh@
---
Describe constraints of key_sp_ref and key_sp_unref

Requested by riastradh@
---
Hold key_sad.lock on SAVLIST_WRITER_INSERT_TAIL
---
Add __read_mostly to key_psz

Suggested by riastradh@
---
Tweak wording (pserialize critical section => pserialize read section)

Suggested by riastradh@
---
Add missing mutex_exit
---
Fix setkey -D -P outputs

The outputs were tweaked (by me), but I forgot updating libipsec
in my local ATF environment...
---
MP-ify SAD (key_sad.sahlist and sah entries)

localcount(9) is used to protect key_sad.sahlist and sah entries
as well as SPD (and will be used for SAD sav).

Please read the locking notes of SAD for more details.
---
Introduce key_sa_refcnt and replace sav->refcnt with it (NFC)
---
Destroy sav only in the loop for DEAD sav
---
Fix KASSERT(solocked(sb->sb_so)) failure in sbappendaddr that is called eventually from key_sendup_mbuf

If key_sendup_mbuf isn't passed a socket, the assertion fails.
Originally in this case sb->sb_so was softnet_lock and callers
held softnet_lock so the assertion was magically satisfied.
Now sb->sb_so is key_so_mtx and also softnet_lock isn't always
held by callers so the assertion can fail.

Fix it by holding key_so_mtx if key_sendup_mbuf isn't passed a socket.

Reported by knakahara@
Tested by knakahara@ and ozaki-r@
---
Fix locking notes of SAD
---
Fix deadlock between key_sendup_mbuf called from key_acquire and localcount_drain

If we call key_sendup_mbuf from key_acquire that is called on packet
processing, a deadlock can happen like this:
- At key_acquire, a reference to an SP (and an SA) is held
- key_sendup_mbuf will try to take key_so_mtx
- Some other thread may try to localcount_drain to the SP with
holding key_so_mtx in say key_api_spdflush
- In this case localcount_drain never return because key_sendup_mbuf
that has stuck on key_so_mtx never release a reference to the SP

Fix the deadlock by deferring key_sendup_mbuf to the timer
(key_timehandler).
---
Fix that prev isn't cleared on retry
---
Limit the number of mbufs queued for deferred key_sendup_mbuf

It's easy to be queued hundreds of mbufs on the list under heavy
network load.
---
MP-ify SAD (savlist)

localcount(9) is used to protect savlist of sah. The basic design is
similar to MP-ifications of SPD and SAD sahlist. Please read the
locking notes of SAD for more details.
---
Simplify ipsec_reinject_ipstack (NFC)
---
Add per-CPU rtcache to ipsec_reinject_ipstack

It reduces route lookups and also reduces rtcache lock contentions
when NET_MPSAFE is enabled.
---
Use pool_cache(9) instead of pool(9) for tdb_crypto objects

The change improves network throughput especially on multi-core systems.
---
Update

ipsec(4), opencrypto(9) and vlan(4) are now MP-safe.
---
Write known issues on scalability
---
Share a global dummy SP between PCBs

It's never be changed so it can be pre-allocated and shared safely between PCBs.
---
Fix race condition on the rawcb list shared by rtsock and keysock

keysock now protects itself by its own mutex, which means that
the rawcb list is protected by two different mutexes (keysock's one
and softnet_lock for rtsock), of course it's useless.

Fix the situation by having a discrete rawcb list for each.
---
Use a dedicated mutex for rt_rawcb instead of softnet_lock if NET_MPSAFE
---
fix localcount leak in sav. fixed by ozaki-r@n.o.

I commit on behalf of him.
---
remove unnecessary comment.
---
Fix deadlock between pserialize_perform and localcount_drain

A typical ussage of localcount_drain looks like this:

mutex_enter(&mtx);
item = remove_from_list();
pserialize_perform(psz);
localcount_drain(&item->localcount, &cv, &mtx);
mutex_exit(&mtx);

This sequence can cause a deadlock which happens for example on the following
situation:

- Thread A calls localcount_drain which calls xc_broadcast after releasing
a specified mutex
- Thread B enters the sequence and calls pserialize_perform with holding
the mutex while pserialize_perform also calls xc_broadcast
- Thread C (xc_thread) that calls an xcall callback of localcount_drain tries
to hold the mutex

xc_broadcast of thread B doesn't start until xc_broadcast of thread A
finishes, which is a feature of xcall(9). This means that pserialize_perform
never complete until xc_broadcast of thread A finishes. On the other hand,
thread C that is a callee of xc_broadcast of thread A sticks on the mutex.
Finally the threads block each other (A blocks B, B blocks C and C blocks A).

A possible fix is to serialize executions of the above sequence by another
mutex, but adding another mutex makes the code complex, so fix the deadlock
by another way; the fix is to release the mutex before pserialize_perform
and instead use a condvar to prevent pserialize_perform from being called
simultaneously.

Note that the deadlock has happened only if NET_MPSAFE is enabled.
---
Add missing ifdef NET_MPSAFE
---
Take softnet_lock on pr_input properly if NET_MPSAFE

Currently softnet_lock is taken unnecessarily in some cases, e.g.,
icmp_input and encap4_input from ip_input, or not taken even if needed,
e.g., udp_input and tcp_input from ipsec4_common_input_cb. Fix them.

NFC if NET_MPSAFE is disabled (default).
---
- sanitize key debugging so that we don't print extra newlines or unassociated
debugging messages.
- remove unused functions and make internal ones static
- print information in one line per message
---
humanize printing of ip addresses
---
cast reduction, NFC.
---
Fix typo in comment
---
Pull out ipsec_fill_saidx_bymbuf (NFC)
---
Don't abuse key_checkrequest just for looking up sav

It does more than expected for example key_acquire.
---
Fix SP is broken on transport mode

isr->saidx was modified accidentally in ipsec_nextisr.

Reported by christos@
Helped investigations by christos@ and knakahara@
---
Constify isr at many places (NFC)
---
Include socketvar.h for softnet_lock
---
Fix buffer length for ipsec_logsastr
 1.169.4.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.170.4.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.170.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.170.4.1 10-Jun-2019  christos Sync with HEAD
 1.170.2.3 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.170.2.2 30-Sep-2018  pgoyette Ssync with HEAD
 1.170.2.1 20-Mar-2018  pgoyette Initial implementation of sys/kern/kern_stup.c as discussed on tech-kern

For now, we only handle the dev/ccd and NTP needs; more to follow.
 1.175.2.1 03-Sep-2019  martin Pull up following revision(s) (requested by riastradh in ticket #173):

sys/crypto/nist_hash_drbg/nist_hash_drbg.c: revision 1.1
sys/crypto/nist_hash_drbg/nist_hash_drbg.h: revision 1.1
sys/rump/kern/lib/libcrypto/Makefile: revision 1.5
sys/crypto/nist_hash_drbg/files.nist_hash_drbg: revision 1.1
sys/rump/librump/rumpkern/Makefile.rumpkern: revision 1.176
sys/crypto/nist_ctr_drbg/nist_ctr_drbg_aes256.h: file removal
sys/crypto/nist_ctr_drbg/nist_ctr_drbg_config.h: file removal
sys/conf/files: revision 1.1238
sys/dev/rndpseudo.c: revision 1.38
sys/crypto/nist_ctr_drbg/nist_ctr_drbg.c: file removal
sys/sys/cprng.h: revision 1.15
sys/crypto/nist_ctr_drbg/nist_ctr_drbg.h: file removal
sys/crypto/nist_ctr_drbg/nist_ctr_aes_rijndael.h: file removal
sys/crypto/nist_ctr_drbg/files.nist_ctr_drbg: file removal
sys/kern/subr_cprng.c: revision 1.31
sys/crypto/nist_ctr_drbg/nist_ctr_drbg_aes128.h: file removal

Switch from NIST CTR_DRBG with AES to NIST Hash_DRBG with SHA-256.

Benefits:
- larger seeds -- a 128-bit key alone is not enough for `128-bit security'
- better resistance to timing side channels than AES
- a better-understood security story (<a rel="nofollow" href="https://eprint.iacr.org/2018/349">https://eprint.iacr.org/2018/349</a>)
- no loss in compliance with US government standards that nobody ever
got fired for choosing, at least in the US-dominated western world
- no dirty endianness tricks
- self-tests

Drawbacks:
- performance hit: throughput is reduced to about 1/3 in naive measurements
=> possible to mitigate by using hardware SHA-256 instructions
=> all you really need is 32 bytes to seed a userland PRNG anyway
=> if we just used ChaCha this would go away...

XXX pullup-7
XXX pullup-8
XXX pullup-9
 1.181.2.1 17-Jan-2020  ad Sync with head.
 1.191.6.1 02-Aug-2025  perseant Sync with HEAD
 1.3 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.2 03-Apr-2015  pooka Use vmspace of calling [rump kernel] process instead of sysspace.
 1.1 25-Apr-2014  pooka branches: 1.1.2; 1.1.4; 1.1.6; 1.1.10; 1.1.12;
gardenize rump.c: move data structure helper routines to accessors.c
 1.1.12.2 19-Mar-2016  skrll Sync with HEAD
 1.1.12.1 06-Apr-2015  skrll Sync with HEAD
 1.1.10.3 03-Dec-2017  jdolecek update from HEAD
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 25-Apr-2014  tls file accessors.c was added on branch tls-maxphys on 2014-08-20 00:04:40 +0000
 1.1.6.2 10-Aug-2014  tls Rebase.
 1.1.6.1 25-Apr-2014  tls file accessors.c was added on branch tls-earlyentropy on 2014-08-10 06:56:51 +0000
 1.1.4.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.1.4.1 25-Apr-2014  yamt file accessors.c was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.1.2.2 18-May-2014  rmind sync with head
 1.1.2.1 25-Apr-2014  rmind file accessors.c was added on branch rmind-smpnet on 2014-05-18 17:46:18 +0000
 1.6 09-Oct-2008  pooka No point in having our private atomic ops, just use the ones now
available in libc.
 1.5 29-Jul-2008  pooka Install rump libraries and utilities to the base system and remove the
private non-installed build infrastructure from sys/rump.

breakdown of commit:
* install relevant headers into /usr/include/rump
* build sys/rump/librump/rumpuser and sys/rump/librump/rumpkern
from src/lib and install as librumpuser and librump, respectively
+ this retains the ability to test a librump build with just the
kernel sources at hand
* move sys/rump/fs/lib/libukfs and sys/rump/fs/lib/libp2k to src/lib
for general consumption, they are not kernel-space dwellers anyway
* build and install sys/rump/fs/lib/lib$fs as librumpfs_$fs
* add chapter 3 manual pages for rump, rumpuser, ukfs and p2k
* build and install userspace kernel file system daemons if MKPUFFS=yes
is spexified
* retire fsconsole for now, it will make a comeback with an actually
implemented version shortly
 1.4 02-Jul-2008  he branches: 1.4.2;
Don't rely on <sys/mutex.h> being implicitly included, because on
some ports (mvme68k for example) that's not happening.
 1.3 28-Apr-2008  martin branches: 1.3.2; 1.3.4;
Remove clause 3 and 4 from TNF licenses
 1.2 30-Dec-2007  pooka branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8; 1.2.14; 1.2.16; 1.2.18;
pull in atomic ops from vmlocking2
 1.1 28-Dec-2007  ad branches: 1.1.2;
file atomic.c was initially added on branch vmlocking2.
 1.1.2.1 28-Dec-2007  ad Make rump build.
 1.2.18.2 04-May-2009  yamt sync with head.
 1.2.18.1 16-May-2008  yamt sync with head.
 1.2.16.1 18-May-2008  yamt sync with head.
 1.2.14.3 17-Jan-2009  mjf Sync with HEAD.
 1.2.14.2 28-Sep-2008  mjf Sync with HEAD.
 1.2.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.8.2 18-Feb-2008  mjf Sync with HEAD.
 1.2.8.1 30-Dec-2007  mjf file atomic.c was added on branch mjf-devfs on 2008-02-18 21:07:22 +0000
 1.2.6.2 21-Jan-2008  yamt sync with head
 1.2.6.1 30-Dec-2007  yamt file atomic.c was added on branch yamt-lazymbuf on 2008-01-21 09:47:41 +0000
 1.2.4.2 09-Jan-2008  matt sync with HEAD
 1.2.4.1 30-Dec-2007  matt file atomic.c was added on branch matt-armv6 on 2008-01-09 01:57:59 +0000
 1.2.2.2 02-Jan-2008  bouyer Sync with HEAD
 1.2.2.1 30-Dec-2007  bouyer file atomic.c was added on branch bouyer-xeni386 on 2008-01-02 21:57:51 +0000
 1.3.4.2 31-Jul-2008  simonb Sync with head.
 1.3.4.1 03-Jul-2008  simonb Sync with head.
 1.3.2.2 10-Oct-2008  skrll Sync with HEAD.
 1.3.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.4.2.1 19-Oct-2008  haad Sync with HEAD.
 1.3 14-Mar-2021  christos provide generic cas for _LP64
 1.2 18-Dec-2009  pooka branches: 1.2.76;
I got a report about this not compiling on mips64. While I could
not repeat the problem and while this should not be used at all on
mips64, the real fix is a little diablo in the details. So hack
around it for now (yes, it results in only half of the locks being
used on 64bit platforms. no biggie for a hack).
 1.1 12-Jan-2009  pooka branches: 1.1.2; 1.1.4; 1.1.8;
* Add adapted version of the userspace atomic_cas ops for platforms
lacking special instructions. We always use the spinlocked version
(could use RAS on UP NetBSD host, but it's not portable).
* Add platform-based symbol quirk tables for selectively not renaming
toolchain symbols for some platforms. Although, this should really
depend on the (toolchain,platform)-tuple and not just the platform.

This allows arm, hppa, mips and sh3 to build succesfully with an
isolated rump kernel namespace. ... now, one arch remains: vax.
you must compile vax. then, only then will you MI be.
 1.1.8.3 11-Mar-2010  yamt sync with head
 1.1.8.2 04-May-2009  yamt sync with head.
 1.1.8.1 12-Jan-2009  yamt file atomic_cas_generic.c was added on branch yamt-nfs-mp on 2009-05-04 08:14:29 +0000
 1.1.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.4.1 12-Jan-2009  skrll file atomic_cas_generic.c was added on branch nick-hppapmap on 2009-01-19 13:20:25 +0000
 1.1.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.2.1 12-Jan-2009  mjf file atomic_cas_generic.c was added on branch mjf-devfs2 on 2009-01-17 13:29:36 +0000
 1.2.76.1 03-Apr-2021  thorpej Sync with HEAD.
 1.2 22-Nov-2010  pooka rename atomic_cas_up to rump_atomic_cas_up to avoid collisions
 1.1 21-Nov-2010  pooka Add a lockless uniprocessor version of atomic_cas_generic.c, which
is currently used by all the archs that previously used cas_generic.
 1.11 30-Sep-2008  pooka Switch to std kern_auth.
 1.10 29-Jul-2008  pooka Install rump libraries and utilities to the base system and remove the
private non-installed build infrastructure from sys/rump.

breakdown of commit:
* install relevant headers into /usr/include/rump
* build sys/rump/librump/rumpuser and sys/rump/librump/rumpkern
from src/lib and install as librumpuser and librump, respectively
+ this retains the ability to test a librump build with just the
kernel sources at hand
* move sys/rump/fs/lib/libukfs and sys/rump/fs/lib/libp2k to src/lib
for general consumption, they are not kernel-space dwellers anyway
* build and install sys/rump/fs/lib/lib$fs as librumpfs_$fs
* add chapter 3 manual pages for rump, rumpuser, ukfs and p2k
* build and install userspace kernel file system daemons if MKPUFFS=yes
is spexified
* retire fsconsole for now, it will make a comeback with an actually
implemented version shortly
 1.9 01-Jul-2008  pooka branches: 1.9.2;
Fixes to build rump utilities as host binaries on Linux by removing
sys namespace pollution which has crept in.

Submitted in private mail by takemura, domain ca2.so-net.ne.jp
 1.8 23-Jun-2008  pooka Allow KAUTH_SYSTEM_MKNOD in kauth_authorize_generic() to make it
possible to execute sys_mknod().

from Arnaud Ysmal
 1.7 11-Mar-2008  pooka branches: 1.7.4; 1.7.6; 1.7.8;
Backup some fixes for recent breakage from local tree. Also some
other improvements such as exporting the real kernel namei and
using that in ukfs instead of the homegrown heap'o hacks namei.
"etcetc".
 1.6 24-Jan-2008  pooka branches: 1.6.2; 1.6.6;
Use namei() etc. from kernel sources instead of a reimplementation.
To accommodate, give the rootvnode its own vnode op vector with a
simple lookup operation. This is used for looking up the file
system's device vnode instead of doing that directly in a homesmoked
namei().
 1.5 03-Jan-2008  pooka Theoretically this is supposed to be interchangeable with real
kernel code. Use kmem_alloc/free instead of some wily homerolled
rump interfaces for memory allocation.
 1.4 02-Jan-2008  pooka Add the ability to run puffs in userspace. This means that puffs
can now be developed in userspace using puffs for development
(I hate emulators, they are annoyingly clumsy).

To e.g. mount psshfs using puffs-on-puffs, run fs/bin/syspuffs/syspuffs
with the regular mount_psshfs command line as an argument:

golem> ./syspuffs /usr/sbin/mount_psshfs ftp.netbsd.org:/pub /puffs

This will make the mount appear as usual, with the exception that the
requests will be passed through puffs both in the kernel and userspace:

ftp.netbsd.org:/pub on /puffs type puffs|p2k|puffs|psshfs
 1.3 08-Dec-2007  pooka branches: 1.3.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.2 25-Aug-2007  pooka branches: 1.2.2; 1.2.4; 1.2.6; 1.2.10; 1.2.14; 1.2.16; 1.2.18;
Don't play rename & typecast games with kauth_cred_t, but rather
declare the type in rump.h only if necessary with the help of ifdef
magic.
 1.1 21-Aug-2007  pooka Implement credentials. Access control is now similar to if the file
system were run in the kernel.
 1.2.18.1 26-Dec-2007  ad Sync with head.
 1.2.16.1 18-Feb-2008  mjf Sync with HEAD.
 1.2.14.3 09-Dec-2007  jmcneill Sync with HEAD.
 1.2.14.2 02-Nov-2007  joerg Reduce diff to HEAD by adding files forgotten in early merges.
 1.2.14.1 25-Aug-2007  joerg file auth.c was added on branch jmcneill-pm on 2007-11-02 12:43:50 +0000
 1.2.10.2 09-Oct-2007  ad Sync with head.
 1.2.10.1 25-Aug-2007  ad file auth.c was added on branch vmlocking on 2007-10-09 13:45:03 +0000
 1.2.6.5 17-Mar-2008  yamt sync with head.
 1.2.6.4 04-Feb-2008  yamt sync with head.
 1.2.6.3 21-Jan-2008  yamt sync with head
 1.2.6.2 03-Sep-2007  yamt sync with head.
 1.2.6.1 25-Aug-2007  yamt file auth.c was added on branch yamt-lazymbuf on 2007-09-03 14:45:25 +0000
 1.2.4.2 03-Sep-2007  skrll Sync with HEAD.
 1.2.4.1 25-Aug-2007  skrll file auth.c was added on branch nick-csl-alignment on 2007-09-03 10:23:54 +0000
 1.2.2.2 23-Mar-2008  matt sync with HEAD
 1.2.2.1 09-Jan-2008  matt sync with HEAD
 1.3.4.2 08-Jan-2008  bouyer Sync with HEAD
 1.3.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.6.6.5 05-Oct-2008  mjf Sync with HEAD.
 1.6.6.4 28-Sep-2008  mjf Sync with HEAD.
 1.6.6.3 02-Jul-2008  mjf Sync with HEAD.
 1.6.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.6.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.6.2.1 24-Mar-2008  keiichi sync with head.
 1.7.8.3 31-Jul-2008  simonb Sync with head.
 1.7.8.2 03-Jul-2008  simonb Sync with head.
 1.7.8.1 27-Jun-2008  simonb Sync with head.
 1.7.6.2 10-Oct-2008  skrll Sync with HEAD.
 1.7.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.7.4.1 04-May-2009  yamt sync with head.
 1.9.2.1 19-Oct-2008  haad Sync with HEAD.
 1.4 14-Aug-2007  pooka Kill handrolled buffercache and use vfs_bio from the kernel. This is
mostly to get the flag jungle in sync with the kernel.
 1.3 09-Aug-2007  pooka fool some KASSERTs
 1.2 09-Aug-2007  pooka Add some stubs for lfs.
 1.1 05-Aug-2007  pooka branches: 1.1.2;
Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.2 05-Aug-2007  pooka Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.1 05-Aug-2007  pooka file buffercache.c was added on branch matt-mips64 on 2007-08-05 22:28:08 +0000
 1.3 17-Jan-2011  pooka use compat code from sys/compat/common
 1.2 26-Jul-2010  pooka branches: 1.2.2; 1.2.4; 1.2.6;
Add select to list on compat syscalls. Makes some code work for
me with a nb5 userland without having to compile with -g ;)
 1.1 19-Jul-2010  pooka * move stat syscalls to newstyle compat
* implement compat for pollts
 1.2.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.2.4.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.2.4.1 26-Jul-2010  uebayasi file compat.c was added on branch uebayasi-xip on 2010-08-17 06:48:00 +0000
 1.2.2.2 11-Aug-2010  yamt sync with head.
 1.2.2.1 26-Jul-2010  yamt file compat.c was added on branch yamt-nfs-mp on 2010-08-11 22:55:06 +0000
 1.9 02-Jan-2020  thorpej - Eliminate the global "boottime" variable, which was being accessed
without any synchronization against changes by e.g. clock_settime().
- Replace with new getbinboottime() / getnanoboottime() / getmicroboottime()
functions (naming mirrors that of other time access functions in kern_tc.c).
It returns the (maybe-converted) value of timebasebin, which also tracks
our estimate of when the system was booted (i.e. the legacy "boottime" was
redundant).

XXX There needs to be a lockless synchronization mechanism for reading
timebasebin, but this is a problem in kern_tc.c that pre-existed these
"boottime" changes. At least now the problem is centralized in one location.
 1.8 03-Sep-2018  riastradh 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.7 30-Nov-2017  christos branches: 1.7.2; 1.7.4;
add fo_name so we can identify the fileops in a simple way.
 1.6 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.5 26-May-2015  pooka Implement fo_poll so that rump_sys_poll(stdout) works
more or less as expected.

from Martin Lucina <martin@lucina.net> via rumpkernel-users
 1.4 25-Aug-2014  pooka branches: 1.4.2;
No longer create a special process context to fork remote clients off
of, simply always rfork off of proc1 closing all descriptors, and have
the rump kernel open 0/1/2 if the parent process is "1".

Fixes tests/rump/rumpkernel/t_sp, which was failing since the
abovementioned special process change due to attempting to deliver a
signal to the special process and the special process was not equipped
to handle one.
 1.3 08-Sep-2013  pooka branches: 1.3.4; 1.3.6; 1.3.8; 1.3.10;
Fool isatty() into thinking we're a tty.
 1.2 07-Sep-2013  pooka fix -Wuninitialized
 1.1 07-Sep-2013  pooka Add an initial console device and open fd's 0/1/2 for initproc. This is
again useful in standalone-type environments such as Xen, where all
printf/etc calls go through the rump kernel.
 1.3.10.3 03-Dec-2017  jdolecek update from HEAD
 1.3.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.10.1 08-Sep-2013  tls file cons.c was added on branch tls-maxphys on 2014-08-20 00:04:40 +0000
 1.3.8.1 09-Dec-2014  martin Pull up following revision(s) (requested by gson in ticket #299):
sys/rump/librump/rumpkern/cons.c: revision 1.4
sys/rump/librump/rumpkern/rump.c: revision 1.311
lib/librumpuser/rumpuser_sp.c: revision 1.67
No longer create a special process context to fork remote clients off
of, simply always rfork off of proc1 closing all descriptors, and have
the rump kernel open 0/1/2 if the parent process is "1".
Fixes tests/rump/rumpkernel/t_sp, which was failing since the
abovementioned special process change due to attempting to deliver a
signal to the special process and the special process was not equipped
to handle one.
 1.3.6.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.3.6.1 08-Sep-2013  yamt file cons.c was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.3.4.2 18-May-2014  rmind sync with head
 1.3.4.1 08-Sep-2013  rmind file cons.c was added on branch rmind-smpnet on 2014-05-18 17:46:18 +0000
 1.4.2.2 19-Mar-2016  skrll Sync with HEAD
 1.4.2.1 06-Jun-2015  skrll Sync with HEAD
 1.7.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.7.4.1 10-Jun-2019  christos Sync with HEAD
 1.7.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.9 17-Jan-2014  pooka Use subr_cprng.c instead of stub implementation. Rijndael migrates from
rumpkern_crypto to rumpkern due to it being mandatory for cprng.
 1.8 01-Jul-2013  riastradh Remove now-needless rump cprng_strong_deplete stub.

These rump stubs need to go away at some point...
 1.7 23-Jun-2013  riastradh branches: 1.7.2;
Rework rndsink(9) abstraction and adapt arc4random(9) and cprng(9).

rndsink(9):
- Simplify API.
- Simplify locking scheme.
- Add a man page.
- Avoid races in destruction.
- Avoid races in requesting entropy now and scheduling entropy later.

Periodic distribution of entropy to sinks reduces the need for the
last one, but this way we don't need to rely on periodic distribution
(e.g., in a future tickless NetBSD).

rndsinks_lock should probably eventually merge with the rndpool lock,
but we'll put that off for now.

cprng(9):
- Make struct cprng_strong opaque.
- Move rndpseudo.c parts that futz with cprng guts to subr_cprng.c.
- Fix kevent locking. (Is kevent locking documented anywhere?)
- Stub out rump cprng further until we can rumpify rndsink instead.
- Strip code to grovel through struct cprng_strong in fstat.
 1.6 30-Apr-2013  pooka Make hypercall calling conventions consistent: iff a hypercall can fail,
it returns an int containing the error value.
 1.5 27-Apr-2013  pooka make the random hypercall more generic
 1.4 17-Dec-2011  tls branches: 1.4.4; 1.4.8;

Separate /dev/random pseudodevice implemenation from kernel entropy pool
implementation. Rewrite pseudodevice code to use cprng_strong(9).

The new pseudodevice is cloning, so each caller gets bits from a stream
generated with its own key. Users of /dev/urandom get their generators
keyed on a "best effort" basis -- the kernel will rekey generators
whenever the entropy pool hits the high water mark -- while users of
/dev/random get their generators rekeyed every time key-length bits
are output.

The underlying cprng_strong API can use AES-256 or AES-128, but we use
AES-128 because of concerns about related-key attacks on AES-256. This
improves performance (and reduces entropy pool depletion) significantly
for users of /dev/urandom but does cause users of /dev/random to rekey
twice as often.

Also fixes various bugs (including some missing locking and a reseed-counter
overflow in the CTR_DRBG code) found while testing this.

For long reads, this generator is approximately 20 times as fast as the
old generator (dd with bs=64K yields 53MB/sec on 2Ghz Core2 instead of
2.5MB/sec) and also uses a separate mutex per instance so concurrency
is greatly improved. For reads of typical key sizes for modern
cryptosystems (16-32 bytes) performance is about the same as the old
code: a little better for 32 bytes, a little worse for 16 bytes.
 1.3 28-Nov-2011  tls branches: 1.3.2;
Remove arc4random() and arc4randbytes() from the kernel API. Replace
arc4random() hacks in rump with stubs that call the host arc4random() to
get numbers that are hopefully actually random (arc4random() keyed with
stack junk is not). This should fix some of the currently failing anita
tests -- we should no longer generate duplicate "random" MAC addresses in
the test environment.
 1.2 21-Nov-2011  tsutsui No need to include MD <machine/cpu_counter.h> here.
 1.1 19-Nov-2011  tls First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.3.2.1 18-Feb-2012  mrg merge to -current.
 1.4.8.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.8.1 23-Jun-2013  tls resync from head
 1.4.4.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.4.4.2 17-Apr-2012  yamt sync with head
 1.4.4.1 17-Dec-2011  yamt file cprng_stub.c was added on branch yamt-pagecache on 2012-04-17 00:08:49 +0000
 1.7.2.2 18-May-2014  rmind sync with head
 1.7.2.1 28-Aug-2013  rmind sync with head
 1.11 29-Jun-2021  nia Remove uscanner(4) driver

This exists for compatibility with a Linux interface which was apparently
deprecated in Linux 2.6. There are various mailing list threads going
back to 2004 where the usefulness of this driver is discussed, but
the conclusion is that scanner software has all moved to using ugen(4)
instead, and enabling this driver will not help you scan things.
 1.10 27-Jan-2019  maxv branches: 1.10.16;
Remove the satlink driver. It was disabled everywhere, had no man page and
no use either. Spotted by thorpej in PR/21345, ok christos.
 1.9 19-Dec-2018  maxv Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.8 14-Jan-2017  pgoyette branches: 1.8.14; 1.8.16;
Don't call the drvctl module's initialization code during rump component
initialization. Instead, temporarily attach the drvctl's cdevsw to
determine its device c-major, create the /dev/drvctl node using that
c-major, and then detach. This leaves things in a state where normal
module initialization can run.

Since we're now creating the /dev/drvctl device node correctly, we don't
need to create it again. So mark the device as DEVNODE_DONTBOTHER in
the devsw_conv0 conversion table.

This bug was introduced more than a year ago (src/sys/kern/kern_drvctl.c
rev 1.40), but was silently ignored except when running a rump_server
built with LOCKDEBUG.
 1.7 25-Feb-2011  pooka branches: 1.7.14; 1.7.32; 1.7.36;
Don't autogenerate a large number of unnecessary device nodes, just
slows bootstrap.
 1.6 10-Feb-2011  pooka support /dev/zero
 1.5 22-Nov-2010  pooka branches: 1.5.2; 1.5.4;
"regen": /dev/md*
 1.4 07-Jul-2010  pooka branches: 1.4.2; 1.4.4;
Borrow /dev/mem major from i386 for /dev/null and autogenerate node.
 1.3 07-Jul-2010  pooka add /dev/putter to "devfs" (forgot to commit this earlier)
 1.2 21-Jun-2010  pooka regen for vnd (or at least something like that since this file
still isn't really generated, just copypasted)
 1.1 30-Apr-2010  pooka branches: 1.1.2;
Include devsw_conv0 from an i386 kernel compilation (no, we don't
care about the arch as long as all the devices we care about are
present). The file should be autogenerated, but that requires some
more changes to config(1).
 1.1.2.4 05-Mar-2011  rmind sync with head
 1.1.2.3 03-Jul-2010  rmind sync with head
 1.1.2.2 30-May-2010  rmind sync with head
 1.1.2.1 30-Apr-2010  rmind file devsw.c was added on branch rmind-uvmplock on 2010-05-30 05:18:06 +0000
 1.4.4.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.4.4.1 07-Jul-2010  uebayasi file devsw.c was added on branch uebayasi-xip on 2010-08-17 06:48:00 +0000
 1.4.2.2 11-Aug-2010  yamt sync with head.
 1.4.2.1 07-Jul-2010  yamt file devsw.c was added on branch yamt-nfs-mp on 2010-08-11 22:55:06 +0000
 1.5.4.2 05-Mar-2011  bouyer Sync with HEAD
 1.5.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.5.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.7.36.1 20-Mar-2017  pgoyette Sync with HEAD
 1.7.32.1 05-Feb-2017  skrll Sync with HEAD
 1.7.14.1 03-Dec-2017  jdolecek update from HEAD
 1.8.16.1 10-Jun-2019  christos Sync with HEAD
 1.8.14.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.10.16.1 01-Aug-2021  thorpej Sync with HEAD.
 1.202 28-Jul-2024  bad initialize {sys,max}_{cb}devsws next to what they refer to

e.g. {sys,max}_cdevsws next to the definition of cdevsw.
 1.201 15-Oct-2023  riastradh branches: 1.201.6;
rump: Sprinkle sys/syncobj.h here too.
 1.200 28-Sep-2023  manu Fix root search in RAID 1 sets

We use the wedge information given by bootstrap, where the kernel was
found. This requires src/sys/arch/i386/stand/i386/lib/biosdisk.c 1.59
to work in all cases.
 1.199 22-Apr-2023  riastradh rumpkern: Provide stub pnbuf_cache weak alias.

Needed only by sys_module.c handle_modctl_load, which won't work if
there's no rumpvfs linked in anyway.
 1.198 22-Apr-2023  riastradh rumpkern: Provide fs_filtops weak alias.

We should introduce a link set for sys_kfilters, but this works
around the problem for now -- librump's dependency on librumpvfs
symbols.
 1.197 26-Feb-2023  skrll nkmempages should be size_t
 1.196 30-Apr-2020  riastradh branches: 1.196.20;
Rewrite entropy subsystem.

Primary goals:

1. Use cryptography primitives designed and vetted by cryptographers.
2. Be honest about entropy estimation.
3. Propagate full entropy as soon as possible.
4. Simplify the APIs.
5. Reduce overhead of rnd_add_data and cprng_strong.
6. Reduce side channels of HWRNG data and human input sources.
7. Improve visibility of operation with sysctl and event counters.

Caveat: rngtest is no longer used generically for RND_TYPE_RNG
rndsources. Hardware RNG devices should have hardware-specific
health tests. For example, checking for two repeated 256-bit outputs
works to detect AMD's 2019 RDRAND bug. Not all hardware RNGs are
necessarily designed to produce exactly uniform output.

ENTROPY POOL

- A Keccak sponge, with test vectors, replaces the old LFSR/SHA-1
kludge as the cryptographic primitive.

- `Entropy depletion' is available for testing purposes with a sysctl
knob kern.entropy.depletion; otherwise it is disabled, and once the
system reaches full entropy it is assumed to stay there as far as
modern cryptography is concerned.

- No `entropy estimation' based on sample values. Such `entropy
estimation' is a contradiction in terms, dishonest to users, and a
potential source of side channels. It is the responsibility of the
driver author to study the entropy of the process that generates
the samples.

- Per-CPU gathering pools avoid contention on a global queue.

- Entropy is occasionally consolidated into global pool -- as soon as
it's ready, if we've never reached full entropy, and with a rate
limit afterward. Operators can force consolidation now by running
sysctl -w kern.entropy.consolidate=1.

- rndsink(9) API has been replaced by an epoch counter which changes
whenever entropy is consolidated into the global pool.
. Usage: Cache entropy_epoch() when you seed. If entropy_epoch()
has changed when you're about to use whatever you seeded, reseed.
. Epoch is never zero, so initialize cache to 0 if you want to reseed
on first use.
. Epoch is -1 iff we have never reached full entropy -- in other
words, the old rnd_initial_entropy is (entropy_epoch() != -1) --
but it is better if you check for changes rather than for -1, so
that if the system estimated its own entropy incorrectly, entropy
consolidation has the opportunity to prevent future compromise.

- Sysctls and event counters provide operator visibility into what's
happening:
. kern.entropy.needed - bits of entropy short of full entropy
. kern.entropy.pending - bits known to be pending in per-CPU pools,
can be consolidated with sysctl -w kern.entropy.consolidate=1
. kern.entropy.epoch - number of times consolidation has happened,
never 0, and -1 iff we have never reached full entropy

CPRNG_STRONG

- A cprng_strong instance is now a collection of per-CPU NIST
Hash_DRBGs. There are only two in the system: user_cprng for
/dev/urandom and sysctl kern.?random, and kern_cprng for kernel
users which may need to operate in interrupt context up to IPL_VM.

(Calling cprng_strong in interrupt context does not strike me as a
particularly good idea, so I added an event counter to see whether
anything actually does.)

- Event counters provide operator visibility into when reseeding
happens.

INTEL RDRAND/RDSEED, VIA C3 RNG (CPU_RNG)

- Unwired for now; will be rewired in a subsequent commit.
 1.195 02-Jan-2020  thorpej - Eliminate the global "boottime" variable, which was being accessed
without any synchronization against changes by e.g. clock_settime().
- Replace with new getbinboottime() / getnanoboottime() / getmicroboottime()
functions (naming mirrors that of other time access functions in kern_tc.c).
It returns the (maybe-converted) value of timebasebin, which also tracks
our estimate of when the system was booted (i.e. the legacy "boottime" was
redundant).

XXX There needs to be a lockless synchronization mechanism for reading
timebasebin, but this is a problem in kern_tc.c that pre-existed these
"boottime" changes. At least now the problem is centralized in one location.
 1.194 02-Jan-2020  martin Add shutting_down variable for rump.
 1.193 16-Dec-2019  ad - Extend the per-CPU counters matt@ did to include all of the hot counters
in UVM, excluding uvmexp.free, which needs special treatment and will be
done with a separate commit. Cuts system time for a build by 20-25% on
a 48 CPU machine w/DIAGNOSTIC.

- Avoid 64-bit integer divide on every fault (for rnd_add_uint32).
 1.192 26-Sep-2019  bad Provide a weak alias for vnode_to_path to be used unless librumpvfs is present.
 1.191 02-Jun-2019  kre branches: 1.191.2;

Apply a patch from hannken@ which adds a weak alias for rump_getcwd_common()
allowing -lrump to be used without -lrumpvfs.

This is an alternate fix to the earluer one which added -lrumvfs to
many rump based tests (and the rump server) which might be undone soon.

This also fixes the sun2 build.
 1.190 09-Mar-2019  hannken Rumpkernel has its own thread deallocation. Add missing fstrans_lwp_dtor()
to lwproc_freelwp().

PR bin/50350: rump/rumpkern/t_sp/stress_{long,short} fail on Core 2 Quad
 1.189 05-Dec-2018  christos no more need for get_expose_address() here.
 1.188 06-Oct-2018  christos add get_expose_address()
 1.187 05-Oct-2018  hannken Bring back three state file system suspension:

NORMAL -> SUSPENDING -> SUSPENDED

and add operation fstrans_start_lazy() that only blocks while SUSPENDED.

Change vndthread() support operation handle_with_rdwr() to bracket
its file system operations by fstrans_start_lazy() and fstrans_done().

PR kern/53624 (dom0 freeze on domU exit)
 1.186 10-Aug-2018  pgoyette Allow syscall_establish() to install new syscalls when the existing
entry-point is either sys_nomodule or sys_nosys. Update the
makesyscalls.sh script to create a const array of bits to allow
syscall_disestablish() to properly restore the original entry-point.
Update all the initializers of struct emul to initialize the pointer
to the bit array struct emul.

XXX Regen of all files created by makesyscalls.sh will come soon,
XXX followed by a kernel version bump (since struct emul is being
XXX modified).

This commit should address PR kern/45781 and also removes the need
for the work-around for that PR in file

sys/arch/usermode/modules/syscallemu/syscallemu.c
 1.185 21-Nov-2017  ozaki-r branches: 1.185.2; 1.185.4;
Add missing inclusion of pserialize.h (fix build)
 1.184 21-Nov-2017  ozaki-r Implement debugging feature for pserialize(9)

The debugging feature detects violations of pserialize constraints.
It causes a panic:
- if a context switch happens in a read section, or
- if a sleepable function is called in a read section.

The feature is enabled only if LOCKDEBUG is on.

Discussed on tech-kern@
 1.183 09-Nov-2017  christos added booted_method
 1.182 04-Jun-2017  hannken Operations fstrans_start() and fstrans_start_nowait() now always
use FSTRANS_SHARED as lock type so remove the lock type argument.

File system state FSTRANS_SUSPENDING is now unused so remove it.

Regen vnode_if files.

Ride 8.99.1 less than a hour ago.
 1.181 22-Feb-2017  hannken branches: 1.181.6;
Add weak aliases for _fstrans_start() and fstrans_done().
 1.180 22-Dec-2016  cherry branches: 1.180.2;
physmem should be of type psize_t

Also, use PRIxPSIZE when printf(9)ing physmem.
 1.179 26-Jan-2016  pooka branches: 1.179.2;
Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.178 22-Jan-2016  ozaki-r Fix build with RUMP_LOCKDEBUG=yes
 1.177 18-Jan-2016  pooka put lwp/proc stuff into the same source module (emul.c -> lwproc.c)
 1.176 18-Jan-2016  pooka massively reduce header pollution from times prehistoric
 1.175 18-Jan-2016  pooka boottime is a timespec, not timeval
 1.174 29-Dec-2015  pgoyette Now that the table of auto-loadable syscalls is per-emulation, make sure
that the rump-kernel has its own list. Otherwise, missing syscalls won't
trigger a module auto-load.

This commit finishes the work to get tests/lib/librumphijack/t_tcpip
nfs_autoload test case working again after 16 months of failures! (see
PR bin/49153).
 1.173 25-Aug-2015  pooka add cpu_getmodel()
 1.172 24-Jul-2015  pooka Since the rump kernel does not know when the container it's running in
actually halts, print "halted" in the hypercall.
 1.171 22-Apr-2015  pooka Include kern_clock.c in rump kernels.
 1.170 18-Apr-2015  pooka Give remote clients struct pmap storage. Although the pmap is unused,
that way we can sure that the pmap macro framework doesn't access all
the wrong places.
 1.169 03-Jan-2015  pooka Put all sysproxy routines to their own C module, sysproxy.c
 1.168 18-Nov-2014  pooka branches: 1.168.2;
delay() can't use rumpuser_clock_sleep(), because that may unschedule().

Instead, busyloop with calls to rumpuser_clock_gettime(). Fixing delay()
properly should addressed in hypercall rev.18 by introducing a nowrap
variant/flag for rumpuser_clock_sleep().
 1.167 18-Nov-2014  pooka Attempt to make sure that DELAY()/delay() is available in all MD names.
 1.166 28-May-2014  justin Add missing __diagused in rump code
 1.165 25-Apr-2014  pooka cpu_reboot() is more of an emul.c thing than a rump.c thing
 1.164 11-Mar-2014  pooka branches: 1.164.2;
Put the syncobjs in emul.c instead of locks.c so that they are
present for both locks.c and locks_up.c alike.
 1.163 20-Feb-2014  pooka + resettodr
 1.162 29-Jan-2014  pooka lwp0 needs l_proc set for panic->cpu_reboot to dump core the right way
 1.161 17-Jan-2014  pooka Use subr_cprng.c instead of stub implementation. Rijndael migrates from
rumpkern_crypto to rumpkern due to it being mandatory for cprng.
 1.160 16-Dec-2013  pooka Translate return values for emulations, e.g. Linux. For ports without
__HAVE_MINIMAL_EMUL, we simply look up the values from p->p_emul->e_errno.
For ports which cannot afford to keep an extra pointer per emul structure
around, we hope there is __HAVE_SYSCALL_INTERN support and thread the
errno values through p_emuldata. Notably, we cannot alter the syscall
method like most ports do with syscall_intern, since they do it via
p_mdproc, so MI code is not possible there.
 1.159 09-Dec-2013  pooka Support ktrace for rump kernels.

Requested by Justin Cormack on rumpkernel-users.
 1.158 30-Apr-2013  pooka branches: 1.158.4;
Flip parameter order in the clock hypercalls to make them consistent
with everything else wrt in/out parameters.
 1.157 30-Apr-2013  pooka Make hypercall calling conventions consistent: iff a hypercall can fail,
it returns an int containing the error value.
 1.156 28-Apr-2013  pooka Improve the time-related hypercalls so that's it's possible to
sleep until an absolute time on the host's monotonic clock (should
something like that be supported).
 1.155 18-Mar-2013  para calculate vnode cache size based on the resource it gets allocated from
this stops setting kern.maxvnodes to high so it exhausts available space in kmem

http://mail-index.netbsd.org/tech-kern/2013/03/08/msg015095.html
 1.154 07-Mar-2013  pooka set e_nsysent
 1.153 19-Feb-2013  martin Stopgap fix to make rump cooperate with pserialize, may be revisited later.
Patch from pooka, ok: rmind. No related regressions in a complete atf test
run (which works again with this, even on non x86 SMP machines).
 1.152 20-Jan-2013  rmind Provide xc_send_ipi() routine in RUMP, which is required for high-priority
xcall(9) mechanism. It is emulated using low-priority xcall(9).
 1.151 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.150 21-Mar-2011  pooka branches: 1.150.4; 1.150.10; 1.150.14;
Update copyright statements.

no functional change.
 1.149 21-Jan-2011  pooka Since "physmem" is largely unused except for zfs wanting to know
if it has enough memory available, just pick a number which makes
zfs happy.

We *could* use a MIN() of available host mem and rump_memlimit,
though ...
 1.148 06-Jan-2011  pooka branches: 1.148.2; 1.148.4;
Support LOCKDEBUG. To use it, compile sys/rump with RUMP_LOCKDEBUG=yes.

requested by martin (sparc64 gdb cannot reliably produce a stack trace)
 1.147 21-Nov-2010  pooka Realize the >1yo comment above rump_reboot and retire them to make
room for sys_reboot.
 1.146 15-Oct-2010  tsutsui Make common kernel module binaries work on both sun3 and sun3x.
Tested on 3/160 (on TME) and (real) 3/80.

XXX: module files can be loaded only on single user?
 1.145 01-Sep-2010  pooka Implement rump_lwproc: the new lwp/proc management routines for
rump. These move the management of the pid/lwpid space from the
application into the kernel, make code more robust, and make it
possible to attach multiple lwp's to non-proc0 processes.
 1.144 23-Jun-2010  pooka As normal, fix breakage from untested commits by rmind.
 1.143 14-Jun-2010  pooka Remove comment which wasn't supposed to get committed.
 1.142 14-Jun-2010  pooka Make some stubby tty routines used by printf weak aliases, so that
the full ones will be used if we have the upcoming tty component
loaded.
 1.141 13-Jun-2010  pooka Fix previous in emul.c -- only numbers are operands for cpp comparisons.
Apparently non-numbers logically produce arch-dependent behaviour.
 1.140 13-Jun-2010  pooka deal with sun3's module disability
 1.139 13-Jun-2010  pooka add rest of sparc pagesize variables
 1.138 10-Jun-2010  pooka Use kern_proc.c instead of a collection of stubs. But what we
really wanted from this commit was the support for proc_specificdata.

TODO: make creating a new process actually use kern_proc and
maybe even add an interface which starts a process with
"any pid you don't like"
 1.137 11-May-2010  pooka adjust comment in previous.
XXX: should make that (and physmem) mean something here
 1.136 11-May-2010  pooka remove unnecessary #ifdef
 1.135 01-May-2010  pooka Now that we have a big devsw_conv0, need at least as many entries
in devsw as the highest device number in the conv table. Do a
"good for a hundred years" guess now, fix properly later.
 1.134 30-Apr-2010  pooka Include devsw_conv0 from an i386 kernel compilation (no, we don't
care about the arch as long as all the devices we care about are
present). The file should be autogenerated, but that requires some
more changes to config(1).
 1.133 28-Apr-2010  pooka Make initial devsw a little more believable. Especially adjust
max_sys_devsw, since it was previously a bit too much, given that
the correct value is 0.
 1.132 21-Apr-2010  pooka remove stuff which now comes via std. kernel source modules
 1.131 21-Apr-2010  pooka support kern_resource
 1.130 21-Apr-2010  pooka Move all signal-related from emul.c to signals.c. Additionally,
define a few alternate signal models for the rump kernel, including
ones where signals are ignored or sent to host processes.
 1.129 19-Apr-2010  pooka no \n in panic
 1.128 17-Apr-2010  pooka One emul is enough and since we need emul_netbsd, retire emul_rump.
 1.127 17-Apr-2010  pooka Move scheduling related routines from emul.c to scheduler.c
 1.126 14-Apr-2010  pooka Use kern_syscall.c instead of homegrown syscall dis/establishment routines.
 1.125 14-Apr-2010  pooka Include kern_tc and use a timecounter driver instead of homerolled
kern_tc implementation.
 1.124 31-Mar-2010  pooka We don't have a real rootdev (by default at least), so set it to NODEV.
 1.123 01-Mar-2010  pooka branches: 1.123.2;
add signal stubs required by mfs
 1.122 08-Feb-2010  joerg Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.
 1.121 31-Jan-2010  pooka branches: 1.121.2;
Include newly-created subr_device.c and remove few special case
device accessor copypastes. This makes it possible to link static
binaries which use -lrumpdev.
 1.120 31-Jan-2010  pooka include kern_hook.c
 1.119 15-Jan-2010  pooka Use subr_percpu.c instead of homegrown implementation. ...except
when using malloc(3)-relegated allocators (happens in production
e.g. on Linux), since subr_percpu.c uses vmem and i don't want to
reimplement vmem.
 1.118 13-Jan-2010  pooka Minimize unnecessary differences in rump.
 1.117 13-Jan-2010  pooka Add a few symbols used by the tty code.
 1.116 09-Jan-2010  pooka Include kern_pmf.c in rumpdev.
 1.115 08-Jan-2010  dyoung Expand PMF_FN_* macros.
 1.114 25-Dec-2009  elad allow rump to build
 1.113 16-Dec-2009  pooka Generate vers.c and include it in the kernel component.
 1.112 03-Dec-2009  pooka Decide it's not worth the fuss to have rumpfs as a module and just
hardcode attach into rump_vfs_init(). Saves us from a lot of
pingpong init bouncing from one component to another to get the order
right.
 1.111 01-Dec-2009  pooka Include cpu crosscall support (instead of stubbing it out).
 1.110 26-Nov-2009  pooka For rumpfs, do mountroot instead of the bunch of homegrown hacks
currently there. Still needs a little massage to get the kernel
interfaces right and avoid copypaste especially from main().

Also, move it a bit more into the direction of a real file system
(finally!) by giving it a vfsops. Most ops are still unimplemented,
though.
 1.109 04-Nov-2009  pooka misc_stub and emul have been the same thing for a looong time now,
so just move the few remaining routines in misc_stub to emul.
 1.108 04-Nov-2009  pooka Give the kthread->pthread interface emulation its own module.
 1.107 04-Nov-2009  pooka Pull all relegating memory allocators under a common roof in memalloc.c
 1.106 04-Nov-2009  pooka move copy-related routines to their own module
 1.105 04-Nov-2009  pooka Use std. uiomove() & friends.
 1.104 21-Oct-2009  rmind Sync rump with kernel changes.
 1.103 16-Oct-2009  pooka Include sys_select.c for proper select()/poll() support.
 1.102 15-Oct-2009  pooka Give lwp usage some much-needed love: stop treating lwp0 as the
all-sink and make sure each separate thread in rump has its own
lwp. Happy-go-lucky callers will get scheduled a temporary lwp
on entry, while true lwp connoisseurs may request a stable lwp
for their purposes. Some more love may be required later down the
road, but for now different threads will stepping on each others
toes.
 1.101 15-Oct-2009  pooka Add initial work on a rump virtual cpu scheduler. This is necessary
for kernel code which has been written to avoid MP contention by
using cpu-local storage (most prominently, select and pool_cache).

Instead of always assuming rump_cpu, the scheduler must now be run
(and unrun) on all entry points into rump. Likewise, rumpuser
unruns and re-runs the scheduler around each potentially blocking
operation. As an optimization, I modified some locking primitives
to try to get the lock without blocking before releasing the cpu.

Also, ltsleep was modified to assume that it is never called without
the biglock held and made to use the biglock as the sleep interlock.
Otherwise there is just too much drama with deadlocks. If some
kernel code wants to call ltsleep without the biglock, then, *snif*,
it's no longer supported and rump and should be modified to support
newstyle locks anyway.
 1.100 14-Oct-2009  pooka "rumppriv" goes back to "rump" per internal interface naming change.
 1.99 14-Oct-2009  pooka Adjust rump sources for external/internal interfaces.
No functional change.
 1.98 09-Oct-2009  pooka Provide an interface for reboot.
 1.97 03-Oct-2009  christos Need proc_uidmatch
 1.96 24-Sep-2009  pooka remove a no longer necessary hack
 1.95 20-Sep-2009  pooka default to AB_SILENT
 1.94 07-Sep-2009  pooka provide pmf stubs
 1.93 06-Sep-2009  pooka move hppa cpp kludge to the end of the file
 1.92 04-Sep-2009  pooka add a few global symbols required by kernel code
 1.91 20-Jul-2009  pooka realloc works much better if it actually uses realloc instead of malloc
 1.90 09-Jun-2009  pooka Nuke some bss stuff which is coming from vfs_bio via rumpvfs.
 1.89 07-May-2009  pooka Don't create unpgc thread if RUMP_THREADS is 0. The benefit is the
usual: possible to run programs using AF_LOCAL without threads.
 1.88 29-Apr-2009  pooka Add proof-of-concept code for enabling system calls to rump virtual
kernels running in other processes on the same machine or on an
entirely different host. I wrote this a while ago and am now
committing it mainly to avoid losing it. It works, but could do
with a little tuning here and there.

What this will hopefully eventually buy us is the ability to use
standard userland tools to configure rump kernels, e.g. ifconfig(8)
and route(8) could be used to configure the networking stack provided
by a rump kernel. Also some distributed OS implications may apply.

fun fact: a system call which just does copyin/copyout takes >1000x
longer when made over the LAN as compared to when made on the same
machine.
 1.87 26-Apr-2009  pooka Fix getnano/microuptime to report actual uptime.
 1.86 26-Apr-2009  pgoyette Catch up with recent changes to sys/proc.h (Hello, rmind!)
 1.85 30-Mar-2009  christos we want microuptime too.
 1.84 30-Mar-2009  christos need getnanouptime not getmicrouptime
 1.83 30-Mar-2009  christos one more timeval -> timespec line
 1.82 29-Mar-2009  christos Catch up with kernel changes
 1.81 18-Mar-2009  pooka Support kqueue in the rump virtual kernel.
 1.80 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.79 27-Feb-2009  pooka decouple rumpuser gettime from struct timeval
 1.78 26-Feb-2009  pooka Make rumpuser stat and nanosleep independent of the host system
stat and timespec definitions.
 1.77 07-Feb-2009  pooka branches: 1.77.2;
Make the clock interrupt tick based on absolute time instead of
relative time. This prevents drifting. Also, keep track of time
within userspace, so we do not have to make a syscall to get the
clock value. This is approximately 7 times cheaper, but on the
negative side is limited to the clock interrupt frequency.
 1.76 13-Jan-2009  pooka Implement block I/O as a real block driver instead of a hacked copy
of specfs. That was easier years ago when rump didn't support
devices, but brings no gain now. This allows us to include the
real specfs in rump.
 1.75 12-Jan-2009  pooka Shove in some hppa love to help with spcopy.S (why does that need
to be in libkern?).
 1.74 11-Jan-2009  pooka Protect against nfssilly in RUMP_THREADS=0
 1.73 11-Jan-2009  christos merge christos-time_t
 1.72 07-Jan-2009  pooka provide kern_realloc
 1.71 05-Jan-2009  pooka Rename malloc() to kern_malloc() to avoid name conflict with libc.
Now it is possible to use the kernel linker with rump.
 1.70 04-Jan-2009  pooka Include libkern contents in librump.
 1.69 02-Jan-2009  pooka Sauce with some kludges:
* revert rev 1.68 of emul.c: delay() is hopelessly MD and needs
whipping (not the fun kind)
* #undef DELAY in cpu.h

This will hopefully fix build for all archs and give me time to
hop through our 46521 fine archs and edit the headers.
 1.68 02-Jan-2009  pooka Export delay, _delay and delay_func symbols to attempt to appease
the macro mania set over all architectures.
 1.67 02-Jan-2009  pooka Include kernel printf routines in rump instead of relying on the
magic libc symbol. This also allows to bid farewell to subr_prf2.c
and merge the contents back to subr_prf.c. The host kernel bridging
is now done via rumpuser_putchar().
 1.66 01-Jan-2009  pooka Define MODULAR for rump core components. This enables module
loading via the kernel module framework (instead of dlopen()).
For now it only works on amd64 and i386, but for the rest it should
just be a matter of including the relevant kobj_machdep.c modules
from the kernel sources.
 1.65 30-Dec-2008  pooka properly handle kthread_exit()
 1.64 29-Dec-2008  pooka include subr_devsw in rumpkern
 1.63 21-Dec-2008  cegger branches: 1.63.2;
undo turn malloc flags to enums.
Requested by christos.

Keep malloc flag defines in kernel section.
 1.62 20-Dec-2008  cegger Turn malloc flags into an enum. Fixes build breakage.
 1.61 18-Dec-2008  pooka __KERNEL_RCSID
 1.60 17-Dec-2008  pooka If available (__NetBSD__), use pthread_setname_np() to set the
thread name for kthread_create().
 1.59 14-Dec-2008  pooka If the arch uses __BSWAP_RENAME, provide non-namespaced kernel
symbols which just call the libc symbols. Allows to get rid of
rump machine/bswap.h.

XXX:
1) this is unlikely to work on non-NetBSD
==>
2) should look into including libkern in librump
 1.58 10-Dec-2008  pooka Make non-mpsafe threads KERNEL_LOCK() before starting execution.
 1.57 27-Nov-2008  pooka Remove the whole magic ubc window thingie. All file systems use
ubc_uiomove() now, so we can hook ourselves there.
 1.56 26-Nov-2008  pooka Add a few symbols required by nfsd
 1.55 17-Nov-2008  pooka Add more verbose commentage to the module thread non-creation.
 1.54 17-Nov-2008  pooka Ignore the module unload thread.
 1.53 14-Oct-2008  pooka branches: 1.53.2; 1.53.4; 1.53.8;
Add some more trivial emulations.
 1.52 13-Oct-2008  pooka Provide psignal() so that we don't get linked against psignal(3).
As there is no real process model currently, just "trap" the signals
appropriately.
 1.51 10-Oct-2008  pooka Support callouts and call callout_hardclock() from the timer
interrupt thread.

The sleepq implementation required for callouts is horrible, kludged
only for callouts, and generally unacceptable. It needs revisiting,
but I'm not sure yet should rump or kern_timeout be improved. It's
almost untested as of now, but committing this will give me some
maneuvering space while letting application compile.
 1.50 02-Oct-2008  pooka Remove rumpuser_yield(). Not only doesn't it really make sense
here, some kind soul made it completely empty.
 1.49 30-Sep-2008  pooka Switch to std kern_auth.
 1.48 25-Sep-2008  pooka Move global malloc types from kern_malloc into a separate module.
 1.47 12-Aug-2008  pooka Make it possible to control starting of threads per env variable
instead of only at compile-time.
 1.46 04-Aug-2008  pooka Add support for using real kmem/vmem. Don't enable it by default,
though, since it a) is a lot of unnecessary indirection in rump
b) requires callouts which are so far unimplemented.
 1.45 01-Aug-2008  pooka support real sysctls
 1.44 29-Jul-2008  pooka Install rump libraries and utilities to the base system and remove the
private non-installed build infrastructure from sys/rump.

breakdown of commit:
* install relevant headers into /usr/include/rump
* build sys/rump/librump/rumpuser and sys/rump/librump/rumpkern
from src/lib and install as librumpuser and librump, respectively
+ this retains the ability to test a librump build with just the
kernel sources at hand
* move sys/rump/fs/lib/libukfs and sys/rump/fs/lib/libp2k to src/lib
for general consumption, they are not kernel-space dwellers anyway
* build and install sys/rump/fs/lib/lib$fs as librumpfs_$fs
* add chapter 3 manual pages for rump, rumpuser, ukfs and p2k
* build and install userspace kernel file system daemons if MKPUFFS=yes
is spexified
* retire fsconsole for now, it will make a comeback with an actually
implemented version shortly
 1.43 21-Jul-2008  pooka Repeat after me: do not pollute sys with #ifdef _RUMPKERNEL
 1.42 18-Jul-2008  pooka emulate vlog()
 1.41 25-Jun-2008  pooka branches: 1.41.2;
Don't compile kern_lock for rump any more, it's no longer required.
Allows us to get rid of the incorrect _RUMPKERNEL ifdefs outside sys/rump.
 1.40 24-Jun-2008  pooka Make kpause() use nanosleep() instead of usleep(). Fixes >=1s sleeps
to actually sleep a bit too.

from Arnaud Ysmal
 1.39 29-May-2008  pooka branches: 1.39.2;
Also fake the namecache g/c thread in kthread_create() so that file
systems can again be run without threads (and hence gdb can be used
on them).
 1.38 24-Apr-2008  ad branches: 1.38.2; 1.38.4;
Catch up with process locking changes.
 1.37 06-Apr-2008  matt branches: 1.37.2;
Add a device_xname() stub.
 1.36 25-Mar-2008  yamt - for some ports, especially for ones without pmap_growkernel,
buf_memcalc is used by bootstrap as well. fix NULL dereference for them.
- limit kva usage for each cache to 20% of vm_map. XXX a bit arbitrary.
- add a comment.
 1.35 24-Mar-2008  martin Adapt to sel* changes
 1.34 23-Mar-2008  yamt when calculating some cache sizes, consider the amount of available kva.
PR/33185.
 1.33 21-Mar-2008  ad Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.32 19-Mar-2008  bjs Add lwp_unsleep from kern/kern_lwp.c so that this builds. ok ad@
 1.31 12-Mar-2008  pooka Support multiple file systems within one process with ukfs by using
a "chroot" for each file system.
 1.30 11-Mar-2008  pooka Backup some fixes for recent breakage from local tree. Also some
other improvements such as exporting the real kernel namei and
using that in ukfs instead of the homegrown heap'o hacks namei.
"etcetc".
 1.29 15-Feb-2008  ad branches: 1.29.2; 1.29.6;
Implement yield().
 1.28 15-Feb-2008  ad Add dummy hardclock_ticks.
 1.27 27-Jan-2008  pooka Use vfs_subr.c from sys/kern. This brings differences in the vnode
life cycle between rump and a real kernel to a minimum.
 1.26 24-Jan-2008  pooka Use namei() etc. from kernel sources instead of a reimplementation.
To accommodate, give the rootvnode its own vnode op vector with a
simple lookup operation. This is used for looking up the file
system's device vnode instead of doing that directly in a homesmoked
namei().
 1.25 24-Jan-2008  pooka Don't use PAGE_SIZE when faking physmem, as it's not always available
at compile-time. We could init it runtime, but it's just a random
number anyway.
 1.24 24-Jan-2008  pooka Default physmem was too tight, increase to 256megs from 0 bytes.
 1.23 22-Jan-2008  pooka Until debugging threaded programs in NetBSD is fixed, supply the
cpp option RUMP_WITHOUT_THREADS as a workaround. If defined, it
makes rump itself operate single-threaded and prevents kthread_create()
from working.
 1.22 20-Jan-2008  joerg Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.
 1.21 04-Jan-2008  pooka Print "panic: " before panicstr when panicking.
 1.20 02-Jan-2008  pooka Add the ability to run puffs in userspace. This means that puffs
can now be developed in userspace using puffs for development
(I hate emulators, they are annoyingly clumsy).

To e.g. mount psshfs using puffs-on-puffs, run fs/bin/syspuffs/syspuffs
with the regular mount_psshfs command line as an argument:

golem> ./syspuffs /usr/sbin/mount_psshfs ftp.netbsd.org:/pub /puffs

This will make the mount appear as usual, with the exception that the
requests will be passed through puffs both in the kernel and userspace:

ftp.netbsd.org:/pub on /puffs type puffs|p2k|puffs|psshfs
 1.19 11-Nov-2007  pooka branches: 1.19.6;
fix build (hi rmind!)
 1.18 04-Nov-2007  pooka branches: 1.18.2;
* sprinkle some locking into the vm code
* avoid extra insert+search+remove step in file systems using
ubc_uiomove() instead of standard uiomove()
 1.17 31-Oct-2007  pooka Make it possible to run rumps multithreaded. This brings real
locking and makes it possible to run file systems which create
threads. It also makes rump file system behaviour better match
file system behaviour in the kernel.
 1.16 24-Oct-2007  pooka branches: 1.16.2;
"flags * (M_CANFAIL | M_NOWAIT)" is probably not correct. Use & instead.
And while committing, add other random cruft I've needed recently.
 1.15 19-Oct-2007  ad machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.14 24-Sep-2007  pooka branches: 1.14.2;
Don't whine about wakeup() not being implemented every time it's
called. Nobody cares unless ltsleep() is called (and it panics).
 1.13 11-Sep-2007  briggs branches: 1.13.2;
If !_HAVE_TIMECOUNTER, initialize 'time' instead of 'time_second.'
 1.12 10-Sep-2007  pooka Provide errno from rumpuser_{gettimeofday,close}() to be consistent.
 1.11 26-Aug-2007  pooka branches: 1.11.2; 1.11.4;
few panicky functions
 1.10 20-Aug-2007  pooka branches: 1.10.2;
Hide NetBSD kernel headers completely from ukfs. This includes creating
accessors for:
* struct mount & VFS ops
* struct uio
* struct vnode
* struct vattr

and some namespace games for:
* namei flags
* VOPs
* enum vtype

Also, split rump services into two categories: library private and public
(rump_private.h and rump.h, respectively).

As a result, it is now possible to compile and use the NetBSD kernel
file systems on Linux (and probably other systems too with very
little work), although the makefiles need a bit of work to make it
a pleasureable experience.
 1.9 15-Aug-2007  pooka Wrap malloc() so that we catch the kernel arguments (namely M_ZERO)
properly. It's fairly amusing that this wasn't noticed until now.
 1.8 14-Aug-2007  pooka branches: 1.8.2;
Kill handrolled buffercache and use vfs_bio from the kernel. This is
mostly to get the flag jungle in sync with the kernel.
 1.7 13-Aug-2007  pooka Use supermarket variety vfs_vnops.c instead of homecooked routines
(that's actually a good thing here).
 1.6 13-Aug-2007  pooka compile in libkern __assert.c, argument order differs from libc model
 1.5 09-Aug-2007  pooka Add some stubs for lfs.
 1.4 08-Aug-2007  pooka Provide rumpmachine bswap.h, which makes bswapxx() call rumpuser
directly instead of relying on a symbol in rumpkern. I would like
to make it call the libc symbol directly, but I don't currently know
how to make it do that MI.

Makes hfs work (on i386), as it avoids endless recursion in bswap64().
Thanks to dillo for the image!
 1.3 08-Aug-2007  pooka * compile param.c
* move opts to a separate directory
 1.2 08-Aug-2007  pooka add microtime
 1.1 05-Aug-2007  pooka branches: 1.1.2;
Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.2 05-Aug-2007  pooka Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.1 05-Aug-2007  pooka file emul.c was added on branch matt-mips64 on 2007-08-05 22:28:08 +0000
 1.8.2.3 03-Sep-2007  skrll Sync with HEAD.
 1.8.2.2 15-Aug-2007  skrll Sync with HEAD.
 1.8.2.1 14-Aug-2007  skrll file emul.c was added on branch nick-csl-alignment on 2007-08-15 13:50:35 +0000
 1.10.2.4 23-Oct-2007  ad Sync with head.
 1.10.2.3 09-Oct-2007  ad Sync with head.
 1.10.2.2 20-Aug-2007  ad Sync with HEAD.
 1.10.2.1 20-Aug-2007  ad file emul.c was added on branch vmlocking on 2007-08-20 22:07:26 +0000
 1.11.4.9 24-Mar-2008  yamt sync with head.
 1.11.4.8 17-Mar-2008  yamt sync with head.
 1.11.4.7 27-Feb-2008  yamt sync with head.
 1.11.4.6 04-Feb-2008  yamt sync with head.
 1.11.4.5 21-Jan-2008  yamt sync with head
 1.11.4.4 15-Nov-2007  yamt sync with head.
 1.11.4.3 27-Oct-2007  yamt sync with head.
 1.11.4.2 03-Sep-2007  yamt sync with head.
 1.11.4.1 26-Aug-2007  yamt file emul.c was added on branch yamt-lazymbuf on 2007-09-03 14:45:26 +0000
 1.11.2.3 23-Mar-2008  matt sync with HEAD
 1.11.2.2 09-Jan-2008  matt sync with HEAD
 1.11.2.1 06-Nov-2007  matt sync with HEAD
 1.13.2.1 06-Oct-2007  yamt sync with head.
 1.14.2.2 13-Nov-2007  bouyer Sync with HEAD
 1.14.2.1 25-Oct-2007  bouyer Sync with HEAD.
 1.16.2.4 14-Nov-2007  joerg Sync with HEAD.
 1.16.2.3 04-Nov-2007  jmcneill Sync with HEAD.
 1.16.2.2 31-Oct-2007  joerg Sync with HEAD.
 1.16.2.1 24-Oct-2007  joerg file emul.c was added on branch jmcneill-pm on 2007-10-31 23:14:16 +0000
 1.18.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.18.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.19.6.3 23-Jan-2008  bouyer Sync with HEAD.
 1.19.6.2 08-Jan-2008  bouyer Sync with HEAD
 1.19.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.29.6.6 17-Jan-2009  mjf Sync with HEAD.
 1.29.6.5 05-Oct-2008  mjf Sync with HEAD.
 1.29.6.4 28-Sep-2008  mjf Sync with HEAD.
 1.29.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.29.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.29.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.29.2.1 24-Mar-2008  keiichi sync with head.
 1.37.2.2 04-Jun-2008  yamt sync with head
 1.37.2.1 18-May-2008  yamt sync with head.
 1.38.4.3 10-Oct-2008  skrll Sync with HEAD.
 1.38.4.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.38.4.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.38.2.8 09-Oct-2010  yamt sync with head
 1.38.2.7 11-Aug-2010  yamt sync with head.
 1.38.2.6 11-Mar-2010  yamt sync with head
 1.38.2.5 16-Sep-2009  yamt sync with head
 1.38.2.4 19-Aug-2009  yamt sync with head.
 1.38.2.3 20-Jun-2009  yamt sync with head
 1.38.2.2 16-May-2009  yamt sync with head
 1.38.2.1 04-May-2009  yamt sync with head.
 1.39.2.3 31-Jul-2008  simonb Sync with head.
 1.39.2.2 21-Jul-2008  simonb Sync with head.
 1.39.2.1 27-Jun-2008  simonb Sync with head.
 1.41.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.41.2.1 19-Oct-2008  haad Sync with HEAD.
 1.53.8.1 15-Feb-2014  matt Add vpanic
 1.53.4.1 15-Jul-2011  riz Pull up following revision(s) (requested by manu in ticket #1604):
sys/fs/puffs/puffs_msgif.c: revision 1.84
Apply patch from PR kern/44093 by yamt:
Interrupt server wait only on certain signals (same set at nfs -i)
instead of all signals. According to the PR this helps with
"git clone" run on a puffs file system.
 1.53.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.53.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.53.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.63.2.5 10-Jan-2009  christos merge diffs
 1.63.2.4 04-Jan-2009  christos merge diffs.
 1.63.2.3 30-Dec-2008  christos sync with head.
 1.63.2.2 28-Dec-2008  christos missing const
 1.63.2.1 21-Dec-2008  christos file emul.c was added on branch christos-time_t on 2008-12-28 22:22:12 +0000
 1.77.2.2 23-Jul-2009  jym Sync with HEAD.
 1.77.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.121.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.121.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.121.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.123.2.4 21-Apr-2011  rmind sync with head
 1.123.2.3 05-Mar-2011  rmind sync with head
 1.123.2.2 03-Jul-2010  rmind sync with head
 1.123.2.1 30-May-2010  rmind sync with head
 1.148.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.148.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.150.14.5 03-Dec-2017  jdolecek update from HEAD
 1.150.14.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.150.14.3 23-Jun-2013  tls resync from head
 1.150.14.2 25-Feb-2013  tls resync with head
 1.150.14.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.150.10.1 08-Feb-2013  riz Pull up following revision(s) (requested by rmind in ticket #794):
sys/rump/librump/rumpkern/emul.c: revision 1.152
Provide xc_send_ipi() routine in RUMP, which is required for high-priority
xcall(9) mechanism. It is emulated using low-priority xcall(9).
 1.150.4.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.150.4.2 23-Jan-2013  yamt sync with head
 1.150.4.1 30-Oct-2012  yamt sync with head
 1.158.4.1 18-May-2014  rmind sync with head
 1.164.2.1 10-Aug-2014  tls Rebase.
 1.168.2.6 28-Aug-2017  skrll Sync with HEAD
 1.168.2.5 05-Feb-2017  skrll Sync with HEAD
 1.168.2.4 19-Mar-2016  skrll Sync with HEAD
 1.168.2.3 22-Sep-2015  skrll Sync with HEAD
 1.168.2.2 06-Jun-2015  skrll Sync with HEAD
 1.168.2.1 06-Apr-2015  skrll Sync with HEAD
 1.179.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.179.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.180.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.181.6.3 09-Oct-2018  martin Pull up following revision(s) (requested by hannken in ticket #1052):

sys/kern/vfs_trans.c: revision 1.51
distrib/sets/lists/comp/mi: revision 1.2233
share/man/man9/fstrans.9: revision 1.27
share/man/man9/Makefile: revision 1.431
sys/sys/fstrans.h: revision 1.12
sys/rump/librump/rumpkern/emul.c: revision 1.187
sys/dev/vnd.c: revision 1.266
sys/miscfs/genfs/genfs_vfsops.c: revision 1.8

Bring back three state file system suspension:

NORMAL -> SUSPENDING -> SUSPENDED

and add operation fstrans_start_lazy() that only blocks while SUSPENDED.

Change vndthread() support operation handle_with_rdwr() to bracket
its file system operations by fstrans_start_lazy() and fstrans_done().

PR kern/53624 (dom0 freeze on domU exit)
 1.181.6.2 30-Nov-2017  martin Pull up following revision(s) (requested by ozaki-r in ticket #405):
sys/sys/pserialize.h: revision 1.2
sys/kern/kern_lock.c: revision 1.160
sys/kern/subr_pserialize.c: revision 1.9
sys/rump/librump/rumpkern/emul.c: revision 1.184
sys/rump/librump/rumpkern/emul.c: revision 1.185
sys/rump/librump/rumpkern/rump.c: revision 1.330
Implement debugging feature for pserialize(9)
The debugging feature detects violations of pserialize constraints.
It causes a panic:
- if a context switch happens in a read section, or
- if a sleepable function is called in a read section.
The feature is enabled only if LOCKDEBUG is on.
Discussed on tech-kern@
Add missing inclusion of pserialize.h (fix build)
 1.181.6.1 04-Jun-2017  bouyer pullup the following revisions, requested by hannken in ticket #2:
src/share/man/man9/fstrans.9 1.25
src/sys/kern/vfs_mount.c 1.66
src/sys/kern/vfs_subr.c 1.468
src/sys/kern/vfs_trans.c 1.46
src/sys/kern/vfs_vnode.c 1.94, 1.95, 1.96
src/sys/kern/vnode_if.c 1.105, 1.106
src/sys/kern/vnode_if.sh 1.65, 1.66
src/sys/kern/vnode_if.src 1.76
src/sys/miscfs/genfs/genfs_io.c 1.69
src/sys/miscfs/genfs/genfs_vnops.c 1.196, 1.197
src/sys/miscfs/genfs/layer_extern.h 1.40
src/sys/miscfs/genfs/layer_vfsops.c 1.51
src/sys/miscfs/genfs/layer_vnops.c 1.67
src/sys/miscfs/nullfs/null_vnops.c 1.42
src/sys/miscfs/overlay/overlay_vnops.c 1.24
src/sys/miscfs/umapfs/umap_vnops.c 1.60
src/sys/rump/include/rump/rumpvnode_if.h 1.29, 1.30
src/sys/rump/librump/rumpkern/emul.c 1.182
src/sys/rump/librump/rumpvfs/rumpvnode_if.c 1.29, 1.30
src/sys/sys/fstrans.h 1.11
src/sys/sys/vnode.h 1.278
src/sys/sys/vnode_if.h 1.100, 1.101
src/sys/sys/vnode_impl.h 1.14, 1.15
src/sys/ufs/lfs/lfs_pages.c 1.12

Vnode state, lock and fstrans cleanup:
- Rename vnode state "VS_ACTIVE" to "VS_LOADED" and add synthetic
state "VS_ACTIVE" to assert a loaded vnode with usecount > 0.

- Redo FSTRANS in vnode_if.c and use it for VOP_LOCK and VOP_UNLOCK.

- Cleanup the genfs lock operations.

- Make "struct vnode_impl" member "vi_lock" a krwlock_t again.

- Remove the lock type argument from fstrans_start and
fstrans_start_nowait,
remove now unused FSTRANS state "FSTRANS_SUSPENDING".
 1.185.4.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.185.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.185.4.1 10-Jun-2019  christos Sync with HEAD
 1.185.2.3 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.185.2.2 20-Oct-2018  pgoyette Sync with head
 1.185.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.191.2.1 18-Oct-2023  martin Pull up following revision(s) (requested by manu in ticket #1751):

sys/dev/raidframe/rf_netbsdkintf.c: revision 1.383
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.385
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.402
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.403
sys/arch/i386/stand/lib/biosdisk.c: revision 1.59
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.377
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.378
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.379
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.392
sys/rump/librump/rumpkern/emul.c: revision 1.200
sys/arch/i386/stand/lib/biosdisk.c: revision 1.60
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.416
(all via patch)

Get &rsc->sc_dksc only when we know 'rsc' is not NULL. This was actually
harmless because we didn't use the pointer then.

Gcc -Os on landisk is not smart enough to follow the conditional
initialization and warns, unconditionaly initialize dksc at declaration
with a XXX gcc comment.

Improve wording in comments in raid_dumpblock().

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.

Nix trailing whitespace.

if raidframe sets booted_device, log a debug message about it.
merge two debug lines in auto-root selection.
convert non-config-handled "DEBUG_ROOT" to aprint_debug().
now it's possible to get boot-time info about raidframe root
device selection with simple "boot -x".

Align the behavior of different boot methods in RAIDframe

We enforce the documented and paritally implemented behavior when
looking for the kernel in RAID 1 sets without a partition name given.

We search for:
- A GPT partition with bootme attribute set
- A FFS or LFS patititon
- The first partition

Fix root search in RAID 1 sets

We use the wedge information given by bootstrap, where the kernel was
found. This requires src/sys/arch/i386/stand/i386/lib/biosdisk.c 1.59
to work in all cases.

Fix build with -DNO_GPT
 1.196.20.1 18-Oct-2023  martin Pull up following revision(s) (requested by manu in ticket #418):

sys/arch/i386/stand/lib/biosdisk.c: revision 1.59
sys/rump/librump/rumpkern/emul.c: revision 1.200
sys/arch/i386/stand/lib/biosdisk.c: revision 1.60
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.416

Align the behavior of different boot methods in RAIDframe

We enforce the documented and paritally implemented behavior when
looking for the kernel in RAID 1 sets without a partition name given.

We search for:
- A GPT partition with bootme attribute set
- A FFS or LFS patititon
- The first partition

Fix root search in RAID 1 sets

We use the wedge information given by bootstrap, where the kernel was
found. This requires src/sys/arch/i386/stand/i386/lib/biosdisk.c 1.59
to work in all cases.

Fix build with -DNO_GPT
 1.201.6.1 02-Aug-2025  perseant Sync with HEAD
 1.2 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.1 25-Apr-2014  pooka branches: 1.1.2; 1.1.4; 1.1.6; 1.1.10; 1.1.12;
Move the etfs linkage from rumpvfs to rumpkern, and replace the
weak alias show with an honest pointer indirection.

No client-visible change. (apart from this version working e.g.
on musl w/ dlopen)
 1.1.12.1 19-Mar-2016  skrll Sync with HEAD
 1.1.10.3 03-Dec-2017  jdolecek update from HEAD
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 25-Apr-2014  tls file etfs_wrap.c was added on branch tls-maxphys on 2014-08-20 00:04:40 +0000
 1.1.6.2 10-Aug-2014  tls Rebase.
 1.1.6.1 25-Apr-2014  tls file etfs_wrap.c was added on branch tls-earlyentropy on 2014-08-10 06:56:51 +0000
 1.1.4.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.1.4.1 25-Apr-2014  yamt file etfs_wrap.c was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.1.2.2 18-May-2014  rmind sync with head
 1.1.2.1 25-Apr-2014  rmind file etfs_wrap.c was added on branch rmind-smpnet on 2014-05-18 17:46:18 +0000
 1.7 19-Nov-2008  pooka Split vfs out of rumpkern into rumpvfs. Non-fs rumps no longer
include the file system code. File system rumps explicitly need
to include rumpvfs from now on.
 1.6 21-Jul-2008  pooka branches: 1.6.2;
Have a COW with fscow_run(). Fixes problem of allocating files
on ffs with indirect blocks.

found by simonb
 1.5 02-Jan-2008  pooka branches: 1.5.6; 1.5.10; 1.5.12; 1.5.14; 1.5.16;
Add the ability to run puffs in userspace. This means that puffs
can now be developed in userspace using puffs for development
(I hate emulators, they are annoyingly clumsy).

To e.g. mount psshfs using puffs-on-puffs, run fs/bin/syspuffs/syspuffs
with the regular mount_psshfs command line as an argument:

golem> ./syspuffs /usr/sbin/mount_psshfs ftp.netbsd.org:/pub /puffs

This will make the mount appear as usual, with the exception that the
requests will be passed through puffs both in the kernel and userspace:

ftp.netbsd.org:/pub on /puffs type puffs|p2k|puffs|psshfs
 1.4 02-Jan-2008  ad Merge vmlocking2 to head.
 1.3 02-Dec-2007  hannken branches: 1.3.2; 1.3.6;
Make it compile again.
 1.2 07-Oct-2007  hannken branches: 1.2.4; 1.2.6;
Update the file system copy-on-write handler.

- Instead of hooking the handler on the specdev of a mounted file system
hook directly on the `struct mount'.

- Rename from `vn_cow_*' to `fscow_*' and move to `kern/vfs_trans.c'. Use
`mount_*specific' instead of clobbering `struct mount' or `struct specinfo'.

- Replace the hand-made reader/writer lock with a krwlock.

- Keep `vn_cow_*' functions and mark as obsolete.

- Welcome to NetBSD 4.99.32 - `struct specinfo' changed size.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
 1.1 05-Aug-2007  pooka branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.10; 1.1.12;
Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.12.2 05-Aug-2007  pooka Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.12.1 05-Aug-2007  pooka file fstrans_stub.c was added on branch matt-mips64 on 2007-08-05 22:28:08 +0000
 1.1.10.1 14-Oct-2007  yamt sync with head.
 1.1.8.5 21-Jan-2008  yamt sync with head
 1.1.8.4 07-Dec-2007  yamt sync with head
 1.1.8.3 27-Oct-2007  yamt sync with head.
 1.1.8.2 03-Sep-2007  yamt sync with head.
 1.1.8.1 05-Aug-2007  yamt file fstrans_stub.c was added on branch yamt-lazymbuf on 2007-09-03 14:45:27 +0000
 1.1.6.2 09-Jan-2008  matt sync with HEAD
 1.1.6.1 06-Nov-2007  matt sync with HEAD
 1.1.4.3 09-Oct-2007  ad Sync with head.
 1.1.4.2 20-Aug-2007  ad Sync with HEAD.
 1.1.4.1 05-Aug-2007  ad file fstrans_stub.c was added on branch vmlocking on 2007-08-20 22:07:27 +0000
 1.1.2.2 15-Aug-2007  skrll Sync with HEAD.
 1.1.2.1 05-Aug-2007  skrll file fstrans_stub.c was added on branch nick-csl-alignment on 2007-08-15 13:50:36 +0000
 1.2.6.2 18-Feb-2008  mjf Sync with HEAD.
 1.2.6.1 08-Dec-2007  mjf Sync with HEAD.
 1.2.4.3 03-Dec-2007  joerg Sync with HEAD.
 1.2.4.2 02-Nov-2007  joerg Reduce diff to HEAD by adding files forgotten in early merges.
 1.2.4.1 07-Oct-2007  joerg file fstrans_stub.c was added on branch jmcneill-pm on 2007-11-02 12:43:51 +0000
 1.3.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.3.2.1 28-Dec-2007  ad Make rump build.
 1.5.16.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.5.16.1 19-Oct-2008  haad Sync with HEAD.
 1.5.14.1 21-Jul-2008  simonb Sync with head.
 1.5.12.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.5.10.1 04-May-2009  yamt sync with head.
 1.5.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.5.6.1 28-Sep-2008  mjf Sync with HEAD.
 1.6.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.20 17-Oct-2007  pooka Compile most genfs routines directly out of the kernel sources.
Move special I/O routines to genfs_io.c to mirror kernel naming.
 1.19 10-Oct-2007  ad Merge from vmlocking:

- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
 1.18 01-Sep-2007  pooka branches: 1.18.2; 1.18.4;
* fill struct buf a little better
* hop, skip & jump to make uvm_pageratop work
 1.17 20-Aug-2007  pooka branches: 1.17.2;
g/c comment invalidated by previous
 1.16 20-Aug-2007  pooka * in getpages, make sure we always align our buffer size to the page size
* in putpages, make sure we don't try attempt to push data in a page
after eof. also, skip blocks which bmap can't locate (see comment
in code).

the effect: file systems with fs_bsize < PAGE_SIZE now work r/w
 1.15 20-Aug-2007  pooka branches: 1.15.2;
Hide NetBSD kernel headers completely from ukfs. This includes creating
accessors for:
* struct mount & VFS ops
* struct uio
* struct vnode
* struct vattr

and some namespace games for:
* namei flags
* VOPs
* enum vtype

Also, split rump services into two categories: library private and public
(rump_private.h and rump.h, respectively).

As a result, it is now possible to compile and use the NetBSD kernel
file systems on Linux (and probably other systems too with very
little work), although the makefiles need a bit of work to make it
a pleasureable experience.
 1.14 14-Aug-2007  pooka branches: 1.14.2;
Kill handrolled buffercache and use vfs_bio from the kernel. This is
mostly to get the flag jungle in sync with the kernel.
 1.13 13-Aug-2007  pooka Use supermarket variety vfs_vnops.c instead of homecooked routines
(that's actually a good thing here).
 1.12 11-Aug-2007  pooka * move rump_vopwrite_fault() into history - we now support the file
system faulting in pages if it does e.g. fragment reallocation
* get rid of rumpvm_findpage() and always use uvm_pagelookup()
* determine a vnode's cleanness by flagging it as being on the work
list if we "take" a write fault and removing it from the worklist
once pages are flushed. There is no work list here, but at least
there is symmetry with the kernel.
 1.11 09-Aug-2007  pooka Fix it a bit & wait for the dust to settle. Also, enable UBC by default.

ffs in userspace on top of puffs/p2k/rump is now stable enough to
host a make -j4 kernel build (well, at least my kernel build ...
but, yes, I am currently running that kernel on my desktop)
 1.10 09-Aug-2007  pooka * fix symlink
* actually call a couple of VOPs
 1.9 09-Aug-2007  pooka deal with holes in getpages()
 1.8 09-Aug-2007  pooka fool some KASSERTs
 1.7 09-Aug-2007  pooka Add some stubs for lfs.
 1.6 07-Aug-2007  pooka * adjust device block number based on if we're putting pages to a
fs block boudary or not
* round writes to DEV_BSIZE, just to be kosher
 1.5 07-Aug-2007  pooka remove the allocstorage param from makepage - not needed
 1.4 07-Aug-2007  pooka track dirty vm objects
 1.3 07-Aug-2007  pooka offset orgies, part n+1. this is still not right, but at least it's better
 1.2 06-Aug-2007  pooka branches: 1.2.2;
Instead of going for a PAGE_SIZE nuke, do getpages() in a more
sniper style. Makes efs (& other file systems with bsize < PAGE_SIZE)
work better.
 1.1 05-Aug-2007  pooka Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.2.2.2 06-Aug-2007  pooka Instead of going for a PAGE_SIZE nuke, do getpages() in a more
sniper style. Makes efs (& other file systems with bsize < PAGE_SIZE)
work better.
 1.2.2.1 06-Aug-2007  pooka file genfs.c was added on branch matt-mips64 on 2007-08-06 20:46:29 +0000
 1.14.2.3 03-Sep-2007  skrll Sync with HEAD.
 1.14.2.2 15-Aug-2007  skrll Sync with HEAD.
 1.14.2.1 14-Aug-2007  skrll file genfs.c was added on branch nick-csl-alignment on 2007-08-15 13:50:37 +0000
 1.15.2.3 09-Oct-2007  ad Sync with head.
 1.15.2.2 20-Aug-2007  ad Sync with HEAD.
 1.15.2.1 20-Aug-2007  ad file genfs.c was added on branch vmlocking on 2007-08-20 22:07:27 +0000
 1.17.2.1 06-Nov-2007  matt sync with HEAD
 1.18.4.2 18-Oct-2007  yamt sync with head.
 1.18.4.1 14-Oct-2007  yamt sync with head.
 1.18.2.3 27-Oct-2007  yamt sync with head.
 1.18.2.2 03-Sep-2007  yamt sync with head.
 1.18.2.1 01-Sep-2007  yamt file genfs.c was added on branch yamt-lazymbuf on 2007-09-03 14:45:29 +0000
 1.17 19-Nov-2008  pooka Split vfs out of rumpkern into rumpvfs. Non-fs rumps no longer
include the file system code. File system rumps explicitly need
to include rumpvfs from now on.
 1.16 16-Nov-2008  pooka explicitly include <sys/buf.h> since we explicitly use it
 1.15 14-Nov-2008  pooka Clearly state that VOP_BMAP panic in putpages is because I'm a lazy bum.
(although I can't really think of any scenario where VOP_BMAP could
legally fail)
 1.14 30-Sep-2008  pooka branches: 1.14.2; 1.14.4;
When paging in data, do not try to read past "disk" EOF. This
fixes reads for file systems which are not bound by such mundane
limitations as block size (example: nfs).
 1.13 29-Jul-2008  pooka Install rump libraries and utilities to the base system and remove the
private non-installed build infrastructure from sys/rump.

breakdown of commit:
* install relevant headers into /usr/include/rump
* build sys/rump/librump/rumpuser and sys/rump/librump/rumpkern
from src/lib and install as librumpuser and librump, respectively
+ this retains the ability to test a librump build with just the
kernel sources at hand
* move sys/rump/fs/lib/libukfs and sys/rump/fs/lib/libp2k to src/lib
for general consumption, they are not kernel-space dwellers anyway
* build and install sys/rump/fs/lib/lib$fs as librumpfs_$fs
* add chapter 3 manual pages for rump, rumpuser, ukfs and p2k
* build and install userspace kernel file system daemons if MKPUFFS=yes
is spexified
* retire fsconsole for now, it will make a comeback with an actually
implemented version shortly
 1.12 20-Jul-2008  pooka assert -> KASSERT
 1.11 15-Jul-2008  pooka Honor PGO_FREE in putpages.

Fixes cp-then-rm ukfs panic reported by Arnaud Ysmal.
 1.10 04-Jun-2008  ad branches: 1.10.2; 1.10.4;
Make it build.
 1.9 14-May-2008  reinoud Make rump compile UDF correctly. Note that it won't work though since rump
needs to be compiled with thread support.
 1.8 02-Jan-2008  pooka branches: 1.8.6; 1.8.8; 1.8.10; 1.8.12;
fix vmlocking2 fallout:

* I heard a wild rumor that vp_interlock is a mutex these days (hi ad!)
* init new locks (hi ad)
* observe that with simple_locks only deadlocks would be caught while
releasing unlocked locks would go unnoticed. make locking work (hi pooka)
 1.7 02-Jan-2008  ad Merge vmlocking2 to head.
 1.6 07-Nov-2007  pooka branches: 1.6.2; 1.6.6;
Execute I/O in a separate thread for async I/O where previously
everything was written/read in caller context.

Also, make the "kernel" lock recursive. It works better that way ...
 1.5 06-Nov-2007  pooka branches: 1.5.2;
yank out extra debug printf
 1.4 06-Nov-2007  pooka Sprinkle some more locking, especially to the vm. Due to some
additional fixes, it's now possible to run file systems with
spinlocks actually enabled. The genfs_putpages() locking is still
working only due to greater powers, but I'll eventually get around to
fixing it.
 1.3 04-Nov-2007  pooka branches: 1.3.2;
Allocate buf using getiobuf() instead of abusing the stack.
 1.2 31-Oct-2007  pooka branches: 1.2.2;
Make it possible to run rumps multithreaded. This brings real
locking and makes it possible to run file systems which create
threads. It also makes rump file system behaviour better match
file system behaviour in the kernel.
 1.1 17-Oct-2007  pooka branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Compile most genfs routines directly out of the kernel sources.
Move special I/O routines to genfs_io.c to mirror kernel naming.
 1.1.8.4 21-Jan-2008  yamt sync with head
 1.1.8.3 15-Nov-2007  yamt sync with head.
 1.1.8.2 27-Oct-2007  yamt sync with head.
 1.1.8.1 17-Oct-2007  yamt file genfs_io.c was added on branch yamt-lazymbuf on 2007-10-27 11:36:22 +0000
 1.1.6.2 23-Oct-2007  ad Sync with head.
 1.1.6.1 17-Oct-2007  ad file genfs_io.c was added on branch vmlocking on 2007-10-23 20:36:44 +0000
 1.1.4.2 18-Oct-2007  yamt sync with head.
 1.1.4.1 17-Oct-2007  yamt file genfs_io.c was added on branch yamt-x86pmap on 2007-10-18 08:33:14 +0000
 1.1.2.1 13-Nov-2007  bouyer Sync with HEAD
 1.2.2.6 11-Nov-2007  joerg Sync with HEAD.
 1.2.2.5 06-Nov-2007  joerg Sync with HEAD.
 1.2.2.4 04-Nov-2007  jmcneill Sync with HEAD.
 1.2.2.3 02-Nov-2007  joerg Remove the rest of the unintentional diff in sys/rump.
 1.2.2.2 31-Oct-2007  joerg Sync with HEAD.
 1.2.2.1 31-Oct-2007  joerg file genfs_io.c was added on branch jmcneill-pm on 2007-10-31 23:14:16 +0000
 1.3.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.3.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.5.2.4 09-Jan-2008  matt sync with HEAD
 1.5.2.3 08-Nov-2007  matt sync with -HEAD
 1.5.2.2 06-Nov-2007  matt sync with HEAD
 1.5.2.1 06-Nov-2007  matt file genfs_io.c was added on branch matt-armv6 on 2007-11-06 23:34:35 +0000
 1.6.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.6.2.1 28-Dec-2007  ad Make rump build.
 1.8.12.3 10-Oct-2008  skrll Sync with HEAD.
 1.8.12.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.8.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.8.10.2 04-May-2009  yamt sync with head.
 1.8.10.1 16-May-2008  yamt sync with head.
 1.8.8.2 17-Jun-2008  yamt sync with head.
 1.8.8.1 18-May-2008  yamt sync with head.
 1.8.6.5 17-Jan-2009  mjf Sync with HEAD.
 1.8.6.4 05-Oct-2008  mjf Sync with HEAD.
 1.8.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.8.6.2 05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.8.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.10.4.1 19-Oct-2008  haad Sync with HEAD.
 1.10.2.3 31-Jul-2008  simonb Sync with head.
 1.10.2.2 21-Jul-2008  simonb Sync with head.
 1.10.2.1 18-Jul-2008  simonb Sync with head.
 1.14.4.1 16-Jan-2009  snj Pull up the following revision(s) (requested by pooka in ticket #253):
sys/rump/librump/rumpvfs/genfs_io.c: revision 1.2 via patch
Make sure we write a positive length of data.
 1.14.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.17 30-Apr-2020  riastradh No need for a lock around rnd_add_data any more.
 1.16 30-Apr-2020  riastradh rnd_attach_source calls the callback itself now.

No need for every driver to explicitly call it to prime the pool.

Eliminate now-unused <sys/rndpool.h>.
 1.15 21-May-2016  riastradh Actually get as many bytes as requested from rumpuser_random.

rumpuser_random is limited to 32 bytes at a time -- which would be
reasonable, except that there are too many buffers in the way between
entropy sources and users of the entropy pool.

Partial fix for PR kern/51135.
 1.14 17-Feb-2016  riastradh Need <sys/mutex.h> for mutex(9).
 1.13 17-Feb-2016  riastradh Caller must have exclusive access to rndsource for rnd_add_data(_sync).
 1.12 17-Feb-2016  riastradh Make hyperentropy rndsource work synchronously, again.

This time for real! *crosses fingers*
 1.11 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.10 21-Apr-2015  riastradh Revert previous -- a little too quick on the commit trigger.

Ran some tests but not enough. There is a deadlock against myself:

rndsink_request acquires rndsinks_lock
-> rnd_getmore
-> hyperentropy feedrandom (or any other rndsource callback)
-> rnd_add_data
-> rndsinks_distribute acquires rndsinks_lock

Need to break this cycle before rndsource callbacks can invoke
rnd_add_data.
 1.9 21-Apr-2015  riastradh Restore simplicity of rump hyperentropy `hardware RNG'.
 1.8 13-Apr-2015  riastradh Convert remaining MI <sys/rnd.h> stragglers. Many MD ones left.
 1.7 15-Aug-2014  riastradh branches: 1.7.2; 1.7.4;
<sys/param.h> comes first, per /usr/share/misc/style.
 1.6 15-Aug-2014  justin Fix header ordering
 1.5 15-Aug-2014  justin add sys/atomic.h and order headers correctly
 1.4 15-Aug-2014  riastradh Call rnd_add_data asynchronously for the rump hyperentropy callback.

Avoids recursion rnd_getmore -> rnd_add_data -> rnd_getmore, which is
silly but I don't have time to fix it properly right now.
 1.3 10-Aug-2014  tls branches: 1.3.2;
Merge tls-earlyentropy branch into HEAD.
 1.2 17-Jan-2014  pooka branches: 1.2.2; 1.2.4; 1.2.6;
don't use temp buffer from the stack, fix the constants
 1.1 17-Jan-2014  pooka Use subr_cprng.c instead of stub implementation. Rijndael migrates from
rumpkern_crypto to rumpkern due to it being mandatory for cprng.
 1.2.6.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.2.6.1 17-Jan-2014  yamt file hyperentropy.c was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.2.4.2 18-May-2014  rmind sync with head
 1.2.4.1 17-Jan-2014  rmind file hyperentropy.c was added on branch rmind-smpnet on 2014-05-18 17:46:18 +0000
 1.2.2.1 07-Apr-2014  tls Be a little more clear and consistent about harvesting entropy from devices:

1) deprecate RND_FLAG_NO_ESTIMATE

2) define RND_FLAG_COLLECT_TIME, RND_FLAG_COLLECT_VALUE

3) define RND_FLAG_ESTIMATE_TIME, RND_FLAG_ESTIMATE_VALUE

4) define RND_FLAG_DEFAULT: RND_FLAG_COLLECT_TIME|
RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_TIME

5) Make entropy harvesting from environmental sensors a little more generic
and remove it from individual sensor drivers.

6) Remove individual open-coded delta-estimators for values from a few
places in the tree (uvm, environmental drivers).

7) 0 -> RND_FLAG_DEFAULT, actually gather entropy from various drivers
that had stubbed out code, other minor cleanups.
 1.3.2.1 18-Aug-2014  martin Pull up following revision(s) (requested by riastradh in ticket #35):
sys/rump/librump/rumpkern/hyperentropy.c: revision 1.6
sys/rump/librump/rumpkern/hyperentropy.c: revision 1.7
sys/rump/librump/rumpkern/hyperentropy.c: revision 1.4
sys/rump/librump/rumpkern/hyperentropy.c: revision 1.5
Call rnd_add_data asynchronously for the rump hyperentropy callback.
Avoids recursion rnd_getmore -> rnd_add_data -> rnd_getmore, which is
silly but I don't have time to fix it properly right now.
add sys/atomic.h and order headers correctly
Fix header ordering
<sys/param.h> comes first, per /usr/share/misc/style.
 1.7.4.3 29-May-2016  skrll Sync with HEAD
 1.7.4.2 19-Mar-2016  skrll Sync with HEAD
 1.7.4.1 06-Jun-2015  skrll Sync with HEAD
 1.7.2.3 03-Dec-2017  jdolecek update from HEAD
 1.7.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7.2.1 15-Aug-2014  tls file hyperentropy.c was added on branch tls-maxphys on 2014-08-20 00:04:40 +0000
 1.3 23-Apr-2015  pooka g/c the never-used and never-useful hyperstubs.c
 1.2 30-Apr-2013  pooka branches: 1.2.4; 1.2.12; 1.2.16;
Stub out anonmmap too.

This is a clever trick to enable me to avoid having to document
that interface. I seriously doubt it's relevant beyond a POSIX
env where it's required by the proplib client-side implementation
which expects it can do munmap() on a return value from a proplib
call.
 1.1 30-Apr-2013  pooka weak stubs for optional hypercalls
 1.2.16.1 06-Jun-2015  skrll Sync with HEAD
 1.2.12.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.2.12.1 30-Apr-2013  yamt file hyperstubs.c was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.2.4.3 03-Dec-2017  jdolecek update from HEAD
 1.2.4.2 23-Jun-2013  tls resync from head
 1.2.4.1 30-Apr-2013  tls file hyperstubs.c was added on branch tls-maxphys on 2013-06-23 06:20:28 +0000
 1.2 16-Dec-2009  pooka update to newnewvers.sh usage
 1.1 16-Dec-2009  pooka Generate vers.c and include it in the kernel component.
 1.57 06-Apr-2025  riastradh rump: Set up the softint CPU bouncer only once, not once per CPU.

This is used for softint_schedule_cpu to schedule softints on other
CPUs. There is one global lock, and one global condition variable,
and really there only needs to be one thread to handle the requests.
Without this change, we reinitialize the lock and condition variable,
leaking them (and possibly leave some threads confused if they are
currently taking the lock or waiting on the condition variable as
they get reinitialized).

Leak found by lsan while investigating:

PR misc/59252: tests/rump/rumpkern/t_sp:sigsafe: out of memory
 1.56 01-Nov-2020  christos branches: 1.56.24;
PR/55664: Ruslan Nikolaev: Fix:

1. A race condition (bug) in sys/rump/librump/rumpkern/intr.c since
rumpuser_cv_signal() is called without holding a mutex
2. sleepq is implemented using a single (global) conditional
variable; that should be done per each sleepq separately
 1.55 16-Dec-2019  ad branches: 1.55.8;
- Extend the per-CPU counters matt@ did to include all of the hot counters
in UVM, excluding uvmexp.free, which needs special treatment and will be
done with a separate commit. Cuts system time for a build by 20-25% on
a 48 CPU machine w/DIAGNOSTIC.

- Avoid 64-bit integer divide on every fault (for rnd_add_uint32).
 1.54 26-Jan-2016  pooka branches: 1.54.18;
Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.53 16-Aug-2015  pooka Don't use KASSERT() to test for external return values, use panic()

from Robert Millan <rmh@freebsd.org>
 1.52 22-Apr-2015  pooka Apparently not all ports define struct clockframe in cpu.h, so we cannot
provide our definition that way. Instead, generate the struct clockframe
passed to hardclock() in MD code.
 1.51 22-Apr-2015  pooka Include kern_clock.c in rump kernels.
 1.50 21-Apr-2015  pooka Use hardclock_ticks instead of a homegrown variable.

... not that I understand how various kernel algorithms can work
after enough uptime with hardclock_ticks being a signed int.
 1.49 16-Apr-2015  pooka "extern int hz" was written in a very aesthetically pleasing way in this
file, but let's just be happy with the sys/kernel.h style of writing it.
 1.48 14-Jan-2015  pooka Execute softints in the order in which they are scheduled (per level).
 1.47 14-Jan-2015  pooka Implement softint_schedule_cpu() for rump kernels.

While distributing processing all over the place is not relevant for
high-performance rump kernel I/O stacks (and downright counterproductive),
the mechanism is used e.g. to reach a quiescent state when detaching
an interface, and therefore a semantically correct implementation is
required.

Fixes at least an uncommon race in the ifconfig destroy case.
reported & patch tested by Justin Cormack.
 1.46 22-Jun-2014  pooka branches: 1.46.4;
Initialize cpu_softcpu before creating softint threads. Fixes things
with rump kernel hypervisors which wrap the thread creation hypercall.

pointed out by Justin Cormack
 1.45 09-Jun-2014  rmind Restore the assert in RUMP's softint_schedule_cpu() and just ensure
curcpu() in the caller.
 1.44 08-Jun-2014  rmind RUMP's softint_schedule_cpu: comment out an assert for now.
 1.43 05-Jun-2014  rmind librump: add kpreempt_disabled(9) and softint_schedule_cpu(9).
 1.42 11-Nov-2013  pooka branches: 1.42.2;
Avoid calling curcpu() when we know the result is constant.
 1.41 11-Nov-2013  pooka Defer softint thread creation to first softint_establish() for that level.
Speeds up rump kernel bootstrap and saves memory -- very rarely are all
softint levels in a rump kernel used.
 1.40 02-May-2013  pooka branches: 1.40.4;
Ok, maybe using int64 for nanoseconds in the (sec,nsec) tuple was
a bit too future-proof. I think long is enough there (let's just
hope nobody redefines "nano"). Also, make seconds signed just in
case someone wants their clock to be in 1901.
 1.39 30-Apr-2013  pooka Flip parameter order in the clock hypercalls to make them consistent
with everything else wrt in/out parameters.
 1.38 28-Apr-2013  pooka Improve the time-related hypercalls so that's it's possible to
sleep until an absolute time on the host's monotonic clock (should
something like that be supported).
 1.37 27-Apr-2013  pooka roll mutex init hypercalls into one (one of them already took a flag anyway)
 1.36 21-Mar-2011  pooka branches: 1.36.4; 1.36.14;
Update copyright statements.

no functional change.
 1.35 01-Dec-2010  pooka branches: 1.35.2;
Track lwp as the rumpuser mutex owner instead of pthread_t (this
is done in rumpuser for simplicity, since on the kernel side things
we assume we have only one pointer of space). As a side-effect,
we can no longer know if the current thread is holding on to a
mutex locked without curlwp context (basically all mutexes inited
outside of mutex_init()). The only thing that called rumpuser_mutex_held()
for a non-kmutex was the giant lock. So, instead implement recursive
locking for the giant lock in the rump kernel and get rid of the
now-unused recursive pthread mutex in the hypercall interface.
 1.34 07-Sep-2010  pooka Allocate softint vectors for the final number of CPUs, not the
number currently attached. Deals with a SNAFU in my commit earlier
today which would cause softints established early to lack a
softint context on non-bootstrap CPUs.
 1.33 07-Sep-2010  pooka update comments. no code change.
 1.32 15-Aug-2010  pooka Implement softints properly: they need to have a schedulable entity
per cpu.
 1.31 10-Aug-2010  pooka Don't create the percpu clock interrupt threads as softint threads
because they aren't softint threads. This fixes callouts in
situations where there is nothing else happening in the rump kernel
(i.e. no threads executed which would trigger the softints when
they unschedule).
 1.30 10-Aug-2010  pooka Use correct indices for clock threads and more descriptive ones
for the softint threads.
 1.29 18-May-2010  martin Add missing include
 1.28 18-May-2010  pooka Make it possible to use the scheduler lock as the rumpuser condvar
interlock. This is applicable in cases where the actual interlock
is the CPU the currently running thread is scheduled on. Borrowing
the scheduler lock as the mutex mandated by pthread_cond_wait()
does away with need to have an additional mutex. This both optimizes
runtime execution and simplifies code, as the extra lock typically
lead to quite some trickeries to avoid the dungeon collapsing due
to zaps from the wand of deadlock.
 1.27 12-May-2010  pooka fix inversion: advance clock on cpu0, not the complement of cpu0
 1.26 28-Apr-2010  pooka Fix snafu which caused the clock to travel lightspeed.
 1.25 27-Apr-2010  pooka Fix multiple virtual cpu support.

... or at least on x86. CPU_INFO_FOREACH() still isn't MI, and I
don't want to support 2^n different versions.
 1.24 14-Apr-2010  pooka Include kern_tc and use a timecounter driver instead of homerolled
kern_tc implementation.
 1.23 05-Dec-2009  pooka branches: 1.23.2; 1.23.4;
Cast Oh Kath Ra once every second.
 1.22 01-Dec-2009  pooka Almost there for virtual CPU MP support:
* support bound kernel threads
* bind softint threads to specific virtual cpus
+ remove now-unnecessary locks from softint code

Now, if we only had MI CPU_INFO_FOREACH() .... (hi rmind ;)
 1.21 11-Nov-2009  pooka Make rumpuser_cv_timedwait take two int64's instead timespec to
uncouple it from the timespec layout. Also, change return value
to zero for "timeout didn't expire" and non-zero for "timeout
expired". This decouples the interface from errno assignments.
 1.20 09-Nov-2009  pooka Hash out soft interrupts to be a little closer to real softints:
* split them into levels
* allow only one per level to be active at a time
* fire softints only when we are unscheduling from a CPU instead
of immediately in softint_schedule(). this will later morph
into return from interrupt, but that part isn't done yet.
 1.19 06-Nov-2009  pooka lie that we are never in a softintr (i.e. add stub)
 1.18 19-Sep-2009  pooka arrr, implement softint_disestablish(). this code be needin' an enema, matey.
 1.17 26-Apr-2009  pooka fix uninitialized
 1.16 26-Apr-2009  pooka Fix getnano/microuptime to report actual uptime.
 1.15 27-Feb-2009  pooka decouple rumpuser gettime from struct timeval
 1.14 07-Feb-2009  pooka branches: 1.14.2;
Make the clock interrupt tick based on absolute time instead of
relative time. This prevents drifting. Also, keep track of time
within userspace, so we do not have to make a syscall to get the
clock value. This is approximately 7 times cheaper, but on the
negative side is limited to the clock interrupt frequency.
 1.13 04-Feb-2009  pooka Create the clock interrupt and soft interrupt workers as MPSAFE
 1.12 13-Jan-2009  pooka misc cleanup, mainly header polish
 1.11 18-Dec-2008  pooka __KERNEL_RCSID
 1.10 18-Dec-2008  pooka Separate the timer thread and soft interrut workers. Use a dynamic
size pool of workers to make sure there are enough for processing
the scheduled soft interrupts.
 1.9 30-Oct-2008  christos fix compilation and lint warnings.
 1.8 10-Oct-2008  pooka branches: 1.8.2;
Provide time_uptime and push it forward every now and then if we happen
to have the timer thread. rump uptime - woohoo.
 1.7 10-Oct-2008  pooka fix brainfart: kthread_create() sets curlwp
 1.6 10-Oct-2008  pooka Support callouts and call callout_hardclock() from the timer
interrupt thread.

The sleepq implementation required for callouts is horrible, kludged
only for callouts, and generally unacceptable. It needs revisiting,
but I'm not sure yet should rump or kern_timeout be improved. It's
almost untested as of now, but committing this will give me some
maneuvering space while letting application compile.
 1.5 09-Oct-2008  pooka Rewrite interrupts to provide better softintr support, i.e. not
execute them simply in the context of the scheduling code, as this
does not work for all applications (e.g. networking soft interrupts).
Rather, schedule them and execute them from a separate context.

Also provide a timer which for now executes just hardclock_callout()
(well, at least after callouts are included in librump, which is
soon).
 1.4 29-Jul-2008  pooka Install rump libraries and utilities to the base system and remove the
private non-installed build infrastructure from sys/rump.

breakdown of commit:
* install relevant headers into /usr/include/rump
* build sys/rump/librump/rumpuser and sys/rump/librump/rumpkern
from src/lib and install as librumpuser and librump, respectively
+ this retains the ability to test a librump build with just the
kernel sources at hand
* move sys/rump/fs/lib/libukfs and sys/rump/fs/lib/libp2k to src/lib
for general consumption, they are not kernel-space dwellers anyway
* build and install sys/rump/fs/lib/lib$fs as librumpfs_$fs
* add chapter 3 manual pages for rump, rumpuser, ukfs and p2k
* build and install userspace kernel file system daemons if MKPUFFS=yes
is spexified
* retire fsconsole for now, it will make a comeback with an actually
implemented version shortly
 1.3 28-Apr-2008  martin branches: 1.3.2; 1.3.4; 1.3.6;
Remove clause 3 and 4 from TNF licenses
 1.2 02-Jan-2008  ad branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8; 1.2.14; 1.2.16; 1.2.18;
Merge vmlocking2 to head.
 1.1 28-Dec-2007  ad branches: 1.1.2;
file intr.c was initially added on branch vmlocking2.
 1.1.2.1 28-Dec-2007  ad Make rump build.
 1.2.18.5 09-Oct-2010  yamt sync with head
 1.2.18.4 11-Aug-2010  yamt sync with head.
 1.2.18.3 11-Mar-2010  yamt sync with head
 1.2.18.2 04-May-2009  yamt sync with head.
 1.2.18.1 16-May-2008  yamt sync with head.
 1.2.16.1 18-May-2008  yamt sync with head.
 1.2.14.3 17-Jan-2009  mjf Sync with HEAD.
 1.2.14.2 28-Sep-2008  mjf Sync with HEAD.
 1.2.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.8.2 18-Feb-2008  mjf Sync with HEAD.
 1.2.8.1 02-Jan-2008  mjf file intr.c was added on branch mjf-devfs on 2008-02-18 21:07:22 +0000
 1.2.6.2 21-Jan-2008  yamt sync with head
 1.2.6.1 02-Jan-2008  yamt file intr.c was added on branch yamt-lazymbuf on 2008-01-21 09:47:42 +0000
 1.2.4.2 09-Jan-2008  matt sync with HEAD
 1.2.4.1 02-Jan-2008  matt file intr.c was added on branch matt-armv6 on 2008-01-09 01:58:00 +0000
 1.2.2.2 02-Jan-2008  bouyer Sync with HEAD
 1.2.2.1 02-Jan-2008  bouyer file intr.c was added on branch bouyer-xeni386 on 2008-01-02 21:57:53 +0000
 1.3.6.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.3.6.1 19-Oct-2008  haad Sync with HEAD.
 1.3.4.1 31-Jul-2008  simonb Sync with head.
 1.3.2.2 10-Oct-2008  skrll Sync with HEAD.
 1.3.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.8.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.8.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.8.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.14.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.23.4.3 21-Apr-2011  rmind sync with head
 1.23.4.2 05-Mar-2011  rmind sync with head
 1.23.4.1 30-May-2010  rmind sync with head
 1.23.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.23.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.23.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.35.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.36.14.3 03-Dec-2017  jdolecek update from HEAD
 1.36.14.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.36.14.1 23-Jun-2013  tls resync from head
 1.36.4.1 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.40.4.1 18-May-2014  rmind sync with head
 1.42.2.1 10-Aug-2014  tls Rebase.
 1.46.4.4 19-Mar-2016  skrll Sync with HEAD
 1.46.4.3 22-Sep-2015  skrll Sync with HEAD
 1.46.4.2 06-Jun-2015  skrll Sync with HEAD
 1.46.4.1 06-Apr-2015  skrll Sync with HEAD
 1.54.18.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.55.8.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.56.24.1 02-Aug-2025  perseant Sync with HEAD
 1.2 21-Aug-2007  pooka Implement credentials. Access control is now similar to if the file
system were run in the kernel.
 1.1 05-Aug-2007  pooka branches: 1.1.2; 1.1.4; 1.1.6;
Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.6.2 05-Aug-2007  pooka Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.6.1 05-Aug-2007  pooka file kauth_stub.c was added on branch matt-mips64 on 2007-08-05 22:28:09 +0000
 1.1.4.3 09-Oct-2007  ad Sync with head.
 1.1.4.2 20-Aug-2007  ad Sync with HEAD.
 1.1.4.1 05-Aug-2007  ad file kauth_stub.c was added on branch vmlocking on 2007-08-20 22:07:27 +0000
 1.1.2.3 03-Sep-2007  skrll Sync with HEAD.
 1.1.2.2 15-Aug-2007  skrll Sync with HEAD.
 1.1.2.1 05-Aug-2007  skrll file kauth_stub.c was added on branch nick-csl-alignment on 2007-08-15 13:50:37 +0000
 1.11 23-Jun-2023  riastradh rump: KASSERT(x && y) -> KASSERT(x); KASSERT(y)

Add some KASSERTMSG while here.
 1.10 07-Jul-2016  msaitoh KNF. Remove extra spaces. No functional change.
 1.9 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.8 30-Apr-2013  pooka branches: 1.8.12;
Make hypercall calling conventions consistent: iff a hypercall can fail,
it returns an int containing the error value.
 1.7 29-Apr-2013  pooka remove routine not meant to be committed
 1.6 29-Apr-2013  pooka Make the rump kernel upcalls which were previous available only to
the sysproxy module available for the entire hypervisor.
 1.5 09-Oct-2012  pooka Gather some statistics about biglock usage.
 1.4 20-Feb-2012  mrg branches: 1.4.2;
add a _kernel_locked_p().
 1.3 01-Dec-2010  pooka branches: 1.3.8; 1.3.12; 1.3.14; 1.3.18; 1.3.20;
Track lwp as the rumpuser mutex owner instead of pthread_t (this
is done in rumpuser for simplicity, since on the kernel side things
we assume we have only one pointer of space). As a side-effect,
we can no longer know if the current thread is holding on to a
mutex locked without curlwp context (basically all mutexes inited
outside of mutex_init()). The only thing that called rumpuser_mutex_held()
for a non-kmutex was the giant lock. So, instead implement recursive
locking for the giant lock in the rump kernel and get rid of the
now-unused recursive pthread mutex in the hypercall interface.
 1.2 18-May-2010  pooka branches: 1.2.2; 1.2.4; 1.2.6;
Namespace rump-only kernel biglock routines appropriately.

No functional change.
 1.1 18-May-2010  pooka Move routines related to kernel locking and scheduling from
locks.c to klock.c.

No functional change.
 1.2.6.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.2.6.1 18-May-2010  uebayasi file klock.c was added on branch uebayasi-xip on 2010-08-17 06:48:01 +0000
 1.2.4.2 11-Aug-2010  yamt sync with head.
 1.2.4.1 18-May-2010  yamt file klock.c was added on branch yamt-nfs-mp on 2010-08-11 22:55:06 +0000
 1.2.2.3 05-Mar-2011  rmind sync with head
 1.2.2.2 30-May-2010  rmind sync with head
 1.2.2.1 18-May-2010  rmind file klock.c was added on branch rmind-uvmplock on 2010-05-30 05:18:06 +0000
 1.3.20.1 18-Jun-2014  msaitoh Pull up following revision(s) (requested by bouyer in ticket #1067):
sys/dist/ipf/netinet/ip_fil_netbsd.c 1.9 via patch
sys/net/if_ethersubr.c 1.197 via patch
sys/net/if_loop.c 1.77 via patch
sys/net/if_vlan.c 1.70 via patch
sys/netinet/if_arp.c 1.158
sys/netinet/ip_carp.c 1.54 via patch
sys/netinet6/ip6_flow.c 1.23 via patch
sys/netinet6/nd6.c 1.150 via patch
sys/rump/librump/rumpkern/klock.c 1.4

Make sure *(if_output)() is called with KERNEL_LOCK held to avoid mbuf leak.
See http://mail-index.netbsd.org/tech-net/2014/04/09/msg004511.html
for details. For netinet6, the problem report, fix and test were done
by njoly@ on current-users@
 1.3.18.1 18-Jun-2014  msaitoh Pull up following revision(s) (requested by bouyer in ticket #1067):
sys/dist/ipf/netinet/ip_fil_netbsd.c 1.9 via patch
sys/net/if_ethersubr.c 1.197 via patch
sys/net/if_loop.c 1.77 via patch
sys/net/if_vlan.c 1.70 via patch
sys/netinet/if_arp.c 1.158
sys/netinet/ip_carp.c 1.54 via patch
sys/netinet6/ip6_flow.c 1.23 via patch
sys/netinet6/nd6.c 1.150 via patch
sys/rump/librump/rumpkern/klock.c 1.4

Make sure *(if_output)() is called with KERNEL_LOCK held to avoid mbuf leak.
See http://mail-index.netbsd.org/tech-net/2014/04/09/msg004511.html
for details. For netinet6, the problem report, fix and test were done
by njoly@ on current-users@
 1.3.14.1 03-Jun-2014  msaitoh Pull up following revision(s) (requested by bouyer in ticket #1067):
sys/dist/ipf/netinet/ip_fil_netbsd.c 1.9 via patch
sys/net/if_ethersubr.c 1.197 via patch
sys/net/if_loop.c 1.77 via patch
sys/net/if_vlan.c 1.70 via patch
sys/netinet/if_arp.c 1.158
sys/netinet/ip_carp.c 1.54 via patch
sys/netinet6/ip6_flow.c 1.23 via patch
sys/netinet6/nd6.c 1.150 via patch
sys/rump/librump/rumpkern/klock.c 1.4

Make sure *(if_output)() is called with KERNEL_LOCK held to avoid mbuf leak.
See http://mail-index.netbsd.org/tech-net/2014/04/09/msg004511.html
for details. For netinet6, the problem report, fix and test were done
by njoly@ on current-users@
 1.3.12.1 20-Feb-2012  mrg pull across from -current:
>add a _kernel_locked_p().
 1.3.8.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.3.8.2 30-Oct-2012  yamt sync with head
 1.3.8.1 17-Apr-2012  yamt sync with head
 1.4.2.3 03-Dec-2017  jdolecek update from HEAD
 1.4.2.2 23-Jun-2013  tls resync from head
 1.4.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.8.12.2 09-Jul-2016  skrll Sync with HEAD
 1.8.12.1 19-Mar-2016  skrll Sync with HEAD
 1.3 20-Feb-2020  joerg The global offset table is spelled .TOC. on PPC64, so preserve that symbol.
 1.2 25-Apr-2014  pooka branches: 1.2.28; 1.2.34;
gardenize: function calls over #ifdefs
 1.1 26-Apr-2010  pooka branches: 1.1.2; 1.1.4; 1.1.6; 1.1.14; 1.1.24; 1.1.28; 1.1.38;
Implement kobj_renamespace() for rump. Support for a few archs is
missing, but that doesn't really matter, since they are living in
their own "everything is a macro" happyland and don't support the
native kernel ABI anyway.
 1.1.38.1 10-Aug-2014  tls Rebase.
 1.1.28.1 18-May-2014  rmind sync with head
 1.1.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.14.1 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.1.6.2 11-Aug-2010  yamt sync with head.
 1.1.6.1 26-Apr-2010  yamt file kobj_rename.c was added on branch yamt-nfs-mp on 2010-08-11 22:55:06 +0000
 1.1.4.2 30-May-2010  rmind sync with head
 1.1.4.1 26-Apr-2010  rmind file kobj_rename.c was added on branch rmind-uvmplock on 2010-05-30 05:18:06 +0000
 1.1.2.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.2.1 26-Apr-2010  uebayasi file kobj_rename.c was added on branch uebayasi-xip on 2010-04-30 14:44:30 +0000
 1.2.34.1 29-Feb-2020  ad Sync with head.
 1.2.28.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3 12-Feb-2014  pooka Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.2 01-Jan-2009  pooka branches: 1.2.2; 1.2.4; 1.2.8; 1.2.20; 1.2.30; 1.2.34;
fix format
 1.1 01-Jan-2009  pooka missed cvs add in previous commit:

Define MODULAR for rump core components. This enables module
loading via the kernel module framework (instead of dlopen()).
For now it only works on amd64 and i386, but for the rest it should
just be a matter of including the relevant kobj_machdep.c modules
from the kernel sources.
 1.2.34.1 18-May-2014  rmind sync with head
 1.2.30.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.20.1 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.2.8.2 04-May-2009  yamt sync with head.
 1.2.8.1 01-Jan-2009  yamt file kobj_stubs.c was added on branch yamt-nfs-mp on 2009-05-04 08:14:29 +0000
 1.2.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.4.1 01-Jan-2009  skrll file kobj_stubs.c was added on branch nick-hppapmap on 2009-01-19 13:20:25 +0000
 1.2.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.1 01-Jan-2009  mjf file kobj_stubs.c was added on branch mjf-devfs2 on 2009-01-17 13:29:36 +0000
 1.4 31-Oct-2007  pooka Make it possible to run rumps multithreaded. This brings real
locking and makes it possible to run file systems which create
threads. It also makes rump file system behaviour better match
file system behaviour in the kernel.
 1.3 11-Oct-2007  ad branches: 1.3.2;
Merge from vmlocking:

- G/C spinlockmgr() and simple_lock debugging.
- Always include the kernel_lock functions, for LKMs.
- Slightly improved subr_lockdebug code.
- Keep sizeof(struct lock) the same if LOCKDEBUG.
 1.2 10-Oct-2007  ad transferlockers() is gone.
 1.1 26-Aug-2007  pooka branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.10;
split implemented lock stuff out of lock_stub.c into lock.c
 1.1.10.2 09-Oct-2007  ad Sync with head.
 1.1.10.1 26-Aug-2007  ad file lock.c was added on branch vmlocking on 2007-10-09 13:45:04 +0000
 1.1.8.1 14-Oct-2007  yamt sync with head.
 1.1.6.4 15-Nov-2007  yamt sync with head.
 1.1.6.3 27-Oct-2007  yamt sync with head.
 1.1.6.2 03-Sep-2007  yamt sync with head.
 1.1.6.1 26-Aug-2007  yamt file lock.c was added on branch yamt-lazymbuf on 2007-09-03 14:45:29 +0000
 1.1.4.2 03-Sep-2007  skrll Sync with HEAD.
 1.1.4.1 26-Aug-2007  skrll file lock.c was added on branch nick-csl-alignment on 2007-09-03 10:23:55 +0000
 1.1.2.1 06-Nov-2007  matt sync with HEAD
 1.3.2.1 13-Nov-2007  bouyer Sync with HEAD
 1.10 31-Oct-2007  pooka Make it possible to run rumps multithreaded. This brings real
locking and makes it possible to run file systems which create
threads. It also makes rump file system behaviour better match
file system behaviour in the kernel.
 1.9 22-Sep-2007  pooka branches: 1.9.4;
add rw_tryenter() and rw_lock_held(), inspired by Adam Hamsik
 1.8 26-Aug-2007  pooka branches: 1.8.2; 1.8.4;
split implemented lock stuff out of lock_stub.c into lock.c
 1.7 26-Aug-2007  pooka very rudimentary recursive lock support
 1.6 16-Aug-2007  pooka branches: 1.6.2;
tweaks
 1.5 12-Aug-2007  pooka branches: 1.5.2;
track lockmgr lock status. makes lfs work again
 1.4 09-Aug-2007  pooka fool some KASSERTs
 1.3 09-Aug-2007  pooka Add some stubs for lfs.
 1.2 07-Aug-2007  pooka mutex_pwned - needed for kassert
 1.1 05-Aug-2007  pooka branches: 1.1.2;
Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.2 05-Aug-2007  pooka Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.1 05-Aug-2007  pooka file lock_stub.c was added on branch matt-mips64 on 2007-08-05 22:28:09 +0000
 1.5.2.3 03-Sep-2007  skrll Sync with HEAD.
 1.5.2.2 15-Aug-2007  skrll Sync with HEAD.
 1.5.2.1 12-Aug-2007  skrll file lock_stub.c was added on branch nick-csl-alignment on 2007-08-15 13:50:38 +0000
 1.6.2.3 09-Oct-2007  ad Sync with head.
 1.6.2.2 20-Aug-2007  ad Sync with HEAD.
 1.6.2.1 16-Aug-2007  ad file lock_stub.c was added on branch vmlocking on 2007-08-20 22:07:28 +0000
 1.8.4.4 15-Nov-2007  yamt sync with head.
 1.8.4.3 27-Oct-2007  yamt sync with head.
 1.8.4.2 03-Sep-2007  yamt sync with head.
 1.8.4.1 26-Aug-2007  yamt file lock_stub.c was added on branch yamt-lazymbuf on 2007-09-03 14:45:30 +0000
 1.8.2.1 06-Nov-2007  matt sync with HEAD
 1.9.4.1 13-Nov-2007  bouyer Sync with HEAD
 1.88 02-Nov-2023  martin Back out the following revisions on behalf of core:

sys/sys/lwp.h: revision 1.228
sys/sys/pipe.h: revision 1.40
sys/kern/uipc_socket.c: revision 1.306
sys/kern/kern_sleepq.c: revision 1.84
sys/rump/librump/rumpkern/locks_up.c: revision 1.13
sys/kern/sys_pipe.c: revision 1.165
usr.bin/fstat/fstat.c: revision 1.119
sys/rump/librump/rumpkern/locks.c: revision 1.87
sys/ddb/db_xxx.c: revision 1.78
sys/ddb/db_command.c: revision 1.187
sys/sys/condvar.h: revision 1.18
sys/ddb/db_interface.h: revision 1.42
sys/sys/socketvar.h: revision 1.166
sys/kern/uipc_syscalls.c: revision 1.209
sys/kern/kern_condvar.c: revision 1.60

Add cv_fdrestart() [...]
Use cv_fdrestart() to implement fo_restart.
Simplify/streamline pipes a little bit [...]

This changes have caused regressions and need to be debugged.
The cv_fdrestart() addition needs more discussion.
 1.87 13-Oct-2023  ad Add cv_fdrestart() (better name suggestions welcome):

Like cv_broadcast(), but make any LWPs that share the same file descriptor
table as the caller return ERESTART when resuming. Used to dislodge LWPs
waiting for I/O that prevent a file descriptor from being closed, without
upsetting access to the file (not descriptor) made from another direction.
 1.86 16-Jul-2023  riastradh rump: Fix comment to reflect l_private -> l_sched.info.

Comment was misspelled `l->private', hence didn't come up in grep.
 1.85 16-Jul-2023  riastradh rump: Use l_sched.info, not l_private, for cv waits.

- l_sched is scheduler-private, used only by sched_m2.c, should be safe
- l_private is lwp-private, used by tls in user threads, would like to
reuse for kthreads too
 1.84 12-Apr-2023  riastradh kern: Nix mutex_owner.

There is no valid reason to use this except in assertions of the form

KASSERT(mutex_owner(lock) == curlwp),

which is more obviously spelled as

KASSERT(mutex_owned(lock)).

Exception: There's one horrible kludge in zfs that abuses this, which
should be eliminated.

XXX kernel revbump -- deleting symbol

PR kern/47114
 1.83 26-Oct-2022  riastradh rwlock(9): Nix extern _rw_init in .c; use sys/rwlock.h.
 1.82 26-Oct-2022  riastradh mutex(9): Properly declare _mutex_init in sys/mutex.h.
 1.81 22-Feb-2020  ad rump rw_lock_op
 1.80 05-Feb-2018  ozaki-r branches: 1.80.4; 1.80.10;
Obtain proper initialized addresses of locks allocated by mutex_obj_alloc or rw_obj_alloc

Initialized addresses of locks allocated by mutex_obj_alloc or rw_obj_alloc
were not useful because the addresses were mutex_obj_alloc or rw_obj_alloc
itself. What we want to know are callers of them.

(forgot to commit)
 1.79 27-Dec-2017  ozaki-r rump: check if the mutex is surely owned by the caller in mutex_exit

Unlocking a not-owned mutex wasn't detected well (it could detect if the mutex
is not held by anyone but that's not enough). Let's check it (the check is the
same as normal kernel's mutex).

If LOCKDEBUG is enabled, give the check over LOCKDEBUG because it can provide
better debugging information.
 1.78 27-Dec-2017  ozaki-r Distinguish spin mutex and adaptive mutex on rump kernels for LOCKDEBUG

Formerly rump kernels treated the two types of mutexes as both adaptive for
LOCKDEBUG for some reasons.

Now we can detect violations of mutex restrictions on rump kernels such as
taking an adaptive mutex with holding a spin mutex as well as normal kernels.
 1.77 27-Dec-2017  ozaki-r Tweak LOCKDEBUG macros (NFC)
 1.76 25-Dec-2017  ozaki-r Apply C99-style struct initialization to lockops_t
 1.75 17-Sep-2017  kre As if rump wasn't constipated enough...

Add some more blockages, hopefully allow the build to find a
path all the way to the other end...
 1.74 01-May-2017  pgoyette branches: 1.74.2;
Introduce mutex_ownable() to determine if it is possible for the current
process to acquire a mutex.
 1.73 27-Jan-2017  ozaki-r branches: 1.73.4;
Unbreak builds of rump libraries with RUMP_LOCKDEBUG
 1.72 26-Jan-2016  pooka branches: 1.72.2; 1.72.4;
Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.71 30-Sep-2015  ozaki-r Add lockdebug_barrier

ok pooka@
 1.70 30-Sep-2015  ozaki-r Remove redundant UNLOCKED and LOCKED

UNLOCKED and LOCKED are done inside mutex_exit and mutex_enter respectively
so we don't need to do them outside mutex_exit and mutex_enter.

Reviewed by pooka@
 1.69 25-Apr-2014  pooka branches: 1.69.4;
gardenizing rump.c: move rump_lockdebug to locks.c
 1.68 11-Mar-2014  pooka branches: 1.68.2;
Put the syncobjs in emul.c instead of locks.c so that they are
present for both locks.c and locks_up.c alike.
 1.67 09-Dec-2013  pooka make !LOCKDEBUG work too
 1.66 09-Dec-2013  pooka Support ktrace for rump kernels.

Requested by Justin Cormack on rumpkernel-users.
 1.65 03-Jul-2013  njoly Make RUMP_LOCKDEBUG work again.
With some help from pooka@.
 1.64 15-May-2013  pooka branches: 1.64.2;
Pass enums over the hypercall interface as ints to avoid some
pathological scenarios from arising in setups where enums might be
of a different size in the rump kernel and hypervisor.
 1.63 02-May-2013  pooka Push rwlock upgrade and downgrade into the hypervisor where there's
at least a chance to implement them with minimal fuss.
 1.62 02-May-2013  pooka g/c stale comment
 1.61 02-May-2013  pooka Retry enabling spin mutexes. We should be able to avoid poking the
scheduler by just making wakeup from cv_wait() honor the same locking
order as when a spin mutex is acquired though mutex_enter().
*fingers crossed*
 1.60 30-Apr-2013  pooka Make hypercall calling conventions consistent: iff a hypercall can fail,
it returns an int containing the error value.
 1.59 29-Apr-2013  pooka Disable spin mutexes for now. They need some more work in the case
where a spin mutex is used as an argument to cv_wait(). Plus, it
would be good to sprinkle some asserts to make sure that the cpu
context is not released while holding on to a spin mutex. All in
all, should not be difficult, but needs careful testing and bravery
(the scheduler will bite your legs off).
 1.58 28-Apr-2013  pooka Change rumpuser_cv_timedwait() from absolute time to relative time.
It's then the hypervisor's problem to translate it accordingly.
Now we no longer have to worry about the kernel having to know the
hypervisor's time and vice versa.
 1.57 27-Apr-2013  pooka roll mutex init hypercalls into one (one of them already took a flag anyway)
 1.56 27-Apr-2013  pooka Try to make sure that the appropriate calls to mutex_enter() takes
a spin mutex (i.e. does not relinquish cpu context while trying to
take the mutex).

Bump the hypercall interface version number. I'll be doing a bunch
of other cleanups to simplify the interface for the benefit of
alternative hypervisor implementations. I'll be riding this bump
and doing a second one only after I'm finished with all of the
changes.
 1.55 06-Dec-2011  njoly branches: 1.55.6;
Do not protect wrong KASSERT by LOCKEDBUG ifdef/endif, the latter uses
its own mecanism. Kill them both.
From discussion with pooka@.
 1.54 21-Mar-2011  pooka branches: 1.54.4; 1.54.8;
Update copyright statements.

no functional change.
 1.53 09-Mar-2011  pooka track lockdebug data even in the special path
 1.52 09-Mar-2011  pooka Mark cv_wait mutex as locked before doing any further dances.
Fixes a LOCKDEBUG panic in case the uncommon condition is hit.
 1.51 08-Mar-2011  pooka Nuke all threads belonging to a process calling exec before allowing
the exec handshake to return.

In addition to being The Right Thing To Do, fixes some nasty
conditions for CLOEXEC fd's (or at least does so in theory, I
couldn't create any problems although I tried).
 1.50 28-Jan-2011  pooka If we are "unsleepable" due to a dying proc, yield() instead of
returning directly. This allows other threads to run possible
setting a condition we are waiting on.

Fixes a busyloop condition which could be entered from vfs_unmountall()
where we were waiting for vrele_pending and the vrele thread could
not run since we were hogging the CPU.
 1.49 28-Jan-2011  pooka Some lwp-walkers expect the correct value for l_stat, so use a flag
in l_flag instead of l_stat for the purpose of flagging lwps in a
dying proc.
 1.48 18-Jan-2011  haad branches: 1.48.2;
Add support for compiling ZFS and Solaris modules as RUMP libraries. Add
some locking and rumpcopy primitives and refactor module building Makefiles
to work with both RUMP and kernel modules. This is first part of adding
support for regular test of zfs on NetBSD to hunt some bugs and make it
stable.

Ok by pooka@.
 1.47 12-Jan-2011  pooka branches: 1.47.2;
When the client and the rump kernel are the same host process, all
threads blocking in the kernel automatically exit when the process
exists. However, for the sysproxy case this does not hold.
Typically it's ~harmless, but e.g. in the case of socket binding
following by poll it gets annoying.

Introduce sysproxy procexit, which wakes up all threads blocking
on a condition when a process's communication socket is closed.
The code is a little different from the regular kernel simply
because in a rump kernel l_mutex is not available at all times
(this is because scheduling happens on every kernel entry and exit,
and that path must be kept lockless for any reasonable performance).
Instead, use gating which makes sure all threads are either out of
the cv code or suspended in a well-known state. Then, wake up the
threads and tell them to get the hell out of our galaxy.
 1.46 06-Jan-2011  pooka antipasto
 1.45 06-Jan-2011  pooka Support LOCKDEBUG. To use it, compile sys/rump with RUMP_LOCKDEBUG=yes.

requested by martin (sparc64 gdb cannot reliably produce a stack trace)
 1.44 01-Dec-2010  pooka implement mutex_owner()
 1.43 01-Dec-2010  pooka Track lwp as the rumpuser mutex owner instead of pthread_t (this
is done in rumpuser for simplicity, since on the kernel side things
we assume we have only one pointer of space). As a side-effect,
we can no longer know if the current thread is holding on to a
mutex locked without curlwp context (basically all mutexes inited
outside of mutex_init()). The only thing that called rumpuser_mutex_held()
for a non-kmutex was the giant lock. So, instead implement recursive
locking for the giant lock in the rump kernel and get rid of the
now-unused recursive pthread mutex in the hypercall interface.
 1.42 09-Jun-2010  pooka Similarly to cv_wait, fail if trying to cv_wait_sig() without threads.
 1.41 18-May-2010  pooka Move routines related to kernel locking and scheduling from
locks.c to klock.c.

No functional change.
 1.40 18-May-2010  pooka Make it possible to use the scheduler lock as the rumpuser condvar
interlock. This is applicable in cases where the actual interlock
is the CPU the currently running thread is scheduled on. Borrowing
the scheduler lock as the mutex mandated by pthread_cond_wait()
does away with need to have an additional mutex. This both optimizes
runtime execution and simplifies code, as the extra lock typically
lead to quite some trickeries to avoid the dungeon collapsing due
to zaps from the wand of deadlock.
 1.39 14-Apr-2010  pooka Add comment about clock mismatch.
 1.38 31-Jan-2010  snj branches: 1.38.2; 1.38.4;
Some might argue that it is benefi_c_ial to spell words correctly.
 1.37 03-Dec-2009  pooka Remove last remnants of the long-ago-properly-fixed RUMP_LMUTEX_MAGIC hack.
 1.36 01-Dec-2009  pooka Almost there for virtual CPU MP support:
* support bound kernel threads
* bind softint threads to specific virtual cpus
+ remove now-unnecessary locks from softint code

Now, if we only had MI CPU_INFO_FOREACH() .... (hi rmind ;)
 1.35 26-Nov-2009  pooka Provide some sort of cv_is_valid(). What a silly routine.
 1.34 11-Nov-2009  pooka Make rumpuser_cv_timedwait take two int64's instead timespec to
uncouple it from the timespec layout. Also, change return value
to zero for "timeout didn't expire" and non-zero for "timeout
expired". This decouples the interface from errno assignments.
 1.33 04-Nov-2009  pooka Use kern_mutex_obj.c directly instead of copypasting code.
 1.32 16-Oct-2009  pooka Include sys_select.c for proper select()/poll() support.
 1.31 15-Oct-2009  pooka When allocating the temporary lwp we must have an lwp context. So
take turns using lwp0 for this purpose, nothing else uses it.
 1.30 15-Oct-2009  pooka Give lwp usage some much-needed love: stop treating lwp0 as the
all-sink and make sure each separate thread in rump has its own
lwp. Happy-go-lucky callers will get scheduled a temporary lwp
on entry, while true lwp connoisseurs may request a stable lwp
for their purposes. Some more love may be required later down the
road, but for now different threads will stepping on each others
toes.
 1.29 15-Oct-2009  pooka Add initial work on a rump virtual cpu scheduler. This is necessary
for kernel code which has been written to avoid MP contention by
using cpu-local storage (most prominently, select and pool_cache).

Instead of always assuming rump_cpu, the scheduler must now be run
(and unrun) on all entry points into rump. Likewise, rumpuser
unruns and re-runs the scheduler around each potentially blocking
operation. As an optimization, I modified some locking primitives
to try to get the lock without blocking before releasing the cpu.

Also, ltsleep was modified to assume that it is never called without
the biglock held and made to use the biglock as the sleep interlock.
Otherwise there is just too much drama with deadlocks. If some
kernel code wants to call ltsleep without the biglock, then, *snif*,
it's no longer supported and rump and should be modified to support
newstyle locks anyway.
 1.28 02-Oct-2009  pooka panic if cv_wait() is called in non-threaded mode
 1.27 07-Feb-2009  pooka Make the clock interrupt tick based on absolute time instead of
relative time. This prevents drifting. Also, keep track of time
within userspace, so we do not have to make a syscall to get the
clock value. This is approximately 7 times cheaper, but on the
negative side is limited to the clock interrupt frequency.
 1.26 13-Jan-2009  pooka misc cleanup, mainly header polish
 1.25 19-Dec-2008  pooka CTASSERT kcondvar size
 1.24 19-Dec-2008  pooka fix build

(hi thorpej! the first one is always free ;)
 1.23 18-Dec-2008  pooka __KERNEL_RCSID
 1.22 13-Dec-2008  pooka Get rid of local machine/{mutex,rwlock}.h files by treating the
object storage as a single pointer (all archs have at least one
uintptr_t in the objects).
 1.21 10-Dec-2008  pooka Make kernel biglock recursecount volatile.
 1.20 10-Oct-2008  pooka branches: 1.20.2;
Support callouts and call callout_hardclock() from the timer
interrupt thread.

The sleepq implementation required for callouts is horrible, kludged
only for callouts, and generally unacceptable. It needs revisiting,
but I'm not sure yet should rump or kern_timeout be improved. It's
almost untested as of now, but committing this will give me some
maneuvering space while letting application compile.
 1.19 09-Oct-2008  pooka Rewrite kernel lockus maximus handling to be correct.
 1.18 29-Jul-2008  pooka Install rump libraries and utilities to the base system and remove the
private non-installed build infrastructure from sys/rump.

breakdown of commit:
* install relevant headers into /usr/include/rump
* build sys/rump/librump/rumpuser and sys/rump/librump/rumpkern
from src/lib and install as librumpuser and librump, respectively
+ this retains the ability to test a librump build with just the
kernel sources at hand
* move sys/rump/fs/lib/libukfs and sys/rump/fs/lib/libp2k to src/lib
for general consumption, they are not kernel-space dwellers anyway
* build and install sys/rump/fs/lib/lib$fs as librumpfs_$fs
* add chapter 3 manual pages for rump, rumpuser, ukfs and p2k
* build and install userspace kernel file system daemons if MKPUFFS=yes
is spexified
* retire fsconsole for now, it will make a comeback with an actually
implemented version shortly
 1.17 18-Jul-2008  pooka support cv_has_waiters()
 1.16 31-May-2008  ad branches: 1.16.2; 1.16.4;
Turn off DIAGNOSTIC so it builds.
 1.15 28-Apr-2008  martin branches: 1.15.2;
Remove clause 3 and 4 from TNF licenses
 1.14 11-Apr-2008  ad branches: 1.14.2; 1.14.4;
More stubs.
 1.13 01-Apr-2008  drochner remove useless passing of the lwp from the KERNEL_LOCK() ABI
(not the API; this would be easy as well)
agreed (a while ago) by ad
 1.12 11-Mar-2008  pooka Backup some fixes for recent breakage from local tree. Also some
other improvements such as exporting the real kernel namei and
using that in ukfs instead of the homegrown heap'o hacks namei.
"etcetc".
 1.11 30-Jan-2008  ad branches: 1.11.2; 1.11.6;
Fix pasto. Spotted by pooka@
 1.10 30-Jan-2008  ad Replace struct lock on vnodes with a simpler lock object built on
krwlock_t. This is a step towards removing lockmgr and simplifying
vnode locking. Discussed on tech-kern.
 1.9 21-Jan-2008  pooka In case cv_timedwait() gets ticks == 0, make sure we sleep eternally
(or at least until wakeup) instead of immediately waking up.

In other words, fix this after it broke when another piece of the
code was fixed. Ain't programming fun?
 1.8 02-Jan-2008  ad Fix merge error.
 1.7 02-Jan-2008  ad Merge vmlocking2 to head.
 1.6 01-Jan-2008  pooka emulate a couple more locking interfaces
 1.5 30-Dec-2007  pooka steal 1.4.2.1 from vmlocking2: cv_xwait_sig()
 1.4 19-Nov-2007  pooka branches: 1.4.2; 1.4.6;
support cv_broadcast()
 1.3 17-Nov-2007  pooka Implement cv_timedwait(), requested by Reinoud.
 1.2 07-Nov-2007  pooka branches: 1.2.2; 1.2.4;
implement _kernel_lock{,_unlock}()
 1.1 31-Oct-2007  pooka branches: 1.1.2; 1.1.4; 1.1.6;
Make it possible to run rumps multithreaded. This brings real
locking and makes it possible to run file systems which create
threads. It also makes rump file system behaviour better match
file system behaviour in the kernel.
 1.1.6.5 23-Mar-2008  matt sync with HEAD
 1.1.6.4 09-Jan-2008  matt sync with HEAD
 1.1.6.3 08-Nov-2007  matt sync with -HEAD
 1.1.6.2 06-Nov-2007  matt sync with HEAD
 1.1.6.1 31-Oct-2007  matt file locks.c was added on branch matt-armv6 on 2007-11-06 23:34:36 +0000
 1.1.4.3 18-Feb-2008  mjf Sync with HEAD.
 1.1.4.2 08-Dec-2007  mjf Sync with HEAD.
 1.1.4.1 19-Nov-2007  mjf Sync with HEAD.
 1.1.2.4 21-Nov-2007  joerg Sync with HEAD.
 1.1.2.3 11-Nov-2007  joerg Sync with HEAD.
 1.1.2.2 31-Oct-2007  joerg Sync with HEAD.
 1.1.2.1 31-Oct-2007  joerg file locks.c was added on branch jmcneill-pm on 2007-10-31 23:14:16 +0000
 1.2.4.6 17-Mar-2008  yamt sync with head.
 1.2.4.5 04-Feb-2008  yamt sync with head.
 1.2.4.4 21-Jan-2008  yamt sync with head
 1.2.4.3 07-Dec-2007  yamt sync with head
 1.2.4.2 15-Nov-2007  yamt sync with head.
 1.2.4.1 07-Nov-2007  yamt file locks.c was added on branch yamt-lazymbuf on 2007-11-15 11:45:26 +0000
 1.2.2.4 21-Nov-2007  bouyer Sync with HEAD
 1.2.2.3 18-Nov-2007  bouyer Sync with HEAD
 1.2.2.2 13-Nov-2007  bouyer Sync with HEAD
 1.2.2.1 07-Nov-2007  bouyer file locks.c was added on branch bouyer-xenamd64 on 2007-11-13 16:03:14 +0000
 1.4.6.2 23-Jan-2008  bouyer Sync with HEAD.
 1.4.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.4.2.1 28-Dec-2007  ad Make rump build.
 1.11.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.11.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.11.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.11.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.11.2.1 24-Mar-2008  keiichi sync with head.
 1.14.4.4 11-Aug-2010  yamt sync with head.
 1.14.4.3 11-Mar-2010  yamt sync with head
 1.14.4.2 04-May-2009  yamt sync with head.
 1.14.4.1 16-May-2008  yamt sync with head.
 1.14.2.2 04-Jun-2008  yamt sync with head
 1.14.2.1 18-May-2008  yamt sync with head.
 1.15.2.3 10-Oct-2008  skrll Sync with HEAD.
 1.15.2.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.15.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.16.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.16.4.1 19-Oct-2008  haad Sync with HEAD.
 1.16.2.2 31-Jul-2008  simonb Sync with head.
 1.16.2.1 21-Jul-2008  simonb Sync with head.
 1.20.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.20.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.38.4.4 21-Apr-2011  rmind sync with head
 1.38.4.3 05-Mar-2011  rmind sync with head
 1.38.4.2 03-Jul-2010  rmind sync with head
 1.38.4.1 30-May-2010  rmind sync with head
 1.38.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.38.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.47.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.48.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.54.8.1 18-Feb-2012  mrg merge to -current.
 1.54.4.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.54.4.1 17-Apr-2012  yamt sync with head
 1.55.6.3 03-Dec-2017  jdolecek update from HEAD
 1.55.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.55.6.1 23-Jun-2013  tls resync from head
 1.64.2.2 18-May-2014  rmind sync with head
 1.64.2.1 28-Aug-2013  rmind sync with head
 1.68.2.1 10-Aug-2014  tls Rebase.
 1.69.4.4 28-Aug-2017  skrll Sync with HEAD
 1.69.4.3 05-Feb-2017  skrll Sync with HEAD
 1.69.4.2 19-Mar-2016  skrll Sync with HEAD
 1.69.4.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.72.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.72.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.73.4.3 02-May-2017  pgoyette Sync with HEAD - tag prg-localcount2-base1
 1.73.4.2 30-Apr-2017  pgoyette Use the right conditional to enable/disable LOCKDEBUG within RUMP
 1.73.4.1 30-Apr-2017  pgoyette Introduce mutex_ownable(9) and use it in localcount_release(9).

Commit of same code to head is awaiting discussion on tech-kern.
 1.74.2.2 02-Apr-2018  martin Pull up following revision(s) (requested by ozaki-r in ticket #687):
sys/kern/kern_rwlock_obj.c: revision 1.4
sys/rump/librump/rumpkern/locks.c: revision 1.80
sys/kern/kern_rwlock.c: revision 1.50
sys/arch/x86/x86/db_memrw.c: revision 1.5,1.6
sys/ddb/db_command.c: revision 1.150-1.153
share/man/man4/ddb.4: revision 1.175 (via patch),1.176-1.178
sys/kern/kern_mutex_obj.c: revision 1.6
sys/kern/subr_lockdebug.c: revision 1.61-1.64
sys/sys/lockdebug.h: revision 1.17
sys/kern/kern_mutex.c: revision 1.71
sys/sys/lockdebug.h: revision 1.18,1.19
sys/kern/subr_xcall.c: revision 1.26

Obtain proper initialized addresses of locks allocated by mutex_obj_alloc or rw_obj_alloc

Initialized addresses of locks allocated by mutex_obj_alloc or rw_obj_alloc
were not useful because the addresses were mutex_obj_alloc or rw_obj_alloc
itself. What we want to know are callers of them.

Spinkle ASSERT_SLEEPABLE to xcall functions

Use db_printf instead of printf in ddb

Add a new command, show lockstat, which shows statistics of locks
Currently the command shows the number of allocated locks.
The command is useful only if LOCKDEBUG is enabled.

Add a new command, show all locks, which shows information of active locks

The command shows information of all active (i.e., being held) locks that are
tracked through either of LWPs or CPUs by the LOCKDEBUG facility. The /t
modifier additionally shows a backtrace for each LWP additionally. This
feature is useful for debugging especially to analyze deadlocks.
The command is useful only if LOCKDEBUG is enabled.

Don't pass a unset address to lockdebug_lock_print

x86: avoid accessing invalid addresses in ddb like arm32
This avoids that a command stops in the middle of an execution if
a fault occurs due to an access to an invalid address.

Get rid of a redundant output

Improve wording. Fix a Cm argument.

ddb: rename "show lockstat" to "show lockstats" to avoid conflicting with lockstat(8)
Requested by mrg@
 1.74.2.1 13-Jan-2018  snj Pull up following revision(s) (requested by ozaki-r in ticket #495):
lib/librumpuser/rumpfiber.c: revision 1.13
lib/librumpuser/rumpuser_pth.c: revision 1.46
lib/librumpuser/rumpuser_pth_dummy.c: revision 1.18
sys/kern/kern_condvar.c: revision 1.40
sys/kern/kern_lock.c: revision 1.161
sys/kern/kern_mutex.c: revision 1.68
sys/kern/kern_rwlock.c: revision 1.48
sys/rump/include/rump/rumpuser.h: revision 1.115
sys/rump/librump/rumpkern/locks.c: revision 1.76-1.79
Apply C99-style struct initialization to lockops_t
--
Tweak LOCKDEBUG macros (NFC)
--
Distinguish spin mutex and adaptive mutex on rump kernels for LOCKDEBUG
Formerly rump kernels treated the two types of mutexes as both adaptive for
LOCKDEBUG for some reasons.
Now we can detect violations of mutex restrictions on rump kernels such as
taking an adaptive mutex with holding a spin mutex as well as normal kernels.
--
rump: check if the mutex is surely owned by the caller in mutex_exit
Unlocking a not-owned mutex wasn't detected well (it could detect if the mutex
is not held by anyone but that's not enough). Let's check it (the check is the
same as normal kernel's mutex).
If LOCKDEBUG is enabled, give the check over LOCKDEBUG because it can provide
better debugging information.
 1.80.10.1 29-Feb-2020  ad Sync with head.
 1.80.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.14 02-Nov-2023  martin Back out the following revisions on behalf of core:

sys/sys/lwp.h: revision 1.228
sys/sys/pipe.h: revision 1.40
sys/kern/uipc_socket.c: revision 1.306
sys/kern/kern_sleepq.c: revision 1.84
sys/rump/librump/rumpkern/locks_up.c: revision 1.13
sys/kern/sys_pipe.c: revision 1.165
usr.bin/fstat/fstat.c: revision 1.119
sys/rump/librump/rumpkern/locks.c: revision 1.87
sys/ddb/db_xxx.c: revision 1.78
sys/ddb/db_command.c: revision 1.187
sys/sys/condvar.h: revision 1.18
sys/ddb/db_interface.h: revision 1.42
sys/sys/socketvar.h: revision 1.166
sys/kern/uipc_syscalls.c: revision 1.209
sys/kern/kern_condvar.c: revision 1.60

Add cv_fdrestart() [...]
Use cv_fdrestart() to implement fo_restart.
Simplify/streamline pipes a little bit [...]

This changes have caused regressions and need to be debugged.
The cv_fdrestart() addition needs more discussion.
 1.13 13-Oct-2023  ad Add cv_fdrestart() (better name suggestions welcome):

Like cv_broadcast(), but make any LWPs that share the same file descriptor
table as the caller return ERESTART when resuming. Used to dislodge LWPs
waiting for I/O that prevent a file descriptor from being closed, without
upsetting access to the file (not descriptor) made from another direction.
 1.12 12-Apr-2023  riastradh kern: Nix mutex_owner.

There is no valid reason to use this except in assertions of the form

KASSERT(mutex_owner(lock) == curlwp),

which is more obviously spelled as

KASSERT(mutex_owned(lock)).

Exception: There's one horrible kludge in zfs that abuses this, which
should be eliminated.

XXX kernel revbump -- deleting symbol

PR kern/47114
 1.11 22-Feb-2020  ad rump rw_lock_op
 1.10 26-Jan-2016  pooka branches: 1.10.18; 1.10.24;
Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.9 06-May-2013  pooka branches: 1.9.12;
update for new hypercalls
 1.8 28-Apr-2013  pooka Change rumpuser_cv_timedwait() from absolute time to relative time.
It's then the hypervisor's problem to translate it accordingly.
Now we no longer have to worry about the kernel having to know the
hypervisor's time and vice versa.
 1.7 27-Apr-2013  pooka Try to make sure that the appropriate calls to mutex_enter() takes
a spin mutex (i.e. does not relinquish cpu context while trying to
take the mutex).

Bump the hypercall interface version number. I'll be doing a bunch
of other cleanups to simplify the interface for the benefit of
alternative hypervisor implementations. I'll be riding this bump
and doing a second one only after I'm finished with all of the
changes.
 1.6 28-Apr-2012  stacktic branches: 1.6.2;
Fixed build with locks_up.c
 1.5 01-Dec-2010  pooka branches: 1.5.8; 1.5.12;
implement mutex_owner()
 1.4 14-Jun-2010  pooka branches: 1.4.2; 1.4.4;
Make it possible to define an upper limit for memory consumed by
the rump kernel by specifying RUMP_MEMLIMIT. In case allocation
over that limit is attempted, essentially pool reclaim and uvm_wait()
is done. The default is to allow to allocate as much as the host
will give.

XXX: uvm_km_alloc and malloc(9) do not currently conform. the
former is easy, the latter requires kern_malloc.c (rump malloc is
currently directly relegated to host malloc).
 1.3 03-Jun-2010  pooka Implement a sort-of pagedaemon: adjust all memory allocators to go
through an in-rumpkernel hypermemory allocator which knows it should
kick the pagedaemon and block in case ``waitok'' memory allocation
fails.

This allows us to recover from some out-of-memory situations.
Realworld'istically speaking (as opposed to whatever "should be"
theory), these OOM situations will happen extremely rarely if ever
when our hypervisor is a regular process. Speculatively, this
should be useful for other types of hosts.

issues remaining:
* the hypervisor does not know how to reclaim kernel memory (and
for the reason I stated above, I'm not sure if it makes sense
to teach the current implementation about that)
* vfs memory (buffers, vm object pages etc.) is not reclaimed
 1.2 01-Jun-2010  pooka Don't pass "canfail" down to rumpuser_malloc -- there's quite little
we can do with that info way down there. Instead, pass alignment.
Implement rumpuser_malloc() with posix_memalign().
 1.1 18-May-2010  pooka branches: 1.1.2;
Add uniprocessor versions of mutex/rw/cv. They work only on virtual
unicpu configurations (i.e. RUMP_NCPU==1), but are massively faster
than the multiprocessor versions since the fast path does not have
to perform any cache coherent operations. _Applications_ with
lock-happy kernel paths, i.e. _not_ lock microbenchmarks, measure
up to tens of percents speedup on my Core2 Duo. Every globally
atomic state required by normal locks/atomic ops implies a hideous
speed penalty even for the fast path.

While this requires a unicpu configuration, it should be noted that
we are talking about a virtual unicpu configuration. The host can
have as many processors as it desires, and the speed benefit of
virtual unicpu is still there. It's pretty obvious that in terms
of scalability simple workload partitioning and replication into
multiple kernels wins hands down over complicated locking or
locklessing algorithms which depend on globally atomic state.
 1.1.2.4 05-Mar-2011  rmind sync with head
 1.1.2.3 03-Jul-2010  rmind sync with head
 1.1.2.2 30-May-2010  rmind sync with head
 1.1.2.1 18-May-2010  rmind file locks_up.c was added on branch rmind-uvmplock on 2010-05-30 05:18:06 +0000
 1.4.4.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.4.4.1 14-Jun-2010  uebayasi file locks_up.c was added on branch uebayasi-xip on 2010-08-17 06:48:01 +0000
 1.4.2.2 11-Aug-2010  yamt sync with head.
 1.4.2.1 14-Jun-2010  yamt file locks_up.c was added on branch yamt-nfs-mp on 2010-08-11 22:55:06 +0000
 1.5.12.1 29-Apr-2012  mrg sync to latest -current.
 1.5.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.5.8.1 23-May-2012  yamt sync with head.
 1.6.2.2 03-Dec-2017  jdolecek update from HEAD
 1.6.2.1 23-Jun-2013  tls resync from head
 1.9.12.1 19-Mar-2016  skrll Sync with HEAD
 1.10.24.1 29-Feb-2020  ad Sync with head.
 1.10.18.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.36 14-Mar-2020  ad Make page waits (WANTED vs BUSY) interlocked by pg->interlock. Gets RW
locks out of the equation for sleep/wakeup, and allows observing+waiting
for busy pages when holding only a read lock. Proposed on tech-kern.
 1.35 23-Feb-2020  ad UVM locking changes, proposed on tech-kern:

- Change the lock on uvm_object, vm_amap and vm_anon to be a RW lock.
- Break v_interlock and vmobjlock apart. v_interlock remains a mutex.
- Do partial PV list locking in the x86 pmap. Others to follow later.
 1.34 26-Jan-2016  pooka branches: 1.34.18; 1.34.24;
Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.33 15-May-2013  pooka branches: 1.33.10;
how did that extra asterisk get there?
 1.32 15-May-2013  pooka qlock can now be a regular kernel spin mutex instead of a rumpuser mutex.
 1.31 28-Apr-2013  pooka Change rumpuser_cv_timedwait() from absolute time to relative time.
It's then the hypervisor's problem to translate it accordingly.
Now we no longer have to worry about the kernel having to know the
hypervisor's time and vice versa.
 1.30 27-Apr-2013  pooka roll mutex init hypercalls into one (one of them already took a flag anyway)
 1.29 28-Jan-2012  rmind branches: 1.29.6;
Remove obsolete ltsleep(9) and wakeup_one(9).
 1.28 01-Dec-2010  pooka branches: 1.28.8; 1.28.12;
Track lwp as the rumpuser mutex owner instead of pthread_t (this
is done in rumpuser for simplicity, since on the kernel side things
we assume we have only one pointer of space). As a side-effect,
we can no longer know if the current thread is holding on to a
mutex locked without curlwp context (basically all mutexes inited
outside of mutex_init()). The only thing that called rumpuser_mutex_held()
for a non-kmutex was the giant lock. So, instead implement recursive
locking for the giant lock in the rump kernel and get rid of the
now-unused recursive pthread mutex in the hypercall interface.
 1.27 31-May-2010  pooka Support mtsleep() without a biglocked sleeper (uvm uses this in
UVM_UNLOCK_AND_WAIT())
 1.26 18-May-2010  pooka Namespace rump-only kernel biglock routines appropriately.

No functional change.
 1.25 20-Dec-2009  pooka branches: 1.25.2; 1.25.4;
add comment about prospective perils to previous
 1.24 20-Dec-2009  pooka pthread_cond_timedwait (and therefore rumpuser_cv_timedwait) wants
an absolute time instead of a delta. Fix bug which caused timed
tsleeps to always wake up immediately (unless the system clock was
around "0", which was not very probable ;).
 1.23 05-Dec-2009  pooka Cast Oh Kath Ra once every second.
 1.22 05-Dec-2009  pooka Remove now-empty rump_sleepers_init()
 1.21 11-Nov-2009  pooka set return value properly
 1.20 11-Nov-2009  pooka support timeouts in tsleep
 1.19 15-Oct-2009  pooka Add initial work on a rump virtual cpu scheduler. This is necessary
for kernel code which has been written to avoid MP contention by
using cpu-local storage (most prominently, select and pool_cache).

Instead of always assuming rump_cpu, the scheduler must now be run
(and unrun) on all entry points into rump. Likewise, rumpuser
unruns and re-runs the scheduler around each potentially blocking
operation. As an optimization, I modified some locking primitives
to try to get the lock without blocking before releasing the cpu.

Also, ltsleep was modified to assume that it is never called without
the biglock held and made to use the biglock as the sleep interlock.
Otherwise there is just too much drama with deadlocks. If some
kernel code wants to call ltsleep without the biglock, then, *snif*,
it's no longer supported and rump and should be modified to support
newstyle locks anyway.
 1.18 04-Oct-2009  pooka Fix hopefully the last deadlock in the wretched piece of code:
since ltsleep abuses "while (!mutex_tryenter()) continue;" for NOT
releasing the kernel biglock before sleeping, we cannot do a normal
mutex_enter() in the wakeup path, or otherwise we might be a
situation where the sleeper holds the kernel lock and wants the
sleepermutex (and will not back down) and the wakeupper holds the
sleepermutex and wants the kernel lock. So introduce kernel lock
backdown to the wakeup path.
 1.17 04-Sep-2009  pooka brace policy. no functional change.
 1.16 04-Sep-2009  pooka Actually, we cannot release the megalock before we take sleepermtx,
since that opens a race window for non-mpsafe code, so do it after.
Additionally, we cannot call mutex_enter() for sleepermtx, since
ltsleep/mtsleep should not block (i.e. release kernel lock) before
actually blocking, so busyloop in mutex_tryenter(). Finally, when
waking up, take kernel lock back only *after* releasing sleepermtx
to avoid deadlock against another thread holding the kernel lock
and wanting sleepermtx.
 1.15 04-Sep-2009  pooka * wrap tsleep functions to drop die grosslock since we're going to
sleep anyway in a few flicks from the clock
* broadcast instead of signal in wakeup()
 1.14 09-Jun-2009  pooka check that interlock isn't null before releasing it
 1.13 09-Jun-2009  pooka simplelocks have been supported in rump for a while, allow their use.
 1.12 03-Jun-2009  pooka implement wakeup_one
 1.11 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.10 06-Feb-2009  pooka branches: 1.10.2;
Rip out the rwlock spl emulation code. It never did anything useful
except keep my feet warm by consuming an insane amount of cpu
cycles -- in rump our current "cpu" context is never interrupted
& we have MULTIPROCESSOR.

(itch i'm scratching: it made the networking stack 10-20% slower.
this is one of the places where fast code actually matters)
 1.9 18-Dec-2008  pooka __KERNEL_RCSID
 1.8 09-Oct-2008  pooka branches: 1.8.2;
Unsupport ltsleep() called with an interlock. Not that it was
really supported before either, since without MULTIPROCESSOR it's
just a nop.
 1.7 29-Jul-2008  pooka Install rump libraries and utilities to the base system and remove the
private non-installed build infrastructure from sys/rump.

breakdown of commit:
* install relevant headers into /usr/include/rump
* build sys/rump/librump/rumpuser and sys/rump/librump/rumpkern
from src/lib and install as librumpuser and librump, respectively
+ this retains the ability to test a librump build with just the
kernel sources at hand
* move sys/rump/fs/lib/libukfs and sys/rump/fs/lib/libp2k to src/lib
for general consumption, they are not kernel-space dwellers anyway
* build and install sys/rump/fs/lib/lib$fs as librumpfs_$fs
* add chapter 3 manual pages for rump, rumpuser, ukfs and p2k
* build and install userspace kernel file system daemons if MKPUFFS=yes
is spexified
* retire fsconsole for now, it will make a comeback with an actually
implemented version shortly
 1.6 27-Jan-2008  pooka branches: 1.6.6; 1.6.10; 1.6.12; 1.6.14; 1.6.16;
Use vfs_subr.c from sys/kern. This brings differences in the vnode
life cycle between rump and a real kernel to a minimum.
 1.5 05-Jan-2008  riz Add #include <sys/simplelock.h>
 1.4 02-Jan-2008  ad Merge vmlocking2 to head.
 1.3 07-Nov-2007  pooka branches: 1.3.2; 1.3.4; 1.3.6; 1.3.10;
Execute I/O in a separate thread for async I/O where previously
everything was written/read in caller context.

Also, make the "kernel" lock recursive. It works better that way ...
 1.2 04-Nov-2007  pooka branches: 1.2.2; 1.2.4;
Fix some comments: thinking of it more closely, it is actually safe
to release the sleep interlock before calling cv_wait() because we
are protected by the list mutex which prevents a wakeup race.
 1.1 31-Oct-2007  pooka branches: 1.1.2;
Make it possible to run rumps multithreaded. This brings real
locking and makes it possible to run file systems which create
threads. It also makes rump file system behaviour better match
file system behaviour in the kernel.
 1.1.2.4 11-Nov-2007  joerg Sync with HEAD.
 1.1.2.3 04-Nov-2007  jmcneill Sync with HEAD.
 1.1.2.2 31-Oct-2007  joerg Sync with HEAD.
 1.1.2.1 31-Oct-2007  joerg file ltsleep.c was added on branch jmcneill-pm on 2007-10-31 23:14:16 +0000
 1.2.4.5 23-Mar-2008  matt sync with HEAD
 1.2.4.4 09-Jan-2008  matt sync with HEAD
 1.2.4.3 08-Nov-2007  matt sync with -HEAD
 1.2.4.2 06-Nov-2007  matt sync with HEAD
 1.2.4.1 04-Nov-2007  matt file ltsleep.c was added on branch matt-armv6 on 2007-11-06 23:34:36 +0000
 1.2.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.2.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.3.10.2 08-Jan-2008  bouyer Sync with HEAD
 1.3.10.1 02-Jan-2008  bouyer Sync with HEAD
 1.3.6.1 28-Dec-2007  ad Make rump build.
 1.3.4.4 04-Feb-2008  yamt sync with head.
 1.3.4.3 21-Jan-2008  yamt sync with head
 1.3.4.2 15-Nov-2007  yamt sync with head.
 1.3.4.1 07-Nov-2007  yamt file ltsleep.c was added on branch yamt-lazymbuf on 2007-11-15 11:45:26 +0000
 1.3.2.2 13-Nov-2007  bouyer Sync with HEAD
 1.3.2.1 07-Nov-2007  bouyer file ltsleep.c was added on branch bouyer-xenamd64 on 2007-11-13 16:03:14 +0000
 1.6.16.1 19-Oct-2008  haad Sync with HEAD.
 1.6.14.1 31-Jul-2008  simonb Sync with head.
 1.6.12.2 10-Oct-2008  skrll Sync with HEAD.
 1.6.12.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.6.10.5 11-Aug-2010  yamt sync with head.
 1.6.10.4 11-Mar-2010  yamt sync with head
 1.6.10.3 16-Sep-2009  yamt sync with head
 1.6.10.2 20-Jun-2009  yamt sync with head
 1.6.10.1 04-May-2009  yamt sync with head.
 1.6.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.6.6.1 28-Sep-2008  mjf Sync with HEAD.
 1.8.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.8.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.8.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.10.2.2 23-Jul-2009  jym Sync with HEAD.
 1.10.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.25.4.3 05-Mar-2011  rmind sync with head
 1.25.4.2 03-Jul-2010  rmind sync with head
 1.25.4.1 30-May-2010  rmind sync with head
 1.25.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.28.12.1 18-Feb-2012  mrg merge to -current.
 1.28.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.28.8.1 17-Apr-2012  yamt sync with head
 1.29.6.2 03-Dec-2017  jdolecek update from HEAD
 1.29.6.1 23-Jun-2013  tls resync from head
 1.33.10.1 19-Mar-2016  skrll Sync with HEAD
 1.34.24.1 29-Feb-2020  ad Sync with head.
 1.34.18.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.59 06-Apr-2025  riastradh rump: Nix leaked struct lwp on every rump_server syscall.

This leak was introduced by lwproc.c rev. 1.51 back in 2020, when the
kmem_zalloc(sizeof(*l), KM_SLEEP) was factored out of callers and
into lwproc_makelwp:

-static void
-lwproc_makelwp(struct proc *p, struct lwp *l, bool doswitch, bool procmake)
+static struct lwp *
+lwproc_makelwp(struct proc *p, bool doswitch, bool procmake)
{
+ struct lwp *l = kmem_zalloc(sizeof(*l), KM_SLEEP);
...
@@ -435,8 +431,12 @@ rump_lwproc_newlwp(pid_t pid)
kmem_free(l, sizeof(*l));
return EBUSY;
}
+ mutex_exit(p->p_lock);
mutex_exit(&proc_lock);
- lwproc_makelwp(p, l, true, false);
+
+ /* XXX what holds proc? */
+
+ lwproc_makelwp(p, true, false);

Unfortunately, the kmem_zalloc in rump_lwproc_newlwp was not deleted.
So it just leaked.

And this routine is called on _every_ syscall handled by rump_server
(via struct rumpuser_hyperup::hyp_lwproc_newlwp):

674 static void
675 serv_handlesyscall(struct spclient *spc, struct rsp_hdr *rhdr, uint8_t *data)
676 {
677 register_t retval[2] = {0, 0};
678 int rv, sysnum;
679
680 sysnum = (int)rhdr->rsp_sysnum;
681 DPRINTF(("rump_sp: handling syscall %d from client %d\n",
682 sysnum, spc->spc_pid));
683
=> 684 if (__predict_false((rv = lwproc_newlwp(spc->spc_pid)) != 0)) {
685 retval[0] = -1;
686 send_syscall_resp(spc, rhdr->rsp_reqno, rv, retval);
687 return;
688 }
689 spc->spc_syscallreq = rhdr->rsp_reqno;
690 rv = rumpsyscall(sysnum, data, retval);

https://nxr.netbsd.org/xref/src/lib/librumpuser/rumpuser_sp.c?r=1.77#684

So this leak would grow fairly quickly in processes issuing rump
syscalls to rump_servers, which t_sp:sigsafe's helper h_sigcli does
as fast as it can in a loop for 5sec -- which is just long enough for
the i386 releng testbed with about 128 MB of RAM to run out of memory
in roughly half of the test runs, but not long enough on my laptop
with 64 GB of RAM to ever reproduce the problem.

Found by:

(a) running the test for 20sec rather than 5sec to amplify the leak;
(b) counting bytes allocated by return addresses of rumpuser_malloc;
(c) chasing that to rump_hypermalloc (culprit) vs uvm_km_alloc;
(d) chasing that to pgctor, uvm_map, uvm_km_kmem_alloc (culprit),
vmapbuf;
(e) then to pool_page_alloc, then to pool_allocator_alloc, then to
pool_grow, then to pool_get, then to pool_cache_get, then to
kmem_zalloc;
(f) finally to the call to kmem_zalloc in rump_lwproc_newlwp, which
at last yielded to my stare.

This instrumentation was extremely ad hoc -- I just created a table
of 4096 entries for each routine, and populated by linear scan with
atomics:

struct {
void *volatile ra;
volatile unsigned long n;
} pool_cache_get_bytes;

void *
kmem_zalloc(size_t size, km_flags_t flags)
{
...
void *const ra = __builtin_return_address(0);
size_t i;
for (i = 0; i < __arraycount(kmem_zalloc_bytes); i++) {
if (pool_cache_get_bytes[i].ra == ra ||
(pool_cache_get_bytes[i].ra == NULL &&
atomic_cas_ptr(&pool_cache_get_bytes[i].ra, NULL,
ra) == NULL)) {
atomic_add_long(&pool_cache_get_bytes[i].n, size);
break;
}
}
...
}

Would be nice to systematize this. Would also be nice to bring back
malloc tags for accounting purposes so you don't need to match up the
kmem_zalloc return addresses with the kmem_free return addresses to
find leaks -- I got lucky here because there were very few return
addresses to piece through.

PR misc/59252: tests/rump/rumpkern/t_sp:sigsafe: out of memory
 1.58 15-Oct-2023  riastradh branches: 1.58.6;
rump: Sprinkle sys/syncobj.h here too.
 1.57 05-Oct-2023  ad Arrange to update cached LWP credentials in userret() rather than during
syscall/trap entry, eliminating a test+branch on every syscall/trap.

This wasn't possible in the 3.99.x timeframe when l->l_cred came about
because there wasn't a reliable/timely way to force an ONPROC LWP running on
a remote CPU into the kernel (which is just about the only new thing in
this scheme).
 1.56 04-Oct-2023  ad Eliminate l->l_biglocks. Originally I think it had a use but these days a
local variable will do.
 1.55 04-Oct-2023  ad Eliminate l->l_ncsw and l->l_nivcsw. From memory think they were added
before we had per-LWP struct rusage; the same is now tracked there.
 1.54 22-Feb-2023  riastradh rump: Nix membar_enter/exit after/before RUMPUSER_LWP_CREATE/DESTROY.

These make no sense and are obviously not needed for any of the
rumpuser implementations in-tree. (For single-threaded fiber and
pth_dummy, no barriers needed; for pth, RUMPUSER_LWP_CREATE/DESTROY
use pthread_mutex so don't need any barriers.)

It _might_ make sense to do membar_release/acquire around just
RUMPUSER_LWP_DESTROY, perhaps if there's some reference-counting
business involved. But if a rumpuser implementation really needs
that it can do it itself.
 1.53 22-Feb-2023  riastradh rumpkern/lwproc.c: Nix trailing whitespace.
 1.52 02-Nov-2022  ozaki-r rump: don't touch p_nlwps without holding p_lock

There was a race condition on p_nlwps. Heavy thread switching could
cause a kernel panic like:
panic: kernel diagnostic assertion "LIST_EMPTY(&p->p_lwps)" failed:
file "(hidden)/src/lib/librump/../../sys/rump/librump/rumpkern/lwproc.c", line 177
 1.51 30-May-2020  ad Fix a lock order reversal that caused hangs.
 1.50 23-May-2020  ad Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.49 23-May-2020  ad - Replace pid_table_lock with a lockless lookup covered by pserialize, with
the "writer" side being pid_table expansion. The basic idea is that when
doing an LWP lookup there is usually already a lock held (p->p_lock), or a
spin mutex that needs to be taken (l->l_mutex), and either can be used to
get the found LWP stable and confidently determine that all is correct.

- For user processes LSLARVAL implies the same thing as LSIDL ("not visible
by ID"), and lookup by ID in proc0 doesn't really happen. In-tree the new
state should be understood by top(1), the tty subsystem and so on, and
would attract the attention of 3rd party kernel grovellers in time, so
remove it and just rely on LSIDL.
 1.48 25-Apr-2020  bouyer Merge the bouyer-xenpvh branch, bringing in Xen PV drivers support under HVM
guests in GENERIC.
Xen support can be disabled at runtime with
boot -c
disable hypervisor
 1.47 24-Apr-2020  thorpej lwp0.l_lid needs to be 0.
 1.46 24-Apr-2020  thorpej Adapt to LWP ID allocation changes.
 1.45 19-Apr-2020  thorpej - Only increment nprocs when we're creating a new process, not just
when allocating a PID.
- Per above, proc_free_pid() no longer decrements nprocs. It's now done
in proc_free() right after proc_free_pid().
- Ensure nprocs is accessed using atomics everywhere.
 1.44 15-Feb-2020  ad branches: 1.44.4;
- Move the LW_RUNNING flag back into l_pflag: updating l_flag without lock
in softint_dispatch() is risky. May help with the "softint screwup"
panic.

- Correct the memory barriers around zombies switching into oblivion.
 1.43 08-Jan-2020  ad Hopefully fix some problems seen with MP support on non-x86, in particular
where curcpu() is defined as curlwp->l_cpu:

- mi_switch(): undo the ~2007ish optimisation to unlock curlwp before
calling cpu_switchto(). It's not safe to let other actors mess with the
LWP (in particular l->l_cpu) while it's still context switching. This
removes l->l_ctxswtch.

- Move the LP_RUNNING flag into l->l_flag and rename to LW_RUNNING since
it's now covered by the LWP's lock.

- Ditch lwp_exit_switchaway() and just call mi_switch() instead. Everything
is in cache anyway so it wasn't buying much by trying to avoid saving old
state. This means cpu_switchto() will never be called with prevlwp ==
NULL.

- Remove some KERNEL_LOCK handling which hasn't been needed for years.
 1.42 17-May-2019  ozaki-r branches: 1.42.4;
Implement an aggressive psref leak detector

It is yet another psref leak detector that enables to tell where a leak occurs
while a simpler version that is already committed just tells an occurrence of a
leak.

Investigating of psref leaks is hard because once a leak occurs a percpu list of
psref that tracks references can be corrupted. A reference to a tracking object
is memorized in the list via an intermediate object (struct psref) that is
normally allocated on a stack of a thread. Thus, the intermediate object can be
overwritten on a leak resulting in corruption of the list.

The tracker makes a shadow entry to an intermediate object and stores some hints
into it (currently it's a caller address of psref_acquire). We can detect a
leak by checking the entries on certain points where any references should be
released such as the return point of syscalls and the end of each softint
handler.

The feature is expensive and enabled only if the kernel is built with
PSREF_DEBUG.

Proposed on tech-kern
 1.41 09-Mar-2019  hannken Rumpkernel has its own thread deallocation. Add missing fstrans_lwp_dtor()
to lwproc_freelwp().

PR bin/50350: rump/rumpkern/t_sp/stress_{long,short} fail on Core 2 Quad
 1.40 24-Apr-2016  martin branches: 1.40.18;
Add lwp_find() - verbatim copy from the hard kernel.
 1.39 04-Apr-2016  christos Split p_xstat (composite wait(2) status code, or signal number depending
on context) into:
1. p_xexit: exit code
2. p_xsig: signal number
3. p_sflag & WCOREFLAG bit to indicated that the process core-dumped.

Fix the documentation of the flag bits in <sys/proc.h>
 1.38 08-Feb-2016  pooka Allocate struct cpu_info dynamically. Saves quite a lot of BSS in the
common case and reduces rump kernel memory requirements by 10% or more
in really tiny deployments.
 1.37 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.36 18-Jan-2016  pooka put lwp/proc stuff into the same source module (emul.c -> lwproc.c)
 1.35 18-Apr-2015  pooka Give remote clients struct pmap storage. Although the pmap is unused,
that way we can sure that the pmap macro framework doesn't access all
the wrong places.
 1.34 17-Apr-2015  pooka Don't share file descriptors between proc0 and local clients.
 1.33 03-Apr-2015  pooka Use a different vmspace for rump kernel proc0 and local clients.
While the rump kernel and local clients are by definition in the same
host vmspace, there are subtle differences in how in-kernel code works
in case accessing the kernel vmspace or a user process vmspace.

Problem discovered by riastradh's "read(fd, NULL, 1)" test.
 1.32 21-Jan-2015  pooka Account for lwps so that rump_sys_setuid() doesn't hit a KASSERT when
it tries to reaccount a switching procs lwps.

from Mato Lucina
 1.31 25-Apr-2014  pooka branches: 1.31.4;
Init function pointers to nullop() so that callers don't need a dance
 1.30 16-Apr-2014  pooka Reparent children of a dying lwproc. Fixes wpa_supplicant -B (and
most likely a bunch of other things).
 1.29 09-Apr-2014  pooka implement lwp_create() and a few related interfaces.
main raison d'impalerment: the aio driver
 1.28 16-Mar-2014  pooka branches: 1.28.2;
remove unnecesary verbosity: s/RUMP_CURLWP_MODEL/RUMP_CURLWP/
 1.27 15-Mar-2014  pooka Allow compile-time optimizations to curlwp. This can have a pretty
staggering impact on performance. When running sendto() in a loop,
the improvement is 200k more calls per second with an inlined __thread
curlwp as opposed to the default. In other words, it shaves off hundreds
of CPU cycles per call (~20%). Even just eliminating the x86_curlwp()
call in favor of an inline gives an improvement of 60k calls per second.
 1.26 16-Dec-2013  pooka Translate return values for emulations, e.g. Linux. For ports without
__HAVE_MINIMAL_EMUL, we simply look up the values from p->p_emul->e_errno.
For ports which cannot afford to keep an extra pointer per emul structure
around, we hope there is __HAVE_SYSCALL_INTERN support and thread the
errno values through p_emuldata. Notably, we cannot alter the syscall
method like most ports do with syscall_intern, since they do it via
p_mdproc, so MI code is not possible there.
 1.25 09-Dec-2013  pooka stop ktrace at process exit
 1.24 27-Oct-2013  pooka Enable holding implicit threads over explicit scheduling points (i.e.
a kernel driver calling rump_lwproc_switch()). Also, correctly handle
curcpu()->ci_curlwp and biglock there.
 1.23 15-May-2013  pooka branches: 1.23.2;
Add RUMPUSER_LWP_CLEAR instead of overloading RUMPUSER_LWP_SET.
This simplifies some alternative hypervisor implementations.
 1.22 02-May-2013  pooka Inform the rump kernel hypervisor of valid thread contexts so
that the implementation can allocate and release storage for them
in an optimal fashion, if necessary.
 1.21 28-Apr-2013  pooka One more mutex which is used as a spin mutex and therefore needs
to be tagged as one, lest the mighty assert smites thee.
 1.20 07-Mar-2013  pooka Support multiple syscall emuls.

Rump kernels with only local clients have it easy, since they have to
support at most two syscall vectors (some calls such as mount/unmount
can be made only through the "native" NetBSD vector). Remote clients
are a whole different tin of green beans. This change addresses local
clients only.
 1.19 13-Nov-2012  pooka kill some -Wunused-but-set-variable warnings
 1.18 01-May-2011  pgoyette branches: 1.18.4; 1.18.14;
More lim_free() fallout
 1.17 08-Mar-2011  pooka Nuke all threads belonging to a process calling exec before allowing
the exec handshake to return.

In addition to being The Right Thing To Do, fixes some nasty
conditions for CLOEXEC fd's (or at least does so in theory, I
couldn't create any problems although I tried).
 1.16 07-Mar-2011  pooka Fill in a functional struct lwp (especially l_mutex) before exposing
it on p_lwps.
 1.15 10-Feb-2011  pooka branches: 1.15.2;
Explicitly zerofill some fields which are not within the boundaries
of p_start/endzero for whatever reasons.

Obviously, this fixes remote physio when running with MALLOC_OPTIONS J.
Otherwise PS_WEXIT is set in struct proc, proc_vmspace_getref() fails,
and copyout_proc() with it.

Reported by njoly
 1.14 10-Feb-2011  pooka copy parent's p_comm when forking (if it exists)
 1.13 28-Jan-2011  pooka Don't NULL out l_cpu, l_stat is the new rumpkernel way too.
 1.12 28-Jan-2011  pooka Some lwp-walkers expect the correct value for l_stat, so use a flag
in l_flag instead of l_stat for the purpose of flagging lwps in a
dying proc.
 1.11 28-Jan-2011  pooka fill in a default name for p_comm
 1.10 13-Jan-2011  pooka branches: 1.10.2; 1.10.4;
Introduce RUMP_LOCALPROC_P() macro and use it.
 1.9 12-Jan-2011  pooka When the client and the rump kernel are the same host process, all
threads blocking in the kernel automatically exit when the process
exists. However, for the sysproxy case this does not hold.
Typically it's ~harmless, but e.g. in the case of socket binding
following by poll it gets annoying.

Introduce sysproxy procexit, which wakes up all threads blocking
on a condition when a process's communication socket is closed.
The code is a little different from the regular kernel simply
because in a rump kernel l_mutex is not available at all times
(this is because scheduling happens on every kernel entry and exit,
and that path must be kept lockless for any reasonable performance).
Instead, use gating which makes sure all threads are either out of
the cv code or suspended in a well-known state. Then, wake up the
threads and tell them to get the hell out of our galaxy.
 1.8 06-Jan-2011  pooka Support LOCKDEBUG. To use it, compile sys/rump with RUMP_LOCKDEBUG=yes.

requested by martin (sparc64 gdb cannot reliably produce a stack trace)
 1.7 02-Jan-2011  pooka There is a use case where preserving the parent's fd table is
relevant, so to accommodate that change rump_lwproc_newproc() to
rump_lwproc_rfork(). The new interface has the rfork() fd table
semantics. The equivalent of rump_lwproc_newproc() is
rump_lwproc_rfork(RUMP_RFCFDG).
 1.6 22-Nov-2010  pooka Support physio for remote processes.
==> add support for remote vmspace vmapbuf/vunmapbuf
==> add proper support for copyin/out_vmspace
==> add support for remote vmspace uvm_io
==> add support for non-curproc rumpuser_sp_copyin/out
==> store remote context in vm_map->pmap instead of
pthread_specificdata

In short, makes read/write of most (all?) block devices work from
a remote rump client via rump syscalls.
 1.5 17-Nov-2010  pooka cleanup some old garbage
 1.4 15-Nov-2010  pooka Add a new signal model RUMP_SIGMODEL_RECORD which records all
signals which are posted to a process.
 1.3 29-Oct-2010  pooka Attach implicit threads to initproc instead of proc0. This way
applications which alter, by purpose or by accident, the uid in an
implicit thread are don't affect kernel threads.

from discussion with njoly
 1.2 01-Sep-2010  pooka branches: 1.2.2; 1.2.4;
proper panic for trying to release implicit lwp
 1.1 01-Sep-2010  pooka Implement rump_lwproc: the new lwp/proc management routines for
rump. These move the management of the pid/lwpid space from the
application into the kernel, make code more robust, and make it
possible to attach multiple lwp's to non-proc0 processes.
 1.2.4.3 06-Nov-2010  uebayasi Sync with HEAD.
 1.2.4.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.2.4.1 01-Sep-2010  uebayasi file lwproc.c was added on branch uebayasi-xip on 2010-10-22 07:22:49 +0000
 1.2.2.2 09-Oct-2010  yamt sync with head
 1.2.2.1 01-Sep-2010  yamt file lwproc.c was added on branch yamt-nfs-mp on 2010-10-09 03:32:43 +0000
 1.10.4.2 17-Feb-2011  bouyer Sync with HEAD
 1.10.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.10.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.15.2.4 31-May-2011  rmind sync with head
 1.15.2.3 21-Apr-2011  rmind sync with head
 1.15.2.2 05-Mar-2011  rmind sync with head
 1.15.2.1 10-Feb-2011  rmind file lwproc.c was added on branch rmind-uvmplock on 2011-03-05 20:56:15 +0000
 1.18.14.4 03-Dec-2017  jdolecek update from HEAD
 1.18.14.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.14.2 23-Jun-2013  tls resync from head
 1.18.14.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.18.4.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.18.4.1 16-Jan-2013  yamt sync with (a bit old) head
 1.23.2.1 18-May-2014  rmind sync with head
 1.28.2.1 10-Aug-2014  tls Rebase.
 1.31.4.5 29-May-2016  skrll Sync with HEAD
 1.31.4.4 22-Apr-2016  skrll Sync with HEAD
 1.31.4.3 19-Mar-2016  skrll Sync with HEAD
 1.31.4.2 06-Jun-2015  skrll Sync with HEAD
 1.31.4.1 06-Apr-2015  skrll Sync with HEAD
 1.40.18.2 21-Apr-2020  martin Sync with HEAD
 1.40.18.1 10-Jun-2019  christos Sync with HEAD
 1.42.4.2 29-Feb-2020  ad Sync with head.
 1.42.4.1 17-Jan-2020  ad Sync with head.
 1.44.4.2 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.44.4.1 20-Apr-2020  bouyer Sync with HEAD
 1.58.6.1 02-Aug-2025  perseant Sync with HEAD
 1.22 17-Jun-2015  pooka Remove unreal allocators, unconditionally use subr_{kmem,pool}.

Will, with other work, allow to tighten the memory allocation hypercall
specification to page-granularity allocations in the future.
 1.21 27-Apr-2013  pooka branches: 1.21.12;
* treat kern_malloc.c as an unreal allocator (it's so lightweight)
* get rid of the rumpuser_realloc() hypercall
* pass size to rumpuser_free()
 1.20 10-Mar-2013  pooka Use kern_malloc.c instead of the relegated allocators in memalloc.c.
Previously this didn't make sense due to the use of kmem_map, but the
new malloc is more dynamic and puts sense into using it.
 1.19 10-Mar-2013  pooka Always include subr_vmem.c, even with RUMP_UNREAL_ALLOCATORS=yes
(previously it was just missing in that case).

Record wchan to unreal pool_init() to avoid memory leak warning.
 1.18 20-Jul-2012  pooka branches: 1.18.2;
Make it possible to select between real and unreal allocators from
make. Plus some gratuitous renaming.
 1.17 20-Jul-2012  pooka make unreal allocators work again
 1.16 05-Jun-2012  jym Now that pool_cache_invalidate() is synchronous and can handle per-CPU
caches, merge together pool_drain_start() and pool_drain_end() into

bool pool_drain(struct pool **ppp);

"bool" value indicates whether reclaiming was fully done (true) or not (false)
"ppp" will contain a pointer to the pool that was drained (optional).

See http://mail-index.netbsd.org/tech-kern/2012/06/04/msg013287.html
 1.15 29-Apr-2012  dsl Remove everything to do with 'struct malloc_type' and the malloc link_set.
To make code in 'external' (etc) still compile, MALLOC_DECLARE() still
has to generate something of type 'struct malloc_type *', with
normal optimisation gcc generates a compile-time 0.
MALLOC_DEFINE() and friends have no effect.
Fix one or two places where the code would no longer compile.
 1.14 29-Apr-2012  dsl Remove the unused 'struct malloc_type' args to kern_malloc/realloc/free
The M_xxx arg is left on the calls to malloc() and free(),
maybe they could be converted to an enumeration and just saved in
the malloc header (for deep diag use).
Remove the malloc_type from mbuf extension.
Fixes rump build as well.
Welcome to 6.99.6
 1.13 29-Apr-2012  rmind Fix RUMP build.
 1.12 04-Feb-2012  para make acorn26 compile by fixing up subpage pool allocations

ok: riz@
 1.11 11-Jul-2010  pooka branches: 1.11.8; 1.11.12;
Reflect change to pool_drain_end. Makes -DRUMP_USE_UNREAL_ALLOCATORS
compile (and work) again.
 1.10 08-Jul-2010  pooka Emulate malloc(9) a little better by panicking if a should-not-fail
allocation fails. We could invoke the pagedaemon here, but since
malloc(9) is panicky when it runs out of kmem_map, let's do the
"same".
 1.9 14-Jun-2010  pooka Make it possible to define an upper limit for memory consumed by
the rump kernel by specifying RUMP_MEMLIMIT. In case allocation
over that limit is attempted, essentially pool reclaim and uvm_wait()
is done. The default is to allow to allocate as much as the host
will give.

XXX: uvm_km_alloc and malloc(9) do not currently conform. the
former is easy, the latter requires kern_malloc.c (rump malloc is
currently directly relegated to host malloc).
 1.8 03-Jun-2010  pooka Don't use rumpuser_malloc() directly.
 1.7 03-Jun-2010  pooka Implement a sort-of pagedaemon: adjust all memory allocators to go
through an in-rumpkernel hypermemory allocator which knows it should
kick the pagedaemon and block in case ``waitok'' memory allocation
fails.

This allows us to recover from some out-of-memory situations.
Realworld'istically speaking (as opposed to whatever "should be"
theory), these OOM situations will happen extremely rarely if ever
when our hypervisor is a regular process. Speculatively, this
should be useful for other types of hosts.

issues remaining:
* the hypervisor does not know how to reclaim kernel memory (and
for the reason I stated above, I'm not sure if it makes sense
to teach the current implementation about that)
* vfs memory (buffers, vm object pages etc.) is not reclaimed
 1.6 01-Jun-2010  pooka Don't pass "canfail" down to rumpuser_malloc -- there's quite little
we can do with that info way down there. Instead, pass alignment.
Implement rumpuser_malloc() with posix_memalign().
 1.5 15-Jan-2010  pooka branches: 1.5.2; 1.5.4; 1.5.6;
Use subr_percpu.c instead of homegrown implementation. ...except
when using malloc(3)-relegated allocators (happens in production
e.g. on Linux), since subr_percpu.c uses vmem and i don't want to
reimplement vmem.
 1.4 11-Jan-2010  stacktic Fixed typo.
 1.3 23-Dec-2009  stacktic Fixed build when using unreal allocators.
 1.2 27-Nov-2009  pooka Now that Makefile.rump was changed and everything gets built in
update builds too, flip the allocator define to prefer the kernel
pool/kmem instead of malloc(3). Use malloc(3) only if
RUMP_USE_UNREAL_ALLOCATORS is defined.
 1.1 04-Nov-2009  pooka Pull all relegating memory allocators under a common roof in memalloc.c
(forgot to commit the new file)
 1.5.6.2 05-Mar-2011  rmind sync with head
 1.5.6.1 03-Jul-2010  rmind sync with head
 1.5.4.3 11-Aug-2010  yamt sync with head.
 1.5.4.2 11-Mar-2010  yamt sync with head
 1.5.4.1 15-Jan-2010  yamt file memalloc.c was added on branch yamt-nfs-mp on 2010-03-11 15:04:38 +0000
 1.5.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.11.12.3 02-Jun-2012  mrg sync to latest -current.
 1.11.12.2 29-Apr-2012  mrg sync to latest -current.
 1.11.12.1 18-Feb-2012  mrg merge to -current.
 1.11.8.4 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.11.8.3 30-Oct-2012  yamt sync with head
 1.11.8.2 23-May-2012  yamt sync with head.
 1.11.8.1 17-Apr-2012  yamt sync with head
 1.18.2.2 03-Dec-2017  jdolecek update from HEAD
 1.18.2.1 23-Jun-2013  tls resync from head
 1.21.12.1 22-Sep-2015  skrll Sync with HEAD
 1.26 04-Nov-2009  pooka misc_stub and emul have been the same thing for a looong time now,
so just move the few remaining routines in misc_stub to emul.
 1.25 04-Nov-2009  pooka Implement yield()/preempt() now that there is a CPU scheduler.
 1.24 15-Oct-2009  pooka Add initial work on a rump virtual cpu scheduler. This is necessary
for kernel code which has been written to avoid MP contention by
using cpu-local storage (most prominently, select and pool_cache).

Instead of always assuming rump_cpu, the scheduler must now be run
(and unrun) on all entry points into rump. Likewise, rumpuser
unruns and re-runs the scheduler around each potentially blocking
operation. As an optimization, I modified some locking primitives
to try to get the lock without blocking before releasing the cpu.

Also, ltsleep was modified to assume that it is never called without
the biglock held and made to use the biglock as the sleep interlock.
Otherwise there is just too much drama with deadlocks. If some
kernel code wants to call ltsleep without the biglock, then, *snif*,
it's no longer supported and rump and should be modified to support
newstyle locks anyway.
 1.23 02-Oct-2009  elad First part of secmodel cleanup and other misc. changes:

- Separate the suser part of the bsd44 secmodel into its own secmodel
and directory, pending even more cleanups. For revision history
purposes, the original location of the files was

src/sys/secmodel/bsd44/secmodel_bsd44_suser.c
src/sys/secmodel/bsd44/suser.h

- Add a man-page for secmodel_suser(9) and update the one for
secmodel_bsd44(9).

- Add a "secmodel" module class and use it. Userland program and
documentation updated.

- Manage secmodel count (nsecmodels) through the module framework.
This eliminates the need for secmodel_{,de}register() calls in
secmodel code.

- Prepare for secmodel modularization by adding relevant module bits.
The secmodels don't allow auto unload. The bsd44 secmodel depends
on the suser and securelevel secmodels. The overlay secmodel depends
on the bsd44 secmodel. As the module class is only cosmetic, and to
prevent ambiguity, the bsd44 and overlay secmodels are prefixed with
"secmodel_".

- Adapt the overlay secmodel to recent changes (mainly vnode scope).

- Stop using link-sets for the sysctl node(s) creation.

- Keep sysctl variables under nodes of their relevant secmodels. In
other words, don't create duplicates for the suser/securelevel
secmodels under the bsd44 secmodel, as the latter is merely used
for "grouping".

- For the suser and securelevel secmodels, "advertise presence" in
relevant sysctl nodes (sysctl.security.models.{suser,securelevel}).

- Get rid of the LKM preprocessor stuff.

- As secmodels are now modules, there's no need for an explicit call
to secmodel_start(); it's handled by the module framework. That
said, the module framework was adjusted to properly load secmodels
early during system startup.

- Adapt rump to changes: Instead of using empty stubs for securelevel,
simply use the suser secmodel. Also replace secmodel_start() with a
call to secmodel_suser_start().

- 5.99.20.

Testing was done on i386 ("release" build). Spearated module_init()
changes were tested on sparc and sparc64 as well by martin@ (thanks!).

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/09/25/msg006135.html
 1.22 02-May-2009  pooka Do not include securelevel, it includes too many dependencies on
vfs in its current form.
 1.21 29-Mar-2009  pooka include subr_evcnt
 1.20 19-Mar-2009  pooka Simple syscall_establish() support.
(should use kernel sources version, but it's buried inside a
module with a lot of junk in it, so shortcut for now)
 1.19 18-Mar-2009  pooka Support kqueue in the rump virtual kernel.
 1.18 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.17 01-Jan-2009  pooka branches: 1.17.2;
Define MODULAR for rump core components. This enables module
loading via the kernel module framework (instead of dlopen()).
For now it only works on amd64 and i386, but for the rest it should
just be a matter of including the relevant kobj_machdep.c modules
from the kernel sources.
 1.16 18-Dec-2008  pooka __KERNEL_RCSID
 1.15 26-Nov-2008  pooka Add a few symbols required by nfsd
 1.14 19-Nov-2008  ad +evcnt_detach
 1.13 15-Oct-2008  ad branches: 1.13.2;
- Rename cpu_lookup_byindex() to cpu_lookup(). The hardware ID isn't of
interest to MI code. No functional change.
- Change /dev/cpu to operate on cpu index, not hardware ID. Now cpuctl
shouldn't print confused output.
 1.12 02-Oct-2008  pooka Remove rumpuser_yield(). Not only doesn't it really make sense
here, some kind soul made it completely empty.
 1.11 01-Aug-2008  pooka support real sysctls
 1.10 28-Jun-2008  chris branches: 1.10.2;
Add sysctl_teardown stub, moves the build past breakage in rump.
 1.9 04-May-2008  ad branches: 1.9.2; 1.9.4;
Pull in the kernel module stuff so that rump can set up built-in modules.
 1.8 11-Apr-2008  ad branches: 1.8.2; 1.8.4;
+evcnt_attach_dynamic
 1.7 27-Feb-2008  ad +cpu_lookup_byindex
 1.6 16-Jan-2008  ad branches: 1.6.2; 1.6.6;
Pull in my modules code for review/test/hacking.
 1.5 09-Jan-2008  he Declare nbpg if we're building for sparc, and initialize to the
smallest sparc pagesize. This should deal with the IOCPARM_MAX
build problem, which occurs on sparc because various models have
different page size, so it's run-time determined instead.

pooka says that rump doesn't use ioctl(), so the value is apparently
of no consequence.
 1.4 07-Jan-2008  ad Patch up sysctl locking:

- Lock processes, credentials, filehead etc correctly.
- Acquire a read hold on sysctl_treelock if only doing a query.
- Don't wire down the output buffer. It doesn't work correctly and the code
regularly does long term sleeps with it held - it's not worth it.
- Don't hold locks other than sysctl_lock while doing copyout().
- Drop sysctl_lock while doing copyout / allocating memory in a few places.
- Don't take kernel_lock for sysctl.
- Fix a number of bugs spotted along the way
 1.3 14-Aug-2007  pooka branches: 1.3.2; 1.3.4; 1.3.6; 1.3.8; 1.3.14; 1.3.16; 1.3.22;
Kill handrolled buffercache and use vfs_bio from the kernel. This is
mostly to get the flag jungle in sync with the kernel.
 1.2 09-Aug-2007  pooka Add some stubs for lfs.
 1.1 05-Aug-2007  pooka branches: 1.1.2;
Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.2 05-Aug-2007  pooka Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.1 05-Aug-2007  pooka file misc_stub.c was added on branch matt-mips64 on 2007-08-05 22:28:09 +0000
 1.3.22.3 19-Jan-2008  bouyer Sync with HEAD
 1.3.22.2 10-Jan-2008  bouyer Sync with HEAD
 1.3.22.1 08-Jan-2008  bouyer Sync with HEAD
 1.3.16.1 18-Feb-2008  mjf Sync with HEAD.
 1.3.14.2 02-Nov-2007  joerg Reduce diff to HEAD by adding files forgotten in early merges.
 1.3.14.1 14-Aug-2007  joerg file misc_stub.c was added on branch jmcneill-pm on 2007-11-02 12:43:52 +0000
 1.3.8.4 17-Mar-2008  yamt sync with head.
 1.3.8.3 21-Jan-2008  yamt sync with head
 1.3.8.2 03-Sep-2007  yamt sync with head.
 1.3.8.1 14-Aug-2007  yamt file misc_stub.c was added on branch yamt-lazymbuf on 2007-09-03 14:45:31 +0000
 1.3.6.2 23-Mar-2008  matt sync with HEAD
 1.3.6.1 09-Jan-2008  matt sync with HEAD
 1.3.4.2 20-Aug-2007  ad Sync with HEAD.
 1.3.4.1 14-Aug-2007  ad file misc_stub.c was added on branch vmlocking on 2007-08-20 22:07:28 +0000
 1.3.2.2 15-Aug-2007  skrll Sync with HEAD.
 1.3.2.1 14-Aug-2007  skrll file misc_stub.c was added on branch nick-csl-alignment on 2007-08-15 13:50:39 +0000
 1.6.6.6 17-Jan-2009  mjf Sync with HEAD.
 1.6.6.5 05-Oct-2008  mjf Sync with HEAD.
 1.6.6.4 28-Sep-2008  mjf Sync with HEAD.
 1.6.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.6.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.6.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.6.2.1 24-Mar-2008  keiichi sync with head.
 1.8.4.3 11-Mar-2010  yamt sync with head
 1.8.4.2 04-May-2009  yamt sync with head.
 1.8.4.1 16-May-2008  yamt sync with head.
 1.8.2.1 18-May-2008  yamt sync with head.
 1.9.4.1 03-Jul-2008  simonb Sync with head.
 1.9.2.2 10-Oct-2008  skrll Sync with HEAD.
 1.9.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.10.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.10.2.1 19-Oct-2008  haad Sync with HEAD.
 1.13.2.2 28-Apr-2009  skrll Sync with HEAD.
 1.13.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.17.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2 08-Aug-2007  pooka * compile param.c
* move opts to a separate directory
 1.1 05-Aug-2007  pooka branches: 1.1.2;
Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.2 05-Aug-2007  pooka Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.1 05-Aug-2007  pooka file opt_ddb.h was added on branch matt-mips64 on 2007-08-05 22:28:09 +0000
 1.2 08-Aug-2007  pooka * compile param.c
* move opts to a separate directory
 1.1 05-Aug-2007  pooka branches: 1.1.2;
Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.2 05-Aug-2007  pooka Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.1 05-Aug-2007  pooka file opt_multiprocessor.h was added on branch matt-mips64 on 2007-08-05 22:28:10 +0000
 1.2 08-Aug-2007  pooka * compile param.c
* move opts to a separate directory
 1.1 05-Aug-2007  pooka branches: 1.1.2;
Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.2 05-Aug-2007  pooka Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.1 05-Aug-2007  pooka file opt_revcache.h was added on branch matt-mips64 on 2007-08-05 22:28:10 +0000
 1.2 08-Aug-2007  pooka * compile param.c
* move opts to a separate directory
 1.1 05-Aug-2007  pooka branches: 1.1.2;
Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.2 05-Aug-2007  pooka Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.1 05-Aug-2007  pooka file opt_vnode_lockdebug.h was added on branch matt-mips64 on 2007-08-05 22:28:10 +0000
 1.7 15-Jan-2010  pooka Use subr_percpu.c instead of homegrown implementation. ...except
when using malloc(3)-relegated allocators (happens in production
e.g. on Linux), since subr_percpu.c uses vmem and i don't want to
reimplement vmem.
 1.6 15-Oct-2009  pooka Add initial work on a rump virtual cpu scheduler. This is necessary
for kernel code which has been written to avoid MP contention by
using cpu-local storage (most prominently, select and pool_cache).

Instead of always assuming rump_cpu, the scheduler must now be run
(and unrun) on all entry points into rump. Likewise, rumpuser
unruns and re-runs the scheduler around each potentially blocking
operation. As an optimization, I modified some locking primitives
to try to get the lock without blocking before releasing the cpu.

Also, ltsleep was modified to assume that it is never called without
the biglock held and made to use the biglock as the sleep interlock.
Otherwise there is just too much drama with deadlocks. If some
kernel code wants to call ltsleep without the biglock, then, *snif*,
it's no longer supported and rump and should be modified to support
newstyle locks anyway.
 1.5 18-Mar-2009  cegger branches: 1.5.2;
Ansify function definitions w/o arguments. Generated with sed.
 1.4 29-Dec-2008  pooka branches: 1.4.2; 1.4.4;
Switch i386 away from rump/include/machine. This means that rump
on i386 now uses the native kernel ABI. This in turn means that
rump modules and kernel modules are binary equivalent and can be
used interchangeably.
 1.3 18-Dec-2008  pooka __KERNEL_RCSID
 1.2 11-Oct-2008  pooka branches: 1.2.2; 1.2.4;
Include <machine/cpu> for the benefit of archs where it doesn't happen
accidentally automagically.

Pointed out by Havard.
 1.1 10-Oct-2008  pooka branches: 1.1.2;
Add a simple percpu implementation (which isn't actually percpu at
all, since we don't currently have the notion of "real" cpu in
rump...but that's beyond the point).
 1.1.2.2 10-Oct-2008  skrll Sync with HEAD.
 1.1.2.1 10-Oct-2008  skrll file percpu.c was added on branch wrstuden-revivesa on 2008-10-10 22:36:16 +0000
 1.2.4.2 28-Apr-2009  skrll Sync with HEAD.
 1.2.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.2.2.2 19-Oct-2008  haad Sync with HEAD.
 1.2.2.1 11-Oct-2008  haad file percpu.c was added on branch haad-dm on 2008-10-19 22:18:06 +0000
 1.4.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.4.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.4.2.1 29-Dec-2008  mjf file percpu.c was added on branch mjf-devfs2 on 2009-01-17 13:29:36 +0000
 1.5.2.3 11-Mar-2010  yamt sync with head
 1.5.2.2 04-May-2009  yamt sync with head.
 1.5.2.1 18-Mar-2009  yamt file percpu.c was added on branch yamt-nfs-mp on 2009-05-04 08:14:29 +0000
 1.26 12-Feb-2014  pooka Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.25 02-Mar-2011  pooka branches: 1.25.4; 1.25.14; 1.25.18;
We track page modified info with PG_CLEAN, so make clear_modify
return false. This makes rump lfs unmount work on platforms which
use the pmap stub (i.e. non-x86, which already returned false here).
Otherwise, lfs would hang itself trying to flush some buffers but
couldn't fill a segment and therefore wouldn't actually write
anything.
 1.24 16-Jun-2010  pooka branches: 1.24.2; 1.24.4;
Reinstate the blanket pmap.h for archs which do not conform to the
kernel ABI (i.e. not i386 or amd64). Due to the "half function,
half macro, all noodles" nature of pmap.h, it's too entangling and
too brittle to keep up with an ifdeffy MI implementation.
 1.23 09-Nov-2009  nakayama branches: 1.23.2; 1.23.4;
- make this compile on sparc.
- shrink blanks to fit in 80 columns.
 1.22 07-Nov-2009  dsl Fix stub prototype
 1.21 22-Oct-2009  rmind Simplify pmap_remove() a little by avoiding pmap_do_remove() layer, since
possibility to skip wired mappings is not needed anymore. Apart from that,
no functional differences are intended.
 1.20 18-Sep-2009  pooka vax macro magic requires Sysmap (untested).
XXX: I should add the blanket userspace pmap back for vax, its
pmap.h just has too many inlines and macros for this to ever work.
 1.19 16-Aug-2009  skrll s/int/u_int/ for flags in pmap_enter and deal with this in rump.

Hi cegger.
 1.18 16-Aug-2009  skrll KNF
 1.17 10-Aug-2009  martin Use __sparc_v9__ instead of __sparc64__ - this hack is due to arch dependend
pmap peculiarities, and does not cover sparc64 code when compiled
with -m32.
 1.16 09-Aug-2009  skrll Fix vax.

Built by default options really should be tested better.
 1.15 08-Aug-2009  pooka arm32 (but not arm26) wants to be different and #define pmap_remove()
as pmap_do_remove(). Compensate.
 1.14 06-Aug-2009  pooka Add suicidal stubs for pmap_enter() and pmap_remove(). Hopefully
the MD bits for all the glorious archs went right.
 1.13 30-Apr-2009  skrll Update to deal with the new hppa pmap.
 1.12 23-Jan-2009  pooka branches: 1.12.2;
Add a compile-time option to use kmem/vmem/pools from the kernel
sources instead of homegrown allocators. Default to "on", even
though they appear to be a few percent slower at least on short
jobs (e.g. untar to tmpfs).
 1.11 17-Jan-2009  pooka #ifdef __powerpc__ -> #ifdef PPC_OEA in previous. Forgot that powerpc
has 57 billion different pmaps.
(not compile-tested for a full build)
 1.10 14-Jan-2009  pooka Stub out some ppc routines to allow the evbppc build to pass through here.
 1.9 18-Dec-2008  pooka __KERNEL_RCSID
 1.8 15-Dec-2008  pooka Also assign a value to pmap_extract_p.
(3rd time's the charm, maybe i finally got it right?)
 1.7 15-Dec-2008  pooka Fix another error in sparc pmap_extract_p, as prompted by mrg
 1.6 13-Dec-2008  pooka * fix pmap_extract() prototype
* sparc64 also defines __sparc__. deal with it
 1.5 12-Dec-2008  pooka Add a few MD ifdefs into the rump pmap stubs to enable us to get
rid of the local pmap.h and unify the pmap ABI with the kernel.
(XXX: compiles but doesn't work on vax)

Thanks once again to Greg Oster for helping with testbuilds.
 1.4 10-Dec-2008  pooka Make kernel_pmap_ptr a const. Requested by steve_martin.
 1.3 09-Dec-2008  pooka Make pmap_kernel() a MI macro for struct pmap *kernel_pmap_ptr,
which is now the "API" provided by the pmap module. pmap_kernel()
remains as the syntactic sugar.

Bonus cosmetics round: move all the pmap_t pointer typedefs into
uvm_pmap.h.

Thanks to Greg Oster for providing cpu muscle for doing test builds.
 1.2 15-Oct-2008  pooka branches: 1.2.2;
Add support bits necessary for rumpnet functionality.
 1.1 09-Aug-2007  pooka branches: 1.1.2; 1.1.4; 1.1.8; 1.1.14; 1.1.30; 1.1.34; 1.1.40;
* compile subr_time.c from kern/
* some pmap stubs
 1.1.40.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.1.40.1 19-Oct-2008  haad Sync with HEAD.
 1.1.34.4 11-Aug-2010  yamt sync with head.
 1.1.34.3 11-Mar-2010  yamt sync with head
 1.1.34.2 19-Aug-2009  yamt sync with head.
 1.1.34.1 04-May-2009  yamt sync with head.
 1.1.30.1 17-Jan-2009  mjf Sync with HEAD.
 1.1.14.2 02-Nov-2007  joerg Reduce diff to HEAD by adding files forgotten in early merges.
 1.1.14.1 09-Aug-2007  joerg file pmap_stub.c was added on branch jmcneill-pm on 2007-11-02 12:43:52 +0000
 1.1.8.2 03-Sep-2007  yamt sync with head.
 1.1.8.1 09-Aug-2007  yamt file pmap_stub.c was added on branch yamt-lazymbuf on 2007-09-03 14:45:32 +0000
 1.1.4.2 20-Aug-2007  ad Sync with HEAD.
 1.1.4.1 09-Aug-2007  ad file pmap_stub.c was added on branch vmlocking on 2007-08-20 22:07:29 +0000
 1.1.2.2 15-Aug-2007  skrll Sync with HEAD.
 1.1.2.1 09-Aug-2007  skrll file pmap_stub.c was added on branch nick-csl-alignment on 2007-08-15 13:50:39 +0000
 1.2.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.2.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.12.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.23.4.2 05-Mar-2011  rmind sync with head
 1.23.4.1 03-Jul-2010  rmind sync with head
 1.23.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.24.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.24.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.25.18.1 18-May-2014  rmind sync with head
 1.25.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.25.4.1 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.16 04-Nov-2009  pooka Pull all relegating memory allocators under a common roof in memalloc.c
 1.15 13-Sep-2009  pooka remove pool link set attach code
 1.14 03-Jun-2009  pooka pool_prime emulation
 1.13 24-Apr-2009  pooka * init pool linksets, makes proplib work. reported by Arnaud Ysmal.
(linksets, sigh)
* reduce #ifdef for RUMP_USE_REAL_ALLOCATORS
 1.12 23-Jan-2009  pooka branches: 1.12.2;
Add a compile-time option to use kmem/vmem/pools from the kernel
sources instead of homegrown allocators. Default to "on", even
though they appear to be a few percent slower at least on short
jobs (e.g. untar to tmpfs).
 1.11 18-Dec-2008  pooka __KERNEL_RCSID
 1.10 14-Oct-2008  pooka branches: 1.10.2;
score some stubs
 1.9 04-Aug-2008  pooka Add support for using real kmem/vmem. Don't enable it by default,
though, since it a) is a lot of unnecessary indirection in rump
b) requires callouts which are so far unimplemented.
 1.8 29-Jul-2008  pooka Install rump libraries and utilities to the base system and remove the
private non-installed build infrastructure from sys/rump.

breakdown of commit:
* install relevant headers into /usr/include/rump
* build sys/rump/librump/rumpuser and sys/rump/librump/rumpkern
from src/lib and install as librumpuser and librump, respectively
+ this retains the ability to test a librump build with just the
kernel sources at hand
* move sys/rump/fs/lib/libukfs and sys/rump/fs/lib/libp2k to src/lib
for general consumption, they are not kernel-space dwellers anyway
* build and install sys/rump/fs/lib/lib$fs as librumpfs_$fs
* add chapter 3 manual pages for rump, rumpuser, ukfs and p2k
* build and install userspace kernel file system daemons if MKPUFFS=yes
is spexified
* retire fsconsole for now, it will make a comeback with an actually
implemented version shortly
 1.7 23-Mar-2008  rmind branches: 1.7.4; 1.7.6; 1.7.8; 1.7.10;
pool_cache_init: Remove the alignment of pc according to the CACHE_LINE_SIZE,
which is not useful for rump. This fixes the pool_cache_destroy() which was
freeing the modified pointer, instead of the original one.

OK by <pooka>.
 1.6 03-Jan-2008  pooka branches: 1.6.6;
Theoretically this is supposed to be interchangeable with real
kernel code. Use kmem_alloc/free instead of some wily homerolled
rump interfaces for memory allocation.
 1.5 02-Jan-2008  pooka Add the ability to run puffs in userspace. This means that puffs
can now be developed in userspace using puffs for development
(I hate emulators, they are annoyingly clumsy).

To e.g. mount psshfs using puffs-on-puffs, run fs/bin/syspuffs/syspuffs
with the regular mount_psshfs command line as an argument:

golem> ./syspuffs /usr/sbin/mount_psshfs ftp.netbsd.org:/pub /puffs

This will make the mount appear as usual, with the exception that the
requests will be passed through puffs both in the kernel and userspace:

ftp.netbsd.org:/pub on /puffs type puffs|p2k|puffs|psshfs
 1.4 07-Nov-2007  pooka branches: 1.4.6;
fix pool cache line alignment code (hi ad)
 1.3 07-Nov-2007  ad Merge from vmlocking:

- pool_cache changes.
- Debugger/procfs locking fixes.
- Other minor changes.
 1.2 14-Aug-2007  pooka branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8; 1.2.12; 1.2.14; 1.2.16;
Kill handrolled buffercache and use vfs_bio from the kernel. This is
mostly to get the flag jungle in sync with the kernel.
 1.1 05-Aug-2007  pooka branches: 1.1.2;
Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.2 05-Aug-2007  pooka Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.1 05-Aug-2007  pooka file pool.c was added on branch matt-mips64 on 2007-08-05 22:28:10 +0000
 1.2.16.2 18-Feb-2008  mjf Sync with HEAD.
 1.2.16.1 19-Nov-2007  mjf Sync with HEAD.
 1.2.14.3 11-Nov-2007  joerg Sync with HEAD.
 1.2.14.2 02-Nov-2007  joerg Reduce diff to HEAD by adding files forgotten in early merges.
 1.2.14.1 14-Aug-2007  joerg file pool.c was added on branch jmcneill-pm on 2007-11-02 12:43:53 +0000
 1.2.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.2.8.5 24-Mar-2008  yamt sync with head.
 1.2.8.4 21-Jan-2008  yamt sync with head
 1.2.8.3 15-Nov-2007  yamt sync with head.
 1.2.8.2 03-Sep-2007  yamt sync with head.
 1.2.8.1 14-Aug-2007  yamt file pool.c was added on branch yamt-lazymbuf on 2007-09-03 14:45:32 +0000
 1.2.6.2 09-Jan-2008  matt sync with HEAD
 1.2.6.1 08-Nov-2007  matt sync with -HEAD
 1.2.4.2 20-Aug-2007  ad Sync with HEAD.
 1.2.4.1 14-Aug-2007  ad file pool.c was added on branch vmlocking on 2007-08-20 22:07:29 +0000
 1.2.2.2 15-Aug-2007  skrll Sync with HEAD.
 1.2.2.1 14-Aug-2007  skrll file pool.c was added on branch nick-csl-alignment on 2007-08-15 13:50:40 +0000
 1.4.6.2 08-Jan-2008  bouyer Sync with HEAD
 1.4.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.6.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.6.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.6.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.7.10.1 19-Oct-2008  haad Sync with HEAD.
 1.7.8.1 31-Jul-2008  simonb Sync with head.
 1.7.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.7.4.4 11-Mar-2010  yamt sync with head
 1.7.4.3 16-Sep-2009  yamt sync with head
 1.7.4.2 20-Jun-2009  yamt sync with head
 1.7.4.1 04-May-2009  yamt sync with head.
 1.10.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.10.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.10.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.12.2.2 23-Jul-2009  jym Sync with HEAD.
 1.12.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.12 02-Dec-2014  pooka branches: 1.12.16;
most of this manpage moved to rumpkernel.7, so simplify a lot
 1.11 09-Nov-2014  pooka branches: 1.11.2;
Move rump kernel man pages from various sources to sys/rump

namely:
* src/lib is used only when building for POSIX'y platforms, but
the man pages have their use for all platforms
* rumpuser.3 is a function of the rump kernel, not one of the of
the POSIX'y implementation hosted in src/lib/librumpuser

no functional change
 1.10 27-Aug-2010  pooka Move the manpage from the kernel sources into lib, 'cause that's
where it's used.
 1.9 26-Aug-2010  pooka update a bit
 1.8 11-May-2010  pooka drop silly backronym. just rump.
 1.7 02-May-2010  pooka ABC2010 paper
 1.6 19-Oct-2009  pooka branches: 1.6.2; 1.6.4;
add Arnaud's EuroBSDCon paper
 1.5 30-Jun-2009  pooka add reference
 1.4 28-May-2009  wiz Use Nx for NetBSD.
 1.3 24-May-2009  pooka Add BSDCan 2009 paper to SEE ALSO.
 1.2 22-Mar-2009  pooka branches: 1.2.2;
reference to ABC2009 paper
 1.1 28-Jul-2008  pooka branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.10; 1.1.16;
Backup some manual page sketches lest I delete the wrong source tree.
 1.1.16.2 23-Jul-2009  jym Sync with HEAD.
 1.1.16.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.1.10.1 28-Apr-2009  skrll Sync with HEAD.
 1.1.8.2 19-Oct-2008  haad Sync with HEAD.
 1.1.8.1 28-Jul-2008  haad file rump.3 was added on branch haad-dm on 2008-10-19 22:18:06 +0000
 1.1.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.1.6.1 28-Jul-2008  mjf file rump.3 was added on branch mjf-devfs2 on 2008-09-28 10:41:03 +0000
 1.1.4.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.1.4.1 28-Jul-2008  wrstuden file rump.3 was added on branch wrstuden-revivesa on 2008-09-18 04:37:04 +0000
 1.1.2.2 31-Jul-2008  simonb Sync with head.
 1.1.2.1 28-Jul-2008  simonb file rump.3 was added on branch simonb-wapbl on 2008-07-31 04:51:05 +0000
 1.2.2.7 09-Oct-2010  yamt sync with head
 1.2.2.6 11-Aug-2010  yamt sync with head.
 1.2.2.5 11-Mar-2010  yamt sync with head
 1.2.2.4 18-Jul-2009  yamt sync with head.
 1.2.2.3 20-Jun-2009  yamt sync with head
 1.2.2.2 04-May-2009  yamt sync with head.
 1.2.2.1 22-Mar-2009  yamt file rump.3 was added on branch yamt-nfs-mp on 2009-05-04 08:14:29 +0000
 1.6.4.2 05-Mar-2011  rmind sync with head
 1.6.4.1 30-May-2010  rmind sync with head
 1.6.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.6.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.11.2.1 06-Apr-2015  skrll Sync with HEAD
 1.12.16.2 03-Dec-2017  jdolecek update from HEAD
 1.12.16.1 02-Dec-2014  jdolecek file rump.3 was added on branch tls-maxphys on 2017-12-03 11:39:16 +0000
 1.361 05-Oct-2023  ad Arrange to update cached LWP credentials in userret() rather than during
syscall/trap entry, eliminating a test+branch on every syscall/trap.

This wasn't possible in the 3.99.x timeframe when l->l_cred came about
because there wasn't a reliable/timely way to force an ONPROC LWP running on
a remote CPU into the kernel (which is just about the only new thing in
this scheme).
 1.360 23-Sep-2023  ad Repply this change with a couple of bugs fixed:

- Do away with separate pool_cache for some kernel objects that have no special
requirements and use the general purpose allocator instead. On one of my
test systems this makes for a small (~1%) but repeatable reduction in system
time during builds presumably because it decreases the kernel's cache /
memory bandwidth footprint a little.
- vfs_lockf: cache a pointer to the uidinfo and put mutex in the data segment.
 1.359 12-Sep-2023  ad Back out recent change to replace pool_cache with then general allocator.
Will return to this when I have time again.
 1.358 10-Sep-2023  ad - Do away with separate pool_cache for some kernel objects that have no special
requirements and use the general purpose allocator instead. On one of my
test systems this makes for a small (~1%) but repeatable reduction in system
time during builds presumably because it decreases the kernel's cache /
memory bandwidth footprint a little.
- vfs_lockf: cache a pointer to the uidinfo and put mutex in the data segment.
 1.357 05-Aug-2023  riastradh Revert "rump: Set mp_online = true and start threads _after_ cold = 0."

This breaks some tests, e.g. dev/scsipi/t_cd:noisyeject, which relies
on config_finalize to wait for driver threads. Trouble is, the
actual setting of cold=0 happens near the call to config_finalize in
RUMP__FACTION_DEV. Need to think harder about this.
 1.356 05-Aug-2023  riastradh rump: Set mp_online = true and start threads _after_ cold = 0.

Otherwise we may have threads running while cold, which is a
contradiction in terms.

Deferring mp_online = true is necessary because things like xcall(9)
use rely on it to decide whether to wait for threads on other CPUs.
 1.355 28-Mar-2022  christos no need to include suser; it gets autoloaded as a module.
 1.354 28-Mar-2022  riastradh sys: Split struct device into a private device_impl.h.

Include this only inside autoconf itself, and a few files that abuse
autoconf in ways I can't confidently make easy fixes for.

XXX kernel ABI change requires bump -- no more use of struct device
internals allowed, previously done by some drivers
 1.353 17-Jan-2021  chs rump_component_init() is called recursively, so LIST_FOREACH_SAFE is not
actually safe, since the recursive calls can result in elements other than
the current element being removed from the list. instead use an explicit
marker element to do safe list traversal.
 1.352 16-Jan-2021  chs remove a const to allow building with QUEUEDEBUG.
 1.351 06-Dec-2020  skrll Fix build after interval timers refectoring by thorpej@
 1.350 04-Nov-2020  christos PR/55781: Ruslan Nikolaev: rump_init() does differentiate when all CPUs are
initialized
 1.349 11-Jun-2020  kamil branches: 1.349.2;
Follow the syscall() logic and mask unsupported syscall ranges in rump

Avoids invalid pointer dereference from too large syscall numbers.
 1.348 23-May-2020  ad Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.347 30-Apr-2020  riastradh Rewrite entropy subsystem.

Primary goals:

1. Use cryptography primitives designed and vetted by cryptographers.
2. Be honest about entropy estimation.
3. Propagate full entropy as soon as possible.
4. Simplify the APIs.
5. Reduce overhead of rnd_add_data and cprng_strong.
6. Reduce side channels of HWRNG data and human input sources.
7. Improve visibility of operation with sysctl and event counters.

Caveat: rngtest is no longer used generically for RND_TYPE_RNG
rndsources. Hardware RNG devices should have hardware-specific
health tests. For example, checking for two repeated 256-bit outputs
works to detect AMD's 2019 RDRAND bug. Not all hardware RNGs are
necessarily designed to produce exactly uniform output.

ENTROPY POOL

- A Keccak sponge, with test vectors, replaces the old LFSR/SHA-1
kludge as the cryptographic primitive.

- `Entropy depletion' is available for testing purposes with a sysctl
knob kern.entropy.depletion; otherwise it is disabled, and once the
system reaches full entropy it is assumed to stay there as far as
modern cryptography is concerned.

- No `entropy estimation' based on sample values. Such `entropy
estimation' is a contradiction in terms, dishonest to users, and a
potential source of side channels. It is the responsibility of the
driver author to study the entropy of the process that generates
the samples.

- Per-CPU gathering pools avoid contention on a global queue.

- Entropy is occasionally consolidated into global pool -- as soon as
it's ready, if we've never reached full entropy, and with a rate
limit afterward. Operators can force consolidation now by running
sysctl -w kern.entropy.consolidate=1.

- rndsink(9) API has been replaced by an epoch counter which changes
whenever entropy is consolidated into the global pool.
. Usage: Cache entropy_epoch() when you seed. If entropy_epoch()
has changed when you're about to use whatever you seeded, reseed.
. Epoch is never zero, so initialize cache to 0 if you want to reseed
on first use.
. Epoch is -1 iff we have never reached full entropy -- in other
words, the old rnd_initial_entropy is (entropy_epoch() != -1) --
but it is better if you check for changes rather than for -1, so
that if the system estimated its own entropy incorrectly, entropy
consolidation has the opportunity to prevent future compromise.

- Sysctls and event counters provide operator visibility into what's
happening:
. kern.entropy.needed - bits of entropy short of full entropy
. kern.entropy.pending - bits known to be pending in per-CPU pools,
can be consolidated with sysctl -w kern.entropy.consolidate=1
. kern.entropy.epoch - number of times consolidation has happened,
never 0, and -1 iff we have never reached full entropy

CPRNG_STRONG

- A cprng_strong instance is now a collection of per-CPU NIST
Hash_DRBGs. There are only two in the system: user_cprng for
/dev/urandom and sysctl kern.?random, and kern_cprng for kernel
users which may need to operate in interrupt context up to IPL_VM.

(Calling cprng_strong in interrupt context does not strike me as a
particularly good idea, so I added an event counter to see whether
anything actually does.)

- Event counters provide operator visibility into when reseeding
happens.

INTEL RDRAND/RDSEED, VIA C3 RNG (CPU_RNG)

- Unwired for now; will be rewired in a subsequent commit.
 1.346 25-Apr-2020  bouyer Merge the bouyer-xenpvh branch, bringing in Xen PV drivers support under HVM
guests in GENERIC.
Xen support can be disabled at runtime with
boot -c
disable hypervisor
 1.345 23-Apr-2020  joerg rump doesn't own pnbuf_cache, externalize it
 1.344 23-Mar-2020  pgoyette branches: 1.344.2;
Don't attempt to detach an evcnt before attaching it. If its not
already attached, we will panic.

It turns out that this check wasn't really needed anyway, it was
simply paranoia on my part.

Thanks to hannken@ for bringing this to my attention.
 1.343 22-Mar-2020  pgoyette Teach rump to process __link_set_evcnts entries. (Second part of
fix for PR kern/55088)
 1.342 22-Feb-2020  ad rump_init(): need to call config_init() now.

PR kern/55004 (Hundreds of file system tests now fail on real hardware)
 1.341 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.340 10-Feb-2020  riastradh Initialize struct cpu_info::ci_cpuname (= ci_data.cpu_name) in rump.
 1.339 02-Jan-2020  thorpej branches: 1.339.2;
- Eliminate the global "boottime" variable, which was being accessed
without any synchronization against changes by e.g. clock_settime().
- Replace with new getbinboottime() / getnanoboottime() / getmicroboottime()
functions (naming mirrors that of other time access functions in kern_tc.c).
It returns the (maybe-converted) value of timebasebin, which also tracks
our estimate of when the system was booted (i.e. the legacy "boottime" was
redundant).

XXX There needs to be a lockless synchronization mechanism for reading
timebasebin, but this is a problem in kern_tc.c that pre-existed these
"boottime" changes. At least now the problem is centralized in one location.
 1.338 15-Dec-2019  pgoyette Initialize the module_hook synchronization variables in rump, too.

Fixes recently reported test failures for dev/sysmon/t_swsensor
and net/if_vlan/t_vlan
 1.337 07-Dec-2019  riastradh Restore call to pserialize_init.

We need it after all for psz_lock on the event counter.
 1.336 03-Dec-2019  riastradh Rip out pserialize(9) logic now that the RCU patent has expired.

pserialize_perform() is now basically just xc_barrier(XC_HIGHPRI).
No more tentacles throughout the scheduler. Simplify the psz read
count for diagnostic assertions by putting it unconditionally into
cpu_info.

From rmind@, tidied up by me.
 1.335 15-Oct-2019  christos Add a function cast for enosys
 1.334 17-May-2019  ozaki-r Implement an aggressive psref leak detector

It is yet another psref leak detector that enables to tell where a leak occurs
while a simpler version that is already committed just tells an occurrence of a
leak.

Investigating of psref leaks is hard because once a leak occurs a percpu list of
psref that tracks references can be corrupted. A reference to a tracking object
is memorized in the list via an intermediate object (struct psref) that is
normally allocated on a stack of a thread. Thus, the intermediate object can be
overwritten on a leak resulting in corruption of the list.

The tracker makes a shadow entry to an intermediate object and stores some hints
into it (currently it's a caller address of psref_acquire). We can detect a
leak by checking the entries on certain points where any references should be
released such as the return point of syscalls and the end of each softint
handler.

The feature is expensive and enabled only if the kernel is built with
PSREF_DEBUG.

Proposed on tech-kern
 1.333 29-Mar-2019  christos fix the build (pnbuf_cache move to vfs_init.c)
 1.332 26-Dec-2018  thorpej Rather than performing lazy initialization, statically initialize early
in the respective kernel startup routines.
 1.331 09-Jan-2018  msaitoh branches: 1.331.2; 1.331.4;
Set mp_online = ture. I don't know the "best" location to set it true.
This change might fix PR#52886.
 1.330 21-Nov-2017  ozaki-r Implement debugging feature for pserialize(9)

The debugging feature detects violations of pserialize constraints.
It causes a panic:
- if a context switch happens in a read section, or
- if a sleepable function is called in a read section.

The feature is enabled only if LOCKDEBUG is on.

Discussed on tech-kern@
 1.329 08-Mar-2016  joerg branches: 1.329.2; 1.329.8; 1.329.10;
Align the message buffer. The kernel routines normally are used only
with page aligned buffers and they assume at least pointer alignment. Be
defensive here and align to 256 Bytes.
 1.328 08-Feb-2016  pooka Allocate struct cpu_info dynamically. Saves quite a lot of BSS in the
common case and reduces rump kernel memory requirements by 10% or more
in really tiny deployments.
 1.327 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.326 18-Jan-2016  pooka Fix dlopen()/dlclose()+RUMP_USE_CTOR to not leave dangling pointers around.
 1.325 31-Aug-2015  ozaki-r Allow rumpkernel to use rw_obj_*
 1.324 25-Aug-2015  pooka initialize ncpuonline
 1.323 25-Aug-2015  pooka remove mksysctls(), now provided by init_sysctl_base
 1.322 07-Jul-2015  justin Move hw.machine and hw.machine_arch sysctls to base so rump can use them

This allows uname(3) and uname(1) to work on rump kernels.
 1.321 08-Jun-2015  pooka Allow device components to create symlinks in /dev
e.g. /dev/audio -> audio0

from Robert Millan <rmh@freebsd.org> via rumpkernel-users
 1.320 20-May-2015  pooka call loginit() later, a lot later
 1.319 22-Apr-2015  pooka Define rump_nativeabi_p() under arch, where one would logically expect
it to be defined.
 1.318 17-Apr-2015  pooka set the local clients' comm to "rumplocal" instead of "system"
 1.317 13-Apr-2015  riastradh Convert remaining MI <sys/rnd.h> stragglers. Many MD ones left.
 1.316 06-Feb-2015  maxv Kill kmeminit().
 1.315 07-Jan-2015  pooka Move sysproxy support into a separate component, rumpkern_sysproxy,
instead of it being always provided by the rump kernel base. This
move accomplishes two things:

1) it is no longer necessary to provide sysproxy hypercall stubs for
platforms which do not want to use sysproxy
2) it is easier to reason about the security aspects, since configurations
not linking the sysproxy component simply do not support remote
system calls

discussed on rumpkernel-users
 1.314 04-Jan-2015  pooka Extend RUMP_USE_CTOR to SYSCTL_SETUP(), similar to what is already
done in MODULE(). The sysctl tree nodes from all components which
were loaded when rump_init() was called now get created -- mimics the
monolithic kernel.

No change to the monolithic kernel.
 1.313 03-Jan-2015  pooka Put all sysproxy routines to their own C module, sysproxy.c
 1.312 25-Aug-2014  pooka branches: 1.312.2;
Remove and obsolete rumpkern_time as a separate component.
 1.311 25-Aug-2014  pooka No longer create a special process context to fork remote clients off
of, simply always rfork off of proc1 closing all descriptors, and have
the rump kernel open 0/1/2 if the parent process is "1".

Fixes tests/rump/rumpkernel/t_sp, which was failing since the
abovementioned special process change due to attempting to deliver a
signal to the special process and the special process was not equipped
to handle one.
 1.310 14-Aug-2014  riastradh Restore placement of percpu_init in rump_init.

Probably doesn't matter, but let's avoid needless churn around the
real bug fix.
 1.309 14-Aug-2014  riastradh Defer cprng_fast_init until CPUs are detected.
 1.308 11-Aug-2014  ozaki-r branches: 1.308.2;
Do cprng_fast_init in rump_init

It fixes rump bootup failure:
panic: kernel diagnostic assertion "off < percpu_nextoff" failed:
file "/usr/src/lib/librump/../../sys/rump/../kern/subr_percpu.c", line 76
 1.307 29-Jun-2014  justin Change assertion as rump_component_load may be called before curlwp available
 1.306 13-Jun-2014  pooka Add rump_boot_etfs_register(), which can be used to specify etfs
nodes that will be available immediately when mountroot is done
and file systems are available.

The intended use is for example for firmware images to be available when
config_mountroot() hooks run.
 1.305 25-May-2014  pooka Call biodone() in the bdev_strategy() error via a pointer. Decouples
subr_devsw from VFS -- not that I/O buffers are _VFS_ entities -- and
eliminates the last weak alias from librump, which means things now
fully work on glibc (w/o LD_DYNAMIC_WEAK) and musl.

The whole code path is suspect anyway, since nothing prevents the device
from escaping after the lookup, suggesting that the whole error path
should be handled by the caller, but oh well.
 1.304 27-Apr-2014  pooka Eliminate weak symbols from rump kernel syscall handlers, part 4:

Do not query system call handlers by using the rumpuser_dl_globalsym()
hypercall -- it will not work in environments which are not in control
of their own symbols (e.g. rumpuser-xen). Instead, provide
rump_syscall_boot_establish(), which component constructors can use
to establish their non-modular syscalls.
 1.303 26-Apr-2014  pooka kill weak aliases which are no longer necessary
 1.302 25-Apr-2014  pooka cpu_reboot() is more of an emul.c thing than a rump.c thing
 1.301 25-Apr-2014  pooka gardenize rump.c: move data structure helper routines to accessors.c
 1.300 25-Apr-2014  pooka gardenizing rump.c: move rump_lockdebug to locks.c
 1.299 25-Apr-2014  pooka Init function pointers to nullop() so that callers don't need a dance
 1.298 25-Apr-2014  pooka g/c no longer necessary weak alias
 1.297 25-Apr-2014  pooka Move the etfs linkage from rumpvfs to rumpkern, and replace the
weak alias show with an honest pointer indirection.

No client-visible change. (apart from this version working e.g.
on musl w/ dlopen)
 1.296 23-Apr-2014  pooka Add a RUMP_USE_CTOR compile-time switch. If defined, use
__attribute__((constructor)) to determine which rump kernel components
and kernel modules are linked into the rump kernel. If not defined
(default), use the regular approach with link sets.

This option is aimed to fix problems with toolchains where using link
sets is not possible because the linker does not generate the requisite
__start/__stop symbols for the link set sections (e.g. GNU gold, OS X, ...).
 1.295 23-Apr-2014  pooka Include LIST_ENTRY() in "struct rump_component".

Main benefit: rump_component_load() can now be called from an
early-running constructor since the routine doesn't need to allocate
memory.
 1.294 09-Apr-2014  pooka implement lwp_create() and a few related interfaces.
main raison d'impalerment: the aio driver
 1.293 09-Apr-2014  pooka initialize exec_lock
 1.292 02-Apr-2014  pooka branches: 1.292.2;
Put nanosleep() and folks in librump instead of maintaining them in
the separate rumpkern_time component. Keeping time-related routines
elsewhere lead to some illogical behavior if you didn't think of linking
in rumpkern_time (hands up everyone who checks the return value of
nanosleep()).

Add warnings if rumpkern_time is linked or used. I'll remove it in a
month or two instead of now since it was part of a buildrump.sh snapshot
and it's nicer if trying to use it gives a warning instead of an error
in the next snapshot.

"everything should be as modular as possible, but no more modular than that"
 1.291 20-Mar-2014  christos kill sprintf
 1.290 15-Mar-2014  pooka Allow compile-time optimizations to curlwp. This can have a pretty
staggering impact on performance. When running sendto() in a loop,
the improvement is 200k more calls per second with an inlined __thread
curlwp as opposed to the default. In other words, it shaves off hundreds
of CPU cycles per call (~20%). Even just eliminating the x86_curlwp()
call in favor of an inline gives an improvement of 60k calls per second.
 1.289 10-Mar-2014  pooka rump_getversion() does not require a thread context, so make it a straight
call instead of being wrapped around rump_pub_getversion().
 1.288 10-Mar-2014  pooka Move the "is arch capable of loading native kernel modules into
rump kernel" clauses from bsd.own.mk to Makefile.rump. Also,
add a rump_nativeabi_p() call to determine if rump kernel is
compiled with native ABI support.
 1.287 28-Feb-2014  skrll G/C sys/simplelock.h includes
 1.286 25-Feb-2014  pooka Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.285 25-Feb-2014  justin Add kern.{ostype,osrelease,osrevision,version} kern.domainname,
kern.rawpartition sysctl support to rump kernel.
Moved the sysctl support that is shared between rump and normal
kernels to init_sysctl_base.c as rump cannot use init_sysctl.c
in order to avoid code duplication. Agreed with pooka@.
 1.284 29-Jan-2014  pooka lwp0 needs l_proc set for panic->cpu_reboot to dump core the right way
 1.283 17-Jan-2014  pooka sysctl_init needs to be pretty much at the top of main()
 1.282 17-Jan-2014  pooka Use subr_cprng.c instead of stub implementation. Rijndael migrates from
rumpkern_crypto to rumpkern due to it being mandatory for cprng.
 1.281 16-Dec-2013  pooka Translate return values for emulations, e.g. Linux. For ports without
__HAVE_MINIMAL_EMUL, we simply look up the values from p->p_emul->e_errno.
For ports which cannot afford to keep an extra pointer per emul structure
around, we hope there is __HAVE_SYSCALL_INTERN support and thread the
errno values through p_emuldata. Notably, we cannot alter the syscall
method like most ports do with syscall_intern, since they do it via
p_mdproc, so MI code is not possible there.
 1.280 09-Dec-2013  pooka Make ktrace a compile-time option
 1.279 09-Dec-2013  pooka need ktrace.h now
 1.278 09-Dec-2013  pooka Support ktrace for rump kernels.

Requested by Justin Cormack on rumpkernel-users.
 1.277 09-Dec-2013  pooka Use sy_invoke() instead of sy_call() directly.
 1.276 18-Nov-2013  njoly Do lwp0 initialisation as early as possible, right after
rumpuser_init(). This makes rump applications work again when
RUMP_LOCKDEBUG is enabled.

ok pooka.
 1.275 09-Sep-2013  pooka Fix minor bug in previous: make sure we come out of rump_init()
without a bound lwp set.
 1.274 07-Sep-2013  pooka Add an initial console device and open fd's 0/1/2 for initproc. This is
again useful in standalone-type environments such as Xen, where all
printf/etc calls go through the rump kernel.
 1.273 04-Sep-2013  pooka Also create hw.pagesize, makes sysconf(_SC_PAGESIZE) return a more
sensible result.
 1.272 03-Sep-2013  pooka Don't autogenerate the wrapper that is called from the rump kernel
local syscall entry points. The wrapper is now so big that it doesn't
get inlined (original intent for having it close to the entry points),
and autogenerating a regular function just loses in flexibility.
 1.271 03-Jul-2013  njoly Make RUMP_LOCKDEBUG work again.
With some help from pooka@.
 1.270 31-May-2013  pooka branches: 1.270.2;
run shutdownhooks
 1.269 15-May-2013  pooka Add RUMPUSER_LWP_CLEAR instead of overloading RUMPUSER_LWP_SET.
This simplifies some alternative hypervisor implementations.
 1.268 02-May-2013  pooka Ok, maybe using int64 for nanoseconds in the (sec,nsec) tuple was
a bit too future-proof. I think long is enough there (let's just
hope nobody redefines "nano"). Also, make seconds signed just in
case someone wants their clock to be in 1901.
 1.267 02-May-2013  pooka Inform the rump kernel hypervisor of valid thread contexts so
that the implementation can allocate and release storage for them
in an optimal fashion, if necessary.
 1.266 30-Apr-2013  pooka Flip parameter order in the clock hypercalls to make them consistent
with everything else wrt in/out parameters.
 1.265 29-Apr-2013  pooka Make rumpuser_dl_bootstrap() optional for platforms which don't
provide dynamic linking.
 1.264 29-Apr-2013  pooka Replace the various "get info from hypervisor" interfaces with one
unified rumpuser_getparam(), and make it return a plist. The
contents can come e.g. from the env or a config file. Make
identifiers starting with an underscore denote system identifiers
which must be implemented by hypervisor. (yea, j/k about the plist bit)
 1.263 29-Apr-2013  pooka Make the rump kernel upcalls which were previous available only to
the sysproxy module available for the entire hypervisor.
 1.262 28-Apr-2013  pooka Improve the time-related hypercalls so that's it's possible to
sleep until an absolute time on the host's monotonic clock (should
something like that be supported).
 1.261 27-Apr-2013  pooka roll mutex init hypercalls into one (one of them already took a flag anyway)
 1.260 27-Apr-2013  pooka wrap unportable register_t with a long. should do it in the front
of the house too, but at least this is a start.
 1.259 27-Apr-2013  pooka Get rid of the rump__init() macro. it was never useful and just makes
debugging less obvious.
 1.258 27-Apr-2013  pooka * integrate rumpuser_getversion() with the hypervisor initialization
* rename some identifiers to better match reality
 1.257 10-Mar-2013  pooka Use kern_malloc.c instead of the relegated allocators in memalloc.c.
Previously this didn't make sense due to the use of kmem_map, but the
new malloc is more dynamic and puts sense into using it.
 1.256 10-Mar-2013  pooka Don't allow kernel threads to run before all CPUs have been initialized
to avoid them getting scheduled on non-initialized CPUs.
 1.255 08-Mar-2013  pooka Ensure that rump kernel component constructors from the main object
get processed. This applies to ones which were linked statically.
Unfortunately, that's where it got a bit tricky, since the dlsym()
interface searches the handle and all its dependencies. For the main
object the list of dependencies includes all the dynamic rump kernel
components that were included when the binary is linked. So, a long
story short, make only one pass through the objects to harvest all the
component entries, weed out the dupes, and initialize components from
an in-memory dupe-free list when so requested.
 1.254 07-Mar-2013  pooka Make the device node creation routines function pointers which default
to nullop without VFS. This relaxes the dependency between VFS and many
components, some of which can be used perfectly fine without VFS.
 1.253 07-Mar-2013  pooka Force references to the component setlist __start/__stop symbols so
that they get generated for rump kernels constructed from static libs.
 1.252 03-Mar-2013  pooka Add a dummy component to ensure that at least one component is present
in every possible rump kernel configuration.
 1.251 19-Feb-2013  martin Stopgap fix to make rump cooperate with pserialize, may be revisited later.
Patch from pooka, ok: rmind. No related regressions in a complete atf test
run (which works again with this, even on non x86 SMP machines).
 1.250 14-Jan-2013  pooka fix typo
 1.249 14-Jan-2013  pooka Don't use __weak_alias where the component framework is sufficient.
 1.248 14-Jan-2013  pooka Add some asserts to component initialization.
 1.247 09-Oct-2012  pooka Gather some statistics about biglock usage.
 1.246 16-Aug-2012  pgoyette branches: 1.246.2;
Use correct routine name - kcpuset_sysinit() vs kcpuset_init()
 1.245 16-Aug-2012  pgoyette We also need kcpuset_init() now.
 1.244 16-Aug-2012  pgoyette It helps to include the declaration of the routine being called.
 1.243 16-Aug-2012  pgoyette Call pserialize_init() during rump start-up, since librump/net/npf
uses it.
 1.242 09-Jun-2012  christos since uidinfo uses sysctl now, move sysctl initialization before it.
 1.241 03-Jun-2012  dsl Fix build now that sysctl_createv() checks its arg type.
 1.240 04-Feb-2012  njoly branches: 1.240.2;
Now that rnd is not optional anymore, add needed rnd_init() for rump.
Fix dev/{scsipi,sysmon} testcases.
 1.239 29-Jan-2012  njoly Move pool subsystem init from rump__init() to uvm_init(), following
kernel code. Fix RUMP_LOCKDEBUG early panic.
 1.238 04-Dec-2011  jym Implement the register/deregister/evaluation API for secmodel(9). It
allows registration of callbacks that can be used later for
cross-secmodel "safe" communication.

When a secmodel wishes to know a property maintained by another
secmodel, it has to submit a request to it so the other secmodel can
proceed to evaluating the request. This is done through the
secmodel_eval(9) call; example:

bool isroot;
error = secmodel_eval("org.netbsd.secmodel.suser", "is-root",
cred, &isroot);
if (error == 0 && !isroot)
result = KAUTH_RESULT_DENY;

This one asks the suser module if the credentials are assumed to be root
when evaluated by suser module. If the module is present, it will
respond. If absent, the call will return an error.

Args and command are arbitrarily defined; it's up to the secmodel(9) to
document what it expects.

Typical example is securelevel testing: when someone wants to know
whether securelevel is raised above a certain level or not, the caller
has to request this property to the secmodel_securelevel(9) module.
Given that securelevel module may be absent from system's context (thus
making access to the global "securelevel" variable impossible or
unsafe), this API can cope with this absence and return an error.

We are using secmodel_eval(9) to implement a secmodel_extensions(9)
module, which plugs with the bsd44, suser and securelevel secmodels
to provide the logic behind curtain, usermount and user_set_cpu_affinity
modes, without adding hooks to traditional secmodels. This solves a
real issue with the current secmodel(9) code, as usermount or
user_set_cpu_affinity are not really tied to secmodel_suser(9).

The secmodel_eval(9) is also used to restrict security.models settings
when securelevel is above 0, through the "is-securelevel-above"
evaluation:
- curtain can be enabled any time, but cannot be disabled if
securelevel is above 0.
- usermount/user_set_cpu_affinity can be disabled any time, but cannot
be enabled if securelevel is above 0.

Regarding sysctl(7) entries:
curtain and usermount are now found under security.models.extensions
tree. The security.curtain and vfs.generic.usermount are still
accessible for backwards compat.

Documentation is incoming, I am proof-reading my writings.

Written by elad@, reviewed and tested (anita test + interact for rights
tests) by me. ok elad@.

See also
http://mail-index.netbsd.org/tech-security/2011/11/29/msg000422.html

XXX might consider va0 mapping too.

XXX Having a secmodel(9) specific printf (like aprint_*) for reporting
secmodel(9) errors might be a good idea, but I am not sure on how
to design such a function right now.
 1.237 01-Dec-2011  tls branches: 1.237.2;
Initialize the kern_cprng in rump startup. Oops.

Should fix some "mysterious" rump test failures. Thanks to Nicholas Joly
for pointing out exactly what was wrong.
 1.236 26-Nov-2011  njoly Do not call cprng_fast32() before locks init. Makes rump build with
RUMP_LOCKDEBUG=yes work again.
 1.235 19-Nov-2011  tls First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.234 22-Mar-2011  pooka branches: 1.234.4;
pnbuf_cache is used all over the place outside of vfs, so put it
in one place to avoid many definitions.
 1.233 21-Mar-2011  pooka Update copyright statements.

no functional change.
 1.232 08-Mar-2011  pooka Nuke all threads belonging to a process calling exec before allowing
the exec handshake to return.

In addition to being The Right Thing To Do, fixes some nasty
conditions for CLOEXEC fd's (or at least does so in theory, I
couldn't create any problems although I tried).
 1.231 15-Feb-2011  pooka Support FD_CLOEXEC in rump kernels.
 1.230 15-Feb-2011  pooka Add an "exec" callback for the proxy code. The client can now
notify the rump kernel of an exec having taken place.
 1.229 10-Feb-2011  pooka zalloc struct vmspace to avoid having one full of garbage
 1.228 03-Feb-2011  pooka weakalias the "withsize" variant of rump_pub_etfs_register too
 1.227 30-Jan-2011  bouyer Move rumpuser_sp_fini() after the kernel has completed shuwdown
(and especially, after filesystems have been unmounted).
This way, rump.halt returns once the rump kernel is really out of the
game, which avoids races issues in test scripts using a rump kernel.
OK pooka@
 1.226 28-Jan-2011  pooka Pass the value of getprogname() from the client to the server and
record it in p_comm. This is nice for things like sockstat, since
they now display the client command name:

pain-rustique:43:~> rump.sockstat
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
root xulrunner- 16 0 tcp 192.168.2.114.65507 204.152.190.12.80
root xulrunner- 16 1 tcp 192.168.2.114.65501 204.152.190.12.80
root xulrunner- 16 2 tcp 192.168.2.114.65500 204.152.190.12.80
root xulrunner- 16 3 tcp 192.168.2.114.65499 204.152.190.12.80
root xulrunner- 16 5 tcp 192.168.2.114.65498 204.152.190.12.80
root xulrunner- 16 6 tcp 192.168.2.114.65497 204.152.190.12.80
root socket 62 0 tcp6 *.http *.*
root socket 62 1 tcp *.http *.*
root socket 63 0 tcp6 *.81 *.*
root socket 63 1 tcp *.81 *.*
 1.225 28-Jan-2011  pooka Don't NULL out l_cpu, l_stat is the new rumpkernel way too.
 1.224 28-Jan-2011  pooka call procinit_sysctl to register the proc sysctl tree
 1.223 28-Jan-2011  pooka Some lwp-walkers expect the correct value for l_stat, so use a flag
in l_flag instead of l_stat for the purpose of flagging lwps in a
dying proc.
 1.222 27-Jan-2011  pooka Fix syscall name for compat syscalls. Arguably makesyscalls.sh
should generate the right info, but it's easier to fix here now.

This fixes compat syscalls for rump servers with dynamically loaded
components. Since the compat syscall revamp a little time ago e.g.
stat() didn't work on my system (which is 5.0-based) with e.g.
rump_server -lrumpvfs. Static servers and non-compat syscalls
worked just fine, though, making this a little harder to spot that
the usual bug.
 1.221 22-Jan-2011  pooka inverse inversely incorrect comment
 1.220 22-Jan-2011  pooka In case sys_reboot() was called by a remote client, put the response
in the socket before we shut down. This way the response to the
syscall travels to the caller and they know things worked correctly
instead of having to just assume.
 1.219 12-Jan-2011  pooka branches: 1.219.2; 1.219.4;
When the client and the rump kernel are the same host process, all
threads blocking in the kernel automatically exit when the process
exists. However, for the sysproxy case this does not hold.
Typically it's ~harmless, but e.g. in the case of socket binding
following by poll it gets annoying.

Introduce sysproxy procexit, which wakes up all threads blocking
on a condition when a process's communication socket is closed.
The code is a little different from the regular kernel simply
because in a rump kernel l_mutex is not available at all times
(this is because scheduling happens on every kernel entry and exit,
and that path must be kept lockless for any reasonable performance).
Instead, use gating which makes sure all threads are either out of
the cv code or suspended in a well-known state. Then, wake up the
threads and tell them to get the hell out of our galaxy.
 1.218 07-Jan-2011  pooka Avoid double init of tty_lock if rumpkern_tty is included. LOCKDEBUG
does not tolerate double inits.

pointed out by njoly
 1.217 06-Jan-2011  pooka give the outside world some idea of if we have LOCKDEBUG or not
 1.216 06-Jan-2011  pooka Support LOCKDEBUG. To use it, compile sys/rump with RUMP_LOCKDEBUG=yes.

requested by martin (sparc64 gdb cannot reliably produce a stack trace)
 1.215 04-Jan-2011  pooka Add SMP support for all architectures.

tested on sparc64 by martin
 1.214 02-Jan-2011  pooka There is a use case where preserving the parent's fd table is
relevant, so to accommodate that change rump_lwproc_newproc() to
rump_lwproc_rfork(). The new interface has the rfork() fd table
semantics. The equivalent of rump_lwproc_newproc() is
rump_lwproc_rfork(RUMP_RFCFDG).
 1.213 30-Dec-2010  pooka Requery syscall handlers during rump kernel init. This fixes
syscalls provided by a rump faction such as rumpvfs when the library
is not linked into the binary, but is dlopen()'d before calling
rump_init().
(it is illegal to dlopen() a faction after rump_init(), but syscalls
maybe be added the usual way with modules)

rump_server(1) -lstuff works now.
 1.212 16-Dec-2010  pooka Print a banner a connecting client. The banner contains rump sp
protocol version, os name, os revision and machine.
 1.211 13-Dec-2010  pooka stubs to make life easier
 1.210 12-Dec-2010  pooka Call rumpuser_sp_fini() from cpu_reboot() to make sure sys_reboot
with RB_HALT does not hang.
 1.209 12-Dec-2010  pooka print a bit more diagnostics when halting
 1.208 01-Dec-2010  pooka Track lwp as the rumpuser mutex owner instead of pthread_t (this
is done in rumpuser for simplicity, since on the kernel side things
we assume we have only one pointer of space). As a side-effect,
we can no longer know if the current thread is holding on to a
mutex locked without curlwp context (basically all mutexes inited
outside of mutex_init()). The only thing that called rumpuser_mutex_held()
for a non-kmutex was the giant lock. So, instead implement recursive
locking for the giant lock in the rump kernel and get rid of the
now-unused recursive pthread mutex in the hypercall interface.
 1.207 30-Nov-2010  pooka Require server to be explicitly initialized with rump_init_server(url).
Also, add rump_daemonize_begin() / rump_daemonize_end() to help
with the "can't daemon() after pthread_create()" problem. Applications
could accomplish the same, but since it's such a common operation,
provide a little help.
 1.206 22-Nov-2010  pooka Support physio for remote processes.
==> add support for remote vmspace vmapbuf/vunmapbuf
==> add proper support for copyin/out_vmspace
==> add support for remote vmspace uvm_io
==> add support for non-curproc rumpuser_sp_copyin/out
==> store remote context in vm_map->pmap instead of
pthread_specificdata

In short, makes read/write of most (all?) block devices work from
a remote rump client via rump syscalls.
 1.205 21-Nov-2010  pooka Encode smp-capability into the makefile so that it can be used to
avoid potential screwups.
 1.204 21-Nov-2010  pooka Fix situation where we try to configure >MAXCPUS cpus.
 1.203 21-Nov-2010  pooka Realize the >1yo comment above rump_reboot and retire them to make
room for sys_reboot.
 1.202 19-Nov-2010  pooka remove no longer necessary code
 1.201 19-Nov-2010  pooka Pass routines necessary for multithreaded operation down to rumpuser_sp.
 1.200 17-Nov-2010  pooka Remove unused rump_set_vmspace. An equivalent needs to come back
later, though, but in its current form it's just unusable garbage.
 1.199 17-Nov-2010  pooka Provide a special rump_proxy_syscall for handling received proxy
syscalls and retire unused rump_syscall.
 1.198 17-Nov-2010  pooka cleanup some old garbage
 1.197 15-Nov-2010  pooka apply const
 1.196 04-Nov-2010  pooka Refactor the sysproxy code so that rumpuser contains only the server side.
 1.195 01-Nov-2010  pooka Missed a few symbols in previous ...

Also, reorganize rumpuser header inclusion to make sure problem is
caught already by the compiler.
 1.194 01-Nov-2010  pooka Make librumpuser linkage once again free of librump.

problem pointed out by <he>
 1.193 29-Oct-2010  pooka Attach implicit threads to initproc instead of proc0. This way
applications which alter, by purpose or by accident, the uid in an
implicit thread are don't affect kernel threads.

from discussion with njoly
 1.192 28-Oct-2010  pooka Count proc0 as uid 0's process. Besides being the right thing to
do, this effectively allows changing the uid of proc0 without
running into KASSERT problems in uidinfo code (although I'm not
quite so sure changing proc0's uid is the right thing to do ...).

problem reported by njoly
 1.191 27-Oct-2010  pooka Start rework of system call proxying over socket ("sysproxy").
This incarnation is written in the user namespace as opposed to
the previous one which was done in kernel namespace. Also, rump
does all the handshaking now instead of excepting an application
to come up with the user namespace socket.

There's still a lot to do, including making code "a bit" more
robust, actually running different clients in a different process
inside the kernel and splitting the client side library from librump.
I'm committing this now so that I don't lose it, plus it generally
works as long as you don't use it in unexcepted ways: i've tested
ifconfig(8), route(8), envstat(8) and sysctl(8).
 1.190 27-Oct-2010  pooka Remove old crud which is no longer used (since kern_proc).
 1.189 25-Oct-2010  pooka make printed string more accurate
 1.188 07-Sep-2010  pooka Make the Diabolical (Page)Daemon Director drain vfs buffers when
we are short of memory.

There are still some funnies left to iron out. For example, with
a certain file system / memory size configuration it's still not
possible to create enough files to make the file system run out of
inodes before the kernel runs out of memory. Also, with some other
configurations disk access slows down gargantually (though i'm sure
there are >0 buffers available). Anyway, it ~works for now and
it's by no means worse than what it was before.
 1.187 07-Sep-2010  pooka Allocate softint vectors for the final number of CPUs, not the
number currently attached. Deals with a SNAFU in my commit earlier
today which would cause softints established early to lack a
softint context on non-bootstrap CPUs.
 1.186 07-Sep-2010  pooka Attach only one CPU for the bootstrap phase.
 1.185 06-Sep-2010  pooka Use standard uvm aobj pager. Most of the kernel aobj pager complexity
comes from swap handling, but that is included only with VMSWAP.
 1.184 01-Sep-2010  pooka Implement rump_lwproc: the new lwp/proc management routines for
rump. These move the management of the pid/lwpid space from the
application into the kernel, make code more robust, and make it
possible to attach multiple lwp's to non-proc0 processes.
 1.183 30-Aug-2010  pooka * record proc's cred in p_cred too
* account procs for uids
 1.182 26-Aug-2010  pooka print one line of dmesg per cpu present
 1.181 23-Aug-2010  pgoyette Initialize the new kernconfig_lock for rump kernels before it can be used.

Should fix the rather massive breakage in the automated test runs, too.
Sorry for breaking rump.
 1.180 11-Jul-2010  pooka fd_hold() when creating new threads. This makes the fd code use
multithreaded mode and actually work with a multithreaded process.
 1.179 12-Jun-2010  pooka Support rumpkern components and rumpkern components depending on vfs init.
 1.178 10-Jun-2010  pooka Use kern_proc.c instead of a collection of stubs. But what we
really wanted from this commit was the support for proc_specificdata.

TODO: make creating a new process actually use kern_proc and
maybe even add an interface which starts a process with
"any pid you don't like"
 1.177 09-Jun-2010  pooka Version rumpuser ABI with a lightweight mechanism.
 1.176 09-Jun-2010  pooka initialize specificdata for lwp0 too
 1.175 03-Jun-2010  pooka Implement a sort-of pagedaemon: adjust all memory allocators to go
through an in-rumpkernel hypermemory allocator which knows it should
kick the pagedaemon and block in case ``waitok'' memory allocation
fails.

This allows us to recover from some out-of-memory situations.
Realworld'istically speaking (as opposed to whatever "should be"
theory), these OOM situations will happen extremely rarely if ever
when our hypervisor is a regular process. Speculatively, this
should be useful for other types of hosts.

issues remaining:
* the hypervisor does not know how to reclaim kernel memory (and
for the reason I stated above, I'm not sure if it makes sense
to teach the current implementation about that)
* vfs memory (buffers, vm object pages etc.) is not reclaimed
 1.174 02-Jun-2010  pooka rumpvm_init -> uvm_init to get rid of local prototype.
no functional change
 1.173 31-May-2010  pooka Support mtsleep() without a biglocked sleeper (uvm uses this in
UVM_UNLOCK_AND_WAIT())
 1.172 28-May-2010  pooka Improve the CPU scheduler for a host MP system with multithreaded
access. The old scheduler had a global freelist which caused a
cache crisis with multiple host threads trying to schedule a virtual
CPU simultaneously.

The rump scheduler is different from a normal thread scheduler, so
it has different requirements. First, we schedule a CPU for a
thread (which we get from the host scheduler) instead of scheduling
a thread onto a CPU. Second, scheduling points are at every
entry/exit to/from the rump kernel, including (but not limited to)
syscall entry points and hypercalls. This means scheduling happens
a lot more frequently than in a normal kernel.

For every lwp, cache the previously used CPU. When scheduling,
attempt to reuse the same CPU. If we get it, we can use it directly
without any memory barriers or expensive locks. If the CPU is
taken, migrate. Use a lock/wait only in the slowpath. Be very
wary of walking the entire CPU array because that does not lead to
a happy cacher.

The migration algorithm could probably benefit from improved
heuristics and tuning. Even as such, with the new scheduler an
application which has two threads making rlimit syscalls in a tight
loop experiences almost 400% speedup. The exact speedup is difficult
to pinpoint, though, since the old scheduler caused very jittery
results due to cache contention. Also, the rump version is now
70% faster than the counterpart which calls the host kernel.
 1.171 11-May-2010  pooka Initialize p_pgrp when creating a new process structure (and not
only for proc0). This makes something work. I just can't remember
what it was anymore.
 1.170 01-May-2010  pooka Add rump_printevcnts() which dumps values from all event counters.
(NOTE! it is run unscheduled for various experimentation etcetc. reasons)
 1.169 28-Apr-2010  pooka Uncrack my brain, buggy let me !be.

In other words, make previous commit to this file actually work.
Funny how it's possible to fix things to not dump core and still
have them not work.
 1.168 28-Apr-2010  pooka Set l_sysent so that syscall autoload actually works instead of autocores.
 1.167 28-Apr-2010  pooka If RUMP_NCPU is set, use that for virtual CPU count instead of
host CPU count.
 1.166 28-Apr-2010  pooka Make number of virtual CPUs match number of host CPUs on NetBSD/x86 hosts.
 1.165 27-Apr-2010  pooka Fix multiple virtual cpu support.

... or at least on x86. CPU_INFO_FOREACH() still isn't MI, and I
don't want to support 2^n different versions.
 1.164 26-Apr-2010  pooka Change machine from "rump" to MACHINE so that module_base goes
right.

Now, any guesses on how many archs this seemingly trivial change
will break the principal metric, i.e. The Build(tm)? Keep the bets
coming in.
 1.163 22-Apr-2010  pooka more signal stuff to group. no functional change.
 1.162 21-Apr-2010  pooka support kern_resource
 1.161 17-Apr-2010  pooka One emul is enough and since we need emul_netbsd, retire emul_rump.
 1.160 14-Apr-2010  pooka Include kern_tc and use a timecounter driver instead of homerolled
kern_tc implementation.
 1.159 12-Apr-2010  pooka support lwp specificdata
 1.158 31-Mar-2010  pooka Create kern.hostname sysctl node. Using init_sysctl.c for creating
the nodes requires some weeding, so don't try to use it yet.
 1.157 31-Mar-2010  pooka set kernel boottime
 1.156 31-Mar-2010  pooka * initialize msgbuf
* for banner, use aprint_verbose instead of if (verbose) printf
 1.155 05-Mar-2010  pooka branches: 1.155.2;
Use improved kernel module interfaces: instead of adding + loading
modules in bootstrap, just add them. Load them later the same way
as the kernel does: module_init_class().

Change the signature of rump_module_init() to take a vector instead
of just one module. All modules in a DSO should be init'd at the
same time because they might depend on each other, and code outside
the rump kernel cannot know which way. (binary kernel modules are
still loaded with rump_sys_modctl() the usual way).
 1.154 01-Mar-2010  pooka Introduce RUMP_COMPONENT. It behaves mostly like a simplified
module which is linked into the kernel and cannot be unloaded.
The main purpose is to get the proper constructors run and create
any /dev nodes necessary for said component. Once more of the
kernel (e.g. networking stack and device drivers) are converted to
MODULE and devfs pops up from somewhere, rump components can be
retired.
 1.153 26-Feb-2010  pooka Rename rumpuser_dl_module_bootstrap() to rumpuser_dl_bootstrap(),
since it hasn't been involved only with modules for quite a while now.
 1.152 09-Feb-2010  pooka Store l_name for kernel threads.
 1.151 15-Jan-2010  pooka branches: 1.151.2;
Accomplish messy stack with slightly less messy code.
 1.150 15-Jan-2010  pooka Use subr_percpu.c instead of homegrown implementation. ...except
when using malloc(3)-relegated allocators (happens in production
e.g. on Linux), since subr_percpu.c uses vmem and i don't want to
reimplement vmem.
 1.149 13-Jan-2010  pooka If RUMP_VERBOSE is set in the env, set boothowto to AB_VERBOSE.
 1.148 16-Dec-2009  pooka print spammy banner in spammy bootstrap
 1.147 09-Dec-2009  pooka Get rid of useless stubs.
 1.146 05-Dec-2009  pooka Remove now-empty rump_sleepers_init()
 1.145 04-Dec-2009  pooka Provide the default_mapaddr method in default rump emul (since some
kernel callers want to use it).
 1.144 03-Dec-2009  pooka Decide it's not worth the fuss to have rumpfs as a module and just
hardcode attach into rump_vfs_init(). Saves us from a lot of
pingpong init bouncing from one component to another to get the order
right.
 1.143 01-Dec-2009  pooka Almost there for virtual CPU MP support:
* support bound kernel threads
* bind softint threads to specific virtual cpus
+ remove now-unnecessary locks from softint code

Now, if we only had MI CPU_INFO_FOREACH() .... (hi rmind ;)
 1.142 27-Nov-2009  pooka Remove no longer necessary vfs weak symbols.
 1.141 27-Nov-2009  pooka Now that Makefile.rump was changed and everything gets built in
update builds too, flip the allocator define to prefer the kernel
pool/kmem instead of malloc(3). Use malloc(3) only if
RUMP_USE_UNREAL_ALLOCATORS is defined.
 1.140 26-Nov-2009  pooka For rumpfs, do mountroot instead of the bunch of homegrown hacks
currently there. Still needs a little massage to get the kernel
interfaces right and avoid copypaste especially from main().

Also, move it a bit more into the direction of a real file system
(finally!) by giving it a vfsops. Most ops are still unimplemented,
though.
 1.139 26-Nov-2009  pooka remember to call pipe_init()
 1.138 26-Nov-2009  pooka Build the kernel symbol table in rumpuser bootstrap and feed it to
the rump kernel. After this change it is possible to use the
in-kernel linker and rump_sys_modctl() to load kernel modules at
runtime.

Previously loading modules at runtime was possible only through
using the host system ld.so. Note that it is still preferred to
use shared libs when possible, since they are PIC and n virtual
kernels will only require one copy of r/o segments. However, when
there is no access to source code, a binary kernel module is the
only thing available ...
 1.137 26-Nov-2009  pooka Add rump_kernelfsym_load(), which loads the kernel symbol table.
 1.136 10-Nov-2009  pooka init uvm readahead
 1.135 06-Nov-2009  pooka account creds for processes, not lwp's
 1.134 05-Nov-2009  pooka enqueue loaded modules and prevent duplicates
 1.133 04-Nov-2009  pooka Use kern_mutex_obj.c directly instead of copypasting code.
 1.132 03-Nov-2009  pooka Weak aliazeize usermount_common_policy() to uncouple rumpkern
linkage from rumpvfs once again after the secmodel changes.
(temp solution, should find a better one)
 1.131 03-Nov-2009  pooka Reorder enough of lwp/cpu initialization to have enough context
for pool/kmem init to work again with the stock versions (as opposed
to rump malloc relegations).
 1.130 03-Nov-2009  pooka Add rump_boot_set/gethowto(), which can be called before rump_init()
to control .... *tadaa* boothowto.
 1.129 24-Oct-2009  pooka Pass modinit to rumpuser_dl_module_bootstrap() as a function pointer
to avoid linker rump -> rumpuser -> rump dependency which is annoying
redundancy in static linking.
 1.128 20-Oct-2009  pooka Actually, put uvm_readahead into rumpkern, since while it's
technically vfs stuff, sys_descrip depends on it and readahead
itself uses only the pager interface.
 1.127 19-Oct-2009  pooka __weak_alias for uvm_readahead() since it's used also in sys_descrip.c
 1.126 16-Oct-2009  pooka Include sys_select.c for proper select()/poll() support.
 1.125 15-Oct-2009  pooka Give lwp usage some much-needed love: stop treating lwp0 as the
all-sink and make sure each separate thread in rump has its own
lwp. Happy-go-lucky callers will get scheduled a temporary lwp
on entry, while true lwp connoisseurs may request a stable lwp
for their purposes. Some more love may be required later down the
road, but for now different threads will stepping on each others
toes.
 1.124 15-Oct-2009  pooka Add initial work on a rump virtual cpu scheduler. This is necessary
for kernel code which has been written to avoid MP contention by
using cpu-local storage (most prominently, select and pool_cache).

Instead of always assuming rump_cpu, the scheduler must now be run
(and unrun) on all entry points into rump. Likewise, rumpuser
unruns and re-runs the scheduler around each potentially blocking
operation. As an optimization, I modified some locking primitives
to try to get the lock without blocking before releasing the cpu.

Also, ltsleep was modified to assume that it is never called without
the biglock held and made to use the biglock as the sleep interlock.
Otherwise there is just too much drama with deadlocks. If some
kernel code wants to call ltsleep without the biglock, then, *snif*,
it's no longer supported and rump and should be modified to support
newstyle locks anyway.
 1.123 14-Oct-2009  pooka "rumppriv" goes back to "rump" per internal interface naming change.
 1.122 14-Oct-2009  pooka Adjust rump sources for external/internal interfaces.
No functional change.
 1.121 09-Oct-2009  pooka Provide an interface for reboot.
 1.120 08-Oct-2009  pooka Seems like module loading code is tasked with calling secmodel_register()
these days ...
 1.119 08-Oct-2009  pooka remove extraneous call to secmodel_suser_start()
 1.118 05-Oct-2009  pooka set l_cpu for lwp0
 1.117 02-Oct-2009  elad First part of secmodel cleanup and other misc. changes:

- Separate the suser part of the bsd44 secmodel into its own secmodel
and directory, pending even more cleanups. For revision history
purposes, the original location of the files was

src/sys/secmodel/bsd44/secmodel_bsd44_suser.c
src/sys/secmodel/bsd44/suser.h

- Add a man-page for secmodel_suser(9) and update the one for
secmodel_bsd44(9).

- Add a "secmodel" module class and use it. Userland program and
documentation updated.

- Manage secmodel count (nsecmodels) through the module framework.
This eliminates the need for secmodel_{,de}register() calls in
secmodel code.

- Prepare for secmodel modularization by adding relevant module bits.
The secmodels don't allow auto unload. The bsd44 secmodel depends
on the suser and securelevel secmodels. The overlay secmodel depends
on the bsd44 secmodel. As the module class is only cosmetic, and to
prevent ambiguity, the bsd44 and overlay secmodels are prefixed with
"secmodel_".

- Adapt the overlay secmodel to recent changes (mainly vnode scope).

- Stop using link-sets for the sysctl node(s) creation.

- Keep sysctl variables under nodes of their relevant secmodels. In
other words, don't create duplicates for the suser/securelevel
secmodels under the bsd44 secmodel, as the latter is merely used
for "grouping".

- For the suser and securelevel secmodels, "advertise presence" in
relevant sysctl nodes (sysctl.security.models.{suser,securelevel}).

- Get rid of the LKM preprocessor stuff.

- As secmodels are now modules, there's no need for an explicit call
to secmodel_start(); it's handled by the module framework. That
said, the module framework was adjusted to properly load secmodels
early during system startup.

- Adapt rump to changes: Instead of using empty stubs for securelevel,
simply use the suser secmodel. Also replace secmodel_start() with a
call to secmodel_suser_start().

- 5.99.20.

Testing was done on i386 ("release" build). Spearated module_init()
changes were tested on sparc and sparc64 as well by martin@ (thanks!).

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/09/25/msg006135.html
 1.116 24-Sep-2009  pooka Load modules from all components which are linked into a rump binary
with -lrumpcomponent. Previously only the first library component
containing a module would get loaded automatically.
 1.115 16-Sep-2009  pooka Replace a large number of link set based sysctl node creations with
calls from subsystem constructors. Benefits both future kernel
modules and rump.

no change to sysctl nodes on i386/MONOLITHIC & build tested i386/ALL
 1.114 13-Sep-2009  pooka call prop_kern_init()
 1.113 08-Sep-2009  pooka Add a few weak symbols for places where the kernel module boundaries
are not as perfect as theory.
 1.112 06-Sep-2009  pooka Run rump_dev_init() where available.
 1.111 04-Sep-2009  pooka allocate p_lock for virtual processes
 1.110 21-Jul-2009  pooka the consumers expect the aiodone workqueue to be mpsafe. make it so.
 1.109 22-May-2009  pooka Add rump_getversion(), which returns the version of NetBSD for the
rump kernel.
 1.108 07-May-2009  pooka Add rump_set_curlwp() for context switch to an existing lwp/proc.
 1.107 03-May-2009  pooka Rename rump_cred_destroy() to rump_cred_put() -- they've been
refcounted since forever now.
 1.106 02-May-2009  pooka Since rump_module_load() doesn't actually load the module, change
the name to rump_module_init(). Also, adjust the signature to take
a direct pointer to modinfo and allow passing of props. Finally,
provide rump_module_fini().
 1.105 30-Apr-2009  pooka Stir up the stack a bit to help arc4random() decide on a more
"random" seed. This is a quick hack, I'll play games with rnd(9)
later (no nethack).
 1.104 29-Apr-2009  pooka Add proof-of-concept code for enabling system calls to rump virtual
kernels running in other processes on the same machine or on an
entirely different host. I wrote this a while ago and am now
committing it mainly to avoid losing it. It works, but could do
with a little tuning here and there.

What this will hopefully eventually buy us is the ability to use
standard userland tools to configure rump kernels, e.g. ifconfig(8)
and route(8) could be used to configure the networking stack provided
by a rump kernel. Also some distributed OS implications may apply.

fun fact: a system call which just does copyin/copyout takes >1000x
longer when made over the LAN as compared to when made on the same
machine.
 1.103 29-Apr-2009  pooka include proc0 in allproc
 1.102 24-Apr-2009  pooka * init pool linksets, makes proplib work. reported by Arnaud Ysmal.
(linksets, sigh)
* reduce #ifdef for RUMP_USE_REAL_ALLOCATORS
 1.101 16-Apr-2009  pooka When I switched to real kauth, I forgot to include a secmodel.
Fix this oversight by including bsd44. Makes permissions for p2k
work again.
 1.100 29-Mar-2009  pooka include subr_evcnt
 1.99 19-Mar-2009  pooka Make it possible to mount a file system through the mount() system
call in addition to the old rump_mnt_mount(). Some issues remain
(but require more deeprooted changes):
* it is possible to mount only to /
* unmount needs MNT_FORCE due to the new fs being root and having
a bonus reference
* cwdi is not set (since there is no concept of a process)
 1.98 18-Mar-2009  pooka Remember to kqueue_init() too so that non-timer events work.
 1.97 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.96 20-Feb-2009  pooka need sys/syscall.h
 1.95 20-Feb-2009  pooka Add local syscall proxy as the default.
 1.94 12-Feb-2009  pooka Use p_nlwpid to store the next lwpid location.
 1.93 06-Feb-2009  pooka branches: 1.93.2;
Rip out the rwlock spl emulation code. It never did anything useful
except keep my feet warm by consuming an insane amount of cpu
cycles -- in rump our current "cpu" context is never interrupted
& we have MULTIPROCESSOR.

(itch i'm scratching: it made the networking stack 10-20% slower.
this is one of the places where fast code actually matters)
 1.92 06-Feb-2009  pooka Add weak alias stubs for a few vfs routines used by the module code -
this allows us to link programs with only rumpkern and rumpnet again.
 1.91 26-Jan-2009  pooka allocate proc_lock
 1.90 26-Jan-2009  pooka Init pool subsystem iff RUMP_USE_REAL_ALLOCATORS is defined.
 1.89 23-Jan-2009  pooka Add a compile-time option to use kmem/vmem/pools from the kernel
sources instead of homegrown allocators. Default to "on", even
though they appear to be a few percent slower at least on short
jobs (e.g. untar to tmpfs).
 1.88 13-Jan-2009  pooka misc cleanup, mainly header polish
 1.87 13-Jan-2009  pooka Implement block I/O as a real block driver instead of a hacked copy
of specfs. That was easier years ago when rump didn't support
devices, but brings no gain now. This allows us to include the
real specfs in rump.
 1.86 11-Jan-2009  pooka __rump_unavailable -> rump__unavailable
 1.85 08-Jan-2009  pooka Put syspuffs_glueinit in the rump kernel namespace.
 1.84 07-Jan-2009  pooka Explicitly pass a pointer to the kernel lock/unlock routines in
rumpuser init instead of magically relying on the linker giving us
the symbols.
 1.83 07-Jan-2009  pooka _rump_init() - > rump__init()
 1.82 07-Jan-2009  pooka ksyms_init()
 1.81 02-Jan-2009  pooka Include kernel printf routines in rump instead of relying on the
magic libc symbol. This also allows to bid farewell to subr_prf2.c
and merge the contents back to subr_prf.c. The host kernel bridging
is now done via rumpuser_putchar().
 1.80 01-Jan-2009  pooka Define MODULAR for rump core components. This enables module
loading via the kernel module framework (instead of dlopen()).
For now it only works on amd64 and i386, but for the rest it should
just be a matter of including the relevant kobj_machdep.c modules
from the kernel sources.
 1.79 29-Dec-2008  pooka include subr_devsw in rumpkern
 1.78 18-Dec-2008  pooka __KERNEL_RCSID
 1.77 13-Dec-2008  pooka Get rid of local machine/{mutex,rwlock}.h files by treating the
object storage as a single pointer (all archs have at least one
uintptr_t in the objects).

(forgot to commmit with others)
 1.76 21-Nov-2008  pooka rump_vfs_load() is really rump_module_load(), so call it that and
move it from rumpvfs to rumpkern.
 1.75 19-Nov-2008  pooka Split vfs out of rumpkern into rumpvfs. Non-fs rumps no longer
include the file system code. File system rumps explicitly need
to include rumpvfs from now on.
 1.74 18-Nov-2008  pooka Pass biodone() to rumpuser as a callback instead of hardcoding it.
Also, explicitly init rumpuser async io thread.
 1.73 17-Nov-2008  pooka Remove rump_vp locking interfaces, use RUMP_VOP instead.
 1.72 15-Oct-2008  pooka branches: 1.72.2;
One more init I happened to forget: iostat_init()
 1.71 15-Oct-2008  pooka Add support bits necessary for rumpnet functionality.
 1.70 13-Oct-2008  pooka award unlimited sbsize rlimit
 1.69 13-Oct-2008  pooka rump_enosys() is autogenerated into rump_syscalls (makes things
actually work)
 1.68 13-Oct-2008  pooka Add uid_init() I managed to miss earlier.
 1.67 13-Oct-2008  pooka add rump_enosys()
 1.66 12-Oct-2008  pooka Add callout inits which I managed to not commit earlier with the
rest of the callout stuff.

problem noticed by Arnaud Ysmal
 1.65 10-Oct-2008  pooka remember to call percpu_init()
 1.64 10-Oct-2008  pooka Support callouts and call callout_hardclock() from the timer
interrupt thread.

The sleepq implementation required for callouts is horrible, kludged
only for callouts, and generally unacceptable. It needs revisiting,
but I'm not sure yet should rump or kern_timeout be improved. It's
almost untested as of now, but committing this will give me some
maneuvering space while letting application compile.
 1.63 09-Oct-2008  pooka Rewrite interrupts to provide better softintr support, i.e. not
execute them simply in the context of the scheduling code, as this
does not work for all applications (e.g. networking soft interrupts).
Rather, schedule them and execute them from a separate context.

Also provide a timer which for now executes just hardclock_callout()
(well, at least after callouts are included in librump, which is
soon).
 1.62 09-Oct-2008  pooka No point in having our private atomic ops, just use the ones now
available in libc.
 1.61 07-Oct-2008  pooka Embed library build version into the init call and refuse to init
if they don't match. In other words, this is a lightweight library
major number.
 1.60 30-Sep-2008  pooka Check that we apply the previous kludge only to the root vnode.
 1.59 30-Sep-2008  pooka Switch to std kern_auth.
 1.58 30-Sep-2008  pooka Always set HASBUF when creating a componentname.
 1.57 30-Sep-2008  pooka Add an unspeakable kludge for nfs, which keeps an explicit reference
to the root vnode. Properly fixing this would require fixing p2k,
which would require fixing puffs, which has some optimizations,
which are incompatible with kernel file systems... guess my Eyes
of the Overworld were misplaced at that time.
 1.56 07-Sep-2008  pooka Give lwp0 an fd table and cwd. Allows easier direct use of rump.
 1.55 02-Sep-2008  pooka Make syspuffs mount code supply mount_syspuffs_parseargs() like
the other mount binaries do. Now syspuffs can be used to run all
puffs file systems as utilities. This includes fuse file systems
and becomes interesting with the fs-utils project. We can now do
e.g. this:

ReFUSE ntfs-3g:
golem> echo hello | fsu_write/fsu_write ntfs-3g puffs ~/img/ntfs.img dafile
golem> fsu_cat/fsu_cat ntfs-3g puffs ~/img/ntfs.img dafile
hello
golem>

puffs sysctlfs:
golem> fsu_ls/fsu_ls mount_sysctlfs puffs sysctl -l ddb
total 0
-r-xr-xr-x 1 pooka users 1 Sep 2 22:11 commandonenter
-r-xr-xr-x 1 pooka users 2 Sep 2 22:11 fromconsole
-r-xr-xr-x 1 pooka users 3 Sep 2 22:11 lines
-r-xr-xr-x 1 pooka users 8 Sep 2 22:11 maxoff
-r-xr-xr-x 1 pooka users 3 Sep 2 22:11 maxwidth
-r-xr-xr-x 1 pooka users 2 Sep 2 22:11 onpanic
-r-xr-xr-x 1 pooka users 3 Sep 2 22:11 radix
-r-xr-xr-x 1 pooka users 2 Sep 2 22:11 tabstops
-r-xr-xr-x 1 pooka users 2 Sep 2 22:11 tee_msgbuf

Same works for psshfs etcetc.

In other words, this provides total integration for "normal"
in-kernel file systems and puffs/fuse file systems on the ukfs
library level.

Note: implementation is still "first stab" and the fs-utils usage
will no doubt change.
 1.54 12-Aug-2008  pooka Make it possible to control starting of threads per env variable
instead of only at compile-time.
 1.53 08-Aug-2008  pooka Don't create a new proc structure for kthreads (pid == 0).
XXX: this routine should probably do better accounting and consistency
checks as well.
 1.52 04-Aug-2008  pooka Add support for using real kmem/vmem. Don't enable it by default,
though, since it a) is a lot of unnecessary indirection in rump
b) requires callouts which are so far unimplemented.
 1.51 01-Aug-2008  pooka support real sysctls
 1.50 01-Aug-2008  pooka Support ukfs_modload(), which dlopens and vfs_attaches rump file
system modules for use. Sneakily this solves the problem with the
dynamic linker not wanting to handle the modules link set for
binaries where more than one file system library is included during
the link phase and therefore only one of the file systems getting
vfs_attach()ed in rump "boot". But more importantly, this is really
TRTTD, since now applications can be built, linked and shipped
completely independently of the file systems they support.

tested by Arnaud Ysmal
 1.49 31-Jul-2008  simonb Merge the simonb-wapbl branch. From the original branch commit:

Add Wasabi System's WAPBL (Write Ahead Physical Block Logging)
journaling code. Originally written by Darrin B. Jewell while
at Wasabi and updated to -current by Antti Kantee, Andy Doran,
Greg Oster and Simon Burge.

OK'd by core@, releng@.
 1.48 29-Jul-2008  pooka Install rump libraries and utilities to the base system and remove the
private non-installed build infrastructure from sys/rump.

breakdown of commit:
* install relevant headers into /usr/include/rump
* build sys/rump/librump/rumpuser and sys/rump/librump/rumpkern
from src/lib and install as librumpuser and librump, respectively
+ this retains the ability to test a librump build with just the
kernel sources at hand
* move sys/rump/fs/lib/libukfs and sys/rump/fs/lib/libp2k to src/lib
for general consumption, they are not kernel-space dwellers anyway
* build and install sys/rump/fs/lib/lib$fs as librumpfs_$fs
* add chapter 3 manual pages for rump, rumpuser, ukfs and p2k
* build and install userspace kernel file system daemons if MKPUFFS=yes
is spexified
* retire fsconsole for now, it will make a comeback with an actually
implemented version shortly
 1.47 03-Jun-2008  ad branches: 1.47.2; 1.47.4;
vfs_cache:

- Don't use goto in critical paths, it can confuse the compiler.
- Sprinkle some branch hints.
- Make namecache stats per-CPU and collate once per second.
- Use vtryget().
 1.46 20-May-2008  ad Fix rump build.
 1.45 06-May-2008  ad branches: 1.45.2;
PR kern/38141 lookup/vfs_busy acquire rwlock recursively

Simplify the mount locking. Remove all the crud to deal with recursion on
the mount lock, and crud to deal with unmount as another weirdo lock.

Hopefully this will once and for all fix the deadlocks with this. With this
commit there are two locks on each mount:

- krwlock_t mnt_unmounting. This is used to prevent unmount across critical
sections like getnewvnode(). It's only ever read locked with rw_tryenter(),
and is only ever write locked in dounmount(). A write hold can't be taken
on this lock if the current LWP could hold a vnode lock.

- kmutex_t mnt_updating. This is taken by threads updating the mount, for
example when going r/o -> r/w, and is only present to serialize updates.
In order to take this lock, a read hold must first be taken on
mnt_unmounting, and the two need to be held across the operation.

One effect of this change: previously if an unmount failed, we would make a
half hearted attempt to back out of it gracefully, but that was unlikely to
work in a lot of cases. Now while an unmount that will be aborted is in
progress, new file operations within the mount will fail instead of being
delayed. That is unlikely to be a problem though, because if the admin
requests unmount of a file system then s(he) has made a decision to deny
access to the resource.
 1.44 04-May-2008  ad Pull in the kernel module stuff so that rump can set up built-in modules.
 1.43 28-Apr-2008  pooka Unbreak recent breakage.
 1.42 24-Mar-2008  martin branches: 1.42.2; 1.42.4;
Adapt to sel* changes
 1.41 22-Mar-2008  ad Update for select/poll changes.
 1.40 21-Mar-2008  ad Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.39 18-Mar-2008  pooka Reorder a few init bits into a better order to make syspuffs work again.
 1.38 12-Mar-2008  pooka Implement all ukfs interfaces (except getdents, that's a bit more
tricky) with the help of rump system calls instead of calling namei
by themselves. Trust me when I say it was non-trivial to get the
namei calls right.
 1.37 12-Mar-2008  pooka Support multiple file systems within one process with ukfs by using
a "chroot" for each file system.
 1.36 11-Mar-2008  pooka Backup some fixes for recent breakage from local tree. Also some
other improvements such as exporting the real kernel namei and
using that in ukfs instead of the homegrown heap'o hacks namei.
"etcetc".
 1.35 30-Jan-2008  ad branches: 1.35.2; 1.35.6;
Make it compile.
 1.34 27-Jan-2008  pooka Replace vrelel() 010101-mania with a flags parameter. However,
leave flags unimplemented for a while (no change in functionality).
 1.33 27-Jan-2008  pooka Don't fool around when recycling vnodes, simply override refcount
to 1, hold on tight to your hat, and call recycle. The reason is
that we might pick up extra references such as from lookup and we
don't really care about tracking those. For example with p2k,
puffs in the kernel already does all the refcounting we could ever
dream of, and therefore it's left to the client and unnecessary.
 1.32 27-Jan-2008  pooka Use vfs_subr.c from sys/kern. This brings differences in the vnode
life cycle between rump and a real kernel to a minimum.
 1.31 24-Jan-2008  pooka Use namei() etc. from kernel sources instead of a reimplementation.
To accommodate, give the rootvnode its own vnode op vector with a
simple lookup operation. This is used for looking up the file
system's device vnode instead of doing that directly in a homesmoked
namei().
 1.30 24-Jan-2008  ad specfs changes for PR kern/37717 (raidclose() is no longer called on
shutdown). There are still problems with device access and a PR will be
filed.

- Kill checkalias(). Allow multiple vnodes to reference a single device.

- Don't play dangerous tricks with block vnodes to ensure that only one
vnode can describe a block device. Instead, prohibit concurrent opens of
block devices. As a bonus remove the unreliable code that prevents
multiple file system mounts on the same device. It's no longer needed.

- Track opens by vnode and by device. Issue cdev_close() when the last open
goes away, instead of abusing vnode::v_usecount to tell if the device is
open.
 1.29 22-Jan-2008  pooka Until debugging threaded programs in NetBSD is fixed, supply the
cpp option RUMP_WITHOUT_THREADS as a workaround. If defined, it
makes rump itself operate single-threaded and prevents kthread_create()
from working.
 1.28 03-Jan-2008  pooka Theoretically this is supposed to be interchangeable with real
kernel code. Use kmem_alloc/free instead of some wily homerolled
rump interfaces for memory allocation.
 1.27 02-Jan-2008  pooka Add the ability to run puffs in userspace. This means that puffs
can now be developed in userspace using puffs for development
(I hate emulators, they are annoyingly clumsy).

To e.g. mount psshfs using puffs-on-puffs, run fs/bin/syspuffs/syspuffs
with the regular mount_psshfs command line as an argument:

golem> ./syspuffs /usr/sbin/mount_psshfs ftp.netbsd.org:/pub /puffs

This will make the mount appear as usual, with the exception that the
requests will be passed through puffs both in the kernel and userspace:

ftp.netbsd.org:/pub on /puffs type puffs|p2k|puffs|psshfs
 1.26 02-Jan-2008  pooka fix vmlocking2 fallout:

* I heard a wild rumor that vp_interlock is a mutex these days (hi ad!)
* init new locks (hi ad)
* observe that with simple_locks only deadlocks would be caught while
releasing unlocked locks would go unnoticed. make locking work (hi pooka)
 1.25 30-Dec-2007  pooka pull in atomic ops from vmlocking2
 1.24 30-Dec-2007  pooka fake sigcantmask
 1.23 08-Dec-2007  pooka branches: 1.23.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.22 26-Nov-2007  pooka branches: 1.22.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.21 07-Nov-2007  pooka Execute I/O in a separate thread for async I/O where previously
everything was written/read in caller context.

Also, make the "kernel" lock recursive. It works better that way ...
 1.20 07-Nov-2007  pooka final splash of ketchup after source update: init/fini mountspecific
 1.19 07-Nov-2007  pooka implement _kernel_lock{,_unlock}()
 1.18 07-Nov-2007  pooka Emulate spls by using pthread rwlocks: splfoo() takes a read lock
and when doing processing in an interrupt (effectively when calling
biodone()), we take the write lock.
 1.17 07-Nov-2007  pooka oops, backout part which wasn't supposed to go in
 1.16 07-Nov-2007  pooka Call buf_syncwait() after releasing a file system.
 1.15 04-Nov-2007  pooka branches: 1.15.2;
Make the strategy routine get the results through biowait() and
the "disk driver" (rumpuser) call biodone() to indicate the completion
of I/O. Support for B_ASYNC is coming at some point, but I need
more locking support in the emulated vm for that.
 1.14 31-Oct-2007  pooka branches: 1.14.2;
Make it possible to run rumps multithreaded. This brings real
locking and makes it possible to run file systems which create
threads. It also makes rump file system behaviour better match
file system behaviour in the kernel.
 1.13 19-Oct-2007  ad machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.12 02-Sep-2007  pooka branches: 1.12.2; 1.12.6;
* Give rump_vfs_root() the option of returning the vnode unlocked.
* initialize syncdelay
* implement io_sync handler
 1.11 01-Sep-2007  pooka avoid uninitialized warning from impossible enum
 1.10 25-Aug-2007  pooka branches: 1.10.2;
Don't play rename & typecast games with kauth_cred_t, but rather
declare the type in rump.h only if necessary with the help of ifdef
magic.
 1.9 21-Aug-2007  pooka Implement credentials. Access control is now similar to if the file
system were run in the kernel.
 1.8 20-Aug-2007  pooka branches: 1.8.2;
Hide NetBSD kernel headers completely from ukfs. This includes creating
accessors for:
* struct mount & VFS ops
* struct uio
* struct vnode
* struct vattr

and some namespace games for:
* namei flags
* VOPs
* enum vtype

Also, split rump services into two categories: library private and public
(rump_private.h and rump.h, respectively).

As a result, it is now possible to compile and use the NetBSD kernel
file systems on Linux (and probably other systems too with very
little work), although the makefiles need a bit of work to make it
a pleasureable experience.
 1.7 16-Aug-2007  pooka tweaks
 1.6 14-Aug-2007  pooka branches: 1.6.2;
* split userspace file system access into two separate libraries:
+ libp2k: the interface between libpuffs and vfs/vop
+ libukfs: generic user kernel file system library, usable
independent of libp2k and/or puffs
* use file system name (MOUNT_XYZ) instead of vfsops pointer to
mount file system
 1.5 14-Aug-2007  pooka Kill handrolled buffercache and use vfs_bio from the kernel. This is
mostly to get the flag jungle in sync with the kernel.
 1.4 08-Aug-2007  pooka Provide rump_getvninfo() and use that in libp2k_lookup() to avoid an
extra getattr for stuff the file system already cached in the vnode.
 1.3 07-Aug-2007  pooka realpath() can also fail, take that into account
 1.2 06-Aug-2007  pooka branches: 1.2.2;
Allow to de/register pathnames which should be faked as block
devices instead of faking all non-blks as blks in namei().
 1.1 05-Aug-2007  pooka Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.2.2.2 06-Aug-2007  pooka Allow to de/register pathnames which should be faked as block
devices instead of faking all non-blks as blks in namei().
 1.2.2.1 06-Aug-2007  pooka file rump.c was added on branch matt-mips64 on 2007-08-06 22:20:58 +0000
 1.6.2.3 03-Sep-2007  skrll Sync with HEAD.
 1.6.2.2 15-Aug-2007  skrll Sync with HEAD.
 1.6.2.1 14-Aug-2007  skrll file rump.c was added on branch nick-csl-alignment on 2007-08-15 13:50:40 +0000
 1.8.2.4 23-Oct-2007  ad Sync with head.
 1.8.2.3 09-Oct-2007  ad Sync with head.
 1.8.2.2 20-Aug-2007  ad Sync with HEAD.
 1.8.2.1 20-Aug-2007  ad file rump.c was added on branch vmlocking on 2007-08-20 22:07:29 +0000
 1.10.2.4 23-Mar-2008  matt sync with HEAD
 1.10.2.3 09-Jan-2008  matt sync with HEAD
 1.10.2.2 08-Nov-2007  matt sync with -HEAD
 1.10.2.1 06-Nov-2007  matt sync with HEAD
 1.12.6.2 13-Nov-2007  bouyer Sync with HEAD
 1.12.6.1 25-Oct-2007  bouyer Sync with HEAD.
 1.12.2.9 24-Mar-2008  yamt sync with head.
 1.12.2.8 17-Mar-2008  yamt sync with head.
 1.12.2.7 04-Feb-2008  yamt sync with head.
 1.12.2.6 21-Jan-2008  yamt sync with head
 1.12.2.5 07-Dec-2007  yamt sync with head
 1.12.2.4 15-Nov-2007  yamt sync with head.
 1.12.2.3 27-Oct-2007  yamt sync with head.
 1.12.2.2 03-Sep-2007  yamt sync with head.
 1.12.2.1 02-Sep-2007  yamt file rump.c was added on branch yamt-lazymbuf on 2007-09-03 14:45:33 +0000
 1.14.2.7 09-Dec-2007  jmcneill Sync with HEAD.
 1.14.2.6 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.14.2.5 11-Nov-2007  joerg Sync with HEAD.
 1.14.2.4 04-Nov-2007  jmcneill Sync with HEAD.
 1.14.2.3 02-Nov-2007  joerg Remove the rest of the unintentional diff in sys/rump.
 1.14.2.2 31-Oct-2007  joerg Sync with HEAD.
 1.14.2.1 31-Oct-2007  joerg file rump.c was added on branch jmcneill-pm on 2007-10-31 23:14:17 +0000
 1.15.2.4 18-Feb-2008  mjf Sync with HEAD.
 1.15.2.3 27-Dec-2007  mjf Sync with HEAD.
 1.15.2.2 08-Dec-2007  mjf Sync with HEAD.
 1.15.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.22.2.2 28-Dec-2007  ad Make rump build.
 1.22.2.1 26-Dec-2007  ad Sync with head.
 1.23.4.3 23-Jan-2008  bouyer Sync with HEAD.
 1.23.4.2 08-Jan-2008  bouyer Sync with HEAD
 1.23.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.35.6.6 17-Jan-2009  mjf Sync with HEAD.
 1.35.6.5 05-Oct-2008  mjf Sync with HEAD.
 1.35.6.4 28-Sep-2008  mjf Sync with HEAD.
 1.35.6.3 05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.35.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.35.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.35.2.1 24-Mar-2008  keiichi sync with head.
 1.42.4.9 09-Oct-2010  yamt sync with head
 1.42.4.8 11-Aug-2010  yamt sync with head.
 1.42.4.7 11-Mar-2010  yamt sync with head
 1.42.4.6 16-Sep-2009  yamt sync with head
 1.42.4.5 19-Aug-2009  yamt sync with head.
 1.42.4.4 20-Jun-2009  yamt sync with head
 1.42.4.3 16-May-2009  yamt sync with head
 1.42.4.2 04-May-2009  yamt sync with head.
 1.42.4.1 16-May-2008  yamt sync with head.
 1.42.2.3 17-Jun-2008  yamt sync with head.
 1.42.2.2 04-Jun-2008  yamt sync with head
 1.42.2.1 18-May-2008  yamt sync with head.
 1.45.2.4 10-Oct-2008  skrll Sync with HEAD.
 1.45.2.3 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.45.2.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.45.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.47.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.47.4.1 19-Oct-2008  haad Sync with HEAD.
 1.47.2.2 31-Jul-2008  simonb Sync with head.
 1.47.2.1 10-Jun-2008  simonb Initial commit of Wasabi System's WAPBL (Write Ahead Physical Block
Logging) journaling code. Originally written by Darrin B. Jewell
while at Wasabi and updated to -current by Antti Kantee, Andy Doran,
Greg Oster and Simon Burge.

Still a number of issues - look in doc/BRANCHES for "simonb-wapbl"
for more info.
 1.72.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.72.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.72.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.93.2.2 23-Jul-2009  jym Sync with HEAD.
 1.93.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.151.2.4 06-Nov-2010  uebayasi Sync with HEAD.
 1.151.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.151.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.151.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.155.2.4 21-Apr-2011  rmind sync with head
 1.155.2.3 05-Mar-2011  rmind sync with head
 1.155.2.2 03-Jul-2010  rmind sync with head
 1.155.2.1 30-May-2010  rmind sync with head
 1.219.4.2 17-Feb-2011  bouyer Sync with HEAD
 1.219.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.219.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.234.4.5 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.234.4.4 23-Jan-2013  yamt sync with head
 1.234.4.3 30-Oct-2012  yamt sync with head
 1.234.4.2 17-Apr-2012  yamt sync with head
 1.234.4.1 02-Nov-2011  yamt page cache related changes

- maintain object pages in radix tree rather than rb tree.
- reduce unnecessary page scan in putpages. esp. when an object has a ton of
pages cached but only a few of them are dirty.
- reduce the number of pmap operations by tracking page dirtiness more
precisely in uvm layer.
- fix nfs commit range tracking.
- fix nfs write clustering. XXX hack
 1.237.2.1 18-Feb-2012  mrg merge to -current.
 1.240.2.1 18-Nov-2012  riz Pull up following revision(s) (requested by rmind in ticket #678):
sys/rump/librump/rumpkern/rump.c: revision 1.243
sys/rump/librump/rumpkern/rump.c: revision 1.244
sys/rump/librump/rumpkern/rump.c: revision 1.245
sys/rump/librump/rumpkern/rump.c: revision 1.246
usr.sbin/npf/npftest/npftest.c: revision 1.5
usr.sbin/npf/npftest/README: revision 1.2
usr.sbin/npf/npftest/npftest.h: revision 1.5
sys/rump/net/Makefile.rumpnetcomp: revision 1.5
sys/rump/net/lib/libnpf/shlib_version: revision 1.1
sys/net/npf/npf_impl.h: revision 1.22
sys/rump/dev/lib/libnpf/Makefile: file removal
usr.sbin/npf/npftest/Makefile: revision 1.3
sys/rump/dev/lib/libnpf/component.c: file removal
sys/rump/dev/lib/libnpf/shlib_version: file removal
sys/net/npf/npf_state.c: revision 1.12
sys/rump/net/lib/libnpf/component.c: revision 1.1
usr.sbin/npf/npftest/libnpftest/npf_test_subr.c: revision 1.4
usr.sbin/npf/npftest/libnpftest/npf_test.h: revision 1.6
sys/rump/net/lib/libnpf/Makefile: revision 1.1
Move and rename librumpdev_npf to librumpnet_npf.
Enable the build of librumpnet_npf.
Add npf_state_setsampler() for _NPF_TESTING case. This also fixes the build.
Call pserialize_init() during rump start-up, since librump/net/npf
uses it.
It helps to include the declaration of the routine being called.
We also need kcpuset_init() now.
Use correct routine name - kcpuset_sysinit() vs kcpuset_init()
 1.246.2.5 03-Dec-2017  jdolecek update from HEAD
 1.246.2.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.246.2.3 23-Jun-2013  tls resync from head
 1.246.2.2 25-Feb-2013  tls resync with head
 1.246.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.270.2.2 18-May-2014  rmind sync with head
 1.270.2.1 28-Aug-2013  rmind sync with head
 1.292.2.1 10-Aug-2014  tls Rebase.
 1.308.2.4 09-May-2016  snj Pull up following revision(s) (requested by joerg in ticket #1162):
sys/rump/librump/rumpkern/rump.c: revision 1.329
Align the message buffer. The kernel routines normally are used only
with page aligned buffers and they assume at least pointer alignment. Be
defensive here and align to 256 Bytes.
 1.308.2.3 25-Mar-2015  snj Pull up following revision(s) (requested by maxv in ticket #617):
sys/kern/kern_malloc.c: revision 1.144, 1.145
sys/kern/kern_pmf.c: revision 1.37
sys/rump/librump/rumpkern/rump.c: revision 1.316
sys/uvm/uvm_extern.h: revision 1.193
sys/uvm/uvm_km.c: revision 1.139
Don't include <uvm/uvm_extern.h>
--
Kill kmeminit().
--
Remove this MALLOC_DEFINE (M_PMF unused).
 1.308.2.2 09-Dec-2014  martin Pull up following revision(s) (requested by gson in ticket #299):
sys/rump/librump/rumpkern/cons.c: revision 1.4
sys/rump/librump/rumpkern/rump.c: revision 1.311
lib/librumpuser/rumpuser_sp.c: revision 1.67
No longer create a special process context to fork remote clients off
of, simply always rfork off of proc1 closing all descriptors, and have
the rump kernel open 0/1/2 if the parent process is "1".
Fixes tests/rump/rumpkernel/t_sp, which was failing since the
abovementioned special process change due to attempting to deliver a
signal to the special process and the special process was not equipped
to handle one.
 1.308.2.1 15-Aug-2014  martin Pull up following revision(s) (requested by riastradh in ticket #23):
sys/rump/librump/rumpkern/rump.c: revision 1.310
sys/rump/librump/rumpkern/rump.c: revision 1.309
sys/kern/init_main.c: revision 1.459
Defer cprng_fast_init until CPUs are detected.
Restore placement of percpu_init in rump_init.
Probably doesn't matter, but let's avoid needless churn around the
real bug fix.
 1.312.2.4 19-Mar-2016  skrll Sync with HEAD
 1.312.2.3 22-Sep-2015  skrll Sync with HEAD
 1.312.2.2 06-Jun-2015  skrll Sync with HEAD
 1.312.2.1 06-Apr-2015  skrll Sync with HEAD
 1.329.10.2 22-Jan-2018  martin Pull up following revision(s) (requested by jdolecek in ticket #506):
sys/kern/kern_softint.c: revision 1.45
sys/rump/librump/rumpkern/rump.c: revision 1.331
sys/kern/subr_pserialize.c: revision 1.10
sys/kern/subr_psref.c: revision 1.10
Prevent panic or hangup in softint_disestablish(), pserialize_perform() or
psref_target_destroy() while mp_online == false.
See http://mail-index.netbsd.org/tech-kern/2017/12/25/msg022829.html
Set mp_online = true. This change might fix PR#52886.
 1.329.10.1 30-Nov-2017  martin Pull up following revision(s) (requested by ozaki-r in ticket #405):
sys/sys/pserialize.h: revision 1.2
sys/kern/kern_lock.c: revision 1.160
sys/kern/subr_pserialize.c: revision 1.9
sys/rump/librump/rumpkern/emul.c: revision 1.184
sys/rump/librump/rumpkern/emul.c: revision 1.185
sys/rump/librump/rumpkern/rump.c: revision 1.330
Implement debugging feature for pserialize(9)
The debugging feature detects violations of pserialize constraints.
It causes a panic:
- if a context switch happens in a read section, or
- if a sleepable function is called in a read section.
The feature is enabled only if LOCKDEBUG is on.
Discussed on tech-kern@
Add missing inclusion of pserialize.h (fix build)
 1.329.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.329.2.1 18-Jul-2016  pgoyette We also need to init devsw's pserialize stuff when running as rump.

XXX Noted that in rump, pserialize is initialized much sooner than devsw,
XXX while in "real" kernels, pserialize comes _after_ devsw. Hmmm.
 1.331.4.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.331.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.331.4.1 10-Jun-2019  christos Sync with HEAD
 1.331.2.1 18-Jan-2019  pgoyette Synch with HEAD
 1.339.2.1 29-Feb-2020  ad Sync with head.
 1.344.2.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.349.2.2 03-Apr-2021  thorpej Sync with HEAD.
 1.349.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.35 17-Nov-2008  pooka Move rump public headers to include/rump
 1.34 07-Oct-2008  pooka branches: 1.34.2;
Embed library build version into the init call and refuse to init
if they don't match. In other words, this is a lightweight library
major number.
 1.33 30-Sep-2008  pooka Switch to std kern_auth.
 1.32 02-Sep-2008  pooka Make syspuffs mount code supply mount_syspuffs_parseargs() like
the other mount binaries do. Now syspuffs can be used to run all
puffs file systems as utilities. This includes fuse file systems
and becomes interesting with the fs-utils project. We can now do
e.g. this:

ReFUSE ntfs-3g:
golem> echo hello | fsu_write/fsu_write ntfs-3g puffs ~/img/ntfs.img dafile
golem> fsu_cat/fsu_cat ntfs-3g puffs ~/img/ntfs.img dafile
hello
golem>

puffs sysctlfs:
golem> fsu_ls/fsu_ls mount_sysctlfs puffs sysctl -l ddb
total 0
-r-xr-xr-x 1 pooka users 1 Sep 2 22:11 commandonenter
-r-xr-xr-x 1 pooka users 2 Sep 2 22:11 fromconsole
-r-xr-xr-x 1 pooka users 3 Sep 2 22:11 lines
-r-xr-xr-x 1 pooka users 8 Sep 2 22:11 maxoff
-r-xr-xr-x 1 pooka users 3 Sep 2 22:11 maxwidth
-r-xr-xr-x 1 pooka users 2 Sep 2 22:11 onpanic
-r-xr-xr-x 1 pooka users 3 Sep 2 22:11 radix
-r-xr-xr-x 1 pooka users 2 Sep 2 22:11 tabstops
-r-xr-xr-x 1 pooka users 2 Sep 2 22:11 tee_msgbuf

Same works for psshfs etcetc.

In other words, this provides total integration for "normal"
in-kernel file systems and puffs/fuse file systems on the ukfs
library level.

Note: implementation is still "first stab" and the fs-utils usage
will no doubt change.
 1.31 08-Aug-2008  pooka minor nit: fix header #ifndef namespacing
 1.30 01-Aug-2008  pooka Support ukfs_modload(), which dlopens and vfs_attaches rump file
system modules for use. Sneakily this solves the problem with the
dynamic linker not wanting to handle the modules link set for
binaries where more than one file system library is included during
the link phase and therefore only one of the file systems getting
vfs_attach()ed in rump "boot". But more importantly, this is really
TRTTD, since now applications can be built, linked and shipped
completely independently of the file systems they support.

tested by Arnaud Ysmal
 1.29 29-Jul-2008  pooka Install rump libraries and utilities to the base system and remove the
private non-installed build infrastructure from sys/rump.

breakdown of commit:
* install relevant headers into /usr/include/rump
* build sys/rump/librump/rumpuser and sys/rump/librump/rumpkern
from src/lib and install as librumpuser and librump, respectively
+ this retains the ability to test a librump build with just the
kernel sources at hand
* move sys/rump/fs/lib/libukfs and sys/rump/fs/lib/libp2k to src/lib
for general consumption, they are not kernel-space dwellers anyway
* build and install sys/rump/fs/lib/lib$fs as librumpfs_$fs
* add chapter 3 manual pages for rump, rumpuser, ukfs and p2k
* build and install userspace kernel file system daemons if MKPUFFS=yes
is spexified
* retire fsconsole for now, it will make a comeback with an actually
implemented version shortly
 1.28 01-Jul-2008  pooka branches: 1.28.2;
Fixes to build rump utilities as host binaries on Linux by removing
sys namespace pollution which has crept in.

Submitted in private mail by takemura, domain ca2.so-net.ne.jp
 1.27 06-Jun-2008  pooka branches: 1.27.2;
Use -3 for wizardmode credentials instead of -1. Technically we
shouldn't have to do this, but some pieces of kernel code still
make direct comparisons like cred == NOCRED (which, incidentally,
is defined as -1).
 1.26 12-Mar-2008  pooka branches: 1.26.2; 1.26.4; 1.26.6;
Support chdir. This is useful for example when testing and not
wanting to stress namei() so much as test individual ops.
XXX: it should be implemented per calling thread, not per fs.
 1.25 12-Mar-2008  pooka Support multiple file systems within one process with ukfs by using
a "chroot" for each file system.
 1.24 11-Mar-2008  pooka Backup some fixes for recent breakage from local tree. Also some
other improvements such as exporting the real kernel namei and
using that in ukfs instead of the homegrown heap'o hacks namei.
"etcetc".
 1.23 27-Jan-2008  pooka branches: 1.23.2; 1.23.6;
Don't fool around when recycling vnodes, simply override refcount
to 1, hold on tight to your hat, and call recycle. The reason is
that we might pick up extra references such as from lookup and we
don't really care about tracking those. For example with p2k,
puffs in the kernel already does all the refcounting we could ever
dream of, and therefore it's left to the client and unnecessary.
 1.22 27-Jan-2008  pooka Use vfs_subr.c from sys/kern. This brings differences in the vnode
life cycle between rump and a real kernel to a minimum.
 1.21 24-Jan-2008  pooka Use namei() etc. from kernel sources instead of a reimplementation.
To accommodate, give the rootvnode its own vnode op vector with a
simple lookup operation. This is used for looking up the file
system's device vnode instead of doing that directly in a homesmoked
namei().
 1.20 02-Jan-2008  pooka fix vmlocking2 fallout:

* I heard a wild rumor that vp_interlock is a mutex these days (hi ad!)
* init new locks (hi ad)
* observe that with simple_locks only deadlocks would be caught while
releasing unlocked locks would go unnoticed. make locking work (hi pooka)
 1.19 26-Nov-2007  pooka branches: 1.19.6;
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.18 07-Nov-2007  pooka Emulate spls by using pthread rwlocks: splfoo() takes a read lock
and when doing processing in an interrupt (effectively when calling
biodone()), we take the write lock.
 1.17 07-Nov-2007  pooka Call buf_syncwait() after releasing a file system.
 1.16 31-Oct-2007  pooka branches: 1.16.2; 1.16.4;
Make it possible to run rumps multithreaded. This brings real
locking and makes it possible to run file systems which create
threads. It also makes rump file system behaviour better match
file system behaviour in the kernel.
 1.15 02-Sep-2007  pooka branches: 1.15.2; 1.15.6;
* Give rump_vfs_root() the option of returning the vnode unlocked.
* initialize syncdelay
* implement io_sync handler
 1.14 25-Aug-2007  pooka branches: 1.14.2;
Don't play rename & typecast games with kauth_cred_t, but rather
declare the type in rump.h only if necessary with the help of ifdef
magic.
 1.13 21-Aug-2007  pooka Implement credentials. Access control is now similar to if the file
system were run in the kernel.
 1.12 20-Aug-2007  pooka branches: 1.12.2;
Hide NetBSD kernel headers completely from ukfs. This includes creating
accessors for:
* struct mount & VFS ops
* struct uio
* struct vnode
* struct vattr

and some namespace games for:
* namei flags
* VOPs
* enum vtype

Also, split rump services into two categories: library private and public
(rump_private.h and rump.h, respectively).

As a result, it is now possible to compile and use the NetBSD kernel
file systems on Linux (and probably other systems too with very
little work), although the makefiles need a bit of work to make it
a pleasureable experience.
 1.11 19-Aug-2007  pooka Namespace management: do not call VOP_FOO directly from ukfs or
p2k, but rather make the calls go through librump. This avoids
having to include NetBSD kernel headers in userspace programs.
Stay tuned for some more mods of the same sort ...
 1.10 16-Aug-2007  pooka tweaks
 1.9 14-Aug-2007  pooka branches: 1.9.2;
* split userspace file system access into two separate libraries:
+ libp2k: the interface between libpuffs and vfs/vop
+ libukfs: generic user kernel file system library, usable
independent of libp2k and/or puffs
* use file system name (MOUNT_XYZ) instead of vfsops pointer to
mount file system
 1.8 14-Aug-2007  pooka Add some barely staggering code to get more disklabel support.
 1.7 13-Aug-2007  pooka nuke no longer used vm macros
 1.6 11-Aug-2007  pooka * move rump_vopwrite_fault() into history - we now support the file
system faulting in pages if it does e.g. fragment reallocation
* get rid of rumpvm_findpage() and always use uvm_pagelookup()
* determine a vnode's cleanness by flagging it as being on the work
list if we "take" a write fault and removing it from the worklist
once pages are flushed. There is no work list here, but at least
there is symmetry with the kernel.
 1.5 08-Aug-2007  pooka Provide rump_getvninfo() and use that in libp2k_lookup() to avoid an
extra getattr for stuff the file system already cached in the vnode.
 1.4 07-Aug-2007  pooka remove the allocstorage param from makepage - not needed
 1.3 07-Aug-2007  pooka track dirty vm objects
 1.2 06-Aug-2007  pooka branches: 1.2.2;
Allow to de/register pathnames which should be faked as block
devices instead of faking all non-blks as blks in namei().
 1.1 05-Aug-2007  pooka Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.2.2.2 06-Aug-2007  pooka Allow to de/register pathnames which should be faked as block
devices instead of faking all non-blks as blks in namei().
 1.2.2.1 06-Aug-2007  pooka file rump.h was added on branch matt-mips64 on 2007-08-06 22:20:58 +0000
 1.9.2.3 03-Sep-2007  skrll Sync with HEAD.
 1.9.2.2 15-Aug-2007  skrll Sync with HEAD.
 1.9.2.1 14-Aug-2007  skrll file rump.h was added on branch nick-csl-alignment on 2007-08-15 13:50:41 +0000
 1.12.2.3 12-Oct-2007  ad Fix merge errors.
 1.12.2.2 20-Aug-2007  ad Sync with HEAD.
 1.12.2.1 20-Aug-2007  ad file rump.h was added on branch vmlocking on 2007-08-20 22:07:30 +0000
 1.14.2.4 23-Mar-2008  matt sync with HEAD
 1.14.2.3 09-Jan-2008  matt sync with HEAD
 1.14.2.2 08-Nov-2007  matt sync with -HEAD
 1.14.2.1 06-Nov-2007  matt sync with HEAD
 1.15.6.1 13-Nov-2007  bouyer Sync with HEAD
 1.15.2.7 17-Mar-2008  yamt sync with head.
 1.15.2.6 04-Feb-2008  yamt sync with head.
 1.15.2.5 21-Jan-2008  yamt sync with head
 1.15.2.4 07-Dec-2007  yamt sync with head
 1.15.2.3 15-Nov-2007  yamt sync with head.
 1.15.2.2 03-Sep-2007  yamt sync with head.
 1.15.2.1 02-Sep-2007  yamt file rump.h was added on branch yamt-lazymbuf on 2007-09-03 14:45:34 +0000
 1.16.4.3 18-Feb-2008  mjf Sync with HEAD.
 1.16.4.2 08-Dec-2007  mjf Sync with HEAD.
 1.16.4.1 19-Nov-2007  mjf Sync with HEAD.
 1.16.2.5 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.16.2.4 11-Nov-2007  joerg Sync with HEAD.
 1.16.2.3 02-Nov-2007  joerg Remove the rest of the unintentional diff in sys/rump.
 1.16.2.2 31-Oct-2007  joerg Sync with HEAD.
 1.16.2.1 31-Oct-2007  joerg file rump.h was added on branch jmcneill-pm on 2007-10-31 23:14:17 +0000
 1.19.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.23.6.6 17-Jan-2009  mjf Sync with HEAD.
 1.23.6.5 05-Oct-2008  mjf Sync with HEAD.
 1.23.6.4 28-Sep-2008  mjf Sync with HEAD.
 1.23.6.3 02-Jul-2008  mjf Sync with HEAD.
 1.23.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.23.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.23.2.1 24-Mar-2008  keiichi sync with head.
 1.26.6.3 10-Oct-2008  skrll Sync with HEAD.
 1.26.6.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.26.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.26.4.1 04-May-2009  yamt sync with head.
 1.26.2.1 17-Jun-2008  yamt sync with head.
 1.27.2.2 31-Jul-2008  simonb Sync with head.
 1.27.2.1 03-Jul-2008  simonb Sync with head.
 1.28.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.28.2.1 19-Oct-2008  haad Sync with HEAD.
 1.34.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.2 23-Nov-2010  pooka branches: 1.2.6;
Add aliases for _atomic_cas_foo, as they are used often. A snafu
in "./build.sh rumptest" prevented me from noticing this yesterday,
so thanks to Nick Hudson for re-pinging.
(I'll fix build.sh shortly)
 1.1 22-Nov-2010  pooka rename atomic_cas_up to rump_atomic_cas_up to avoid collisions
 1.2.6.2 05-Mar-2011  rmind sync with head
 1.2.6.1 23-Nov-2010  rmind file rump_atomic_cas_up.c was added on branch rmind-uvmplock on 2011-03-05 20:56:15 +0000
 1.3 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.2 24-Apr-2021  thorpej branches: 1.2.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.1 13-May-2019  bad branches: 1.1.2; 1.1.14;
On the one thousand and ninth day rump's mainbus was moved from
rumpdev to rumpkern, liberating all rumpnet users from the need to
-lrumpdev -lrumpvfs just because a loopback interface is mandatory.

Rename rumpdev/autoconf.c to rumpkern/rump_autoconf.c to avoid
accidentally picking up e.g. sys/arch/amd64/amd64/autoconf.c through
make's .PATH.
Move rumpdev/MAINBUS.ioconf to rumpkern.
 1.1.14.5 05-Apr-2021  thorpej Treat config_probe() as if it were a boolean function; don't compare
return value > 0... except for the odd balls, which are now really easy
to spot.
 1.1.14.4 05-Apr-2021  thorpej config_match() -> config_probe() for the straight-forward indirect config
cases. There are still a few odd balls using config_match() which should
be sorted out later.
 1.1.14.3 04-Apr-2021  thorpej CFARG_SUBMATCH -> CFARG_SEARCH for the indirect configuration uses.
 1.1.14.2 03-Apr-2021  thorpej Give config_attach() the tagged variadic argument treatment and
mechanically convert all call sites.
 1.1.14.1 20-Mar-2021  thorpej The proliferation if config_search_*() and config_found_*() combinations
is a little absurd, so begin to tidy this up:

- Introduce a new cfarg_t enumerated type, that defines the types of
tag-value variadic arguments that can be passed to the various
config_*() functions (CFARG_SUBMATCH, CFARG_IATTR, and CFARG_LOCATORS,
for now, plus a CFARG_EOL sentinel).
- Collapse config_search_*() into config_search() that takes these
variadic arguments.
- Convert all call sites of config_search_*() to the new signature.
Noticed several incorrect usages along the way, which will be
audited in a future commit.
 1.1.2.2 10-Jun-2019  christos Sync with HEAD
 1.1.2.1 13-May-2019  christos file rump_autoconf.c was added on branch phil-wifi on 2019-06-10 22:09:53 +0000
 1.2.8.1 05-Aug-2021  thorpej Adapt to CFARGS().
 1.2 16-Mar-2014  pooka branches: 1.2.4; 1.2.6; 1.2.10;
remove unnecesary verbosity: s/RUMP_CURLWP_MODEL/RUMP_CURLWP/
 1.1 15-Mar-2014  pooka Allow compile-time optimizations to curlwp. This can have a pretty
staggering impact on performance. When running sendto() in a loop,
the improvement is 200k more calls per second with an inlined __thread
curlwp as opposed to the default. In other words, it shaves off hundreds
of CPU cycles per call (~20%). Even just eliminating the x86_curlwp()
call in favor of an inline gives an improvement of 60k calls per second.
 1.2.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.10.1 16-Mar-2014  tls file rump_curlwp.h was added on branch tls-maxphys on 2014-08-20 00:04:41 +0000
 1.2.6.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.2.6.1 16-Mar-2014  yamt file rump_curlwp.h was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.2.4.2 18-May-2014  rmind sync with head
 1.2.4.1 16-Mar-2014  rmind file rump_curlwp.h was added on branch rmind-smpnet on 2014-05-18 17:46:18 +0000
 1.3 19-Apr-2018  christos s/static inline/static __inline/g for consistency.
 1.2 16-Mar-2014  pooka branches: 1.2.4; 1.2.6; 1.2.10; 1.2.34;
remove unnecesary verbosity: s/RUMP_CURLWP_MODEL/RUMP_CURLWP/
 1.1 15-Mar-2014  pooka Allow compile-time optimizations to curlwp. This can have a pretty
staggering impact on performance. When running sendto() in a loop,
the improvement is 200k more calls per second with an inlined __thread
curlwp as opposed to the default. In other words, it shaves off hundreds
of CPU cycles per call (~20%). Even just eliminating the x86_curlwp()
call in favor of an inline gives an improvement of 60k calls per second.
 1.2.34.1 22-Apr-2018  pgoyette Sync with HEAD
 1.2.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.10.1 16-Mar-2014  tls file rump_curlwp___thread.h was added on branch tls-maxphys on 2014-08-20 00:04:41 +0000
 1.2.6.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.2.6.1 16-Mar-2014  yamt file rump_curlwp___thread.h was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.2.4.2 18-May-2014  rmind sync with head
 1.2.4.1 16-Mar-2014  rmind file rump_curlwp___thread.h was added on branch rmind-smpnet on 2014-05-18 17:46:18 +0000
 1.3 19-Apr-2018  christos s/static inline/static __inline/g for consistency.
 1.2 16-Mar-2014  pooka branches: 1.2.4; 1.2.6; 1.2.10; 1.2.34;
remove unnecesary verbosity: s/RUMP_CURLWP_MODEL/RUMP_CURLWP/
 1.1 15-Mar-2014  pooka Allow compile-time optimizations to curlwp. This can have a pretty
staggering impact on performance. When running sendto() in a loop,
the improvement is 200k more calls per second with an inlined __thread
curlwp as opposed to the default. In other words, it shaves off hundreds
of CPU cycles per call (~20%). Even just eliminating the x86_curlwp()
call in favor of an inline gives an improvement of 60k calls per second.
 1.2.34.1 22-Apr-2018  pgoyette Sync with HEAD
 1.2.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.10.1 16-Mar-2014  tls file rump_curlwp_hypercall.h was added on branch tls-maxphys on 2014-08-20 00:04:41 +0000
 1.2.6.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.2.6.1 16-Mar-2014  yamt file rump_curlwp_hypercall.h was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.2.4.2 18-May-2014  rmind sync with head
 1.2.4.1 16-Mar-2014  rmind file rump_curlwp_hypercall.h was added on branch rmind-smpnet on 2014-05-18 17:46:18 +0000
 1.2 23-Mar-2015  pooka branches: 1.2.16;
fix typo

"set curlwp to context" -> "set curlwp to implicit context"
from Martin Lucina <martin@lucina.net>
 1.1 09-Nov-2014  pooka branches: 1.1.2;
Move rump kernel man pages from various sources to sys/rump

namely:
* src/lib is used only when building for POSIX'y platforms, but
the man pages have their use for all platforms
* rumpuser.3 is a function of the rump kernel, not one of the of
the POSIX'y implementation hosted in src/lib/librumpuser

no functional change
 1.1.2.1 06-Apr-2015  skrll Sync with HEAD
 1.2.16.2 03-Dec-2017  jdolecek update from HEAD
 1.2.16.1 23-Mar-2015  jdolecek file rump_lwproc.3 was added on branch tls-maxphys on 2017-12-03 11:39:16 +0000
 1.94 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.93 18-Jan-2016  pooka Fix dlopen()/dlclose()+RUMP_USE_CTOR to not leave dangling pointers around.
 1.92 22-Apr-2015  pooka Apparently not all ports define struct clockframe in cpu.h, so we cannot
provide our definition that way. Instead, generate the struct clockframe
passed to hardclock() in MD code.
 1.91 18-Apr-2015  pooka Give remote clients struct pmap storage. Although the pmap is unused,
that way we can sure that the pmap macro framework doesn't access all
the wrong places.
 1.90 17-Apr-2015  pooka Give the kernel/local pmaps actual storage.

That way friendly neighborhood macros won't go scribbling
in the wrong places.
 1.89 03-Apr-2015  pooka Use RUMP_PMAP_KERNEL and RUMP_PMAP_LOCAL to denote
kernel and local client pmaps, respectively.
 1.88 03-Apr-2015  pooka Use a different vmspace for rump kernel proc0 and local clients.
While the rump kernel and local clients are by definition in the same
host vmspace, there are subtle differences in how in-kernel code works
in case accessing the kernel vmspace or a user process vmspace.

Problem discovered by riastradh's "read(fd, NULL, 1)" test.
 1.87 07-Jan-2015  pooka Move sysproxy support into a separate component, rumpkern_sysproxy,
instead of it being always provided by the rump kernel base. This
move accomplishes two things:

1) it is no longer necessary to provide sysproxy hypercall stubs for
platforms which do not want to use sysproxy
2) it is easier to reason about the security aspects, since configurations
not linking the sysproxy component simply do not support remote
system calls

discussed on rumpkernel-users
 1.86 03-Jan-2015  pooka Put all sysproxy routines to their own C module, sysproxy.c
 1.85 27-Apr-2014  pooka branches: 1.85.4;
unsprinkle const to fix clang build. mmm, travis ci
 1.84 27-Apr-2014  pooka Eliminate weak symbols from rump kernel syscall handlers, part 4:

Do not query system call handlers by using the rumpuser_dl_globalsym()
hypercall -- it will not work in environments which are not in control
of their own symbols (e.g. rumpuser-xen). Instead, provide
rump_syscall_boot_establish(), which component constructors can use
to establish their non-modular syscalls.
 1.83 23-Apr-2014  pooka Add a RUMP_USE_CTOR compile-time switch. If defined, use
__attribute__((constructor)) to determine which rump kernel components
and kernel modules are linked into the rump kernel. If not defined
(default), use the regular approach with link sets.

This option is aimed to fix problems with toolchains where using link
sets is not possible because the linker does not generate the requisite
__start/__stop symbols for the link set sections (e.g. GNU gold, OS X, ...).
 1.82 23-Apr-2014  pooka Include LIST_ENTRY() in "struct rump_component".

Main benefit: rump_component_load() can now be called from an
early-running constructor since the routine doesn't need to allocate
memory.
 1.81 09-Apr-2014  pooka implement lwp_create() and a few related interfaces.
main raison d'impalerment: the aio driver
 1.80 15-Mar-2014  pooka branches: 1.80.2;
Allow compile-time optimizations to curlwp. This can have a pretty
staggering impact on performance. When running sendto() in a loop,
the improvement is 200k more calls per second with an inlined __thread
curlwp as opposed to the default. In other words, it shaves off hundreds
of CPU cycles per call (~20%). Even just eliminating the x86_curlwp()
call in favor of an inline gives an improvement of 60k calls per second.
 1.79 17-Jan-2014  pooka Use subr_cprng.c instead of stub implementation. Rijndael migrates from
rumpkern_crypto to rumpkern due to it being mandatory for cprng.
 1.78 27-Oct-2013  pooka Enable holding implicit threads over explicit scheduling points (i.e.
a kernel driver calling rump_lwproc_switch()). Also, correctly handle
curcpu()->ci_curlwp and biglock there.
 1.77 17-Sep-2013  pooka Make it possible to run component constructors after mainbus attaches,
but before config_finalize() is run.
 1.76 07-Sep-2013  pooka Add an initial console device and open fd's 0/1/2 for initproc. This is
again useful in standalone-type environments such as Xen, where all
printf/etc calls go through the rump kernel.
 1.75 03-Sep-2013  pooka Don't autogenerate the wrapper that is called from the rump kernel
local syscall entry points. The wrapper is now so big that it doesn't
get inlined (original intent for having it close to the entry points),
and autogenerating a regular function just loses in flexibility.
 1.74 10-Mar-2013  pooka branches: 1.74.6;
Don't allow kernel threads to run before all CPUs have been initialized
to avoid them getting scheduled on non-initialized CPUs.
 1.73 19-Feb-2013  martin Stopgap fix to make rump cooperate with pserialize, may be revisited later.
Patch from pooka, ok: rmind. No related regressions in a complete atf test
run (which works again with this, even on non x86 SMP machines).
 1.72 14-Jan-2013  pooka Don't use __weak_alias where the component framework is sufficient.
 1.71 09-Oct-2012  pooka Gather some statistics about biglock usage.
 1.70 21-Mar-2011  pooka branches: 1.70.4; 1.70.14;
Update copyright statements.

no functional change.
 1.69 13-Jan-2011  pooka branches: 1.69.2;
Introduce RUMP_LOCALPROC_P() macro and use it.
 1.68 11-Jan-2011  pooka Add one more component level to networking: IFCFG.
It is executed after IF and the purposes to guarantee the right
order in cross-component interface address configuration.
(e.g. lo0 is attached by net but 127.0.0.1 is configured by netinet)
 1.67 09-Jan-2011  pooka Allow multiple RUMP_COMPONENT() in one file.
 1.66 07-Jan-2011  pooka Avoid double init of tty_lock if rumpkern_tty is included. LOCKDEBUG
does not tolerate double inits.

pointed out by njoly
 1.65 01-Dec-2010  pooka Track lwp as the rumpuser mutex owner instead of pthread_t (this
is done in rumpuser for simplicity, since on the kernel side things
we assume we have only one pointer of space). As a side-effect,
we can no longer know if the current thread is holding on to a
mutex locked without curlwp context (basically all mutexes inited
outside of mutex_init()). The only thing that called rumpuser_mutex_held()
for a non-kmutex was the giant lock. So, instead implement recursive
locking for the giant lock in the rump kernel and get rid of the
now-unused recursive pthread mutex in the hypercall interface.
 1.64 21-Nov-2010  pooka Fix situation where we try to configure >MAXCPUS cpus.
 1.63 17-Nov-2010  pooka Remove unused rump_set_vmspace. An equivalent needs to come back
later, though, but in its current form it's just unusable garbage.
 1.62 17-Nov-2010  pooka cleanup some old garbage
 1.61 04-Nov-2010  pooka Refactor the sysproxy code so that rumpuser contains only the server side.
 1.60 29-Oct-2010  pooka Attach implicit threads to initproc instead of proc0. This way
applications which alter, by purpose or by accident, the uid in an
implicit thread are don't affect kernel threads.

from discussion with njoly
 1.59 27-Oct-2010  pooka Start rework of system call proxying over socket ("sysproxy").
This incarnation is written in the user namespace as opposed to
the previous one which was done in kernel namespace. Also, rump
does all the handshaking now instead of excepting an application
to come up with the user namespace socket.

There's still a lot to do, including making code "a bit" more
robust, actually running different clients in a different process
inside the kernel and splitting the client side library from librump.
I'm committing this now so that I don't lose it, plus it generally
works as long as you don't use it in unexcepted ways: i've tested
ifconfig(8), route(8), envstat(8) and sysctl(8).
 1.58 07-Sep-2010  pooka Make the Diabolical (Page)Daemon Director drain vfs buffers when
we are short of memory.

There are still some funnies left to iron out. For example, with
a certain file system / memory size configuration it's still not
possible to create enough files to make the file system run out of
inodes before the kernel runs out of memory. Also, with some other
configurations disk access slows down gargantually (though i'm sure
there are >0 buffers available). Anyway, it ~works for now and
it's by no means worse than what it was before.
 1.57 07-Sep-2010  pooka Allocate softint vectors for the final number of CPUs, not the
number currently attached. Deals with a SNAFU in my commit earlier
today which would cause softints established early to lack a
softint context on non-bootstrap CPUs.
 1.56 07-Sep-2010  pooka Attach only one CPU for the bootstrap phase.
 1.55 01-Sep-2010  pooka Implement rump_lwproc: the new lwp/proc management routines for
rump. These move the management of the pid/lwpid space from the
application into the kernel, make code more robust, and make it
possible to attach multiple lwp's to non-proc0 processes.
 1.54 14-Jun-2010  pooka Make it possible to define an upper limit for memory consumed by
the rump kernel by specifying RUMP_MEMLIMIT. In case allocation
over that limit is attempted, essentially pool reclaim and uvm_wait()
is done. The default is to allow to allocate as much as the host
will give.

XXX: uvm_km_alloc and malloc(9) do not currently conform. the
former is easy, the latter requires kern_malloc.c (rump malloc is
currently directly relegated to host malloc).
 1.53 13-Jun-2010  pooka Move FLAWLESSCALL from rump_dev_private.h into rump_private.h
so it can be used outside of devices.
 1.52 12-Jun-2010  pooka Support rumpkern components and rumpkern components depending on vfs init.
 1.51 10-Jun-2010  pooka Use kern_proc.c instead of a collection of stubs. But what we
really wanted from this commit was the support for proc_specificdata.

TODO: make creating a new process actually use kern_proc and
maybe even add an interface which starts a process with
"any pid you don't like"
 1.50 03-Jun-2010  pooka Implement a sort-of pagedaemon: adjust all memory allocators to go
through an in-rumpkernel hypermemory allocator which knows it should
kick the pagedaemon and block in case ``waitok'' memory allocation
fails.

This allows us to recover from some out-of-memory situations.
Realworld'istically speaking (as opposed to whatever "should be"
theory), these OOM situations will happen extremely rarely if ever
when our hypervisor is a regular process. Speculatively, this
should be useful for other types of hosts.

issues remaining:
* the hypervisor does not know how to reclaim kernel memory (and
for the reason I stated above, I'm not sure if it makes sense
to teach the current implementation about that)
* vfs memory (buffers, vm object pages etc.) is not reclaimed
 1.49 02-Jun-2010  pooka rumpvm_init -> uvm_init to get rid of local prototype.
no functional change
 1.48 01-Jun-2010  pooka * remove rumpvm_makepage, just use uvm_pagealloc()
* update copyright to reflect reality a little better
 1.47 31-May-2010  pooka Support mtsleep() without a biglocked sleeper (uvm uses this in
UVM_UNLOCK_AND_WAIT())
 1.46 18-May-2010  pooka Namespace rump-only kernel biglock routines appropriately.

No functional change.
 1.45 18-May-2010  pooka Make it possible to use the scheduler lock as the rumpuser condvar
interlock. This is applicable in cases where the actual interlock
is the CPU the currently running thread is scheduled on. Borrowing
the scheduler lock as the mutex mandated by pthread_cond_wait()
does away with need to have an additional mutex. This both optimizes
runtime execution and simplifies code, as the extra lock typically
lead to quite some trickeries to avoid the dungeon collapsing due
to zaps from the wand of deadlock.
 1.44 27-Apr-2010  pooka Fix multiple virtual cpu support.

... or at least on x86. CPU_INFO_FOREACH() still isn't MI, and I
don't want to support 2^n different versions.
 1.43 01-Mar-2010  pooka branches: 1.43.2;
Introduce RUMP_COMPONENT. It behaves mostly like a simplified
module which is linked into the kernel and cannot be unloaded.
The main purpose is to get the proper constructors run and create
any /dev nodes necessary for said component. Once more of the
kernel (e.g. networking stack and device drivers) are converted to
MODULE and devfs pops up from somewhere, rump components can be
retired.
 1.42 05-Dec-2009  pooka branches: 1.42.2;
Remove now-empty rump_sleepers_init()
 1.41 04-Dec-2009  pooka g/c unused functions (previously used by the vnode pager).
 1.40 03-Dec-2009  pooka Remove last remnants of the long-ago-properly-fixed RUMP_LMUTEX_MAGIC hack.
 1.39 03-Dec-2009  pooka Decide it's not worth the fuss to have rumpfs as a module and just
hardcode attach into rump_vfs_init(). Saves us from a lot of
pingpong init bouncing from one component to another to get the order
right.
 1.38 02-Dec-2009  uebayasi Declare global pointers as extern, otherwise they become common symbols.
Fix mips build in lib/librumpnet.
 1.37 01-Dec-2009  pooka Almost there for virtual CPU MP support:
* support bound kernel threads
* bind softint threads to specific virtual cpus
+ remove now-unnecessary locks from softint code

Now, if we only had MI CPU_INFO_FOREACH() .... (hi rmind ;)
 1.36 26-Nov-2009  pooka For rumpfs, do mountroot instead of the bunch of homegrown hacks
currently there. Still needs a little massage to get the kernel
interfaces right and avoid copypaste especially from main().

Also, move it a bit more into the direction of a real file system
(finally!) by giving it a vfsops. Most ops are still unimplemented,
though.
 1.35 09-Nov-2009  pooka Hash out soft interrupts to be a little closer to real softints:
* split them into levels
* allow only one per level to be active at a time
* fire softints only when we are unscheduling from a CPU instead
of immediately in softint_schedule(). this will later morph
into return from interrupt, but that part isn't done yet.
 1.34 16-Oct-2009  pooka Include sys_select.c for proper select()/poll() support.
 1.33 15-Oct-2009  pooka When allocating the temporary lwp we must have an lwp context. So
take turns using lwp0 for this purpose, nothing else uses it.
 1.32 15-Oct-2009  pooka Give lwp usage some much-needed love: stop treating lwp0 as the
all-sink and make sure each separate thread in rump has its own
lwp. Happy-go-lucky callers will get scheduled a temporary lwp
on entry, while true lwp connoisseurs may request a stable lwp
for their purposes. Some more love may be required later down the
road, but for now different threads will stepping on each others
toes.
 1.31 15-Oct-2009  pooka Add initial work on a rump virtual cpu scheduler. This is necessary
for kernel code which has been written to avoid MP contention by
using cpu-local storage (most prominently, select and pool_cache).

Instead of always assuming rump_cpu, the scheduler must now be run
(and unrun) on all entry points into rump. Likewise, rumpuser
unruns and re-runs the scheduler around each potentially blocking
operation. As an optimization, I modified some locking primitives
to try to get the lock without blocking before releasing the cpu.

Also, ltsleep was modified to assume that it is never called without
the biglock held and made to use the biglock as the sleep interlock.
Otherwise there is just too much drama with deadlocks. If some
kernel code wants to call ltsleep without the biglock, then, *snif*,
it's no longer supported and rump and should be modified to support
newstyle locks anyway.
 1.30 14-Oct-2009  pooka g/c some stuff which wasn't supposed to see the light of day
 1.29 14-Oct-2009  pooka Adjust rump sources for external/internal interfaces.
No functional change.
 1.28 29-Apr-2009  pooka Add proof-of-concept code for enabling system calls to rump virtual
kernels running in other processes on the same machine or on an
entirely different host. I wrote this a while ago and am now
committing it mainly to avoid losing it. It works, but could do
with a little tuning here and there.

What this will hopefully eventually buy us is the ability to use
standard userland tools to configure rump kernels, e.g. ifconfig(8)
and route(8) could be used to configure the networking stack provided
by a rump kernel. Also some distributed OS implications may apply.

fun fact: a system call which just does copyin/copyout takes >1000x
longer when made over the LAN as compared to when made on the same
machine.
 1.27 26-Apr-2009  pooka Fix getnano/microuptime to report actual uptime.
 1.26 06-Apr-2009  pooka let drivers define DPRINTF
 1.25 20-Feb-2009  pooka Add local syscall proxy as the default.
 1.24 07-Feb-2009  pooka branches: 1.24.2;
Make the clock interrupt tick based on absolute time instead of
relative time. This prevents drifting. Also, keep track of time
within userspace, so we do not have to make a syscall to get the
clock value. This is approximately 7 times cheaper, but on the
negative side is limited to the clock interrupt frequency.
 1.23 13-Jan-2009  pooka misc cleanup, mainly header polish
 1.22 13-Jan-2009  pooka Implement block I/O as a real block driver instead of a hacked copy
of specfs. That was easier years ago when rump didn't support
devices, but brings no gain now. This allows us to include the
real specfs in rump.
 1.21 02-Jan-2009  pooka Include kernel printf routines in rump instead of relying on the
magic libc symbol. This also allows to bid farewell to subr_prf2.c
and merge the contents back to subr_prf.c. The host kernel bridging
is now done via rumpuser_putchar().
 1.20 29-Dec-2008  pooka Switch i386 away from rump/include/machine. This means that rump
on i386 now uses the native kernel ABI. This in turn means that
rump modules and kernel modules are binary equivalent and can be
used interchangeably.
 1.19 29-Dec-2008  pooka Register a dummy block device for rump, since some file systems do
a sanity check to see if the block device exists. This dummy block
device should eventually replace rump specfs.
 1.18 16-Dec-2008  pooka Make rumpflushva flush only the atop info for a certain uvm object.
Better, but still not completely race-free (if two threads call
RUMP_VOP_PUTPAGES() directly for the same vm object).
 1.17 13-Dec-2008  pooka Get rid of local machine/{mutex,rwlock}.h files by treating the
object storage as a single pointer (all archs have at least one
uintptr_t in the objects).
 1.16 27-Nov-2008  pooka Remove the whole magic ubc window thingie. All file systems use
ubc_uiomove() now, so we can hook ourselves there.
 1.15 19-Nov-2008  pooka Split vfs out of rumpkern into rumpvfs. Non-fs rumps no longer
include the file system code. File system rumps explicitly need
to include rumpvfs from now on.
 1.14 18-Nov-2008  pooka Pass biodone() to rumpuser as a callback instead of hardcoding it.
Also, explicitly init rumpuser async io thread.
 1.13 13-Oct-2008  pooka branches: 1.13.2;
rump_enosys() is autogenerated into rump_syscalls (makes things
actually work)
 1.12 13-Oct-2008  pooka add rump_enosys()
 1.11 10-Oct-2008  pooka Support callouts and call callout_hardclock() from the timer
interrupt thread.

The sleepq implementation required for callouts is horrible, kludged
only for callouts, and generally unacceptable. It needs revisiting,
but I'm not sure yet should rump or kern_timeout be improved. It's
almost untested as of now, but committing this will give me some
maneuvering space while letting application compile.
 1.10 12-Aug-2008  pooka Make it possible to control starting of threads per env variable
instead of only at compile-time.
 1.9 29-Jul-2008  pooka Install rump libraries and utilities to the base system and remove the
private non-installed build infrastructure from sys/rump.

breakdown of commit:
* install relevant headers into /usr/include/rump
* build sys/rump/librump/rumpuser and sys/rump/librump/rumpkern
from src/lib and install as librumpuser and librump, respectively
+ this retains the ability to test a librump build with just the
kernel sources at hand
* move sys/rump/fs/lib/libukfs and sys/rump/fs/lib/libp2k to src/lib
for general consumption, they are not kernel-space dwellers anyway
* build and install sys/rump/fs/lib/lib$fs as librumpfs_$fs
* add chapter 3 manual pages for rump, rumpuser, ukfs and p2k
* build and install userspace kernel file system daemons if MKPUFFS=yes
is spexified
* retire fsconsole for now, it will make a comeback with an actually
implemented version shortly
 1.8 24-Jan-2008  pooka branches: 1.8.6; 1.8.10; 1.8.12; 1.8.14; 1.8.16;
Use namei() etc. from kernel sources instead of a reimplementation.
To accommodate, give the rootvnode its own vnode op vector with a
simple lookup operation. This is used for looking up the file
system's device vnode instead of doing that directly in a homesmoked
namei().
 1.7 25-Dec-2007  perry Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
 1.6 07-Nov-2007  pooka branches: 1.6.2; 1.6.6;
implement _kernel_lock{,_unlock}()
 1.5 06-Nov-2007  pooka Sprinkle some more locking, especially to the vm. Due to some
additional fixes, it's now possible to run file systems with
spinlocks actually enabled. The genfs_putpages() locking is still
working only due to greater powers, but I'll eventually get around to
fixing it.
 1.4 04-Nov-2007  pooka branches: 1.4.2;
* sprinkle some locking into the vm code
* avoid extra insert+search+remove step in file systems using
ubc_uiomove() instead of standard uiomove()
 1.3 31-Oct-2007  pooka branches: 1.3.2;
Make it possible to run rumps multithreaded. This brings real
locking and makes it possible to run file systems which create
threads. It also makes rump file system behaviour better match
file system behaviour in the kernel.
 1.2 01-Sep-2007  pooka branches: 1.2.2; 1.2.4; 1.2.8; 1.2.10;
* fill struct buf a little better
* hop, skip & jump to make uvm_pageratop work
 1.1 20-Aug-2007  pooka branches: 1.1.2;
add rump private parts I forgot to commit earlier today
 1.1.2.4 23-Mar-2008  matt sync with HEAD
 1.1.2.3 09-Jan-2008  matt sync with HEAD
 1.1.2.2 08-Nov-2007  matt sync with -HEAD
 1.1.2.1 06-Nov-2007  matt sync with HEAD
 1.2.10.1 13-Nov-2007  bouyer Sync with HEAD
 1.2.8.2 09-Oct-2007  ad Sync with head.
 1.2.8.1 01-Sep-2007  ad file rump_private.h was added on branch vmlocking on 2007-10-09 13:45:04 +0000
 1.2.4.5 04-Feb-2008  yamt sync with head.
 1.2.4.4 21-Jan-2008  yamt sync with head
 1.2.4.3 15-Nov-2007  yamt sync with head.
 1.2.4.2 03-Sep-2007  yamt sync with head.
 1.2.4.1 01-Sep-2007  yamt file rump_private.h was added on branch yamt-lazymbuf on 2007-09-03 14:45:35 +0000
 1.2.2.2 03-Sep-2007  skrll Sync with HEAD.
 1.2.2.1 01-Sep-2007  skrll file rump_private.h was added on branch nick-csl-alignment on 2007-09-03 10:23:56 +0000
 1.3.2.6 11-Nov-2007  joerg Sync with HEAD.
 1.3.2.5 06-Nov-2007  joerg Sync with HEAD.
 1.3.2.4 04-Nov-2007  jmcneill Sync with HEAD.
 1.3.2.3 02-Nov-2007  joerg Remove the rest of the unintentional diff in sys/rump.
 1.3.2.2 31-Oct-2007  joerg Sync with HEAD.
 1.3.2.1 31-Oct-2007  joerg file rump_private.h was added on branch jmcneill-pm on 2007-10-31 23:14:17 +0000
 1.4.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.4.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.6.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.6.2.1 26-Dec-2007  ad Sync with head.
 1.8.16.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.8.16.1 19-Oct-2008  haad Sync with HEAD.
 1.8.14.1 31-Jul-2008  simonb Sync with head.
 1.8.12.2 10-Oct-2008  skrll Sync with HEAD.
 1.8.12.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.8.10.4 09-Oct-2010  yamt sync with head
 1.8.10.3 11-Aug-2010  yamt sync with head.
 1.8.10.2 11-Mar-2010  yamt sync with head
 1.8.10.1 04-May-2009  yamt sync with head.
 1.8.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.8.6.1 28-Sep-2008  mjf Sync with HEAD.
 1.13.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.13.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.13.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.24.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.42.2.4 06-Nov-2010  uebayasi Sync with HEAD.
 1.42.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.42.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.42.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.43.2.4 21-Apr-2011  rmind sync with head
 1.43.2.3 05-Mar-2011  rmind sync with head
 1.43.2.2 03-Jul-2010  rmind sync with head
 1.43.2.1 30-May-2010  rmind sync with head
 1.69.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.70.14.5 03-Dec-2017  jdolecek update from HEAD
 1.70.14.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.70.14.3 23-Jun-2013  tls resync from head
 1.70.14.2 25-Feb-2013  tls resync with head
 1.70.14.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.70.4.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.70.4.2 23-Jan-2013  yamt sync with head
 1.70.4.1 30-Oct-2012  yamt sync with head
 1.74.6.1 18-May-2014  rmind sync with head
 1.80.2.1 10-Aug-2014  tls Rebase.
 1.85.4.3 19-Mar-2016  skrll Sync with HEAD
 1.85.4.2 06-Jun-2015  skrll Sync with HEAD
 1.85.4.1 06-Apr-2015  skrll Sync with HEAD
 1.164 09-Oct-2024  christos regen
 1.163 05-Oct-2024  mlelstv regen
 1.162 03-Oct-2024  christos regen
 1.161 20-May-2024  christos branches: 1.161.2;
regen
 1.160 19-May-2024  christos regen
 1.159 28-Jul-2023  christos regen
 1.158 10-Jul-2023  christos Regen
 1.157 01-Nov-2021  thorpej regen for "struct sigaltstack" -> "stack_t"
 1.156 19-Sep-2021  thorpej Regen for eventfd(2) and timerfd(2).
 1.155 02-Nov-2020  christos regen
 1.154 14-Aug-2020  riastradh branches: 1.154.2;
regen
 1.153 11-Jun-2020  dholland Regen with new makesyscalls.

(the large diff of rump_syscalls.h has been checked and was the point
of the makesyscalls change)
 1.152 02-Jun-2020  kamil Regenerate syscalls

Respect syscall alias names in rump.

No binary change in this version.

The previous commit was interrupted in the middle by CVS network outage.
 1.151 02-Jun-2020  kamil Regenerate native NetBSD syscalls

The only change is rump repecting syscall alias names.

No binary change.
 1.150 16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.149 26-Apr-2020  thorpej Regen for futex call relocation.
 1.148 26-Apr-2020  thorpej Regen for native futex calls.
 1.147 25-Apr-2020  bouyer Merge the bouyer-xenpvh branch, bringing in Xen PV drivers support under HVM
guests in GENERIC.
Xen support can be disabled at runtime with
boot -c
disable hypervisor
 1.146 22-Apr-2020  thorpej Regen for removal of _lwp_gettid(2).
 1.145 04-Apr-2020  thorpej branches: 1.145.2;
Regen for _lwp_gettid(2).
 1.144 21-Jan-2020  pgoyette Regen
 1.143 09-Oct-2019  christos branches: 1.143.2;
regen
 1.142 22-Sep-2019  christos regen
 1.141 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.140 10-Aug-2018  pgoyette Regen
 1.139 31-Jul-2018  rjs regen.
 1.138 12-Jul-2018  maxv Remove the kernel PMC code. Sent yesterday on tech-kern@.

This change:

* Removes "options PERFCTRS", the associated includes, and the associated
ifdefs. In doing so, it removes several XXXSMPs in the MI code, which is
good.

* Removes the PMC code of ARM XSCALE.

* Removes all the pmc.h files. They were all empty, except for ARM XSCALE.

* Reorders the x86 PMC code not to rely on the legacy pmc.h file. The
definitions are put in sysarch.h.

* Removes the kern/sys_pmc.c file, and along with it, the sys_pmc_control
and sys_pmc_get_info syscalls. They are marked as OBSOL in kern,
netbsd32 and rump.

* Removes the pmc_evid_t and pmc_ctr_t types.

* Removes all the associated man pages. The sets are marked as obsolete.
 1.137 06-Jan-2018  kamil branches: 1.137.2; 1.137.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.136 19-Dec-2017  kamil Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

It is an obsolete remnant from the old UNIX.

Sponsored by <The NetBSD Foundation>
 1.135 19-Dec-2017  kamil Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.134 19-Dec-2017  kamil Drop the sstk(2) syscall stub

sstk - change stack section size

This functionality has never been implemented and is a remnant from 16-bit
UNIX. This stub appeared with the first NetBSD commit.

Sponsored by <The NetBSD Foundation>
 1.133 08-Dec-2017  christos regen
XXX: pullup-8
 1.132 10-May-2017  riastradh regen
 1.131 13-Jan-2017  christos branches: 1.131.6;
regen
 1.130 02-Nov-2016  pgoyette Forgot these two generated files...
 1.129 03-Jul-2016  christos branches: 1.129.2;
regen
 1.128 06-May-2016  pooka regen syscall files
 1.127 23-Apr-2016  christos regen
 1.126 03-Apr-2016  christos regen
 1.125 03-Apr-2016  christos regen
 1.124 02-Apr-2016  christos regen
 1.123 26-Jan-2016  pooka regen syscall files
 1.122 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.121 03-Dec-2015  pgoyette Regen
 1.120 01-Dec-2015  pgoyette Regen
 1.119 30-Nov-2015  pgoyette Finish the regen - some of the files from sys/kern got committed
accidentally with the fix to makesyscalls.sh - sorry about that.
 1.118 30-Nov-2015  pgoyette Regen for 7.99.23
 1.117 14-Oct-2015  christos CID 1327233: Expicitly ignore return values of syscalls that don't fail.
 1.116 10-Oct-2015  pgoyette Regen
 1.115 24-Sep-2015  christos regen
 1.114 24-Aug-2015  pooka regen
 1.113 18-Jun-2015  pooka regen
 1.112 13-May-2015  pgoyette Regenerate
 1.111 10-May-2015  pgoyette Regen for changes related to separation of compat_sysv syscalls into a
separate module.
 1.110 09-May-2015  pgoyette Regen again, this time without the extra word in the "generated from" line.
 1.109 09-May-2015  pgoyette Regen from syscalls.master
 1.108 08-Apr-2015  justin regen after syscall update
 1.107 08-Mar-2015  christos regen
 1.106 07-Mar-2015  christos regen
 1.105 25-Feb-2015  christos belated regen (posix_fallocate, readlinkat)
 1.104 25-Jul-2014  dholland branches: 1.104.2; 1.104.4;
Regen for fdiscard and posix_fallocate.
 1.103 24-Jul-2014  pooka regen
 1.102 23-Jul-2014  pooka regen
 1.101 12-Jun-2014  joerg Regenerate
 1.100 27-Apr-2014  pooka Eliminate weak symbols from rump kernel syscall handlers, part 5:

regen syscalls to eliminate weak aliases and link-time initialization
 1.99 09-Apr-2014  pooka regen
 1.98 14-Mar-2014  pooka branches: 1.98.2;
regen: time/timer related syscalls for rump kernels
 1.97 11-Dec-2013  pooka reregengen
 1.96 09-Dec-2013  pooka regen
 1.95 09-Dec-2013  pooka regen
 1.94 09-Dec-2013  pooka regen
 1.93 09-Dec-2013  pooka regen
 1.92 17-Oct-2013  njoly Regen for mknodat(2) device argument type change.
 1.91 10-Sep-2013  pooka regen
 1.90 03-Sep-2013  pooka regen
 1.89 30-Aug-2013  pooka regen
 1.88 15-Aug-2013  pooka regen
 1.87 10-May-2013  christos branches: 1.87.2;
regen (stale)
 1.86 07-Mar-2013  pooka regen
 1.85 17-Jan-2013  pooka regen
 1.84 02-Oct-2012  christos regen
 1.83 20-Sep-2012  pooka regen
 1.82 03-Aug-2012  pooka branches: 1.82.2;
reregen
 1.81 03-Aug-2012  pooka regen
 1.80 20-Jul-2012  pooka reregen
 1.79 20-Jul-2012  pooka regen
 1.78 08-Mar-2012  joerg Implement sem_timedwait.
 1.77 11-Feb-2012  martin branches: 1.77.2;
Regen for posix_spawn
 1.76 01-Feb-2012  dholland Regen syscalls with proper id info.
 1.75 01-Feb-2012  dholland Change the syscall API for quotas over to the new non-proplib one.

- struct vfs_quotactl_args -> struct quotactl_args
- add sys/stdint.h to sys/quotactl.h for clean userland build
- install sys/quotactl.h in /usr/include
- update set lists for same
- add new marshalling code in libquota
- add new unmarshalling code in vfs_syscalls.c
- discard proplib interpreter code in vfs_quotactl.c
- add dispatching code for the 14 quotactl ops in vfs_quotactl.c
- mark the proplib quotactl syscall obsolete
- add a new syscall number for the new quotactl syscall
- change the name of the syscall to __quotactl()
- remove the decl of the old quotactl from quota/quotaprop.h
- add a decl of the new quotactl to sys/quotactl.h
- update the libc build
- update ktruss
- remove proplib marshalling code from libquota
- update copy of syscall table in gdb ppc sources
- hack rumphijack to accomodate new quotactl name (as I recall,
pooka wanted such a name change to simplify something, but I
don't really see what/how)

This change appears to require a kernel version bump for rumpish
reasons.
 1.74 08-Aug-2011  manu branches: 1.74.2; 1.74.6;
regen
 1.73 18-Jul-2011  drochner regen after *setxattr constification
 1.72 26-Jun-2011  christos regen
 1.71 08-Mar-2011  pooka regen: include rumpclient syscall headers from source tree instead of host
 1.70 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.69 22-Feb-2011  pooka omstart
 1.68 22-Feb-2011  pooka regenagain: make returning off_t work (without breaking other return
types on some archs)
 1.67 22-Feb-2011  pooka unregen
 1.66 22-Feb-2011  pooka regen: cast rval to return type instead of just using rval[0]
 1.65 21-Feb-2011  pooka regen: NOERR syscalls
 1.64 21-Feb-2011  pooka regen: preadv/pwritev
 1.63 21-Feb-2011  pooka regen: always explicitly set errno (fixes some apps)
 1.62 21-Feb-2011  pooka commit regen for int -> pid_t fix
 1.61 17-Jan-2011  pooka branches: 1.61.2;
regen: more compat syscalls
 1.60 17-Jan-2011  pooka regen: rework rump syscall stubs (see makesyscalls.sh log for details)
 1.59 10-Jan-2011  christos branches: 1.59.2;
regen
 1.58 30-Dec-2010  pooka regen for comments
 1.57 30-Dec-2010  pooka regen: SYCALL_NOSYS in rump_sysent[]
 1.56 30-Dec-2010  pooka regen: whitespace polish police
 1.55 17-Nov-2010  pooka regen: optimize local syscall path a bit
 1.54 11-Nov-2010  pooka +posix_fadvise
 1.53 04-Nov-2010  pooka regen: standalone client support for rump syscalls
 1.52 01-Nov-2010  pooka regen: whitespace blues
 1.51 07-Sep-2010  pooka regen: getcwd
 1.50 06-Sep-2010  pooka regen: umask
 1.49 30-Aug-2010  pooka regen: rump syscalls for kern_prot interfaces
 1.48 30-Aug-2010  pooka Empty commit to show makesyscalls.sh rev 1.99 didn't change anything (yet).
 1.47 19-Jul-2010  pooka Regen syscalls to get compat header included.
 1.46 10-Jun-2010  pooka regen: ksem syscalls
 1.45 04-Jun-2010  njoly Regen for pathconf/fpathconf rumpification.
 1.44 11-May-2010  pooka regen: _RUMPKERNEL -> _KERNEL
 1.43 27-Apr-2010  pooka regen: rump_enosys -> sys_nomodule for modular system calls
 1.42 21-Apr-2010  pooka regen: get/setrlimit
 1.41 05-Mar-2010  pooka branches: 1.41.2;
regen (for lfs syscalls #ifdef removal).
 1.40 26-Nov-2009  pooka branches: 1.40.2;
regen for rump_sys_pipe()
 1.39 26-Nov-2009  pooka regen: retval -> retval[2]
 1.38 26-Nov-2009  pooka regen: rump_sys_modctl()
 1.37 13-Oct-2009  pooka regen: fix rump varargs syscalls prototypes
 1.36 21-Jul-2009  pooka regen: fh syscalls
 1.35 15-May-2009  pooka regen: removal of pad arguments from the public interfaces
 1.34 28-Mar-2009  pooka regen: new syscalls
 1.33 19-Mar-2009  pooka regen: rump_sys_mount()
 1.32 18-Mar-2009  pooka regen: kevent and kqueue
 1.31 18-Mar-2009  pooka regen: arg -> callarg
 1.30 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.29 20-Feb-2009  pooka regen: make syscalls through a table
 1.28 26-Jan-2009  pooka branches: 1.28.2;
regen for new syscalls
 1.27 23-Jan-2009  pooka regen: int *error is dead.
 1.26 14-Jan-2009  pooka regen: internal prototype for rump_syscalls.c
 1.25 13-Jan-2009  pooka Regen. We now have compat __RENAME(). E.g. what was previously
rump_sys___stat50() is now rump_sys_stat() from the code.
 1.24 11-Jan-2009  tsutsui Regen to pull proper "created from" revision strings.
 1.23 11-Jan-2009  christos merge christos-time_t
 1.22 26-Nov-2008  pooka regen
 1.21 16-Nov-2008  pooka regen
 1.20 16-Oct-2008  wrstuden branches: 1.20.2; 1.20.4; 1.20.8;
Regen syscall tables. I forgot to do it after revivesa. While pooka
did some, not all are regenerated. Do them all at once for consistency.
 1.19 16-Oct-2008  pooka regen: ioctl
 1.18 15-Oct-2008  pooka regen: few networking calls
 1.17 15-Oct-2008  wrstuden Merge wrstuden-revivesa into HEAD.
 1.16 13-Oct-2008  pooka regen: properly create weak references to sys_foo()
 1.15 13-Oct-2008  pooka regen - weak aliasing for default syscall
 1.14 07-Sep-2008  pooka regen: return -1 for error
 1.13 01-Aug-2008  pooka regen: sys___sysctl
 1.12 16-Jul-2008  pooka regen: fsync
 1.11 07-Jul-2008  pooka branches: 1.11.2;
regen: u times, lu times, you know i had my share
 1.10 01-Jul-2008  pooka regen
 1.9 17-Jun-2008  tsutsui Regen from syscalls.master rev 1.204.
 1.8 29-May-2008  pooka branches: 1.8.2;
regen
 1.7 24-Apr-2008  ad branches: 1.7.2; 1.7.4;
Regen.
 1.6 21-Apr-2008  ad Regen.
 1.5 27-Mar-2008  ad branches: 1.5.2; 1.5.4; 1.5.6;
Regen.
 1.4 24-Mar-2008  yamt regen.
 1.3 24-Mar-2008  yamt regen.
 1.2 21-Mar-2008  ad branches: 1.2.2; 1.2.4;
Er, regen...
 1.1 11-Mar-2008  pooka branches: 1.1.2;
gen
 1.1.2.3 24-Mar-2008  yamt sync with head.
 1.1.2.2 17-Mar-2008  yamt sync with head.
 1.1.2.1 11-Mar-2008  yamt file rump_syscalls.c was added on branch yamt-lazymbuf on 2008-03-17 09:15:46 +0000
 1.2.4.2 24-Mar-2008  keiichi sync with head.
 1.2.4.1 21-Mar-2008  keiichi file rump_syscalls.c was added on branch keiichi-mipv6 on 2008-03-24 07:16:28 +0000
 1.2.2.2 23-Mar-2008  matt sync with HEAD
 1.2.2.1 21-Mar-2008  matt file rump_syscalls.c was added on branch matt-armv6 on 2008-03-23 02:05:09 +0000
 1.5.6.2 04-Jun-2008  yamt sync with head
 1.5.6.1 18-May-2008  yamt sync with head.
 1.5.4.7 17-Jan-2009  mjf Sync with HEAD.
 1.5.4.6 28-Sep-2008  mjf Sync with HEAD.
 1.5.4.5 02-Jul-2008  mjf Sync with HEAD.
 1.5.4.4 29-Jun-2008  mjf Sync with HEAD.
 1.5.4.3 02-Jun-2008  mjf Sync with HEAD.
 1.5.4.2 03-Apr-2008  mjf Sync with HEAD.
 1.5.4.1 27-Mar-2008  mjf file rump_syscalls.c was added on branch mjf-devfs2 on 2008-04-03 12:43:11 +0000
 1.5.2.9 29-Dec-2008  christos regen
 1.5.2.8 28-Dec-2008  christos missing const
 1.5.2.7 27-Dec-2008  christos merge with head.
 1.5.2.6 20-Nov-2008  christos catch up with head.
 1.5.2.5 20-Nov-2008  christos merge with head.
 1.5.2.4 09-Nov-2008  christos regen
 1.5.2.3 09-Nov-2008  christos regen
 1.5.2.2 01-Nov-2008  christos Sync with head.
 1.5.2.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.7.4.6 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.7.4.5 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.7.4.4 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.7.4.3 28-May-2008  wrstuden Regen.
 1.7.4.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.7.4.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.7.2.6 09-Oct-2010  yamt sync with head
 1.7.2.5 11-Aug-2010  yamt sync with head.
 1.7.2.4 11-Mar-2010  yamt sync with head
 1.7.2.3 19-Aug-2009  yamt sync with head.
 1.7.2.2 16-May-2009  yamt sync with head
 1.7.2.1 04-May-2009  yamt sync with head.
 1.8.2.3 18-Jul-2008  simonb Sync with head.
 1.8.2.2 03-Jul-2008  simonb Sync with head.
 1.8.2.1 18-Jun-2008  simonb Sync with head.
 1.11.2.3 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.11.2.2 19-Oct-2008  haad Sync with HEAD.
 1.11.2.1 07-Jul-2008  haad file rump_syscalls.c was added on branch haad-dm on 2008-10-19 22:18:07 +0000
 1.20.8.1 21-Apr-2010  matt sync to netbsd-5
 1.20.4.1 17-Sep-2011  bouyer Pull up following revision(s) (requested by manu in ticket #1658):
sys/rump/include/rump/rump_syscalls.h: revision 1.52 via patch
sys/kern/init_sysent.c: revision 1.257 via patch
sys/rump/include/rump/rumpvnode_if.h: revision 1.12 via patch
lib/libc/sys/Makefile.inc: revision 1.208 via patch
sys/sys/syscallargs.h: revision 1.227 via patch
sys/kern/kern_exec.c: revision 1.317 via patch
sys/rump/librump/rumpkern/rump_syscalls.c: revision 1.74 via patch
include/limits.h: revision 1.30 via patch
sys/kern/syscalls.master: revision 1.251 via patch
sys/sys/vnode_if.h: revision 1.83 via patch
sys/sys/fcntl.h: revision 1.40 via patch
sys/sys/fcntl.h: revision 1.41 via patch
sys/kern/vfs_syscalls.c: revision 1.433 via patch
sys/rump/librump/rumpvfs/rumpvnode_if.c: revision 1.11 via patch
sys/kern/syscalls.c: revision 1.248 via patch
sys/sys/syscall.h: revision 1.244 via patch
lib/libc/sys/link.2: revision 1.25 via patch
include/unistd.h: revision 1.127 via patch
distrib/sets/lists/comp/mi: revision 1.1659 via patch
sys/sys/stat.h: revision 1.61 via patch
First stage of support for Extended API set 2. Most of the think is
unimplemented, except enough of linkat(2) to hardlink to a symlink.
Everything new in headers is guarded #ifdef _INCOMPLETE_XOPEN_C063 since
some software (e.g.: xcvs in our own tree) will assume they can use openat(2)
when AT_FDCWD is defined. _INCOMPLETE_XOPEN_C063 will go away once support
will be completed.
regen
improve comment about AT_* defines: they are not only used by linkat(2)
Add macros to hide OpenGroup extened API set 2 from GNU configure. This
is a temporary workaround until the implementation is completed.
 1.20.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.20.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.20.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.28.2.2 23-Jul-2009  jym Sync with HEAD.
 1.28.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.40.2.4 06-Nov-2010  uebayasi Sync with HEAD.
 1.40.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.40.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.40.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.41.2.4 21-Apr-2011  rmind sync with head
 1.41.2.3 05-Mar-2011  rmind sync with head
 1.41.2.2 03-Jul-2010  rmind sync with head
 1.41.2.1 30-May-2010  rmind sync with head
 1.59.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.61.2.2 05-Mar-2011  bouyer Sync with HEAD
 1.61.2.1 20-Jan-2011  bouyer Snapshot of work in progress on a modernised disk quota system:
- new quotactl syscall (versionned for backward compat), which takes
as parameter a path to a mount point, and a prop_dictionary
(in plistref format) describing commands and arguments.
For each command, status and data are returned as a prop_dictionary.
quota commands features will be added to take advantage of this,
exporting quota data or getting quota commands as plists.

- new on disk-format storage (all 64bit wide), integrated to metadata for
ffs (and playing nicely with wapbl).
Quotas are enabled on a ffs filesystem via superblock flags.
tunefs(8) can enable or disable quotas.
On a quota-enabled filesystem, fsck_ffs(8) will track per-uid/gid
block and inode usages, and will check and update quotas in Pass 6.
quota usage and limits are stored in unliked files (one for users,
one for groups)l fsck_ffs(8) will create the files if needed, or
free them if needed. This means that after enabling or disabling
quotas on a filesystem; a fsck_ffs(8) run is required.
quotacheck(8) is not needed any more, on a unclean shutdown
fsck or journal replay will take care of fixing quotas.
newfs(8) can create a ready-to-mount quota-enabled filesystem
(superblock flags are set and quota inodes are created).
Other new features or semantic changes:
- default quota datas, applied to users or groups which don't already
have a quota entry
- per-user/group grace time (instead of a filesystem global one)
- 0 really means "nothing allowed at all", not "no limit".
If you want "no limit", set the limit to UQUAD_MAX (tools will
understand "unlimited" and "-")

A quota file is structured as follow:
it starts with a header, containing a few per-filesystem values,
and the default quota limits.
Quota entries are linked together as a simple list, each entry has a
pointer (as an offset withing the file) to the next.
The header has a pointer to a list of free quota entries, and
a hash table of in-use entries. The size of the hash table depends
on the filesystem block size (header+hash table should fit in the
first block). The file is not sparse and is a multiple of
filesystem block size (when the free quota entry list is empty a new
filesystem block is allocated). quota entries to not cross
filesystem block boundaries.

In memory, the kernel keeps a cache of recently used quota entries
as a reference to the block number, and offset withing the block.
The quota entry itself is keept in the buf cache.

fsck_ffs(8), tunefs(8) and newfs(8) supports are completed (with
related atf tests :)
The kernel can update disk usage and report it via quotactl(2).

Todo: enforce quotas limits (limits are not checked by kernel yet)
update repquota, edquota and rpc.rquotad to the new world
implement compat_50_quotactl ioctl.
update quotactl(2) man page

fsck_ffs required fixes so that allocating new blocks or inodes will
properly update the superblock and cg sumaries. This was not an issue up
to now because superblock and cg sumaries check happened last, but now
allocations or frees can happen in pass 6.
 1.74.6.2 11-Mar-2012  mrg sync to latest -current
 1.74.6.1 18-Feb-2012  mrg merge to -current.
 1.74.2.4 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.74.2.3 23-Jan-2013  yamt sync with head
 1.74.2.2 30-Oct-2012  yamt sync with head
 1.74.2.1 17-Apr-2012  yamt sync with head
 1.77.2.1 14-Apr-2015  msaitoh Pull up following revision(s) (requested by khorben in ticket #1264):

include/unistd.h 1.144
sys/kern/init_sysent.c regen
sys/kern/syscalls.c regen
sys/kern/syscalls.master 1.272
sys/rump/include/rump/rump_syscalls.h regen
sys/rump/librump/rumpkern/rump_syscalls.c regen
sys/sys/syscall.h regen
sys/sys/syscallargs.h regen
sys/compat/netbds32/netbsd32_syscall.h regen
sys/compat/netbds32/netbsd32_syscallargs.h regen
sys/compat/netbds32/netbsd32_syscalls.c regen
sys/compat/netbds32/netbsd32_sysent.c regen
sys/compat/netbsd32/syscalls.master 1.102

Fix return type of the readlinkat(2) syscall. PR#49684.
 1.82.2.5 03-Dec-2017  jdolecek update from HEAD
 1.82.2.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.82.2.3 23-Jun-2013  tls resync from head
 1.82.2.2 25-Feb-2013  tls resync with head
 1.82.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.87.2.1 18-May-2014  rmind sync with head
 1.98.2.1 10-Aug-2014  tls Rebase.
 1.104.4.9 05-Dec-2016  skrll Sync with HEAD
 1.104.4.8 09-Jul-2016  skrll Sync with HEAD
 1.104.4.7 29-May-2016  skrll Sync with HEAD
 1.104.4.6 22-Apr-2016  skrll Sync with HEAD
 1.104.4.5 19-Mar-2016  skrll Sync with HEAD
 1.104.4.4 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.104.4.3 22-Sep-2015  skrll Sync with HEAD
 1.104.4.2 06-Jun-2015  skrll Sync with HEAD
 1.104.4.1 06-Apr-2015  skrll Sync with HEAD
 1.104.2.1 24-Feb-2015  martin regen
 1.129.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.129.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.131.6.1 11-May-2017  pgoyette Sync with HEAD
 1.137.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.137.4.1 10-Jun-2019  christos Sync with HEAD
 1.137.2.9 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.137.2.8 28-Jul-2018  pgoyette Sync with HEAD
 1.137.2.7 18-Apr-2018  pgoyette Regen
 1.137.2.6 27-Mar-2018  pgoyette Regen
 1.137.2.5 25-Mar-2018  pgoyette Regen
 1.137.2.4 17-Mar-2018  pgoyette Regen
 1.137.2.3 16-Mar-2018  pgoyette Regen
 1.137.2.2 15-Mar-2018  pgoyette Regen
 1.137.2.1 10-Mar-2018  pgoyette Regen
 1.143.2.1 25-Jan-2020  ad Sync with head.
 1.145.2.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.154.2.3 14-Dec-2020  thorpej Regen for timerfd.
 1.154.2.2 14-Dec-2020  thorpej Regen for eventfd(2).
 1.154.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.161.2.1 02-Aug-2025  perseant Sync with HEAD
 1.21 17-Nov-2008  pooka regen
 1.20 16-Oct-2008  wrstuden branches: 1.20.2; 1.20.4; 1.20.8;
Regen syscall tables. I forgot to do it after revivesa. While pooka
did some, not all are regenerated. Do them all at once for consistency.
 1.19 16-Oct-2008  pooka regen: ioctl
 1.18 15-Oct-2008  pooka regen: few networking calls
 1.17 15-Oct-2008  wrstuden Merge wrstuden-revivesa into HEAD.
 1.16 13-Oct-2008  pooka regen: properly create weak references to sys_foo()
 1.15 13-Oct-2008  pooka regen - weak aliasing for default syscall
 1.14 07-Sep-2008  pooka regen: return -1 for error
 1.13 01-Aug-2008  pooka regen: sys___sysctl
 1.12 16-Jul-2008  pooka regen: fsync
 1.11 07-Jul-2008  pooka branches: 1.11.2;
regen: u times, lu times, you know i had my share
 1.10 01-Jul-2008  pooka regen
 1.9 17-Jun-2008  tsutsui Regen from syscalls.master rev 1.204.
 1.8 29-May-2008  pooka branches: 1.8.2;
regen
 1.7 24-Apr-2008  ad branches: 1.7.2; 1.7.4;
Regen.
 1.6 21-Apr-2008  ad Regen.
 1.5 27-Mar-2008  ad branches: 1.5.2; 1.5.4; 1.5.6;
Regen.
 1.4 24-Mar-2008  yamt regen.
 1.3 24-Mar-2008  yamt regen.
 1.2 21-Mar-2008  ad branches: 1.2.2; 1.2.4;
Er, regen...
 1.1 11-Mar-2008  pooka branches: 1.1.2;
gen
 1.1.2.3 24-Mar-2008  yamt sync with head.
 1.1.2.2 17-Mar-2008  yamt sync with head.
 1.1.2.1 11-Mar-2008  yamt file rump_syscalls.h was added on branch yamt-lazymbuf on 2008-03-17 09:15:46 +0000
 1.2.4.2 24-Mar-2008  keiichi sync with head.
 1.2.4.1 21-Mar-2008  keiichi file rump_syscalls.h was added on branch keiichi-mipv6 on 2008-03-24 07:16:28 +0000
 1.2.2.2 23-Mar-2008  matt sync with HEAD
 1.2.2.1 21-Mar-2008  matt file rump_syscalls.h was added on branch matt-armv6 on 2008-03-23 02:05:09 +0000
 1.5.6.2 04-Jun-2008  yamt sync with head
 1.5.6.1 18-May-2008  yamt sync with head.
 1.5.4.7 17-Jan-2009  mjf Sync with HEAD.
 1.5.4.6 28-Sep-2008  mjf Sync with HEAD.
 1.5.4.5 02-Jul-2008  mjf Sync with HEAD.
 1.5.4.4 29-Jun-2008  mjf Sync with HEAD.
 1.5.4.3 02-Jun-2008  mjf Sync with HEAD.
 1.5.4.2 03-Apr-2008  mjf Sync with HEAD.
 1.5.4.1 27-Mar-2008  mjf file rump_syscalls.h was added on branch mjf-devfs2 on 2008-04-03 12:43:11 +0000
 1.5.2.5 20-Nov-2008  christos merge with head.
 1.5.2.4 09-Nov-2008  christos regen
 1.5.2.3 09-Nov-2008  christos regen
 1.5.2.2 01-Nov-2008  christos Sync with head.
 1.5.2.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.7.4.5 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.7.4.4 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.7.4.3 28-May-2008  wrstuden Regen.
 1.7.4.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.7.4.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.7.2.1 04-May-2009  yamt sync with head.
 1.8.2.3 18-Jul-2008  simonb Sync with head.
 1.8.2.2 03-Jul-2008  simonb Sync with head.
 1.8.2.1 18-Jun-2008  simonb Sync with head.
 1.11.2.3 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.11.2.2 19-Oct-2008  haad Sync with HEAD.
 1.11.2.1 07-Jul-2008  haad file rump_syscalls.h was added on branch haad-dm on 2008-10-19 22:18:07 +0000
 1.20.8.1 21-Apr-2010  matt sync to netbsd-5
 1.20.4.1 17-Sep-2011  bouyer Pull up following revision(s) (requested by manu in ticket #1658):
sys/rump/include/rump/rump_syscalls.h: revision 1.52 via patch
sys/kern/init_sysent.c: revision 1.257 via patch
sys/rump/include/rump/rumpvnode_if.h: revision 1.12 via patch
lib/libc/sys/Makefile.inc: revision 1.208 via patch
sys/sys/syscallargs.h: revision 1.227 via patch
sys/kern/kern_exec.c: revision 1.317 via patch
sys/rump/librump/rumpkern/rump_syscalls.c: revision 1.74 via patch
include/limits.h: revision 1.30 via patch
sys/kern/syscalls.master: revision 1.251 via patch
sys/sys/vnode_if.h: revision 1.83 via patch
sys/sys/fcntl.h: revision 1.40 via patch
sys/sys/fcntl.h: revision 1.41 via patch
sys/kern/vfs_syscalls.c: revision 1.433 via patch
sys/rump/librump/rumpvfs/rumpvnode_if.c: revision 1.11 via patch
sys/kern/syscalls.c: revision 1.248 via patch
sys/sys/syscall.h: revision 1.244 via patch
lib/libc/sys/link.2: revision 1.25 via patch
include/unistd.h: revision 1.127 via patch
distrib/sets/lists/comp/mi: revision 1.1659 via patch
sys/sys/stat.h: revision 1.61 via patch
First stage of support for Extended API set 2. Most of the think is
unimplemented, except enough of linkat(2) to hardlink to a symlink.
Everything new in headers is guarded #ifdef _INCOMPLETE_XOPEN_C063 since
some software (e.g.: xcvs in our own tree) will assume they can use openat(2)
when AT_FDCWD is defined. _INCOMPLETE_XOPEN_C063 will go away once support
will be completed.
regen
improve comment about AT_* defines: they are not only used by linkat(2)
Add macros to hide OpenGroup extened API set 2 from GNU configure. This
is a temporary workaround until the implementation is completed.
 1.20.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.25 01-Jul-2020  riastradh copystr is now in libkern; don't redefine it in rumpcopy.c.

Should fix build breakage from the copystr changes.
 1.24 05-Apr-2020  kamil Return early on 0-sized transfers (usually to/from NULL-objects)

This logic is already present in subr_copy.c:copyin_vmspace() and
rumpcopy.c:copyinstr().

This avoids memcpy() calls for NULL objects that is Undefined Behavior,
allowed in the kernel space (-fno-delete-null-pointer-checks), but not
in userland.

Reported by UBSan.
 1.23 06-Apr-2019  thorpej Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

Also augmement the ucas(9) API, making it consistently available on
all plaforms, supporting uniprocessor and multiprocessor systems, even
those that do not have CAS or LL/SC primitives.

Welcome to NetBSD 8.99.37.
 1.22 25-May-2016  christos branches: 1.22.18;
Introduce security.pax.mprotect.ptrace sysctl which can be used to bypass
mprotect settings so that debuggers can write to the text segment of traced
processes so that they can insert breakpoints. Turned off by default.
Ok: chuq (for now)
 1.21 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.20 18-Apr-2015  pooka Give remote clients struct pmap storage. Although the pmap is unused,
that way we can sure that the pmap macro framework doesn't access all
the wrong places.
 1.19 03-Jan-2015  pooka Put all sysproxy routines to their own C module, sysproxy.c
 1.18 26-Jul-2013  njoly branches: 1.18.6;
Make copyinstr/copyoutstr return EFAULT for special NULL "user"
address.
Ok pooka@.
 1.17 18-Jan-2011  haad branches: 1.17.6; 1.17.16; 1.17.20;
Add support for compiling ZFS and Solaris modules as RUMP libraries. Add
some locking and rumpcopy primitives and refactor module building Makefiles
to work with both RUMP and kernel modules. This is first part of adding
support for regular test of zfs on NetBSD to hunt some bugs and make it
stable.

Ok by pooka@.
 1.16 13-Jan-2011  pooka branches: 1.16.2;
Introduce RUMP_LOCALPROC_P() macro and use it.
 1.15 09-Jan-2011  pooka Shortcircuit remote 0-len copyin/out already in the kernel.
 1.14 09-Jan-2011  pooka accept '\0' as a valid string
 1.13 25-Nov-2010  pooka *facepalm*, adjust remote copyinstr to work in cases where the end
of the max copyin extends to an unmapped page.

Noticed, as usual, by tests.
 1.12 22-Nov-2010  pooka the usual wuninit stuff
 1.11 22-Nov-2010  pooka Support physio for remote processes.
==> add support for remote vmspace vmapbuf/vunmapbuf
==> add proper support for copyin/out_vmspace
==> add support for remote vmspace uvm_io
==> add support for non-curproc rumpuser_sp_copyin/out
==> store remote context in vm_map->pmap instead of
pthread_specificdata

In short, makes read/write of most (all?) block devices work from
a remote rump client via rump syscalls.
 1.10 17-Nov-2010  pooka cleanup some old garbage
 1.9 09-Nov-2010  pooka Fix off-by-one in the rpc path of copyinstr()
 1.8 09-Nov-2010  pooka fix copystr/copyinstr/copyoutstr to return ENAMETOOLONG where appropriate
 1.7 29-Oct-2010  pooka minor knf
 1.6 27-Oct-2010  pooka Start rework of system call proxying over socket ("sysproxy").
This incarnation is written in the user namespace as opposed to
the previous one which was done in kernel namespace. Also, rump
does all the handshaking now instead of excepting an application
to come up with the user namespace socket.

There's still a lot to do, including making code "a bit" more
robust, actually running different clients in a different process
inside the kernel and splitting the client side library from librump.
I'm committing this now so that I don't lose it, plus it generally
works as long as you don't use it in unexcepted ways: i've tested
ifconfig(8), route(8), envstat(8) and sysctl(8).
 1.5 18-Jul-2010  pooka Ignore errors when copyin/out len == 0.
 1.4 12-Jul-2010  pooka Implement poor man's (or woman's) fault handler (or handlim).

from Stan (or Loretta)
 1.3 10-Jun-2010  pooka Use kern_proc.c instead of a collection of stubs. But what we
really wanted from this commit was the support for proc_specificdata.

TODO: make creating a new process actually use kern_proc and
maybe even add an interface which starts a process with
"any pid you don't like"
 1.2 04-Nov-2009  pooka branches: 1.2.2; 1.2.4; 1.2.6;
trim trailing whitespace
 1.1 04-Nov-2009  pooka move copy-related routines to their own module
 1.2.6.2 05-Mar-2011  rmind sync with head
 1.2.6.1 03-Jul-2010  rmind sync with head
 1.2.4.3 11-Aug-2010  yamt sync with head.
 1.2.4.2 11-Mar-2010  yamt sync with head
 1.2.4.1 04-Nov-2009  yamt file rumpcopy.c was added on branch yamt-nfs-mp on 2010-03-11 15:04:38 +0000
 1.2.2.2 06-Nov-2010  uebayasi Sync with HEAD.
 1.2.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.16.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.17.20.1 28-Aug-2013  rmind sync with head
 1.17.16.2 03-Dec-2017  jdolecek update from HEAD
 1.17.16.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.17.6.1 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.18.6.4 29-May-2016  skrll Sync with HEAD
 1.18.6.3 19-Mar-2016  skrll Sync with HEAD
 1.18.6.2 06-Jun-2015  skrll Sync with HEAD
 1.18.6.1 06-Apr-2015  skrll Sync with HEAD
 1.22.18.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.22.18.1 10-Jun-2019  christos Sync with HEAD
 1.5 12-Feb-2014  pooka Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.4 22-Jun-2012  rmind branches: 1.4.2; 1.4.4;
rumpkern:
- Add subr_kcpuset.c and subr_pserialize.c modules.
- Add kcpuset_{running,attached} for RUMP env.
 1.3 04-Jan-2011  pooka branches: 1.3.8; 1.3.14;
Add SMP support for all architectures.

tested on sparc64 by martin
 1.2 27-Apr-2010  pooka Fix multiple virtual cpu support.

... or at least on x86. CPU_INFO_FOREACH() still isn't MI, and I
don't want to support 2^n different versions.
 1.1 15-Oct-2009  pooka branches: 1.1.2; 1.1.4; 1.1.6;
forgot to commit with previous batch
 1.1.6.2 05-Mar-2011  rmind sync with head
 1.1.6.1 30-May-2010  rmind sync with head
 1.1.4.3 11-Aug-2010  yamt sync with head.
 1.1.4.2 11-Mar-2010  yamt sync with head
 1.1.4.1 15-Oct-2009  yamt file rumpcpu_generic.c was added on branch yamt-nfs-mp on 2010-03-11 15:04:38 +0000
 1.1.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.3.14.1 26-Jun-2012  riz Pull up following revision(s) (requested by rmind in ticket #365):
sys/rump/librump/rumpkern/rumpcpu_generic.c: revision 1.4
sys/net/npf/npf_session.c: revision 1.13
sys/net/npf/npf_tableset.c: revision 1.11
sys/net/npf/npf_state_tcp.c: revision 1.7
sys/net/npf/npf_inet.c: revision 1.12
sys/net/npf/npf.h: revision 1.17
sys/net/npf/npf_instr.c: revision 1.11
usr.sbin/npf/npftest/libnpftest/npf_table_test.c: revision 1.2
sys/net/npf/npf_state.c: revision 1.8
sys/net/npf/npf_log.c: revision 1.4
sys/net/npf/npf_alg.c: revision 1.4
sys/rump/librump/rumpkern/Makefile.rumpkern: revision 1.118
sys/net/npf/npf_nat.c: revision 1.13
sys/net/npf/npf.c: revision 1.11
sys/net/npf/npf_sendpkt.c: revision 1.11
sys/net/npf/npf_impl.h: revision 1.16
sys/rump/librump/rumpkern/scheduler.c: revision 1.28
rumpkern:
- Add subr_kcpuset.c and subr_pserialize.c modules.
- Add kcpuset_{running,attached} for RUMP env.
NPF:
- Rename some functions for consistency and de-inline them.
- Fix few invalid asserts (add regressoin test).
- Use pserialize(9) for ALG interface.
- Minor fixes, sprinkle many comments.
 1.3.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.3.8.1 30-Oct-2012  yamt sync with head
 1.4.4.1 18-May-2014  rmind sync with head
 1.4.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14 26-Jan-2016  pooka generate privhdrs to new location
 1.13 25-Apr-2014  pooka branches: 1.13.4;
Move the etfs linkage from rumpvfs to rumpkern, and replace the
weak alias show with an honest pointer indirection.

No client-visible change. (apart from this version working e.g.
on musl w/ dlopen)
 1.12 10-Mar-2014  pooka branches: 1.12.2;
rump_getversion() does not require a thread context, so make it a straight
call instead of being wrapped around rump_pub_getversion().
 1.11 07-Mar-2013  pooka branches: 1.11.6;
Support multiple syscall emuls.

Rump kernels with only local clients have it easy, since they have to
support at most two syscall vectors (some calls such as mount/unmount
can be made only through the "native" NetBSD vector). Remote clients
are a whole different tin of green beans. This change addresses local
clients only.
 1.10 02-Jan-2011  pooka branches: 1.10.8; 1.10.18;
There is a use case where preserving the parent's fd table is
relevant, so to accommodate that change rump_lwproc_newproc() to
rump_lwproc_rfork(). The new interface has the rfork() fd table
semantics. The equivalent of rump_lwproc_newproc() is
rump_lwproc_rfork(RUMP_RFCFDG).
 1.9 21-Nov-2010  pooka Realize the >1yo comment above rump_reboot and retire them to make
room for sys_reboot.
 1.8 17-Nov-2010  pooka remove rump_pub_syscall -- unused/unusable
 1.7 27-Oct-2010  pooka Retire the old sysproxy nonsense (as part of doing it slightly better).

Introduce rump_pub_syscall() as the generic interface for making
system calls with already marshalled arguments. So it's kinda like
syscall(2), except it also remembered to breathe instead of having
to figure out how to deal with 64bit values.
 1.6 01-Sep-2010  pooka Rewrite rump process and lwp allocation routines now that I have
some idea of how they should be done. This change essentially
moves the responsibility of pid/lwpid management from the application
side into the rump kernel. It also introduces clear rules on what
happens when, i.e. introduces semantics (these semantics will be
documented on the man page, and more importantly in atf tests).
 1.5 14-Apr-2010  pooka Use "struct kauth_cred *" instead of kauth_cred_t in all exported
interfaces. Allows to remove hairbrained _t typedef dance.
 1.4 05-Mar-2010  pooka branches: 1.4.2; 1.4.4;
Use improved kernel module interfaces: instead of adding + loading
modules in bootstrap, just add them. Load them later the same way
as the kernel does: module_init_class().

Change the signature of rump_module_init() to take a vector instead
of just one module. All modules in a DSO should be init'd at the
same time because they might depend on each other, and code outside
the rump kernel cannot know which way. (binary kernel modules are
still loaded with rump_sys_modctl() the usual way).
 1.3 26-Nov-2009  pooka branches: 1.3.2;
Add rump_kernelfsym_load(), which loads the kernel symbol table.
 1.2 15-Oct-2009  pooka Give lwp usage some much-needed love: stop treating lwp0 as the
all-sink and make sure each separate thread in rump has its own
lwp. Happy-go-lucky callers will get scheduled a temporary lwp
on entry, while true lwp connoisseurs may request a stable lwp
for their purposes. Some more love may be required later down the
road, but for now different threads will stepping on each others
toes.
 1.1 14-Oct-2009  pooka Create rump public interfaces from description tables. This allows
us to control and wrap all entry points from "userspace" into rump.
This in turn is necessary for the upcoming rump cpu scheduler.

For each interface "foo" a public wrapper called "rump_foo" is
created. It calls the internal implementation "rumppriv_foo". In
case foo is to be called from inside of rump kernel space, the
private interface "rumppriv_foo" is used -- the userspace wrapper
prototypes are not even exported into the rump kernel namespace.
Needless to say, the rump kernel internal interfaces are not exported
for users.

Now, three classes of interfaces fight for control of rump:
+ the noble local control interfaces (which this commit addresses)
+ the insidious rump system calls (which are generated from syscalls.master)
+ and the evil vnode interfaces (which are generated from vnode_if.src)
 1.3.2.3 06-Nov-2010  uebayasi Sync with HEAD.
 1.3.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.3.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.4.4.2 05-Mar-2011  rmind sync with head
 1.4.4.1 30-May-2010  rmind sync with head
 1.4.2.4 09-Oct-2010  yamt sync with head
 1.4.2.3 11-Aug-2010  yamt sync with head.
 1.4.2.2 11-Mar-2010  yamt sync with head
 1.4.2.1 05-Mar-2010  yamt file rumpkern.ifspec was added on branch yamt-nfs-mp on 2010-03-11 15:04:38 +0000
 1.10.18.3 03-Dec-2017  jdolecek update from HEAD
 1.10.18.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.18.1 23-Jun-2013  tls resync from head
 1.10.8.1 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.11.6.1 18-May-2014  rmind sync with head
 1.12.2.1 10-Aug-2014  tls Rebase.
 1.13.4.1 19-Mar-2016  skrll Sync with HEAD
 1.17 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.16 25-Apr-2014  pooka branches: 1.16.4;
regen
 1.15 25-Apr-2014  pooka regen for etfs move from rumpvfs to rumpkern
 1.14 10-Mar-2014  pooka branches: 1.14.2;
rump_getversion() does not require a thread context, so make it a straight
call instead of being wrapped around rump_pub_getversion().
 1.13 07-Mar-2013  pooka branches: 1.13.6;
*** empty log message ***
 1.12 02-Jan-2011  pooka branches: 1.12.8; 1.12.18;
regen: rump_lwproc_rfork
 1.11 21-Nov-2010  pooka regen: rump_reboot is gone
 1.10 17-Nov-2010  pooka regen: -rump_pub_syscall
 1.9 27-Oct-2010  pooka regen:
- rump_sysproxy
+ rump_syscall
 1.8 01-Sep-2010  pooka regen: new lwp/proc interfaces
 1.7 14-Apr-2010  pooka regen: kauth_cred_t -> struct kauth_cred *
 1.6 05-Mar-2010  pooka branches: 1.6.2; 1.6.4;
regen for rump_module interface change
 1.5 26-Nov-2009  pooka branches: 1.5.2;
regen: rump_kernelfsym_load()
 1.4 15-Oct-2009  pooka regen: lwp interface changes
 1.3 15-Oct-2009  pooka regen: scheduling points in rump_pub wrappers
 1.2 14-Oct-2009  pooka regen: put all public interfaces created by ifspec into a rump_pub namespace
 1.1 14-Oct-2009  pooka generate rump local interfaces
 1.5.2.3 06-Nov-2010  uebayasi Sync with HEAD.
 1.5.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.5.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.6.4.2 05-Mar-2011  rmind sync with head
 1.6.4.1 30-May-2010  rmind sync with head
 1.6.2.4 09-Oct-2010  yamt sync with head
 1.6.2.3 11-Aug-2010  yamt sync with head.
 1.6.2.2 11-Mar-2010  yamt sync with head
 1.6.2.1 05-Mar-2010  yamt file rumpkern_if_priv.h was added on branch yamt-nfs-mp on 2010-03-11 15:04:38 +0000
 1.12.18.3 03-Dec-2017  jdolecek update from HEAD
 1.12.18.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.12.18.1 23-Jun-2013  tls resync from head
 1.12.8.1 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.13.6.1 18-May-2014  rmind sync with head
 1.14.2.1 10-Aug-2014  tls Rebase.
 1.16.4.1 19-Mar-2016  skrll Sync with HEAD
 1.18 26-Jan-2016  pooka regen rump kernel interfaces for header change.
(they were already manually edited for a prior commit, so not much change)
 1.17 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.16 25-Apr-2014  pooka branches: 1.16.4;
regen
 1.15 25-Apr-2014  pooka regen for etfs move from rumpvfs to rumpkern
 1.14 10-Mar-2014  pooka branches: 1.14.2;
rump_getversion() does not require a thread context, so make it a straight
call instead of being wrapped around rump_pub_getversion().
 1.13 07-Mar-2013  pooka branches: 1.13.6;
*** empty log message ***
 1.12 02-Jan-2011  pooka branches: 1.12.8; 1.12.18;
regen: rump_lwproc_rfork
 1.11 21-Nov-2010  pooka regen: rump_reboot is gone
 1.10 17-Nov-2010  pooka regen: -rump_pub_syscall
 1.9 27-Oct-2010  pooka regen:
- rump_sysproxy
+ rump_syscall
 1.8 01-Sep-2010  pooka regen: new lwp/proc interfaces
 1.7 14-Apr-2010  pooka regen: kauth_cred_t -> struct kauth_cred *
 1.6 05-Mar-2010  pooka branches: 1.6.2; 1.6.4;
regen for rump_module interface change
 1.5 26-Nov-2009  pooka branches: 1.5.2;
regen: rump_kernelfsym_load()
 1.4 15-Oct-2009  pooka regen: lwp interface changes
 1.3 15-Oct-2009  pooka regen: scheduling points in rump_pub wrappers
 1.2 14-Oct-2009  pooka regen: put all public interfaces created by ifspec into a rump_pub namespace
 1.1 14-Oct-2009  pooka generate rump local interfaces
 1.5.2.3 06-Nov-2010  uebayasi Sync with HEAD.
 1.5.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.5.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.6.4.2 05-Mar-2011  rmind sync with head
 1.6.4.1 30-May-2010  rmind sync with head
 1.6.2.4 09-Oct-2010  yamt sync with head
 1.6.2.3 11-Aug-2010  yamt sync with head.
 1.6.2.2 11-Mar-2010  yamt sync with head
 1.6.2.1 05-Mar-2010  yamt file rumpkern_if_wrappers.c was added on branch yamt-nfs-mp on 2010-03-11 15:04:38 +0000
 1.12.18.3 03-Dec-2017  jdolecek update from HEAD
 1.12.18.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.12.18.1 23-Jun-2013  tls resync from head
 1.12.8.1 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.13.6.1 18-May-2014  rmind sync with head
 1.14.2.1 10-Aug-2014  tls Rebase.
 1.16.4.1 19-Mar-2016  skrll Sync with HEAD
 1.11 20-May-2024  christos regen
 1.10 19-May-2024  christos regen
 1.9 29-Jul-2023  rin rump: Regen again to fix missing __kevent100 symbol.

makerumpsyscalls.sh requires rebuilt rump libraries installed in
/usr/lib or directory specified by its first argument.

Now, new failures observed for ATF after __kevent100 addition are
fixed at least for aarch64.
 1.8 28-Jul-2023  christos regen
 1.7 10-Jul-2023  christos Regen
 1.6 27-May-2020  christos regen for lpathconf.
 1.5 22-Sep-2019  christos regen
 1.4 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.3 18-Jun-2015  pooka regen
 1.2 27-Apr-2014  pooka branches: 1.2.2; 1.2.4; 1.2.6; 1.2.10; 1.2.12;
regen
 1.1 27-Apr-2014  pooka Eliminate weak symbols from rump kernel syscall handlers, part 6:

Generate component constructors which establish non-modular syscalls.
 1.2.12.2 19-Mar-2016  skrll Sync with HEAD
 1.2.12.1 22-Sep-2015  skrll Sync with HEAD
 1.2.10.3 03-Dec-2017  jdolecek update from HEAD
 1.2.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.10.1 27-Apr-2014  tls file rumpkern_syscalls.c was added on branch tls-maxphys on 2014-08-20 00:04:41 +0000
 1.2.6.2 10-Aug-2014  tls Rebase.
 1.2.6.1 27-Apr-2014  tls file rumpkern_syscalls.c was added on branch tls-earlyentropy on 2014-08-10 06:56:51 +0000
 1.2.4.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.2.4.1 27-Apr-2014  yamt file rumpkern_syscalls.c was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.2.2.2 18-May-2014  rmind sync with head
 1.2.2.1 27-Apr-2014  rmind file rumpkern_syscalls.c was added on branch rmind-smpnet on 2014-05-18 17:46:18 +0000
 1.3 19-Nov-2008  pooka Split vfs out of rumpkern into rumpvfs. Non-fs rumps no longer
include the file system code. File system rumps explicitly need
to include rumpvfs from now on.
 1.2 17-Nov-2008  pooka reregen to get those most important rcsids right
 1.1 17-Nov-2008  pooka regen
 1.55 05-Oct-2023  ad Arrange to update cached LWP credentials in userret() rather than during
syscall/trap entry, eliminating a test+branch on every syscall/trap.

This wasn't possible in the 3.99.x timeframe when l->l_cred came about
because there wasn't a reliable/timely way to force an ONPROC LWP running on
a remote CPU into the kernel (which is just about the only new thing in
this scheme).
 1.54 04-Oct-2023  ad Eliminate l->l_ncsw and l->l_nivcsw. From memory think they were added
before we had per-LWP struct rusage; the same is now tracked there.
 1.53 09-Apr-2022  riastradh rumpkern/scheduler: Use membar_release.

...but add an XXX comment asking for clarity on what it pairs with.
 1.52 01-Nov-2020  christos PR/55664: Ruslan Nikolaev: Fix:

1. A race condition (bug) in sys/rump/librump/rumpkern/intr.c since
rumpuser_cv_signal() is called without holding a mutex
2. sleepq is implemented using a single (global) conditional
variable; that should be done per each sleepq separately
 1.51 14-Mar-2020  ad branches: 1.51.4;
- Hide the details of SPCF_SHOULDYIELD and related behind a couple of small
functions: preempt_point() and preempt_needed().

- preempt(): if the LWP has exceeded its timeslice in kernel, strip it of
any priority boost gained earlier from blocking.
 1.50 15-Feb-2020  ad - Move the LW_RUNNING flag back into l_pflag: updating l_flag without lock
in softint_dispatch() is risky. May help with the "softint screwup"
panic.

- Correct the memory barriers around zombies switching into oblivion.
 1.49 08-Jan-2020  ad Hopefully fix some problems seen with MP support on non-x86, in particular
where curcpu() is defined as curlwp->l_cpu:

- mi_switch(): undo the ~2007ish optimisation to unlock curlwp before
calling cpu_switchto(). It's not safe to let other actors mess with the
LWP (in particular l->l_cpu) while it's still context switching. This
removes l->l_ctxswtch.

- Move the LP_RUNNING flag into l->l_flag and rename to LW_RUNNING since
it's now covered by the LWP's lock.

- Ditch lwp_exit_switchaway() and just call mi_switch() instead. Everything
is in cache anyway so it wasn't buying much by trying to avoid saving old
state. This means cpu_switchto() will never be called with prevlwp ==
NULL.

- Remove some KERNEL_LOCK handling which hasn't been needed for years.
 1.48 16-Dec-2019  ad branches: 1.48.2;
- Extend the per-CPU counters matt@ did to include all of the hot counters
in UVM, excluding uvmexp.free, which needs special treatment and will be
done with a separate commit. Cuts system time for a build by 20-25% on
a 48 CPU machine w/DIAGNOSTIC.

- Avoid 64-bit integer divide on every fault (for rnd_add_uint32).
 1.47 01-Dec-2019  ad Another instance of cpu_onproc to replace.
 1.46 01-Dec-2019  ad cpu_onproc -> ci_onproc
 1.45 23-Nov-2019  ad Minor scheduler cleanup:

- Adapt to cpu_need_resched() changes. Avoid lost & duplicate IPIs and ASTs.
sched_resched_cpu() and sched_resched_lwp() contain the logic for this.
- Changes for LSIDL to make the locking scheme match the intended design.
- Reduce lock contention and false sharing further.
- Numerous small bugfixes, including some corrections for SCHED_FIFO/RT.
- Use setrunnable() in more places, and merge cut & pasted code.
 1.44 19-Feb-2016  pooka branches: 1.44.18;
add cpu_lock

from freqlabs on irc
 1.43 08-Feb-2016  pooka Allocate struct cpu_info dynamically. Saves quite a lot of BSS in the
common case and reduces rump kernel memory requirements by 10% or more
in really tiny deployments.
 1.42 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.41 25-Aug-2015  pooka add ncpuonline
 1.40 22-Apr-2015  pooka track cpu_onproc
 1.39 07-Jun-2014  rmind branches: 1.39.4;
Make kpreempt_disabled() always return true in RUMP kernels for now.
May revisit once RUMP provides better splfoo/splx() handling.
 1.38 05-Jun-2014  rmind librump: add kpreempt_disabled(9) and softint_schedule_cpu(9).
 1.37 09-Apr-2014  pooka implement lwp_create() and a few related interfaces.
main raison d'impalerment: the aio driver
 1.36 15-Mar-2014  pooka branches: 1.36.2;
Allow compile-time optimizations to curlwp. This can have a pretty
staggering impact on performance. When running sendto() in a loop,
the improvement is 200k more calls per second with an inlined __thread
curlwp as opposed to the default. In other words, it shaves off hundreds
of CPU cycles per call (~20%). Even just eliminating the x86_curlwp()
call in favor of an inline gives an improvement of 60k calls per second.
 1.35 09-Dec-2013  pooka Reenable calls to KPREEMPT_EN/DISABLE(). I'm almost certain I commented
them out accidentally in rev 1.30.

... not that they do much in rump kernels which are always
run-to-completion, but maybe there's some driver debugging value.
 1.34 15-May-2013  pooka branches: 1.34.2;
Add RUMPUSER_LWP_CLEAR instead of overloading RUMPUSER_LWP_SET.
This simplifies some alternative hypervisor implementations.
 1.33 02-May-2013  pooka Inform the rump kernel hypervisor of valid thread contexts so
that the implementation can allocate and release storage for them
in an optimal fashion, if necessary.
 1.32 27-Apr-2013  pooka Make sure spin mutexes get allocated as spin mutexes (the hypervisor
asserts it now).
 1.31 27-Apr-2013  pooka roll mutex init hypercalls into one (one of them already took a flag anyway)
 1.30 13-Nov-2012  pooka kill some -Wunused-but-set-variable warnings
 1.29 15-Sep-2012  pooka In the "interlock" case (where the scheduler lock is used as the condvar
lock), we need to take the CPU interlock before releasing the CPU.
Otherwise other threads can be scheduled before we get the interlock,
leading to e.g. missed condvar wakeups. This affected only "locks_up.c"
locking (nomen est omen?).

Also, remove various __predicts since they don't have a positive
performance impact in any setup.
 1.28 22-Jun-2012  rmind branches: 1.28.2;
rumpkern:
- Add subr_kcpuset.c and subr_pserialize.c modules.
- Add kcpuset_{running,attached} for RUMP env.
 1.27 31-Oct-2011  yamt branches: 1.27.2; 1.27.8;
comment
 1.26 21-Mar-2011  pooka Update copyright statements.

no functional change.
 1.25 28-Jan-2011  pooka Some lwp-walkers expect the correct value for l_stat, so use a flag
in l_flag instead of l_stat for the purpose of flagging lwps in a
dying proc.
 1.24 11-Jan-2011  pooka branches: 1.24.2; 1.24.4;
KASSERT we don't return back to userspace with the kernel lock held.
 1.23 01-Dec-2010  pooka If the pagedaemon cannot free any memory due to not being able to
lock any uvm objects, check if lockholders are currently on CPU
and yield to try very soon again instead of assuming deadlock.

This makes limited-memory kernels perform the same as memory-unlimited
kernels (provided there is a reasonable amount of memory available).
For example, for large file copy off of ffs where the image is
backed on host memory (i.e. no disk i/o, i.e. ideal conditions)
the figures are, per rump kernel memory limit:

3000kB: same
1000kB: 10% slower
500kB: 50% slower

(per pagedaemon code might still be able to use some tweak, though)
 1.22 21-Nov-2010  pooka Fix situation where we try to configure >MAXCPUS cpus.
 1.21 29-Oct-2010  pooka Attach implicit threads to initproc instead of proc0. This way
applications which alter, by purpose or by accident, the uid in an
implicit thread are don't affect kernel threads.

from discussion with njoly
 1.20 07-Sep-2010  pooka Attach only one CPU for the bootstrap phase.
 1.19 01-Sep-2010  pooka Implement rump_lwproc: the new lwp/proc management routines for
rump. These move the management of the pid/lwpid space from the
application into the kernel, make code more robust, and make it
possible to attach multiple lwp's to non-proc0 processes.
 1.18 15-Aug-2010  pooka Increment lwp's context switch counter when it is scheduled onto
a CPU. This fixes some heavy-load problems with the pool code when
rump kernels essentially lied and caused the pool code not to do
a proper backdown from the fastpath when a context switch happened
when taking a lock.
 1.17 11-Jul-2010  pooka Assert that l_target_cpu isn't null, just in case we had some memory
corruption issues (like passing wrong size to kmem_free ....).
 1.16 28-May-2010  pooka Deal with the "we get a portably arbitrary set of headers on
different archs" problem.
 1.15 28-May-2010  pooka Improve the CPU scheduler for a host MP system with multithreaded
access. The old scheduler had a global freelist which caused a
cache crisis with multiple host threads trying to schedule a virtual
CPU simultaneously.

The rump scheduler is different from a normal thread scheduler, so
it has different requirements. First, we schedule a CPU for a
thread (which we get from the host scheduler) instead of scheduling
a thread onto a CPU. Second, scheduling points are at every
entry/exit to/from the rump kernel, including (but not limited to)
syscall entry points and hypercalls. This means scheduling happens
a lot more frequently than in a normal kernel.

For every lwp, cache the previously used CPU. When scheduling,
attempt to reuse the same CPU. If we get it, we can use it directly
without any memory barriers or expensive locks. If the CPU is
taken, migrate. Use a lock/wait only in the slowpath. Be very
wary of walking the entire CPU array because that does not lead to
a happy cacher.

The migration algorithm could probably benefit from improved
heuristics and tuning. Even as such, with the new scheduler an
application which has two threads making rlimit syscalls in a tight
loop experiences almost 400% speedup. The exact speedup is difficult
to pinpoint, though, since the old scheduler caused very jittery
results due to cache contention. Also, the rump version is now
70% faster than the counterpart which calls the host kernel.
 1.14 18-May-2010  pooka Make it possible to use the scheduler lock as the rumpuser condvar
interlock. This is applicable in cases where the actual interlock
is the CPU the currently running thread is scheduled on. Borrowing
the scheduler lock as the mutex mandated by pthread_cond_wait()
does away with need to have an additional mutex. This both optimizes
runtime execution and simplifies code, as the extra lock typically
lead to quite some trickeries to avoid the dungeon collapsing due
to zaps from the wand of deadlock.
 1.13 28-Apr-2010  pooka Limit virtual CPUs to MAXCPUS for now.
 1.12 27-Apr-2010  pooka Fix multiple virtual cpu support.

... or at least on x86. CPU_INFO_FOREACH() still isn't MI, and I
don't want to support 2^n different versions.
 1.11 21-Apr-2010  pooka support kern_resource
 1.10 17-Apr-2010  pooka Move scheduling related routines from emul.c to scheduler.c
 1.9 25-Jan-2010  pooka branches: 1.9.2; 1.9.4; 1.9.6;
Set attached cpus as running, otherwise (evil) state-probing code
will not execute properly.
 1.8 01-Dec-2009  pooka Almost there for virtual CPU MP support:
* support bound kernel threads
* bind softint threads to specific virtual cpus
+ remove now-unnecessary locks from softint code

Now, if we only had MI CPU_INFO_FOREACH() .... (hi rmind ;)
 1.7 09-Nov-2009  pooka Hash out soft interrupts to be a little closer to real softints:
* split them into levels
* allow only one per level to be active at a time
* fire softints only when we are unscheduling from a CPU instead
of immediately in softint_schedule(). this will later morph
into return from interrupt, but that part isn't done yet.
 1.6 06-Nov-2009  pooka In case a temp thread is exiting, borrow lwp0 for the respective
kmem_free().
 1.5 04-Nov-2009  pooka Implement yield()/preempt() now that there is a CPU scheduler.
 1.4 16-Oct-2009  pooka Include sys_select.c for proper select()/poll() support.
 1.3 15-Oct-2009  pooka When allocating the temporary lwp we must have an lwp context. So
take turns using lwp0 for this purpose, nothing else uses it.
 1.2 15-Oct-2009  pooka Give lwp usage some much-needed love: stop treating lwp0 as the
all-sink and make sure each separate thread in rump has its own
lwp. Happy-go-lucky callers will get scheduled a temporary lwp
on entry, while true lwp connoisseurs may request a stable lwp
for their purposes. Some more love may be required later down the
road, but for now different threads will stepping on each others
toes.
 1.1 15-Oct-2009  pooka Add initial work on a rump virtual cpu scheduler. This is necessary
for kernel code which has been written to avoid MP contention by
using cpu-local storage (most prominently, select and pool_cache).

Instead of always assuming rump_cpu, the scheduler must now be run
(and unrun) on all entry points into rump. Likewise, rumpuser
unruns and re-runs the scheduler around each potentially blocking
operation. As an optimization, I modified some locking primitives
to try to get the lock without blocking before releasing the cpu.

Also, ltsleep was modified to assume that it is never called without
the biglock held and made to use the biglock as the sleep interlock.
Otherwise there is just too much drama with deadlocks. If some
kernel code wants to call ltsleep without the biglock, then, *snif*,
it's no longer supported and rump and should be modified to support
newstyle locks anyway.
 1.9.6.3 21-Apr-2011  rmind sync with head
 1.9.6.2 05-Mar-2011  rmind sync with head
 1.9.6.1 30-May-2010  rmind sync with head
 1.9.4.4 09-Oct-2010  yamt sync with head
 1.9.4.3 11-Aug-2010  yamt sync with head.
 1.9.4.2 11-Mar-2010  yamt sync with head
 1.9.4.1 25-Jan-2010  yamt file scheduler.c was added on branch yamt-nfs-mp on 2010-03-11 15:04:38 +0000
 1.9.2.4 06-Nov-2010  uebayasi Sync with HEAD.
 1.9.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.9.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.9.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.24.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.24.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.27.8.1 26-Jun-2012  riz Pull up following revision(s) (requested by rmind in ticket #365):
sys/rump/librump/rumpkern/rumpcpu_generic.c: revision 1.4
sys/net/npf/npf_session.c: revision 1.13
sys/net/npf/npf_tableset.c: revision 1.11
sys/net/npf/npf_state_tcp.c: revision 1.7
sys/net/npf/npf_inet.c: revision 1.12
sys/net/npf/npf.h: revision 1.17
sys/net/npf/npf_instr.c: revision 1.11
usr.sbin/npf/npftest/libnpftest/npf_table_test.c: revision 1.2
sys/net/npf/npf_state.c: revision 1.8
sys/net/npf/npf_log.c: revision 1.4
sys/net/npf/npf_alg.c: revision 1.4
sys/rump/librump/rumpkern/Makefile.rumpkern: revision 1.118
sys/net/npf/npf_nat.c: revision 1.13
sys/net/npf/npf.c: revision 1.11
sys/net/npf/npf_sendpkt.c: revision 1.11
sys/net/npf/npf_impl.h: revision 1.16
sys/rump/librump/rumpkern/scheduler.c: revision 1.28
rumpkern:
- Add subr_kcpuset.c and subr_pserialize.c modules.
- Add kcpuset_{running,attached} for RUMP env.
NPF:
- Rename some functions for consistency and de-inline them.
- Fix few invalid asserts (add regressoin test).
- Use pserialize(9) for ALG interface.
- Minor fixes, sprinkle many comments.
 1.27.2.4 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.27.2.3 16-Jan-2013  yamt sync with (a bit old) head
 1.27.2.2 30-Oct-2012  yamt sync with head
 1.27.2.1 30-Nov-2011  yamt implement a rump version of kpreempt_disabled
 1.28.2.4 03-Dec-2017  jdolecek update from HEAD
 1.28.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.2.2 23-Jun-2013  tls resync from head
 1.28.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.34.2.1 18-May-2014  rmind sync with head
 1.36.2.1 10-Aug-2014  tls Rebase.
 1.39.4.3 19-Mar-2016  skrll Sync with HEAD
 1.39.4.2 22-Sep-2015  skrll Sync with HEAD
 1.39.4.1 06-Jun-2015  skrll Sync with HEAD
 1.44.18.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.48.2.2 29-Feb-2020  ad Sync with head.
 1.48.2.1 17-Jan-2020  ad Sync with head.
 1.51.4.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.1 22-Apr-2023  riastradh secmodel_extensions: Split vfs part into separate .c file.

This way we can provide weak rumpkern stubs that don't require
rumpvfs for things that are relevant to vfs, but if you do link
rumpvfs then you get the same logic in secmodel extensions.
 1.17 23-May-2020  ad Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.16 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.15 18-Apr-2015  pooka Give remote clients struct pmap storage. Although the pmap is unused,
that way we can sure that the pmap macro framework doesn't access all
the wrong places.
 1.14 03-Jan-2015  pooka Put all sysproxy routines to their own C module, sysproxy.c
 1.13 20-Feb-2014  pooka branches: 1.13.6;
Remove the "host" signal model. I'm not sure it ever made any sense.
I'm also quite sure nobody ever really wanted to use it.

Change the "raise" sigmodel to include the rump kernel PID in the call
to rumpuser_kill(). The purpose is to provide some hint for non-POSIX
platforms which don't sport signals and multiplex many clients in a
single address space.

While this is technically an ABI change, see above. Also, since
rumpuser_kill() was not documented, I'll just claim I'm fixing a bug in
the implementation (and will be sure to document the interface correctly
very soon).
 1.12 22-Nov-2013  christos we now use TAILQ
 1.11 30-Apr-2013  pooka branches: 1.11.4;
Make hypercall calling conventions consistent: iff a hypercall can fail,
it returns an int containing the error value.
 1.10 28-May-2011  tron branches: 1.10.4; 1.10.14;
Fix rump build which got broken by the fix for PR kern/44986.
 1.9 18-May-2011  christos add a hacky version of sigsuspendsetup() to satisfy link requirements.
 1.8 20-Feb-2011  pooka Change the default sigmodel to "raise", it makes more sense than
causing a panic.
 1.7 14-Jan-2011  pooka branches: 1.7.2; 1.7.4;
Support SIGMODEL_RAISE for non-local clients.
 1.6 08-Jan-2011  pooka SIGPIPE is generated internally by the kernel, so include it in
the list of "no panic" sigs.
 1.5 03-Jan-2011  pooka kqueue signal filters are not supported, so be explicit about it.
 1.4 15-Nov-2010  pooka Add a new signal model RUMP_SIGMODEL_RECORD which records all
signals which are posted to a process.
 1.3 10-Jun-2010  pooka branches: 1.3.2;
Use kern_proc.c instead of a collection of stubs. But what we
really wanted from this commit was the support for proc_specificdata.

TODO: make creating a new process actually use kern_proc and
maybe even add an interface which starts a process with
"any pid you don't like"
 1.2 22-Apr-2010  pooka branches: 1.2.2; 1.2.4;
more signal stuff to group. no functional change.
 1.1 21-Apr-2010  pooka Move all signal-related from emul.c to signals.c. Additionally,
define a few alternate signal models for the rump kernel, including
ones where signals are ignored or sent to host processes.
 1.2.4.5 31-May-2011  rmind sync with head
 1.2.4.4 05-Mar-2011  rmind sync with head
 1.2.4.3 03-Jul-2010  rmind sync with head
 1.2.4.2 30-May-2010  rmind sync with head
 1.2.4.1 22-Apr-2010  rmind file signals.c was added on branch rmind-uvmplock on 2010-05-30 05:18:06 +0000
 1.2.2.3 17-Aug-2010  uebayasi Sync with HEAD.
 1.2.2.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.2.2.1 22-Apr-2010  uebayasi file signals.c was added on branch uebayasi-xip on 2010-04-30 14:44:30 +0000
 1.3.2.2 11-Aug-2010  yamt sync with head.
 1.3.2.1 10-Jun-2010  yamt file signals.c was added on branch yamt-nfs-mp on 2010-08-11 22:55:07 +0000
 1.7.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.7.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.10.14.3 03-Dec-2017  jdolecek update from HEAD
 1.10.14.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.14.1 23-Jun-2013  tls resync from head
 1.10.4.1 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.11.4.1 18-May-2014  rmind sync with head
 1.13.6.3 19-Mar-2016  skrll Sync with HEAD
 1.13.6.2 06-Jun-2015  skrll Sync with HEAD
 1.13.6.1 06-Apr-2015  skrll Sync with HEAD
 1.28 13-Oct-2023  ad Rump: sleepq_remove(): don't unlock the sleepq. Spotted by hannken@.
 1.27 08-Oct-2023  ad Ensure that an LWP that has taken a legitimate wakeup never produces an
error code from sleepq_block(). Then, it's possible to make cv_signal()
work as expected and only ever wake a singular LWP.
 1.26 05-Oct-2023  ad Resolve !MULTIPROCESSOR build problem with the nasty kernel lock macros.
 1.25 04-Oct-2023  ad Eliminate l->l_biglocks. Originally I think it had a use but these days a
local variable will do.
 1.24 23-Sep-2023  ad - Simplify how priority boost for blocking in kernel is handled. Rather
than setting it up at each site where we block, make it a property of
syncobj_t. Then, do not hang onto the priority boost until userret(),
drop it as soon as the LWP is out of the run queue and onto a CPU.
Holding onto it longer is of questionable benefit.

- This allows two members of lwp_t to be deleted, and mi_userret() to be
simplified a lot (next step: trim it down to a single conditional).

- While here, constify syncobj_t and de-inline a bunch of small functions
like lwp_lock() which turn out not to be small after all (I don't know
why, but atomic_*_relaxed() seem to provoke a compiler shitfit above and
beyond what volatile does).
 1.23 30-Jun-2022  knakahara Fix rump build failure after sleepq.h:r1.35.
 1.22 09-Apr-2022  riastradh rumpkern/sleepq: Convert membar_exit/store to atomic_store_release.
 1.21 01-Nov-2020  christos PR/55664: Ruslan Nikolaev: Fix:

1. A race condition (bug) in sys/rump/librump/rumpkern/intr.c since
rumpuser_cv_signal() is called without holding a mutex
2. sleepq is implemented using a single (global) conditional
variable; that should be done per each sleepq separately
 1.20 25-Apr-2020  bouyer branches: 1.20.2;
Merge the bouyer-xenpvh branch, bringing in Xen PV drivers support under HVM
guests in GENERIC.
Xen support can be disabled at runtime with
boot -c
disable hypervisor
 1.19 19-Apr-2020  ad good grief..
 1.18 26-Mar-2020  ad branches: 1.18.2;
sleepq_t is now a LIST. Forgot to commit earlier.
 1.17 26-Jan-2016  pooka branches: 1.17.18;
Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.16 24-Apr-2014  pooka branches: 1.16.4;
Make sleepq_wake() type void. The return value hasn't been used in
almost 6 years. Even if it were, returning an arbitrary lwp is a bit
of a wonky interface and can really work only when expected == 1.
 1.15 24-Apr-2014  pooka in sleepq_wake(), honor the "expected" parameter
 1.14 10-Mar-2013  pooka branches: 1.14.6; 1.14.10;
Make RUN_ONCE actually run only once. Also, remove a "slightly"
outdated comment.
 1.13 28-Jan-2011  pooka branches: 1.13.4; 1.13.14;
these days make sure we have an lwp lock (for lwp walker smiths)
 1.12 27-Jan-2011  pooka Fill in l_wmesg since some proc-walkers assume it.
 1.11 12-Jan-2011  pooka branches: 1.11.2; 1.11.4;
When the client and the rump kernel are the same host process, all
threads blocking in the kernel automatically exit when the process
exists. However, for the sysproxy case this does not hold.
Typically it's ~harmless, but e.g. in the case of socket binding
following by poll it gets annoying.

Introduce sysproxy procexit, which wakes up all threads blocking
on a condition when a process's communication socket is closed.
The code is a little different from the regular kernel simply
because in a rump kernel l_mutex is not available at all times
(this is because scheduling happens on every kernel entry and exit,
and that path must be kept lockless for any reasonable performance).
Instead, use gating which makes sure all threads are either out of
the cv code or suspended in a well-known state. Then, wake up the
threads and tell them to get the hell out of our galaxy.
 1.10 18-Dec-2010  skrll Pull in sys/atomic.h so that hp700 can build - needed for membar_exit.
 1.9 18-Dec-2010  rmind - Fix a few possible locking issues in execve1() and exit1(). Add a note
that scheduler locks are special in this regard - adaptive locks cannot
be in the path due to turnstiles. Randomly spotted/reported by uebayasi@.
- Remove unused lwp_relock() and replace lwp_lock_retry() by simplifying
lwp_lock() and sleepq_enter() a little.
- Give alllwp its own cache-line and mark lwp_cache pointer as read-mostly.

OK ad@
 1.8 23-Jul-2010  pooka If a thread wake up spuriously, re-set l_mutex to make sure it's
still at the original value and not the schedstate one. This makes
select not miss wakeups in cases where there was a lot of selecting
going on (which is not all that common in a rump kernel).
 1.7 22-Jul-2010  pooka Reset l_mutex when waking up a thread. select uses it to determine
if a thread is still selecting, and would get a KASSERT panic if
the thread had been woken up but not run yet when selnotify() was
called.
 1.6 17-Nov-2009  pooka branches: 1.6.2; 1.6.4;
init global cv only once
 1.5 21-Oct-2009  rmind Sync rump with kernel changes.
 1.4 16-Oct-2009  pooka In case of timeout, remember to remove ourselves from the sleep staleq.
 1.3 16-Oct-2009  pooka Include sys_select.c for proper select()/poll() support.
 1.2 18-Dec-2008  pooka branches: 1.2.2; 1.2.6;
__KERNEL_RCSID
 1.1 10-Oct-2008  pooka branches: 1.1.2; 1.1.4; 1.1.6;
Support callouts and call callout_hardclock() from the timer
interrupt thread.

The sleepq implementation required for callouts is horrible, kludged
only for callouts, and generally unacceptable. It needs revisiting,
but I'm not sure yet should rump or kern_timeout be improved. It's
almost untested as of now, but committing this will give me some
maneuvering space while letting application compile.
 1.1.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.1.4.2 19-Oct-2008  haad Sync with HEAD.
 1.1.4.1 10-Oct-2008  haad file sleepq.c was added on branch haad-dm on 2008-10-19 22:18:07 +0000
 1.1.2.2 10-Oct-2008  skrll Sync with HEAD.
 1.1.2.1 10-Oct-2008  skrll file sleepq.c was added on branch wrstuden-revivesa on 2008-10-10 22:36:16 +0000
 1.2.6.4 11-Aug-2010  yamt sync with head.
 1.2.6.3 11-Mar-2010  yamt sync with head
 1.2.6.2 04-May-2009  yamt sync with head.
 1.2.6.1 18-Dec-2008  yamt file sleepq.c was added on branch yamt-nfs-mp on 2009-05-04 08:14:30 +0000
 1.2.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.1 18-Dec-2008  mjf file sleepq.c was added on branch mjf-devfs2 on 2009-01-17 13:29:36 +0000
 1.6.4.1 05-Mar-2011  rmind sync with head
 1.6.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.11.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.11.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.13.14.3 03-Dec-2017  jdolecek update from HEAD
 1.13.14.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.14.1 23-Jun-2013  tls resync from head
 1.13.4.1 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.14.10.1 10-Aug-2014  tls Rebase.
 1.14.6.1 18-May-2014  rmind sync with head
 1.16.4.1 19-Mar-2016  skrll Sync with HEAD
 1.17.18.2 21-Apr-2020  martin Sync with HEAD
 1.17.18.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.18.2.1 20-Apr-2020  bouyer Sync with HEAD
 1.20.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.30 19-Nov-2008  pooka Split vfs out of rumpkern into rumpvfs. Non-fs rumps no longer
include the file system code. File system rumps explicitly need
to include rumpvfs from now on.
 1.29 18-Nov-2008  pooka Pass biodone() to rumpuser as a callback instead of hardcoding it.
Also, explicitly init rumpuser async io thread.
 1.28 16-Nov-2008  pooka <sys/buf.h> police
 1.27 11-Sep-2008  pooka branches: 1.27.2;
* fsync after !B_ASYNC write
* replace some b_flags magic with BUF_ISREAD/WRITE()
 1.26 09-Sep-2008  tron Fix build problem with puffs enabled caused by the fix for PR kern/39493.
Problem noted by Thomas Klausner, patch provided by Juan RP.
 1.25 12-Aug-2008  pooka Make it possible to control starting of threads per env variable
instead of only at compile-time.
 1.24 29-Jul-2008  pooka Install rump libraries and utilities to the base system and remove the
private non-installed build infrastructure from sys/rump.

breakdown of commit:
* install relevant headers into /usr/include/rump
* build sys/rump/librump/rumpuser and sys/rump/librump/rumpkern
from src/lib and install as librumpuser and librump, respectively
+ this retains the ability to test a librump build with just the
kernel sources at hand
* move sys/rump/fs/lib/libukfs and sys/rump/fs/lib/libp2k to src/lib
for general consumption, they are not kernel-space dwellers anyway
* build and install sys/rump/fs/lib/lib$fs as librumpfs_$fs
* add chapter 3 manual pages for rump, rumpuser, ukfs and p2k
* build and install userspace kernel file system daemons if MKPUFFS=yes
is spexified
* retire fsconsole for now, it will make a comeback with an actually
implemented version shortly
 1.23 21-Jul-2008  pooka Call mountpoint VFS_FSYNC() from specfs fsync.

Makes rump kern/38057-happy.
 1.22 20-Jul-2008  pooka assert -> KASSERT
 1.21 18-Jul-2008  pooka Don't biohazardwait B_ASYNC buffers.
 1.20 01-Jul-2008  pooka branches: 1.20.2;
Fixes to build rump utilities as host binaries on Linux by removing
sys namespace pollution which has crept in.

Submitted in private mail by takemura, domain ca2.so-net.ne.jp
 1.19 27-Jan-2008  pooka branches: 1.19.6; 1.19.10; 1.19.12; 1.19.14;
Use vfs_subr.c from sys/kern. This brings differences in the vnode
life cycle between rump and a real kernel to a minimum.
 1.18 22-Jan-2008  pooka Until debugging threaded programs in NetBSD is fixed, supply the
cpp option RUMP_WITHOUT_THREADS as a workaround. If defined, it
makes rump itself operate single-threaded and prevents kthread_create()
from working.
 1.17 21-Jan-2008  pooka Implement dummy bmap which just does 1:1 translation.
 1.16 03-Jan-2008  pooka Theoretically this is supposed to be interchangeable with real
kernel code. Use kmem_alloc/free instead of some wily homerolled
rump interfaces for memory allocation.
 1.15 02-Jan-2008  pooka Add the ability to run puffs in userspace. This means that puffs
can now be developed in userspace using puffs for development
(I hate emulators, they are annoyingly clumsy).

To e.g. mount psshfs using puffs-on-puffs, run fs/bin/syspuffs/syspuffs
with the regular mount_psshfs command line as an argument:

golem> ./syspuffs /usr/sbin/mount_psshfs ftp.netbsd.org:/pub /puffs

This will make the mount appear as usual, with the exception that the
requests will be passed through puffs both in the kernel and userspace:

ftp.netbsd.org:/pub on /puffs type puffs|p2k|puffs|psshfs
 1.14 02-Jan-2008  pooka fix vmlocking2 fallout:

* I heard a wild rumor that vp_interlock is a mutex these days (hi ad!)
* init new locks (hi ad)
* observe that with simple_locks only deadlocks would be caught while
releasing unlocked locks would go unnoticed. make locking work (hi pooka)
 1.13 07-Nov-2007  pooka branches: 1.13.6;
Execute I/O in a separate thread for async I/O where previously
everything was written/read in caller context.

Also, make the "kernel" lock recursive. It works better that way ...
 1.12 06-Nov-2007  pooka Sprinkle some more locking, especially to the vm. Due to some
additional fixes, it's now possible to run file systems with
spinlocks actually enabled. The genfs_putpages() locking is still
working only due to greater powers, but I'll eventually get around to
fixing it.
 1.11 04-Nov-2007  pooka branches: 1.11.2;
Make the strategy routine get the results through biowait() and
the "disk driver" (rumpuser) call biodone() to indicate the completion
of I/O. Support for B_ASYNC is coming at some point, but I need
more locking support in the emulated vm for that.
 1.10 31-Oct-2007  pooka branches: 1.10.2;
Make it possible to run rumps multithreaded. This brings real
locking and makes it possible to run file systems which create
threads. It also makes rump file system behaviour better match
file system behaviour in the kernel.
 1.9 24-Sep-2007  pooka branches: 1.9.2;
print 0x before hex, print proper types
 1.8 20-Sep-2007  pooka branches: 1.8.2;
fsync() device fd if doing a non-B_ASYNC write. This makes the
file system safe, but less performant as the kernel, as it syncs
*all* outstanding dirty buffers. However, we don't have much choice
in userspace currently.
 1.7 10-Sep-2007  pooka Provide errno from rumpuser_{gettimeofday,close}() to be consistent.
 1.6 20-Aug-2007  pooka branches: 1.6.2; 1.6.4; 1.6.6;
Hide NetBSD kernel headers completely from ukfs. This includes creating
accessors for:
* struct mount & VFS ops
* struct uio
* struct vnode
* struct vattr

and some namespace games for:
* namei flags
* VOPs
* enum vtype

Also, split rump services into two categories: library private and public
(rump_private.h and rump.h, respectively).

As a result, it is now possible to compile and use the NetBSD kernel
file systems on Linux (and probably other systems too with very
little work), although the makefiles need a bit of work to make it
a pleasureable experience.
 1.5 14-Aug-2007  pooka branches: 1.5.2;
Kill handrolled buffercache and use vfs_bio from the kernel. This is
mostly to get the flag jungle in sync with the kernel.
 1.4 14-Aug-2007  pooka Add some barely staggering code to get more disklabel support.
 1.3 13-Aug-2007  pooka Use supermarket variety vfs_vnops.c instead of homecooked routines
(that's actually a good thing here).
 1.2 09-Aug-2007  pooka * fix symlink
* actually call a couple of VOPs
 1.1 05-Aug-2007  pooka branches: 1.1.2;
Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.2 05-Aug-2007  pooka Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.1 05-Aug-2007  pooka file specfs.c was added on branch matt-mips64 on 2007-08-05 22:28:10 +0000
 1.5.2.3 03-Sep-2007  skrll Sync with HEAD.
 1.5.2.2 15-Aug-2007  skrll Sync with HEAD.
 1.5.2.1 14-Aug-2007  skrll file specfs.c was added on branch nick-csl-alignment on 2007-08-15 13:50:41 +0000
 1.6.6.6 04-Feb-2008  yamt sync with head.
 1.6.6.5 21-Jan-2008  yamt sync with head
 1.6.6.4 15-Nov-2007  yamt sync with head.
 1.6.6.3 27-Oct-2007  yamt sync with head.
 1.6.6.2 03-Sep-2007  yamt sync with head.
 1.6.6.1 20-Aug-2007  yamt file specfs.c was added on branch yamt-lazymbuf on 2007-09-03 14:45:35 +0000
 1.6.4.4 23-Mar-2008  matt sync with HEAD
 1.6.4.3 09-Jan-2008  matt sync with HEAD
 1.6.4.2 08-Nov-2007  matt sync with -HEAD
 1.6.4.1 06-Nov-2007  matt sync with HEAD
 1.6.2.3 09-Oct-2007  ad Sync with head.
 1.6.2.2 20-Aug-2007  ad Sync with HEAD.
 1.6.2.1 20-Aug-2007  ad file specfs.c was added on branch vmlocking on 2007-08-20 22:07:30 +0000
 1.8.2.1 06-Oct-2007  yamt sync with head.
 1.9.2.1 13-Nov-2007  bouyer Sync with HEAD
 1.10.2.6 11-Nov-2007  joerg Sync with HEAD.
 1.10.2.5 06-Nov-2007  joerg Sync with HEAD.
 1.10.2.4 04-Nov-2007  jmcneill Sync with HEAD.
 1.10.2.3 02-Nov-2007  joerg Remove the rest of the unintentional diff in sys/rump.
 1.10.2.2 31-Oct-2007  joerg Sync with HEAD.
 1.10.2.1 31-Oct-2007  joerg file specfs.c was added on branch jmcneill-pm on 2007-10-31 23:14:18 +0000
 1.11.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.11.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.13.6.3 23-Jan-2008  bouyer Sync with HEAD.
 1.13.6.2 08-Jan-2008  bouyer Sync with HEAD
 1.13.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.19.14.3 31-Jul-2008  simonb Sync with head.
 1.19.14.2 21-Jul-2008  simonb Sync with head.
 1.19.14.1 03-Jul-2008  simonb Sync with head.
 1.19.12.2 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.19.12.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.19.10.1 04-May-2009  yamt sync with head.
 1.19.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.19.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.19.6.1 02-Jul-2008  mjf Sync with HEAD.
 1.20.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.20.2.1 19-Oct-2008  haad Sync with HEAD.
 1.27.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.2 07-Jan-2015  pooka Move sysproxy support into a separate component, rumpkern_sysproxy,
instead of it being always provided by the rump kernel base. This
move accomplishes two things:

1) it is no longer necessary to provide sysproxy hypercall stubs for
platforms which do not want to use sysproxy
2) it is easier to reason about the security aspects, since configurations
not linking the sysproxy component simply do not support remote
system calls

discussed on rumpkernel-users
 1.1 03-Jan-2015  pooka Put all sysproxy routines to their own C module, sysproxy.c
 1.10 27-Oct-2010  pooka Retire the old sysproxy nonsense (as part of doing it slightly better).

Introduce rump_pub_syscall() as the generic interface for making
system calls with already marshalled arguments. So it's kinda like
syscall(2), except it also remembered to breathe instead of having
to figure out how to deal with 64bit values.
 1.9 01-Sep-2010  pooka use curlwp
 1.8 01-Sep-2010  pooka Implement rump_lwproc: the new lwp/proc management routines for
rump. These move the management of the pid/lwpid space from the
application into the kernel, make code more robust, and make it
possible to attach multiple lwp's to non-proc0 processes.
 1.7 11-Aug-2010  pgoyette Keep condvar wmesg within 8 char limit
 1.6 01-Mar-2010  pooka branches: 1.6.2;
Add types for LWP_CREATE and LWP_EXIT rpc calls. Currently unimplemented.
 1.5 15-Oct-2009  pooka branches: 1.5.2;
Give lwp usage some much-needed love: stop treating lwp0 as the
all-sink and make sure each separate thread in rump has its own
lwp. Happy-go-lucky callers will get scheduled a temporary lwp
on entry, while true lwp connoisseurs may request a stable lwp
for their purposes. Some more love may be required later down the
road, but for now different threads will stepping on each others
toes.
 1.4 14-Oct-2009  pooka "rumppriv" goes back to "rump" per internal interface naming change.
 1.3 14-Oct-2009  pooka Adjust rump sources for external/internal interfaces.
No functional change.
 1.2 30-Apr-2009  skrll branches: 1.2.2; 1.2.4;
+#include <sys/atomic.h>
 1.1 29-Apr-2009  pooka Add proof-of-concept code for enabling system calls to rump virtual
kernels running in other processes on the same machine or on an
entirely different host. I wrote this a while ago and am now
committing it mainly to avoid losing it. It works, but could do
with a little tuning here and there.

What this will hopefully eventually buy us is the ability to use
standard userland tools to configure rump kernels, e.g. ifconfig(8)
and route(8) could be used to configure the networking stack provided
by a rump kernel. Also some distributed OS implications may apply.

fun fact: a system call which just does copyin/copyout takes >1000x
longer when made over the LAN as compared to when made on the same
machine.
 1.2.4.2 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2.4.1 30-Apr-2009  jym file sysproxy_socket.c was added on branch jym-xensuspend on 2009-05-13 17:22:58 +0000
 1.2.2.4 09-Oct-2010  yamt sync with head
 1.2.2.3 11-Mar-2010  yamt sync with head
 1.2.2.2 04-May-2009  yamt sync with head.
 1.2.2.1 30-Apr-2009  yamt file sysproxy_socket.c was added on branch yamt-nfs-mp on 2009-05-04 08:14:30 +0000
 1.5.2.4 06-Nov-2010  uebayasi Sync with HEAD.
 1.5.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.5.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.5.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.6.2.1 05-Mar-2011  rmind sync with head
 1.28 04-Oct-2023  ad rump now needs lwp_need_userret()
 1.27 01-Aug-2020  riastradh Define kthread_fpu_enter/exit for rump.

XXX Not 100% sure that it's safe to touch curlwp->l_flag in this
context, but this change will make progress, at least.
 1.26 21-Apr-2017  kamil Fix build of rump after change in lwp_create's signature
 1.25 21-Apr-2017  christos - Propagate the signal mask from the ucontext_t to the newly created thread
as specified by _lwp_create(2)
- Reset the signal stack for threads created with _lwp_create(2)
 1.24 26-Jan-2016  pooka branches: 1.24.2; 1.24.4;
Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.23 09-Apr-2014  pooka branches: 1.23.4;
implement lwp_create() and a few related interfaces.
main raison d'impalerment: the aio driver
 1.22 15-Mar-2014  pooka branches: 1.22.2;
Allow compile-time optimizations to curlwp. This can have a pretty
staggering impact on performance. When running sendto() in a loop,
the improvement is 200k more calls per second with an inlined __thread
curlwp as opposed to the default. In other words, it shaves off hundreds
of CPU cycles per call (~20%). Even just eliminating the x86_curlwp()
call in favor of an inline gives an improvement of 60k calls per second.
 1.21 02-May-2013  pooka branches: 1.21.4;
Inform the rump kernel hypervisor of valid thread contexts so
that the implementation can allocate and release storage for them
in an optimal fashion, if necessary.
 1.20 30-Apr-2013  pooka In kthread_create(), pass the priority and cpu index down to the
rump kernel hypervisor (though the current implementation doesn't take
advantage of them).
 1.19 27-Apr-2013  pooka roll mutex init hypercalls into one (one of them already took a flag anyway)
 1.18 10-Mar-2013  pooka Don't allow kernel threads to run before all CPUs have been initialized
to avoid them getting scheduled on non-initialized CPUs.
 1.17 04-Nov-2012  pooka Add vdrain to the list of kernel threads.
 1.16 04-Nov-2012  pooka Use a table to check for kernel threads.
 1.15 07-Aug-2011  rmind branches: 1.15.2; 1.15.12;
Rename slightly misleading KTHREAD_JOINABLE to KTHREAD_MUSTJOIN.
 1.14 17-Jul-2011  joerg Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.13 29-Oct-2010  pooka Attach implicit threads to initproc instead of proc0. This way
applications which alter, by purpose or by accident, the uid in an
implicit thread are don't affect kernel threads.

from discussion with njoly
 1.12 01-Sep-2010  pooka Implement rump_lwproc: the new lwp/proc management routines for
rump. These move the management of the pid/lwpid space from the
application into the kernel, make code more robust, and make it
possible to attach multiple lwp's to non-proc0 processes.
 1.11 03-Jun-2010  pooka Don't use rumpuser_malloc() directly.
 1.10 31-May-2010  pooka Support KTHREAD_JOINABLE/kthread_join(). Also fixes earlier bug
where all pthreads were created non-detached.
 1.9 28-May-2010  pooka Improve the CPU scheduler for a host MP system with multithreaded
access. The old scheduler had a global freelist which caused a
cache crisis with multiple host threads trying to schedule a virtual
CPU simultaneously.

The rump scheduler is different from a normal thread scheduler, so
it has different requirements. First, we schedule a CPU for a
thread (which we get from the host scheduler) instead of scheduling
a thread onto a CPU. Second, scheduling points are at every
entry/exit to/from the rump kernel, including (but not limited to)
syscall entry points and hypercalls. This means scheduling happens
a lot more frequently than in a normal kernel.

For every lwp, cache the previously used CPU. When scheduling,
attempt to reuse the same CPU. If we get it, we can use it directly
without any memory barriers or expensive locks. If the CPU is
taken, migrate. Use a lock/wait only in the slowpath. Be very
wary of walking the entire CPU array because that does not lead to
a happy cacher.

The migration algorithm could probably benefit from improved
heuristics and tuning. Even as such, with the new scheduler an
application which has two threads making rlimit syscalls in a tight
loop experiences almost 400% speedup. The exact speedup is difficult
to pinpoint, though, since the old scheduler caused very jittery
results due to cache contention. Also, the rump version is now
70% faster than the counterpart which calls the host kernel.
 1.8 09-Feb-2010  pooka branches: 1.8.2; 1.8.4;
Store l_name for kernel threads.
 1.7 27-Jan-2010  pooka branches: 1.7.2;
ignore pmf threads if RUMP_THREADS == 0
 1.6 05-Dec-2009  pooka KERNEL_UNLOCK_LAST in non-mpsafe kthread exit.
 1.5 03-Dec-2009  pooka Soft-fail xcall thread creation to make RUMP_THREADS=0 work again.
 1.4 01-Dec-2009  pooka Almost there for virtual CPU MP support:
* support bound kernel threads
* bind softint threads to specific virtual cpus
+ remove now-unnecessary locks from softint code

Now, if we only had MI CPU_INFO_FOREACH() .... (hi rmind ;)
 1.3 09-Nov-2009  pooka adjust comment for previous
 1.2 09-Nov-2009  pooka set LP_INTR for KTHREAD_INTR
 1.1 04-Nov-2009  pooka Give the kthread->pthread interface emulation its own module.
 1.7.2.4 06-Nov-2010  uebayasi Sync with HEAD.
 1.7.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.7.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.7.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.8.4.3 05-Mar-2011  rmind sync with head
 1.8.4.2 03-Jul-2010  rmind sync with head
 1.8.4.1 30-May-2010  rmind sync with head
 1.8.2.4 09-Oct-2010  yamt sync with head
 1.8.2.3 11-Aug-2010  yamt sync with head.
 1.8.2.2 11-Mar-2010  yamt sync with head
 1.8.2.1 09-Feb-2010  yamt file threads.c was added on branch yamt-nfs-mp on 2010-03-11 15:04:38 +0000
 1.15.12.4 03-Dec-2017  jdolecek update from HEAD
 1.15.12.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.15.12.2 23-Jun-2013  tls resync from head
 1.15.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.15.2.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.15.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.21.4.1 18-May-2014  rmind sync with head
 1.22.2.1 10-Aug-2014  tls Rebase.
 1.23.4.2 28-Aug-2017  skrll Sync with HEAD
 1.23.4.1 19-Mar-2016  skrll Sync with HEAD
 1.24.4.2 23-Apr-2017  bouyer Sync with HEAD
 1.24.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.24.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.40 19-Nov-2008  pooka Split vfs out of rumpkern into rumpvfs. Non-fs rumps no longer
include the file system code. File system rumps explicitly need
to include rumpvfs from now on.
 1.39 29-Jul-2008  pooka branches: 1.39.2;
Install rump libraries and utilities to the base system and remove the
private non-installed build infrastructure from sys/rump.

breakdown of commit:
* install relevant headers into /usr/include/rump
* build sys/rump/librump/rumpuser and sys/rump/librump/rumpkern
from src/lib and install as librumpuser and librump, respectively
+ this retains the ability to test a librump build with just the
kernel sources at hand
* move sys/rump/fs/lib/libukfs and sys/rump/fs/lib/libp2k to src/lib
for general consumption, they are not kernel-space dwellers anyway
* build and install sys/rump/fs/lib/lib$fs as librumpfs_$fs
* add chapter 3 manual pages for rump, rumpuser, ukfs and p2k
* build and install userspace kernel file system daemons if MKPUFFS=yes
is spexified
* retire fsconsole for now, it will make a comeback with an actually
implemented version shortly
 1.38 12-Mar-2008  pooka branches: 1.38.4; 1.38.6; 1.38.8; 1.38.10;
Support chdir. This is useful for example when testing and not
wanting to stress namei() so much as test individual ops.
XXX: it should be implemented per calling thread, not per fs.
 1.37 12-Mar-2008  pooka Support multiple file systems within one process with ukfs by using
a "chroot" for each file system.
 1.36 11-Mar-2008  pooka Backup some fixes for recent breakage from local tree. Also some
other improvements such as exporting the real kernel namei and
using that in ukfs instead of the homegrown heap'o hacks namei.
"etcetc".
 1.35 30-Jan-2008  ad branches: 1.35.2; 1.35.6;
Replace struct lock on vnodes with a simpler lock object built on
krwlock_t. This is a step towards removing lockmgr and simplifying
vnode locking. Discussed on tech-kern.
 1.34 27-Jan-2008  pooka Use vfs_subr.c from sys/kern. This brings differences in the vnode
life cycle between rump and a real kernel to a minimum.
 1.33 25-Jan-2008  pooka Nuke local copy of getcwd_common(), we compile in the real thing now.
 1.32 24-Jan-2008  pooka Use namei() etc. from kernel sources instead of a reimplementation.
To accommodate, give the rootvnode its own vnode op vector with a
simple lookup operation. This is used for looking up the file
system's device vnode instead of doing that directly in a homesmoked
namei().
 1.31 24-Jan-2008  pooka Make work again by repairing spec_node_init() and not being afraid
to use it.
 1.30 24-Jan-2008  ad specfs changes for PR kern/37717 (raidclose() is no longer called on
shutdown). There are still problems with device access and a PR will be
filed.

- Kill checkalias(). Allow multiple vnodes to reference a single device.

- Don't play dangerous tricks with block vnodes to ensure that only one
vnode can describe a block device. Instead, prohibit concurrent opens of
block devices. As a bonus remove the unreliable code that prevents
multiple file system mounts on the same device. It's no longer needed.

- Track opens by vnode and by device. Issue cdev_close() when the last open
goes away, instead of abusing vnode::v_usecount to tell if the device is
open.
 1.29 17-Jan-2008  ad Add a dummy vrevoke().
 1.28 03-Jan-2008  pooka Theoretically this is supposed to be interchangeable with real
kernel code. Use kmem_alloc/free instead of some wily homerolled
rump interfaces for memory allocation.
 1.27 03-Jan-2008  pooka use UVM_OBJ_INIT/DESTROY()
 1.26 03-Jan-2008  pooka valloc -> vnalloc, vfree -> vnfree
Avoids collision with userland valloc(3).

no functional change
ad ok
 1.25 02-Jan-2008  pooka Add the ability to run puffs in userspace. This means that puffs
can now be developed in userspace using puffs for development
(I hate emulators, they are annoyingly clumsy).

To e.g. mount psshfs using puffs-on-puffs, run fs/bin/syspuffs/syspuffs
with the regular mount_psshfs command line as an argument:

golem> ./syspuffs /usr/sbin/mount_psshfs ftp.netbsd.org:/pub /puffs

This will make the mount appear as usual, with the exception that the
requests will be passed through puffs both in the kernel and userspace:

ftp.netbsd.org:/pub on /puffs type puffs|p2k|puffs|psshfs
 1.24 02-Jan-2008  pooka fix vmlocking2 fallout:

* I heard a wild rumor that vp_interlock is a mutex these days (hi ad!)
* init new locks (hi ad)
* observe that with simple_locks only deadlocks would be caught while
releasing unlocked locks would go unnoticed. make locking work (hi pooka)
 1.23 02-Jan-2008  ad Provide valloc(), fix vfree().
 1.22 02-Jan-2008  ad Merge vmlocking2 to head.
 1.21 26-Nov-2007  pooka branches: 1.21.2; 1.21.6;
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.20 14-Nov-2007  pooka Shield against returning EJUSTRETURN from relookup()
 1.19 06-Nov-2007  pooka initialize vnode interlock when creating one
 1.18 06-Nov-2007  pooka Sprinkle some more locking, especially to the vm. Due to some
additional fixes, it's now possible to run file systems with
spinlocks actually enabled. The genfs_putpages() locking is still
working only due to greater powers, but I'll eventually get around to
fixing it.
 1.17 27-Oct-2007  pooka branches: 1.17.2; 1.17.4;
Prevent recursion in INACTIVE -> vrecycle -> inactive -> ...
 1.16 26-Oct-2007  pooka more carefully emulate vget() and vrecycle()
 1.15 17-Oct-2007  pooka branches: 1.15.2;
Compile most genfs routines directly out of the kernel sources.
Move special I/O routines to genfs_io.c to mirror kernel naming.
 1.14 10-Oct-2007  ad Merge from vmlocking:

- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
 1.13 08-Sep-2007  pooka branches: 1.13.2;
honor LOCKLEAF in namei
 1.12 01-Sep-2007  pooka branches: 1.12.2;
vinvalbuf in vrecycle
 1.11 20-Aug-2007  pooka branches: 1.11.2; 1.11.4;
Hide NetBSD kernel headers completely from ukfs. This includes creating
accessors for:
* struct mount & VFS ops
* struct uio
* struct vnode
* struct vattr

and some namespace games for:
* namei flags
* VOPs
* enum vtype

Also, split rump services into two categories: library private and public
(rump_private.h and rump.h, respectively).

As a result, it is now possible to compile and use the NetBSD kernel
file systems on Linux (and probably other systems too with very
little work), although the makefiles need a bit of work to make it
a pleasureable experience.
 1.10 14-Aug-2007  pooka branches: 1.10.2;
Kill handrolled buffercache and use vfs_bio from the kernel. This is
mostly to get the flag jungle in sync with the kernel.
 1.9 13-Aug-2007  pooka Use supermarket variety vfs_vnops.c instead of homecooked routines
(that's actually a good thing here).
 1.8 12-Aug-2007  pooka track lockmgr lock status. makes lfs work again
 1.7 09-Aug-2007  pooka Play catchup with ufs/ffs changes: compile subr_specificdata.c
and emulate kmem_foo() to support the prior.
 1.6 09-Aug-2007  pooka whoops, committed old signature of vrele2()
 1.5 09-Aug-2007  pooka Add some stubs for lfs.
 1.4 08-Aug-2007  pooka Provide rump_getvninfo() and use that in libp2k_lookup() to avoid an
extra getattr for stuff the file system already cached in the vnode.
 1.3 07-Aug-2007  pooka flush pages in vflushbuf()
 1.2 06-Aug-2007  pooka branches: 1.2.2;
Allow to de/register pathnames which should be faked as block
devices instead of faking all non-blks as blks in namei().
 1.1 05-Aug-2007  pooka Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.2.2.2 06-Aug-2007  pooka Allow to de/register pathnames which should be faked as block
devices instead of faking all non-blks as blks in namei().
 1.2.2.1 06-Aug-2007  pooka file vfs.c was added on branch matt-mips64 on 2007-08-06 22:20:58 +0000
 1.10.2.4 10-Sep-2007  skrll Sync with HEAD.
 1.10.2.3 03-Sep-2007  skrll Sync with HEAD.
 1.10.2.2 15-Aug-2007  skrll Sync with HEAD.
 1.10.2.1 14-Aug-2007  skrll file vfs.c was added on branch nick-csl-alignment on 2007-08-15 13:50:42 +0000
 1.11.4.4 23-Mar-2008  matt sync with HEAD
 1.11.4.3 09-Jan-2008  matt sync with HEAD
 1.11.4.2 08-Nov-2007  matt sync with -HEAD
 1.11.4.1 06-Nov-2007  matt sync with HEAD
 1.11.2.4 23-Oct-2007  ad Sync with head.
 1.11.2.3 09-Oct-2007  ad Sync with head.
 1.11.2.2 20-Aug-2007  ad Sync with HEAD.
 1.11.2.1 20-Aug-2007  ad file vfs.c was added on branch vmlocking on 2007-08-20 22:07:30 +0000
 1.12.2.8 17-Mar-2008  yamt sync with head.
 1.12.2.7 04-Feb-2008  yamt sync with head.
 1.12.2.6 21-Jan-2008  yamt sync with head
 1.12.2.5 07-Dec-2007  yamt sync with head
 1.12.2.4 15-Nov-2007  yamt sync with head.
 1.12.2.3 27-Oct-2007  yamt sync with head.
 1.12.2.2 03-Sep-2007  yamt sync with head.
 1.12.2.1 01-Sep-2007  yamt file vfs.c was added on branch yamt-lazymbuf on 2007-09-03 14:45:36 +0000
 1.13.2.2 18-Oct-2007  yamt sync with head.
 1.13.2.1 14-Oct-2007  yamt sync with head.
 1.15.2.2 18-Nov-2007  bouyer Sync with HEAD
 1.15.2.1 13-Nov-2007  bouyer Sync with HEAD
 1.17.4.3 18-Feb-2008  mjf Sync with HEAD.
 1.17.4.2 08-Dec-2007  mjf Sync with HEAD.
 1.17.4.1 19-Nov-2007  mjf Sync with HEAD.
 1.17.2.4 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.17.2.3 14-Nov-2007  joerg Sync with HEAD.
 1.17.2.2 06-Nov-2007  joerg Sync with HEAD.
 1.17.2.1 27-Oct-2007  joerg file vfs.c was added on branch jmcneill-pm on 2007-11-06 19:25:37 +0000
 1.21.6.3 19-Jan-2008  bouyer Sync with HEAD
 1.21.6.2 08-Jan-2008  bouyer Sync with HEAD
 1.21.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.21.2.3 28-Dec-2007  ad Make rump build.
 1.21.2.2 08-Dec-2007  ad Fix merge error.
 1.21.2.1 04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.35.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.35.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.35.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.35.2.1 24-Mar-2008  keiichi sync with head.
 1.38.10.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.38.10.1 19-Oct-2008  haad Sync with HEAD.
 1.38.8.1 31-Jul-2008  simonb Sync with head.
 1.38.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.38.4.1 04-May-2009  yamt sync with head.
 1.39.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.8 19-Nov-2008  pooka Split vfs out of rumpkern into rumpvfs. Non-fs rumps no longer
include the file system code. File system rumps explicitly need
to include rumpvfs from now on.
 1.7 30-Sep-2008  pooka branches: 1.7.2;
Make spec_fsync() a do-nothing instead of a do-panic. Some file
systems have it directly in the specfs op vector.
 1.6 17-Oct-2007  pooka branches: 1.6.4; 1.6.20; 1.6.24; 1.6.26; 1.6.30;
Compile most genfs routines directly out of the kernel sources.
Move special I/O routines to genfs_io.c to mirror kernel naming.
 1.5 13-Aug-2007  pooka branches: 1.5.2; 1.5.4; 1.5.6; 1.5.8; 1.5.10;
Use supermarket variety vfs_vnops.c instead of homecooked routines
(that's actually a good thing here).
 1.4 09-Aug-2007  pooka * fix symlink
* actually call a couple of VOPs
 1.3 09-Aug-2007  pooka fool some KASSERTs
 1.2 08-Aug-2007  pooka Make genfs_islocked return always 1 instead of 0. But these should
really get tracked ...
 1.1 05-Aug-2007  pooka branches: 1.1.2;
Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.2 05-Aug-2007  pooka Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.1.2.1 05-Aug-2007  pooka file vfsops_stub.c was added on branch matt-mips64 on 2007-08-05 22:28:11 +0000
 1.5.10.1 18-Oct-2007  yamt sync with head.
 1.5.8.3 27-Oct-2007  yamt sync with head.
 1.5.8.2 03-Sep-2007  yamt sync with head.
 1.5.8.1 13-Aug-2007  yamt file vfsops_stub.c was added on branch yamt-lazymbuf on 2007-09-03 14:45:37 +0000
 1.5.6.1 06-Nov-2007  matt sync with HEAD
 1.5.4.3 23-Oct-2007  ad Sync with head.
 1.5.4.2 20-Aug-2007  ad Sync with HEAD.
 1.5.4.1 13-Aug-2007  ad file vfsops_stub.c was added on branch vmlocking on 2007-08-20 22:07:31 +0000
 1.5.2.2 15-Aug-2007  skrll Sync with HEAD.
 1.5.2.1 13-Aug-2007  skrll file vfsops_stub.c was added on branch nick-csl-alignment on 2007-08-15 13:50:42 +0000
 1.6.30.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.6.30.1 19-Oct-2008  haad Sync with HEAD.
 1.6.26.1 10-Oct-2008  skrll Sync with HEAD.
 1.6.24.1 04-May-2009  yamt sync with head.
 1.6.20.2 17-Jan-2009  mjf Sync with HEAD.
 1.6.20.1 05-Oct-2008  mjf Sync with HEAD.
 1.6.4.2 02-Nov-2007  joerg Reduce diff to HEAD by adding files forgotten in early merges.
 1.6.4.1 17-Oct-2007  joerg file vfsops_stub.c was added on branch jmcneill-pm on 2007-11-02 12:43:54 +0000
 1.7.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.197 24-Sep-2023  martin PR kern/57626: instead of an (arbitrary) FAKE_PAGE_SHIFT (and always
using 4k pages), query the hypervisor for the real page size of the host
kernel and use that for architectures that do not have compile time
constant page sizes.
 1.196 22-Apr-2023  riastradh rump: Move ubc_uiomove, ubc_zerorange from rumpvfs to rumpkern.

Needed by kern_ksyms.c. We could split kern_ksyms.c up into kernel-
internal interfaces and the user/kernel /dev/ksyms interface, but
there's nothing vfs-specific about ubc_uiomove and ubc_zerorange
anyway, so let's just define them in rumpkern.
 1.195 22-Apr-2023  riastradh rumpkern: Provide stub uvm_vnodeops weak alias.

Needed for UVM_OBJ_IS_VNODE, but not for anything else in rumpkern
without rumpvfs.
 1.194 26-Oct-2022  riastradh sys/*: Get module_map consistently from sys/module.h.
 1.193 21-Aug-2022  riastradh rumpkern: Abusing struct pmap internals now requires extra effort.

(as it should)
 1.192 16-Sep-2021  andvar fix typos in word "successfully", mainly s/succesfully/successfully/.
 1.191 05-Dec-2020  chs update the rump copy of uvm_page_unbusy() to match the real version,
in particular handle PG_PAGEOUT. fixes a few atf tests.
 1.190 11-Jun-2020  ad branches: 1.190.2;
uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.
 1.189 06-Jun-2020  ad Correction to previous - set VI_PAGES correctly.
 1.188 03-Jun-2020  ad PR kern/55032 (rump/rumpkern/t_vm:uvmwait test case now fails)

Work around issues with rump's pagedaemon emulation, including one that's
sensitive to timing effects (i.e. scheduler changes). While here tidy up
some other stuff around the emulation of page alloc/free.
 1.187 17-Mar-2020  ad Tweak the March 14th change to make page waits interlocked by pg->interlock.
Remove unneeded changes and only deal with the PQ_WANTED flag, to exclude
possible bugs.
 1.186 14-Mar-2020  ad Make page waits (WANTED vs BUSY) interlocked by pg->interlock. Gets RW
locks out of the equation for sleep/wakeup, and allows observing+waiting
for busy pages when holding only a read lock. Proposed on tech-kern.
 1.185 14-Mar-2020  ad rump - page/object dirtyness tracking corrections.
 1.184 23-Feb-2020  ad UVM locking changes, proposed on tech-kern:

- Change the lock on uvm_object, vm_amap and vm_anon to be a RW lock.
- Break v_interlock and vmobjlock apart. v_interlock remains a mutex.
- Do partial PV list locking in the x86 pmap. Others to follow later.
 1.183 15-Jan-2020  ad Merge from yamt-pagecache (after much testing):

- Reduce unnecessary page scan in putpages esp. when an object has a ton of
pages cached but only a few of them are dirty.

- Reduce the number of pmap operations by tracking page dirtiness more
precisely in uvm layer.
 1.182 05-Jan-2020  para branches: 1.182.2;
remove unused predicate function

likely unused since kmem changes
 1.181 02-Jan-2020  ad rump: initialize pg->interlock
 1.180 31-Dec-2019  ad Fix rump.
 1.179 31-Dec-2019  ad Rename uvm_free() -> uvm_availmem().
 1.178 31-Dec-2019  ad Rename uvm_page_locked_p() -> uvm_page_owner_locked_p()
 1.177 21-Dec-2019  ad Add uvm_free(): returns number of free pages in system.
 1.176 15-Dec-2019  ad Merge from yamt-pagecache:

- do gang lookup of pages using radixtree.
- remove now unused uvm_object::uo_memq and vm_page::listq.queue.
 1.175 14-Dec-2019  ad Merge from yamt-pagecache: use radixtree for page lookup.

rbtree page lookup was introduced during the NetBSD 5.0 development cycle to
bypass lock contention problems with the (then) global page hash, and was a
temporary solution to allow us to make progress. radixtree is the intended
replacement.

Ok yamt@.
 1.174 13-Dec-2019  ad Break the global uvm_pageqlock into a per-page identity lock and a private
lock for use of the pagedaemon policy code. Discussed on tech-kern.

PR kern/54209: NetBSD 8 large memory performance extremely low
PR kern/54210: NetBSD-8 processes presumably not exiting
PR kern/54727: writing a large file causes unreasonable system behaviour
 1.173 14-May-2017  nat branches: 1.173.10; 1.173.14;
Add uvm_map_pageable dummy function. This means that the audio tests
should run again.

Ok christos@.
 1.172 07-May-2017  martin Provide stupid uvm_map() and uvm_unmap1() immplementations - might be enough
to get audio tests in rump going again.
XXX needs a RUMP chef to review/replace by something sane!
 1.171 07-May-2017  martin Add a dummy (non-working) uvm_map().
XXX someone with a clue please fix this for real!
 1.170 20-Jul-2016  christos branches: 1.170.6;
add uvm_km_protect()
 1.169 26-Jan-2016  pooka branches: 1.169.2;
Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.168 26-Nov-2015  martin Adapt to e_default_mapaddr signature changes
 1.167 02-Jun-2015  pooka In case pagedaemon can't release any more memory, use kpause() instead
of cv_timedwait() on the pagedaemon condvar -- it's no use constantly
waking the pagedaemon up for new memory allocation attempts, as will
happen e.g. if new network connections are constantly pouring in.
 1.166 18-Apr-2015  pooka Give remote clients struct pmap storage. Although the pmap is unused,
that way we can sure that the pmap macro framework doesn't access all
the wrong places.
 1.165 17-Apr-2015  pooka g/c rump_vmmap

No recollection what it was used for; didn't seem to be used even when
it was originally added 5th August 2007.
 1.164 17-Apr-2015  pooka Give the kernel/local pmaps actual storage.

That way friendly neighborhood macros won't go scribbling
in the wrong places.
 1.163 03-Apr-2015  pooka Use RUMP_PMAP_KERNEL and RUMP_PMAP_LOCAL to denote
kernel and local client pmaps, respectively.
 1.162 03-Apr-2015  pooka Use a different vmspace for rump kernel proc0 and local clients.
While the rump kernel and local clients are by definition in the same
host vmspace, there are subtle differences in how in-kernel code works
in case accessing the kernel vmspace or a user process vmspace.

Problem discovered by riastradh's "read(fd, NULL, 1)" test.
 1.161 03-Jan-2015  pooka Put all sysproxy routines to their own C module, sysproxy.c
 1.160 14-Dec-2014  chs add a new "fo_mmap" fileops method to allow use of arbitrary uvm_objects for
mappings of file objects. move vnode-specific details of mmap()ing a vnode
from uvm_mmap() to the new vnode-specific vn_mmap(). add new uvm_mmap_dev()
and uvm_mmap_anon() convenience functions for mapping character devices
and anonymous memory, and replace all other calls to uvm_mmap() with those.
use the new fileop in drm2 so that libdrm can use mmap() to map things
like on other platforms (instead of the ioctl that we have used so far).
 1.159 15-Jun-2014  pooka branches: 1.159.2; 1.159.4;
update comment
 1.158 13-Jun-2014  pooka make sure we don't underflow the memlimit
 1.157 13-Jun-2014  pooka fill in a few more uvmexp entries
 1.156 25-Apr-2014  pooka Init function pointers to nullop() so that callers don't need a dance
 1.155 12-Apr-2014  pooka apparently DFLSSIZ isn't defined on powerpc, so pull a value out of el stetson
 1.154 10-Apr-2014  pooka Pretend that we have slightly more reasonable stack size limits.
(we don't have stacks, that's why we pretend)
 1.153 09-Apr-2014  pooka implement lwp_create() and a few related interfaces.
main raison d'impalerment: the aio driver
 1.152 11-Mar-2014  pooka branches: 1.152.2;
kill undesirable #ifndef _RUMPKERNEL
 1.151 11-Mar-2014  pooka deduplicate uvm_object_printit() implementation
 1.150 03-Mar-2014  pooka Fix the memory limiter to work for non-pagedaemon threads again

reported by njoly
 1.149 18-Feb-2014  pooka Use same uvm_swap_shutdown() stub for !vmswap kernels and rump kernels.
 1.148 17-Feb-2014  pooka simply issue a warning if <1MB RAM configured. it might work, but
not going to start enumerating when and where it might.
 1.147 17-Feb-2014  pooka reserve a small amount of memory for the pagedaemon
 1.146 23-Nov-2013  christos add a copy of uvm_swap_shutdown() here so that it is not undefined when we
use it.
 1.145 14-Nov-2013  martin As discussed on tech-kern: make TOPDOWN-VM runtime selectable per process
(offer MD code or emulations to override it).
 1.144 30-Apr-2013  pooka branches: 1.144.4;
Flip parameter order in the clock hypercalls to make them consistent
with everything else wrt in/out parameters.
 1.143 30-Apr-2013  pooka add missing demogorgon
 1.142 30-Apr-2013  pooka Make hypercall calling conventions consistent: iff a hypercall can fail,
it returns an int containing the error value.
 1.141 29-Apr-2013  pooka Replace the various "get info from hypervisor" interfaces with one
unified rumpuser_getparam(), and make it return a plist. The
contents can come e.g. from the env or a config file. Make
identifiers starting with an underscore denote system identifiers
which must be implemented by hypervisor. (yea, j/k about the plist bit)
 1.140 28-Apr-2013  pooka Appearances count: spell "IPL_NONE" correctly.
 1.139 28-Apr-2013  pooka Improve the time-related hypercalls so that's it's possible to
sleep until an absolute time on the host's monotonic clock (should
something like that be supported).
 1.138 27-Apr-2013  pooka * treat kern_malloc.c as an unreal allocator (it's so lightweight)
* get rid of the rumpuser_realloc() hypercall
* pass size to rumpuser_free()
 1.137 10-Mar-2013  pooka Use kern_malloc.c instead of the relegated allocators in memalloc.c.
Previously this didn't make sense due to the use of kmem_map, but the
new malloc is more dynamic and puts sense into using it.
 1.136 06-Mar-2013  yamt simplify code
add a comment
 1.135 29-Jan-2013  para make vmem(9) ready to be used early during bootstrap to replace extent(9)
pass memory for vmem structs into the initialization function and
do away with the static pool of vmem structs.
remove special bootstrapping of the quantum cache pools of the kmem_va_arena
as memory for pool_caches is allocated via pool_allocator_meta which is
fully operational at this point.
 1.134 26-Jan-2013  para revert previous commit not yet fully functional, sorry
 1.133 26-Jan-2013  para make vmem(9) ready to be used early during bootstrap to replace extent(9).
pass memory for vmem structs into the initialization functions and
do away with the static pools for this.
factor out the vmem internal structures into a private header.
remove special bootstrapping of the kmem_va_arena as all necessary memory
comes from pool_allocator_meta wich is fully operational at this point.
 1.132 14-Jan-2013  pooka Don't use __weak_alias where the component framework is sufficient.
 1.131 13-Nov-2012  pooka kill some -Wunused-but-set-variable warnings
 1.130 27-Jul-2012  pooka branches: 1.130.2;
Use mmap hypercall for memory allocation only when absolutely necessary
(map == module_map). Otherwise, use the malloc hypercall. This avoids
relying on the platform's mmap() to be able to return arbitrarily
alignment memory.
 1.129 20-Jul-2012  pooka Make it possible to select between real and unreal allocators from
make. Plus some gratuitous renaming.
 1.128 20-Jul-2012  pooka make unreal allocators work again
 1.127 05-Jun-2012  jym Now that pool_cache_invalidate() is synchronous and can handle per-CPU
caches, merge together pool_drain_start() and pool_drain_end() into

bool pool_drain(struct pool **ppp);

"bool" value indicates whether reclaiming was fully done (true) or not (false)
"ppp" will contain a pointer to the pool that was drained (optional).

See http://mail-index.netbsd.org/tech-kern/2012/06/04/msg013287.html
 1.126 23-May-2012  martin Recently uvm_page_locked_p() leaked outside of uvm/MD code, so rump
needs to provide one.
 1.125 17-Mar-2012  hannken Don't take a mutex we already took 6 lines above.
 1.124 05-Mar-2012  para adjust rump for static pool_cache count
should have went in with subr_vmem 1.73
 1.123 19-Feb-2012  martin Adapt to constification in sys/uvm/uvm_export.h
 1.122 29-Jan-2012  njoly branches: 1.122.2;
Move pool subsystem init from rump__init() to uvm_init(), following
kernel code. Fix RUMP_LOCKDEBUG early panic.
 1.121 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.120 31-Oct-2011  yamt branches: 1.120.2; 1.120.6;
replace a non us-ascii character in a comment
 1.119 02-Sep-2011  christos trylockowner is not needed anymore.
 1.118 01-Sep-2011  christos fix the build for rumpserver.
 1.117 19-Jun-2011  hannken Make ubc_purge() a noop.
 1.116 12-Jun-2011  mrg include uvm_object.c in the rump kernel for the new uvm_obj* functions.
don't build the uvm_object.c uvm_object_printit() for _RUMPKERNEL. (XXX)
add empty panic() stubs for uvm_loanbreak() and ubc_purge().

fixes some more 5.99.53 rump build issues.
 1.115 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.114 21-Mar-2011  pooka branches: 1.114.2;
Update copyright statements.

no functional change.
 1.113 22-Feb-2011  pooka Shuffle the pagedaemon algorithm a bit to record the number of
pageouts active and give up only if the pagedaemon could not free
memory and there are no outstanding pageouts.

This should fix the "out of memory" pauses reported by Mihai Chelaru
and Taylor R Campbell. Tested by copying files to and from an ffs
backed by /dev/wd0 (with and without -o log) using a 1MB rump kernel
memory limit.
 1.112 22-Feb-2011  pooka complete the incomplete pagesize rototill
 1.111 10-Feb-2011  pooka Make vmapbuf() return success/error and make physio deal with a
failure.
 1.110 10-Feb-2011  pooka Set b_error in vunmapbuf() if copyout_proc fails.
XXX: what if copyin fails in vmapbuf()?
 1.109 05-Feb-2011  pooka Use correct strtoululululu variant.

from Taylor R Campbell
 1.108 22-Jan-2011  pooka Add a comment explaning why uvm_reclaim_hook is not currently
necessary for rump.

XXX: strictly speaking, the zfs implementation does not work
correctly since it just wakes up a thread instead of performing
the scan in the context of the pagedaemon
 1.107 18-Jan-2011  haad branches: 1.107.2;
Add support for compiling ZFS and Solaris modules as RUMP libraries. Add
some locking and rumpcopy primitives and refactor module building Makefiles
to work with both RUMP and kernel modules. This is first part of adding
support for regular test of zfs on NetBSD to hunt some bugs and make it
stable.

Ok by pooka@.
 1.106 13-Jan-2011  pooka branches: 1.106.2;
Introduce RUMP_LOCALPROC_P() macro and use it.
 1.105 08-Jan-2011  pooka Do a minidehumanizenumber for RUMP_MEMLIMIT. Now you can set it
to e.g. 16m instead of having to type out 16777216.
 1.104 01-Dec-2010  pooka If the pagedaemon cannot free any memory due to not being able to
lock any uvm objects, check if lockholders are currently on CPU
and yield to try very soon again instead of assuming deadlock.

This makes limited-memory kernels perform the same as memory-unlimited
kernels (provided there is a reasonable amount of memory available).
For example, for large file copy off of ffs where the image is
backed on host memory (i.e. no disk i/o, i.e. ideal conditions)
the figures are, per rump kernel memory limit:

3000kB: same
1000kB: 10% slower
500kB: 50% slower

(per pagedaemon code might still be able to use some tweak, though)
 1.103 01-Dec-2010  pooka Make uvm_pagealloc_tele() fail if the request can't be immediately
satisfied. This allows the caller to unlock the object and the
pagedaemon to avoid deadlock even if ~all memory is consumed by
one vm object. This in turn makes is possible to copy a large file
into a rump kernel with a 10MB memory limit (where large >> 10MB).
A little more tuning will be required to avoid the pagedaemon
hitting the sleep-and-retry path, though.

+ fix some outdated unrelated comments
 1.102 22-Nov-2010  pooka Support physio for remote processes.
==> add support for remote vmspace vmapbuf/vunmapbuf
==> add proper support for copyin/out_vmspace
==> add support for remote vmspace uvm_io
==> add support for non-curproc rumpuser_sp_copyin/out
==> store remote context in vm_map->pmap instead of
pthread_specificdata

In short, makes read/write of most (all?) block devices work from
a remote rump client via rump syscalls.
 1.101 17-Nov-2010  pooka cleanup some old garbage
 1.100 16-Nov-2010  uebayasi Define uvmexp_pagemask and friends used by sparc to set PAGE_SIZE,
PAGE_MASK, PAGE_SHIFT dynamically.
 1.99 12-Nov-2010  uebayasi Abstraction fix; move physical address -> per-page metadata (struct
vm_page *) "reverse" lookup code from uvm_page.h to uvm_page.c, to
help migration to not do that.

Likewise move per-page metadata (struct vm_page *) -> physical
address "forward" conversion code into *.c too. This is called
only low-layer VM and MD code.
 1.98 27-Oct-2010  pooka Start rework of system call proxying over socket ("sysproxy").
This incarnation is written in the user namespace as opposed to
the previous one which was done in kernel namespace. Also, rump
does all the handshaking now instead of excepting an application
to come up with the user namespace socket.

There's still a lot to do, including making code "a bit" more
robust, actually running different clients in a different process
inside the kernel and splitting the client side library from librump.
I'm committing this now so that I don't lose it, plus it generally
works as long as you don't use it in unexcepted ways: i've tested
ifconfig(8), route(8), envstat(8) and sysctl(8).
 1.97 13-Oct-2010  pooka Don't reorder page on the age queue if the lookup is done by the
pagedaemon. This mimics normal kernel behaviour where pmap_kentered
mappings are not tracked for references. Without this change the
vnode pager's clustering could cause one page to be released by
the pagedaemon, and the rest of the pages in the pageout cluster
made unlikely candidates to be released soon.
 1.96 24-Sep-2010  rmind Fixes/improvements to RB-tree implementation:
1. Fix inverted node order, so that negative value from comparison operator
would represent lower (left) node, and positive - higher (right) node.
2. Add an argument (i.e. "context"), passed to comparison operators.
3. Change rb_tree_insert_node() to return a node - either inserted one or
already existing one.
4. Amend the interface to manipulate the actual object, instead of the
rb_node (in a similar way as Patricia-tree interface does).
5. Update all RB-tree users accordingly.

XXX: Perhaps rename rb.h to rbtree.h, since cleaning-up..

1-3 address the PR/43488 by Jeremy Huddleston.

Passes RB-tree regression tests.
Reviewed by: matt@, christos@
 1.95 09-Sep-2010  pooka * unlock object in "error" branch
* fix typo (not in comment)
* improve indentation tailspin
 1.94 09-Sep-2010  pooka Assert that object is locked in page unbusy.
 1.93 08-Sep-2010  pooka Actually, we want to say "no aobjs" instead of "only vnodes" to
make component boundaries go right.
 1.92 08-Sep-2010  pooka Improve pagedaemon performance:
* page out vnode objects
* drain kmem/kernel_map

As long as there is a reasonable memory hardlimit (>600kB or so),
a rump kernel can now survive file system metadata access for an
arbitrary size file system (provided, of course, that the file
system does not use wired kernel memory for metadata ...).

Data handling still needs a little give&take finetuning. The
general problem is that a single vm object can easily be the owner
of all vm pages in a rump kernel. now, if a thread wants to allocate
memory while holding that object locked, there's very little the
pagedaemon can do to avoid deadlock. but I think the problem can
be solved by making an object release a page when it wants to
allocate a page if a) the system is short on memory and b) too many
pages belong to the object. that still doesn't take care of the
pathological situation where 1000 threads hold an object with 1
page of memory locked and try to allocate more. but then again,
running 1000 threads with <1MB of memory is an unlikely scenario.
and ultimately, I call upon the fundamental interaction which is
the basis of why any operating works: luck.
 1.91 07-Sep-2010  pooka Make the Diabolical (Page)Daemon Director drain vfs buffers when
we are short of memory.

There are still some funnies left to iron out. For example, with
a certain file system / memory size configuration it's still not
possible to create enough files to make the file system run out of
inodes before the kernel runs out of memory. Also, with some other
configurations disk access slows down gargantually (though i'm sure
there are >0 buffers available). Anyway, it ~works for now and
it's by no means worse than what it was before.
 1.90 07-Sep-2010  pooka Improve page allocator performance by using pool_cache for the
structure itself and allocating the backing page directly from the
hypervisor.

* initial write to a large tmpfs file is almost 2x faster
* truncating the file to 0 length after write is over 50% faster
* rewrite of the file is just slightly faster (indicating that
kmem does a good job with caching, as expected)
 1.89 07-Sep-2010  pooka Use rb_tree for page lookup instead of list. Unshockingly, this
makes dealing with large uobjs (files) quite a bit faster.
 1.88 06-Sep-2010  pooka Use standard uvm aobj pager. Most of the kernel aobj pager complexity
comes from swap handling, but that is included only with VMSWAP.
 1.87 29-Jul-2010  hannken Correct previous. Skip marker pages in uvm_pagelookup().
Already awake :-)
 1.86 29-Jul-2010  pooka Remove questionable KASSERT from previous. hannken can look at
this more closely when he wakes up. Normally I wouldn't be in such
a huge rush, but due to atf bug #53 the whole test run breaks now.
At least with the KASSERT removed all tests pass again.
 1.85 29-Jul-2010  hannken Add vm page flag PG_MARKER and use it to tag dummy marker pages
in genfs_do_putpages() and uao_put().
Use 'v_uobj.uo_npages' to check for an empty memq.
Put some assertions where these marker pages may not appear.

Ok: YAMAMOTO Takashi <yamt@netbsd.org>
 1.84 14-Jun-2010  pooka Make it possible to define an upper limit for memory consumed by
the rump kernel by specifying RUMP_MEMLIMIT. In case allocation
over that limit is attempted, essentially pool reclaim and uvm_wait()
is done. The default is to allow to allocate as much as the host
will give.

XXX: uvm_km_alloc and malloc(9) do not currently conform. the
former is easy, the latter requires kern_malloc.c (rump malloc is
currently directly relegated to host malloc).
 1.83 10-Jun-2010  pooka Use kern_proc.c instead of a collection of stubs. But what we
really wanted from this commit was the support for proc_specificdata.

TODO: make creating a new process actually use kern_proc and
maybe even add an interface which starts a process with
"any pid you don't like"
 1.82 09-Jun-2010  pooka On amd64, allocate module_map memory from the lowest 2GB.
 1.81 09-Jun-2010  pooka Add the ability to specify a preferred address the "map anon memory"
hypercall.
 1.80 03-Jun-2010  pooka Implement a sort-of pagedaemon: adjust all memory allocators to go
through an in-rumpkernel hypermemory allocator which knows it should
kick the pagedaemon and block in case ``waitok'' memory allocation
fails.

This allows us to recover from some out-of-memory situations.
Realworld'istically speaking (as opposed to whatever "should be"
theory), these OOM situations will happen extremely rarely if ever
when our hypervisor is a regular process. Speculatively, this
should be useful for other types of hosts.

issues remaining:
* the hypervisor does not know how to reclaim kernel memory (and
for the reason I stated above, I'm not sure if it makes sense
to teach the current implementation about that)
* vfs memory (buffers, vm object pages etc.) is not reclaimed
 1.79 02-Jun-2010  pooka rumpvm_init -> uvm_init to get rid of local prototype.
no functional change
 1.78 01-Jun-2010  pooka Don't pass "canfail" down to rumpuser_malloc -- there's quite little
we can do with that info way down there. Instead, pass alignment.
Implement rumpuser_malloc() with posix_memalign().
 1.77 01-Jun-2010  pooka Always use rumpuser_malloc() for allocating both poolpage and
poolpage_cache -- its bootstrap cost is slightly higher than
anonmmap, but it's faster in the long run.
 1.76 01-Jun-2010  pooka * remove rumpvm_makepage, just use uvm_pagealloc()
* update copyright to reflect reality a little better
 1.75 26-May-2010  pooka print vm object refcount
 1.74 14-May-2010  pooka Pick up after people who find build-testing their changes too difficult.
 1.73 11-May-2010  pooka uvm_object_printit() should be wrapped in DEBUGPRINT
 1.72 28-Apr-2010  pooka Instead of causing a catastrophic failure when uvm_loanuobjpages()
is called, just pretend it hit a wired page and return EBUSY. This
should cause callers to use a non-loaning access path instead.

Fixes file read path of stock nfs kernel module (previously it was
easy to just frob the nfsd_use_loan boolean into the other position
by simple value assingment, but now that nfsserver can be autoloaded
at runtime into the rump kernel, that approach is a little more
challenging since the variable isn't available in application
linkage. yes, things like adding a sysctl for the variable would
work, but now everything works out-of-the-box).
 1.71 21-Apr-2010  pooka support kern_resource
 1.70 04-Dec-2009  pooka branches: 1.70.2; 1.70.4;
g/c unused functions (previously used by the vnode pager).
 1.69 04-Dec-2009  pooka Implement enough of uvm_mmap() to make the creative proplib ioctl
copyout code work. No comments ... okok, if that'll make you leave
me alone: it's ioctl, so it's supposed to be funky (with a score
or two of psychedelic rock).
 1.68 04-Dec-2009  pooka Provide the default_mapaddr method in default rump emul (since some
kernel callers want to use it).
 1.67 04-Nov-2009  pooka Pull all relegating memory allocators under a common roof in memalloc.c
 1.66 04-Nov-2009  pooka Use std. uiomove() & friends.
 1.65 21-Oct-2009  rmind Sync rump with kernel changes.
 1.64 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.63 19-Oct-2009  pooka remove stale uvm_readahead() stub
 1.62 16-Oct-2009  pooka Include sys_select.c for proper select()/poll() support.
 1.61 04-Aug-2009  pooka * support uvm_pagermapin/out(), adapt uvm_pageratop()

Instead of doing actual page remapping, which we can't portably
do in userspace without extensive trickery (read: signals), simply
allocate the kva window with new physical backing, copy page
contents, return, and copy contents back in mapout. Since the
pages are locked during the mapping cycle, we can do this without
hazard.

* add lots of stubbies necessary for new stuff coming soon
 1.60 03-Aug-2009  pooka g/c cachepgmtx, i have no idea what it was supposed to be useful for.
 1.59 03-Aug-2009  pooka track number of pages associated with vm object
 1.58 10-Jun-2009  he Add a dummy uvm_readahead() function, to fix build issues after it
recently got added to the kernel.
OK'ed by pooka@
 1.57 03-Jun-2009  pooka Add user vmspace locking and remapping routines. Obviously, these
currently work only if the vmspace is local to the rump kernel.
 1.56 03-May-2009  pooka define DEBUGPRINT
 1.55 28-Apr-2009  pooka Free uao lock when destroying object. Fixes tmpfs rename leak
reported by njoly.
 1.54 24-Apr-2009  pooka * init pool linksets, makes proplib work. reported by Arnaud Ysmal.
(linksets, sigh)
* reduce #ifdef for RUMP_USE_REAL_ALLOCATORS
 1.53 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.52 06-Feb-2009  pooka branches: 1.52.2;
Call uvm_page_unbusy() instead of manually yanking PG_BUSY out.
 1.51 23-Jan-2009  pooka last-minute pasto in previous
 1.50 23-Jan-2009  pooka Add a compile-time option to use kmem/vmem/pools from the kernel
sources instead of homegrown allocators. Default to "on", even
though they appear to be a few percent slower at least on short
jobs (e.g. untar to tmpfs).
 1.49 04-Jan-2009  pooka Include libkern contents in librump.
 1.48 18-Dec-2008  pooka __KERNEL_RCSID
 1.47 16-Dec-2008  pooka Mark pages busy during VOP_PUTPAGES(). Deals with KASSERT in nfs write.
 1.46 16-Dec-2008  pooka Make rumpflushva flush only the atop info for a certain uvm object.
Better, but still not completely race-free (if two threads call
RUMP_VOP_PUTPAGES() directly for the same vm object).
 1.45 27-Nov-2008  pooka Move more vfs-related vm routines from rumpkern to rumpvfs.
 1.44 27-Nov-2008  pooka Remove the whole magic ubc window thingie. All file systems use
ubc_uiomove() now, so we can hook ourselves there.
 1.43 26-Nov-2008  pooka Add a few symbols required by nfsd
 1.42 19-Nov-2008  pooka Split vfs out of rumpkern into rumpvfs. Non-fs rumps no longer
include the file system code. File system rumps explicitly need
to include rumpvfs from now on.
 1.41 15-Oct-2008  pooka branches: 1.41.2; 1.41.8;
Add support bits necessary for rumpnet functionality.
 1.40 10-Oct-2008  pooka * implement uvm_km_alloc/free_poolpage()
* add silly stubs for uvm_lwp_hold/rele()
 1.39 10-Oct-2008  pooka reorganize routines a bit better. no functional change
 1.38 30-Sep-2008  pooka Make sure proc0.p_vmspace qualifies as VMSPACE_IS_KERNEL_P().
 1.37 07-Aug-2008  pooka pg->flags &= PG_CLEAN --> &= ~PG_CLEAN;

Fixes at least writing to the fs for msdosfs.
 1.36 05-Aug-2008  pooka Honor PG_RELEASED when unbusying a page.

Fixes ufs file system full problem discovered by Simon Burge.
 1.35 04-Aug-2008  pooka Add support for using real kmem/vmem. Don't enable it by default,
though, since it a) is a lot of unnecessary indirection in rump
b) requires callouts which are so far unimplemented.
 1.34 29-Jul-2008  pooka Install rump libraries and utilities to the base system and remove the
private non-installed build infrastructure from sys/rump.

breakdown of commit:
* install relevant headers into /usr/include/rump
* build sys/rump/librump/rumpuser and sys/rump/librump/rumpkern
from src/lib and install as librumpuser and librump, respectively
+ this retains the ability to test a librump build with just the
kernel sources at hand
* move sys/rump/fs/lib/libukfs and sys/rump/fs/lib/libp2k to src/lib
for general consumption, they are not kernel-space dwellers anyway
* build and install sys/rump/fs/lib/lib$fs as librumpfs_$fs
* add chapter 3 manual pages for rump, rumpuser, ukfs and p2k
* build and install userspace kernel file system daemons if MKPUFFS=yes
is spexified
* retire fsconsole for now, it will make a comeback with an actually
implemented version shortly
 1.33 20-Jul-2008  pooka assert -> KASSERT
 1.32 05-Jun-2008  ad branches: 1.32.2; 1.32.4;
Make it build again.
 1.31 04-Jun-2008  ad Make it build.
 1.30 11-Mar-2008  pooka branches: 1.30.2; 1.30.4; 1.30.6;
Backup some fixes for recent breakage from local tree. Also some
other improvements such as exporting the real kernel namei and
using that in ukfs instead of the homegrown heap'o hacks namei.
"etcetc".
 1.29 27-Jan-2008  pooka branches: 1.29.2; 1.29.6;
honor pager locking protocol in uao_detach()
 1.28 27-Jan-2008  pooka Fix locking botches: take vm object lock before calling pager,
not inside the pager.
 1.27 03-Jan-2008  pooka Theoretically this is supposed to be interchangeable with real
kernel code. Use kmem_alloc/free instead of some wily homerolled
rump interfaces for memory allocation.
 1.26 02-Jan-2008  pooka fix vmlocking2 fallout:

* I heard a wild rumor that vp_interlock is a mutex these days (hi ad!)
* init new locks (hi ad)
* observe that with simple_locks only deadlocks would be caught while
releasing unlocked locks would go unnoticed. make locking work (hi pooka)
 1.25 02-Jan-2008  ad Merge vmlocking2 to head.
 1.24 01-Dec-2007  yamt branches: 1.24.2; 1.24.6;
constify pagerops.
 1.23 06-Nov-2007  pooka Fix locking issues with the anonymous pager too so that tmpfs can work.
 1.22 06-Nov-2007  pooka Sprinkle some more locking, especially to the vm. Due to some
additional fixes, it's now possible to run file systems with
spinlocks actually enabled. The genfs_putpages() locking is still
working only due to greater powers, but I'll eventually get around to
fixing it.
 1.21 04-Nov-2007  pooka branches: 1.21.2;
* sprinkle some locking into the vm code
* avoid extra insert+search+remove step in file systems using
ubc_uiomove() instead of standard uiomove()
 1.20 31-Oct-2007  pooka branches: 1.20.2;
Make it possible to run rumps multithreaded. This brings real
locking and makes it possible to run file systems which create
threads. It also makes rump file system behaviour better match
file system behaviour in the kernel.
 1.19 28-Oct-2007  pooka In uvm_estimatepageable() "estimate" pageable.
 1.18 10-Oct-2007  ad branches: 1.18.2;
Merge from vmlocking:

- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
 1.17 12-Sep-2007  pooka branches: 1.17.2;
don't allocate variable-sized arrays from the stack
 1.16 01-Sep-2007  pooka branches: 1.16.2;
Make bioops a pointer and point it to the softdeps struct in softdep
init. Decouples "options SOFTDEP" from the main kernel and ffs code.
 1.15 01-Sep-2007  pooka * add a very crude version of uvm_pageatop()
* add biodone/aiodone
 1.14 26-Aug-2007  pooka branches: 1.14.2;
few panicky functions
 1.13 20-Aug-2007  pooka branches: 1.13.2;
Hide NetBSD kernel headers completely from ukfs. This includes creating
accessors for:
* struct mount & VFS ops
* struct uio
* struct vnode
* struct vattr

and some namespace games for:
* namei flags
* VOPs
* enum vtype

Also, split rump services into two categories: library private and public
(rump_private.h and rump.h, respectively).

As a result, it is now possible to compile and use the NetBSD kernel
file systems on Linux (and probably other systems too with very
little work), although the makefiles need a bit of work to make it
a pleasureable experience.
 1.12 14-Aug-2007  pooka branches: 1.12.2;
Kill handrolled buffercache and use vfs_bio from the kernel. This is
mostly to get the flag jungle in sync with the kernel.
 1.11 13-Aug-2007  pooka Use supermarket variety vfs_vnops.c instead of homecooked routines
(that's actually a good thing here).
 1.10 11-Aug-2007  pooka * move rump_vopwrite_fault() into history - we now support the file
system faulting in pages if it does e.g. fragment reallocation
* get rid of rumpvm_findpage() and always use uvm_pagelookup()
* determine a vnode's cleanness by flagging it as being on the work
list if we "take" a write fault and removing it from the worklist
once pages are flushed. There is no work list here, but at least
there is symmetry with the kernel.
 1.9 09-Aug-2007  pooka Play catchup with ufs/ffs changes: compile subr_specificdata.c
and emulate kmem_foo() to support the prior.
 1.8 09-Aug-2007  pooka Fix it a bit & wait for the dust to settle. Also, enable UBC by default.

ffs in userspace on top of puffs/p2k/rump is now stable enough to
host a make -j4 kernel build (well, at least my kernel build ...
but, yes, I am currently running that kernel on my desktop)
 1.7 09-Aug-2007  pooka Add some stubs for lfs.
 1.6 07-Aug-2007  pooka remove the allocstorage param from makepage - not needed
 1.5 07-Aug-2007  pooka track dirty vm objects
 1.4 07-Aug-2007  pooka When doing "ubc faults", truncate offsets to page boundary to get
the last page also if it's accessed from the middle of the page.
 1.3 06-Aug-2007  pooka branches: 1.3.2;
Instead of going for a PAGE_SIZE nuke, do getpages() in a more
sniper style. Makes efs (& other file systems with bsize < PAGE_SIZE)
work better.
 1.2 06-Aug-2007  pooka implement uvm_vnp_zerorange()
 1.1 05-Aug-2007  pooka Introduce RUMPs - Runnable Userspace Meta-Programs

/sys/rump contains programs which run unmodified kernel code in an
emulated userspace environment. The kernel environment is provided
by librump. Currently supported are a number of file systems,
which by using puffs integrate seamlessly into the system and
provide a similar user experience to if the code was running as
part of the kernel. Potential future rumpification targets include
for example parts of the networking stack and some device drivers.

This work was supported by Google Summer of Code 2007.
 1.3.2.2 06-Aug-2007  pooka Instead of going for a PAGE_SIZE nuke, do getpages() in a more
sniper style. Makes efs (& other file systems with bsize < PAGE_SIZE)
work better.
 1.3.2.1 06-Aug-2007  pooka file vm.c was added on branch matt-mips64 on 2007-08-06 20:46:29 +0000
 1.12.2.3 03-Sep-2007  skrll Sync with HEAD.
 1.12.2.2 15-Aug-2007  skrll Sync with HEAD.
 1.12.2.1 14-Aug-2007  skrll file vm.c was added on branch nick-csl-alignment on 2007-08-15 13:50:43 +0000
 1.13.2.3 09-Oct-2007  ad Sync with head.
 1.13.2.2 20-Aug-2007  ad Sync with HEAD.
 1.13.2.1 20-Aug-2007  ad file vm.c was added on branch vmlocking on 2007-08-20 22:07:31 +0000
 1.14.2.4 23-Mar-2008  matt sync with HEAD
 1.14.2.3 09-Jan-2008  matt sync with HEAD
 1.14.2.2 08-Nov-2007  matt sync with -HEAD
 1.14.2.1 06-Nov-2007  matt sync with HEAD
 1.16.2.8 17-Mar-2008  yamt sync with head.
 1.16.2.7 04-Feb-2008  yamt sync with head.
 1.16.2.6 21-Jan-2008  yamt sync with head
 1.16.2.5 07-Dec-2007  yamt sync with head
 1.16.2.4 15-Nov-2007  yamt sync with head.
 1.16.2.3 27-Oct-2007  yamt sync with head.
 1.16.2.2 03-Sep-2007  yamt sync with head.
 1.16.2.1 01-Sep-2007  yamt file vm.c was added on branch yamt-lazymbuf on 2007-09-03 14:45:38 +0000
 1.17.2.1 14-Oct-2007  yamt sync with head.
 1.18.2.1 13-Nov-2007  bouyer Sync with HEAD
 1.20.2.6 03-Dec-2007  joerg Sync with HEAD.
 1.20.2.5 06-Nov-2007  joerg Sync with HEAD.
 1.20.2.4 04-Nov-2007  jmcneill Sync with HEAD.
 1.20.2.3 02-Nov-2007  joerg Remove the rest of the unintentional diff in sys/rump.
 1.20.2.2 31-Oct-2007  joerg Sync with HEAD.
 1.20.2.1 31-Oct-2007  joerg file vm.c was added on branch jmcneill-pm on 2007-10-31 23:14:18 +0000
 1.21.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.21.2.2 08-Dec-2007  mjf Sync with HEAD.
 1.21.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.24.6.2 08-Jan-2008  bouyer Sync with HEAD
 1.24.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.24.2.1 28-Dec-2007  ad Make rump build.
 1.29.6.5 17-Jan-2009  mjf Sync with HEAD.
 1.29.6.4 05-Oct-2008  mjf Sync with HEAD.
 1.29.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.29.6.2 05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.29.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.29.2.1 24-Mar-2008  keiichi sync with head.
 1.30.6.3 10-Oct-2008  skrll Sync with HEAD.
 1.30.6.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.30.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.30.4.6 09-Oct-2010  yamt sync with head
 1.30.4.5 11-Aug-2010  yamt sync with head.
 1.30.4.4 11-Mar-2010  yamt sync with head
 1.30.4.3 19-Aug-2009  yamt sync with head.
 1.30.4.2 20-Jun-2009  yamt sync with head
 1.30.4.1 04-May-2009  yamt sync with head.
 1.30.2.1 17-Jun-2008  yamt sync with head.
 1.32.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.32.4.1 19-Oct-2008  haad Sync with HEAD.
 1.32.2.2 31-Jul-2008  simonb Sync with head.
 1.32.2.1 21-Jul-2008  simonb Sync with head.
 1.41.8.3 19-Dec-2013  matt Adapt to new uvm_estimatepageable arguments
 1.41.8.2 10-Feb-2012  matt uvm_pageout_done doesn't return anything more (it's void).
 1.41.8.1 09-Feb-2012  matt Update uvm_pageout_done defintion.
 1.41.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.41.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.41.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.52.2.2 23-Jul-2009  jym Sync with HEAD.
 1.52.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.70.4.6 12-Jun-2011  rmind Sync RUMP's uvm_pagealloc_strat() and processpage() with branch changes.
 1.70.4.5 21-Apr-2011  rmind sync with head
 1.70.4.4 05-Mar-2011  rmind sync with head
 1.70.4.3 03-Jul-2010  rmind sync with head
 1.70.4.2 30-May-2010  rmind sync with head
 1.70.4.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.70.2.5 06-Nov-2010  uebayasi Sync with HEAD.
 1.70.2.4 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.70.2.3 17-Aug-2010  uebayasi Sync with HEAD.
 1.70.2.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.70.2.1 29-Apr-2010  uebayasi Fix build of rump.
 1.106.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.107.2.3 05-Mar-2011  bouyer Sync with HEAD
 1.107.2.2 17-Feb-2011  bouyer Sync with HEAD
 1.107.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.114.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.120.6.5 02-Jun-2012  mrg sync to latest -current.
 1.120.6.4 05-Apr-2012  mrg sync to latest -current.
 1.120.6.3 06-Mar-2012  mrg sync to -current
 1.120.6.2 24-Feb-2012  mrg sync to -current.
 1.120.6.1 18-Feb-2012  mrg merge to -current.
 1.120.2.10 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.120.2.9 23-Jan-2013  yamt sync with head
 1.120.2.8 16-Jan-2013  yamt sync with (a bit old) head
 1.120.2.7 02-Nov-2012  yamt fix a merge botch
 1.120.2.6 30-Oct-2012  yamt sync with head
 1.120.2.5 17-Apr-2012  yamt sync with head
 1.120.2.4 25-Jan-2012  yamt uvm_loanabj: take an access pattern hint.
 1.120.2.3 14-Jan-2012  yamt implement a rump stub of uvm_loanobj
 1.120.2.2 10-Nov-2011  yamt remove uobj->memq
 1.120.2.1 02-Nov-2011  yamt page cache related changes

- maintain object pages in radix tree rather than rb tree.
- reduce unnecessary page scan in putpages. esp. when an object has a ton of
pages cached but only a few of them are dirty.
- reduce the number of pmap operations by tracking page dirtiness more
precisely in uvm layer.
- fix nfs commit range tracking.
- fix nfs write clustering. XXX hack
 1.122.2.2 03-Apr-2012  riz Pull up following revision(s) (requested by para in ticket #155):
sys/kern/subr_vmem.c: revision 1.73
sys/kern/subr_kmem.c: revision 1.43
sys/rump/librump/rumpkern/vm.c: revision 1.124
make accounting for vm_inuse sane
while here don't statically allocated for more caches then required
adjust rump for static pool_cache count
should have went in with subr_vmem 1.73
don't overallocated once we leave the caches
 1.122.2.1 25-Mar-2012  bouyer Pull up following revision(s) (requested by hannken in ticket #141):
tests/rump/rumpkern/t_vm.c: revision 1.3
sys/rump/librump/rumpkern/vm.c: revision 1.125
Don't take a mutex we already took 6 lines above.
Starting with Rev. 1.191 of kern/subr_pool.c a pool has to be inactive
for at least 10 seconds before it can be reclaimed.
Change the uvmwait test timeout from 10 to 30 seconds so it has a chance
to reclaim memory and succeed.
 1.130.2.5 03-Dec-2017  jdolecek update from HEAD
 1.130.2.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.130.2.3 23-Jun-2013  tls resync from head
 1.130.2.2 25-Feb-2013  tls resync with head
 1.130.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.144.4.1 18-May-2014  rmind sync with head
 1.152.2.1 10-Aug-2014  tls Rebase.
 1.159.4.6 28-Aug-2017  skrll Sync with HEAD
 1.159.4.5 05-Oct-2016  skrll Sync with HEAD
 1.159.4.4 19-Mar-2016  skrll Sync with HEAD
 1.159.4.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.159.4.2 06-Jun-2015  skrll Sync with HEAD
 1.159.4.1 06-Apr-2015  skrll Sync with HEAD
 1.159.2.1 31-Dec-2014  snj Pull up following revision(s) (requested by chs in ticket #363):
common/lib/libprop/prop_kern.c: revision 1.18
sys/arch/mac68k/dev/grf_compat.c: revision 1.27
sys/arch/x68k/dev/grf.c: revision 1.45
sys/external/bsd/drm/dist/bsd-core/drm_bufs.c: revision 1.12
sys/external/bsd/drm2/drm/drm_drv.c: revision 1.12
sys/external/bsd/drm2/drm/drm_vm.c: revision 1.6
sys/external/bsd/drm2/include/linux/mm.h: revision 1.4
sys/kern/vfs_vnops.c: revision 1.192 via patch
sys/rump/librump/rumpkern/vm.c: revision 1.160
sys/sys/file.h: revision 1.78 via patch
sys/uvm/uvm_device.c: revision 1.64
sys/uvm/uvm_device.h: revision 1.13
sys/uvm/uvm_extern.h: revision 1.192
sys/uvm/uvm_mmap.c: revision 1.150 via patch
add a new "fo_mmap" fileops method to allow use of arbitrary uvm_objects for
mappings of file objects. move vnode-specific details of mmap()ing a vnode
from uvm_mmap() to the new vnode-specific vn_mmap(). add new uvm_mmap_dev()
and uvm_mmap_anon() convenience functions for mapping character devices
and anonymous memory, and replace all other calls to uvm_mmap() with those.
use the new fileop in drm2 so that libdrm can use mmap() to map things
like on other platforms (instead of the ioctl that we have used so far).
 1.169.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.170.6.2 19-May-2017  pgoyette Resolve conflicts from previous merge (all resulting from $NetBSD
keywork expansion)
 1.170.6.1 11-May-2017  pgoyette Sync with HEAD
 1.173.14.1 06-Jul-2021  martin Pull up following revision(s) - all via patch -
(requested by riastradh in ticket #1317):

sys/uvm/uvm_page.c: revision 1.248
sys/uvm/uvm_anon.c: revision 1.80
sys/rump/librump/rumpvfs/vm_vfs.c: revision 1.40
sys/rump/librump/rumpvfs/vm_vfs.c: revision 1.41
sys/rump/librump/rumpkern/vm.c: revision 1.191
sys/uvm/uvm_pager.c: revision 1.130
external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c: revision 1.71
tests/rump/rumpkern/t_vm.c: revision 1.5
tests/rump/rumpkern/t_vm.c: revision 1.6
sys/rump/librump/rumpvfs/vm_vfs.c: revision 1.39

Move the handling of PG_PAGEOUT from uvm_aio_aiodone_pages() to
uvm_page_unbusy() so that all callers of uvm_page_unbusy() don't need to
handle this flag separately. Split out the pages part of uvm_aio_aiodone()
into uvm_aio_aiodone_pages() in rump just like in the real kernel.

In ZFS functions that can fail to copy data between the ARC and VM pages,
use uvm_aio_aiodone_pages() rather than uvm_page_unbusy() so that we can
handle these "I/O" errors. Fixes PR 55702.

fix an incorrect assertion in the previous commit.

Handle PG_PAGEOUT in uvm_anon_release() too.

Commit the ZFS file that I forgot in this previous commit:

Move the handling of PG_PAGEOUT from uvm_aio_aiodone_pages() to
uvm_page_unbusy() so that all callers of uvm_page_unbusy() don't need to
handle this flag separately. Split out the pages part of uvm_aio_aiodone()
into uvm_aio_aiodone_pages() in rump just like in the real kernel.

In ZFS functions that can fail to copy data between the ARC and VM pages,
use uvm_aio_aiodone_pages() rather than uvm_page_unbusy() so that we can
handle these "I/O" errors. Fixes PR 55702.
update the rump copy of uvm_page_unbusy() to match the real version,
in particular handle PG_PAGEOUT. fixes a few atf tests.
the busypage test is buggy, expect it to fail.

make rump's uvm_aio_aiodone_pages() look more like the kernel version.
fixes some more rumpy assertions.

for the busypage test, replace atf_tc_expect_fail() with atf_tc_skip()
because atf apparently has no way to expect a test program to crash.
fixes PR 55945.
 1.173.10.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.182.2.2 29-Feb-2020  ad Sync with head.
 1.182.2.1 17-Jan-2020  ad Sync with head.
 1.190.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.4 22-Apr-2015  pooka Apparently new source files need to be added to each Makefile.inc
individually. Who comes up with this kind of crappy build infra?
 1.3 12-Feb-2014  pooka branches: 1.3.6;
Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.2 15-Oct-2009  pooka branches: 1.2.12; 1.2.22; 1.2.26;
include rumpcpu_generic
 1.1 06-Jan-2009  pooka branches: 1.1.2; 1.1.4; 1.1.8;
Add md crud to allow libkern softfloat code to build.
And while here, make alpha use the real elf relocation code.
 1.1.8.3 11-Mar-2010  yamt sync with head
 1.1.8.2 04-May-2009  yamt sync with head.
 1.1.8.1 06-Jan-2009  yamt file Makefile.inc was added on branch yamt-nfs-mp on 2009-05-04 08:14:30 +0000
 1.1.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.4.1 06-Jan-2009  skrll file Makefile.inc was added on branch nick-hppapmap on 2009-01-19 13:20:26 +0000
 1.1.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.2.1 06-Jan-2009  mjf file Makefile.inc was added on branch mjf-devfs2 on 2009-01-17 13:29:36 +0000
 1.2.26.1 18-May-2014  rmind sync with head
 1.2.22.2 03-Dec-2017  jdolecek update from HEAD
 1.2.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.12.1 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.3.6.1 06-Jun-2015  skrll Sync with HEAD
 1.2 18-Mar-2009  cegger branches: 1.2.2;
Ansify function definitions w/o arguments. Generated with sed.
 1.1 06-Jan-2009  pooka branches: 1.1.2; 1.1.4; 1.1.6;
Add md crud to allow libkern softfloat code to build.
And while here, make alpha use the real elf relocation code.
 1.1.6.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.1.4.3 28-Apr-2009  skrll Sync with HEAD.
 1.1.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.4.1 06-Jan-2009  skrll file rumpcrud.c was added on branch nick-hppapmap on 2009-01-19 13:20:26 +0000
 1.1.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.2.1 06-Jan-2009  mjf file rumpcrud.c was added on branch mjf-devfs2 on 2009-01-17 13:29:36 +0000
 1.2.2.2 04-May-2009  yamt sync with head.
 1.2.2.1 18-Mar-2009  yamt file rumpcrud.c was added on branch yamt-nfs-mp on 2009-05-04 08:14:30 +0000
 1.5 22-Apr-2015  pooka Apparently new source files need to be added to each Makefile.inc
individually. Who comes up with this kind of crappy build infra?
 1.4 17-Jun-2014  alnsn branches: 1.4.4; 1.4.6;
Antti objected to including rumpuser_sync_icache. Exclude it from the build.
 1.3 17-Jun-2014  alnsn Implement rumpuser_sync_icache hypercall.
 1.2 12-Feb-2014  pooka branches: 1.2.2; 1.2.4;
Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.1 08-Aug-2013  matt branches: 1.1.2;
Build kobj_machdep.c
 1.1.2.3 18-May-2014  rmind sync with head
 1.1.2.2 28-Aug-2013  rmind sync with head
 1.1.2.1 08-Aug-2013  rmind file Makefile.inc was added on branch rmind-smpnet on 2013-08-28 23:59:37 +0000
 1.2.4.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.2.4.1 12-Feb-2014  yamt file Makefile.inc was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.2.2.1 10-Aug-2014  tls Rebase.
 1.4.6.1 06-Jun-2015  skrll Sync with HEAD
 1.4.4.3 03-Dec-2017  jdolecek update from HEAD
 1.4.4.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.4.1 17-Jun-2014  tls file Makefile.inc was added on branch tls-maxphys on 2014-08-20 00:04:41 +0000
 1.1 17-Jun-2014  alnsn branches: 1.1.2; 1.1.6;
Implement rumpuser_sync_icache hypercall.
 1.1.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.1 17-Jun-2014  tls file cpufunc.c was added on branch tls-maxphys on 2014-08-20 00:04:41 +0000
 1.1.2.2 10-Aug-2014  tls Rebase.
 1.1.2.1 17-Jun-2014  tls file cpufunc.c was added on branch tls-earlyentropy on 2014-08-10 06:56:51 +0000
 1.3 15-Nov-2018  riastradh Make the direct-map API always available, but fail if KASAN or rump.

(Only for architectures that support it at all; on others,
__HAVE_MM_MD_DIRECT_MAPPED_PHYS/IO are still undefined and the
functions unimplemented.)

This gives modules like zfs an opportunity to use it.

While here, fix the one caller of mm_md_direct_mapped_phys that
ignored the return value (and make sure to call pmap_kremove/update
before uvm_km_free).
 1.2 22-Apr-2015  pooka branches: 1.2.16; 1.2.18;
Define rump_nativeabi_p() under arch, where one would logically expect
it to be defined.
 1.1 12-Feb-2014  pooka branches: 1.1.4; 1.1.6; 1.1.10; 1.1.12;
Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.1.12.1 06-Jun-2015  skrll Sync with HEAD
 1.1.10.3 03-Dec-2017  jdolecek update from HEAD
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 12-Feb-2014  tls file Makefile.inc was added on branch tls-maxphys on 2014-08-20 00:04:41 +0000
 1.1.6.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.1.6.1 12-Feb-2014  yamt file Makefile.inc was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 12-Feb-2014  rmind file Makefile.inc was added on branch rmind-smpnet on 2014-05-18 17:46:18 +0000
 1.2.18.1 10-Jun-2019  christos Sync with HEAD
 1.2.16.1 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.2 26-Jan-2016  pooka branches: 1.2.16;
Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.1 22-Apr-2015  pooka branches: 1.1.2;
Define rump_nativeabi_p() under arch, where one would logically expect
it to be defined.
 1.1.2.3 19-Mar-2016  skrll Sync with HEAD
 1.1.2.2 06-Jun-2015  skrll Sync with HEAD
 1.1.2.1 22-Apr-2015  skrll file rump_generic_abi.c was added on branch nick-nhusb on 2015-06-06 14:40:29 +0000
 1.2.16.2 03-Dec-2017  jdolecek update from HEAD
 1.2.16.1 26-Jan-2016  jdolecek file rump_generic_abi.c was added on branch tls-maxphys on 2017-12-03 11:39:16 +0000
 1.3 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.2 22-Apr-2015  pooka Apparently not all ports define struct clockframe in cpu.h, so we cannot
provide our definition that way. Instead, generate the struct clockframe
passed to hardclock() in MD code.
 1.1 12-Feb-2014  pooka branches: 1.1.4; 1.1.6; 1.1.10; 1.1.12;
Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.1.12.2 19-Mar-2016  skrll Sync with HEAD
 1.1.12.1 06-Jun-2015  skrll Sync with HEAD
 1.1.10.3 03-Dec-2017  jdolecek update from HEAD
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 12-Feb-2014  tls file rump_generic_cpu.c was added on branch tls-maxphys on 2014-08-20 00:04:41 +0000
 1.1.6.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.1.6.1 12-Feb-2014  yamt file rump_generic_cpu.c was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 12-Feb-2014  rmind file rump_generic_cpu.c was added on branch rmind-smpnet on 2014-05-18 17:46:18 +0000
 1.3 27-Jan-2019  pgoyette branches: 1.3.4;
Merge the [pgoyette-compat] branch
 1.2 12-Dec-2018  alnsn Add missing RCSIDs.
 1.1 15-Nov-2018  riastradh branches: 1.1.2;
Make the direct-map API always available, but fail if KASAN or rump.

(Only for architectures that support it at all; on others,
__HAVE_MM_MD_DIRECT_MAPPED_PHYS/IO are still undefined and the
functions unimplemented.)

This gives modules like zfs an opportunity to use it.

While here, fix the one caller of mm_md_direct_mapped_phys that
ignored the return value (and make sure to call pmap_kremove/update
before uvm_km_free).
 1.1.2.3 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.1.2.2 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.1.2.1 15-Nov-2018  pgoyette file rump_generic_directmap.c was added on branch pgoyette-compat on 2018-11-26 01:52:51 +0000
 1.3.4.2 10-Jun-2019  christos Sync with HEAD
 1.3.4.1 27-Jan-2019  christos file rump_generic_directmap.c was added on branch phil-wifi on 2019-06-10 22:09:54 +0000
 1.1 12-Feb-2014  pooka branches: 1.1.4; 1.1.6; 1.1.10;
Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 12-Feb-2014  tls file rump_generic_kobj.c was added on branch tls-maxphys on 2014-08-20 00:04:41 +0000
 1.1.6.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.1.6.1 12-Feb-2014  yamt file rump_generic_kobj.c was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 12-Feb-2014  rmind file rump_generic_kobj.c was added on branch rmind-smpnet on 2014-05-18 17:46:18 +0000
 1.7 21-Aug-2022  riastradh rump: Define pmap_resident_count, pmap_wired_count conditionally.

These definitions will not be used by anything yet because on every
architecture except x86 as of yeterday, pmap_resident_count and
pmap_wired_count are defined as macros anyway. But if more struct
pmaps are made private these definitions will get used.
 1.6 21-Aug-2022  mlelstv Add stubs for pmap_resident_count, pmap_wired_count.
 1.5 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.4 17-Apr-2015  pooka Give the kernel/local pmaps actual storage.

That way friendly neighborhood macros won't go scribbling
in the wrong places.
 1.3 03-Apr-2015  pooka Use RUMP_PMAP_KERNEL and RUMP_PMAP_LOCAL to denote
kernel and local client pmaps, respectively.
 1.2 12-Feb-2014  pooka branches: 1.2.4; 1.2.6; 1.2.10; 1.2.12;
Minor comment massage, zero functionality massage.
 1.1 12-Feb-2014  pooka Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.2.12.3 19-Mar-2016  skrll Sync with HEAD
 1.2.12.2 06-Jun-2015  skrll Sync with HEAD
 1.2.12.1 06-Apr-2015  skrll Sync with HEAD
 1.2.10.3 03-Dec-2017  jdolecek update from HEAD
 1.2.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.10.1 12-Feb-2014  tls file rump_generic_pmap.c was added on branch tls-maxphys on 2014-08-20 00:04:41 +0000
 1.2.6.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.2.6.1 12-Feb-2014  yamt file rump_generic_pmap.c was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.2.4.2 18-May-2014  rmind sync with head
 1.2.4.1 12-Feb-2014  rmind file rump_generic_pmap.c was added on branch rmind-smpnet on 2014-05-18 17:46:18 +0000
 1.7 12-Feb-2014  pooka Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.6 16-Jun-2010  pooka branches: 1.6.8; 1.6.18; 1.6.22;
Reinstate the blanket pmap.h for archs which do not conform to the
kernel ABI (i.e. not i386 or amd64). Due to the "half function,
half macro, all noodles" nature of pmap.h, it's too entangling and
too brittle to keep up with an ifdeffy MI implementation.
 1.5 31-May-2010  pooka The x86 kernel ABI depends on __cpu_simple_lock stuff being present.
Since they are practically never used (only when prehistoric code
uses simple_lock()), their efficiency doesn't matter that much and
we can simply adapt the versions from x86 lock.h.
 1.4 11-May-2010  pooka add __HAVE_CPU_COUNTER stubs where possible (i.e. where the arch
doesn't think inlines are the second compiling)
 1.3 01-Jan-2009  pooka branches: 1.3.2; 1.3.4; 1.3.8; 1.3.10; 1.3.12;
Define MODULAR for rump core components. This enables module
loading via the kernel module framework (instead of dlopen()).
For now it only works on amd64 and i386, but for the rest it should
just be a matter of including the relevant kobj_machdep.c modules
from the kernel sources.
 1.2 01-Jan-2009  pooka Rename i386 and amd64 {cpu,spl}.c to rump{cpu,spl}.c to avoid
name collisions with other source files in the kernel tree.
 1.1 29-Dec-2008  pooka Switch i386 away from rump/include/machine. This means that rump
on i386 now uses the native kernel ABI. This in turn means that
rump modules and kernel modules are binary equivalent and can be
used interchangeably.
 1.3.12.2 03-Jul-2010  rmind sync with head
 1.3.12.1 30-May-2010  rmind sync with head
 1.3.10.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.3.8.3 11-Aug-2010  yamt sync with head.
 1.3.8.2 04-May-2009  yamt sync with head.
 1.3.8.1 01-Jan-2009  yamt file Makefile.inc was added on branch yamt-nfs-mp on 2009-05-04 08:14:30 +0000
 1.3.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.3.4.1 01-Jan-2009  skrll file Makefile.inc was added on branch nick-hppapmap on 2009-01-19 13:20:26 +0000
 1.3.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.3.2.1 01-Jan-2009  mjf file Makefile.inc was added on branch mjf-devfs2 on 2009-01-17 13:29:36 +0000
 1.6.22.1 18-May-2014  rmind sync with head
 1.6.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.8.1 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.2 01-Jan-2009  pooka Rename i386 and amd64 {cpu,spl}.c to rump{cpu,spl}.c to avoid
name collisions with other source files in the kernel tree.
 1.1 29-Dec-2008  pooka Switch i386 away from rump/include/machine. This means that rump
on i386 now uses the native kernel ABI. This in turn means that
rump modules and kernel modules are binary equivalent and can be
used interchangeably.
 1.2 12-Feb-2014  pooka Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.1 11-May-2010  pooka branches: 1.1.2; 1.1.4; 1.1.6; 1.1.14; 1.1.24; 1.1.28;
add __HAVE_CPU_COUNTER stubs where possible (i.e. where the arch
doesn't think inlines are the second compiling)
 1.1.28.1 18-May-2014  rmind sync with head
 1.1.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.14.1 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.1.6.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.1.6.1 11-May-2010  uebayasi file cpu_counter.c was added on branch uebayasi-xip on 2010-08-17 06:48:02 +0000
 1.1.4.2 11-Aug-2010  yamt sync with head.
 1.1.4.1 11-May-2010  yamt file cpu_counter.c was added on branch yamt-nfs-mp on 2010-08-11 22:55:07 +0000
 1.1.2.2 30-May-2010  rmind sync with head
 1.1.2.1 11-May-2010  rmind file cpu_counter.c was added on branch rmind-uvmplock on 2010-05-30 05:18:06 +0000
 1.4 12-Feb-2014  pooka Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.3 22-Jul-2012  joerg branches: 1.3.2; 1.3.4;
Needs pmap_write_protect to finish DBG=-g build with clang.
 1.2 17-Jun-2010  pooka branches: 1.2.2; 1.2.4; 1.2.6; 1.2.14;
Give the kernel pmap a container in case some tries to access it
via some pmap.h macro.
 1.1 16-Jun-2010  pooka Reinstate the blanket pmap.h for archs which do not conform to the
kernel ABI (i.e. not i386 or amd64). Due to the "half function,
half macro, all noodles" nature of pmap.h, it's too entangling and
too brittle to keep up with an ifdeffy MI implementation.
 1.2.14.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.2.14.1 30-Oct-2012  yamt sync with head
 1.2.6.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.2.6.1 17-Jun-2010  uebayasi file pmap_x86.c was added on branch uebayasi-xip on 2010-08-17 06:48:02 +0000
 1.2.4.2 11-Aug-2010  yamt sync with head.
 1.2.4.1 17-Jun-2010  yamt file pmap_x86.c was added on branch yamt-nfs-mp on 2010-08-11 22:55:07 +0000
 1.2.2.2 03-Jul-2010  rmind sync with head
 1.2.2.1 17-Jun-2010  rmind file pmap_x86.c was added on branch rmind-uvmplock on 2010-07-03 01:20:03 +0000
 1.3.4.1 18-May-2014  rmind sync with head
 1.3.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.12 12-Feb-2014  pooka Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.11 02-May-2013  pooka branches: 1.11.4;
Inform the rump kernel hypervisor of valid thread contexts so
that the implementation can allocate and release storage for them
in an optimal fashion, if necessary.
 1.10 19-Feb-2013  martin Stopgap fix to make rump cooperate with pserialize, may be revisited later.
Patch from pooka, ok: rmind. No related regressions in a complete atf test
run (which works again with this, even on non x86 SMP machines).
 1.9 28-Apr-2010  pooka branches: 1.9.8; 1.9.18;
set first attached cpu as primary
 1.8 27-Apr-2010  pooka Fix multiple virtual cpu support.

... or at least on x86. CPU_INFO_FOREACH() still isn't MI, and I
don't want to support 2^n different versions.
 1.7 15-Oct-2009  pooka branches: 1.7.2; 1.7.4;
Give lwp usage some much-needed love: stop treating lwp0 as the
all-sink and make sure each separate thread in rump has its own
lwp. Happy-go-lucky callers will get scheduled a temporary lwp
on entry, while true lwp connoisseurs may request a stable lwp
for their purposes. Some more love may be required later down the
road, but for now different threads will stepping on each others
toes.
 1.6 15-Oct-2009  pooka Add initial work on a rump virtual cpu scheduler. This is necessary
for kernel code which has been written to avoid MP contention by
using cpu-local storage (most prominently, select and pool_cache).

Instead of always assuming rump_cpu, the scheduler must now be run
(and unrun) on all entry points into rump. Likewise, rumpuser
unruns and re-runs the scheduler around each potentially blocking
operation. As an optimization, I modified some locking primitives
to try to get the lock without blocking before releasing the cpu.

Also, ltsleep was modified to assume that it is never called without
the biglock held and made to use the biglock as the sleep interlock.
Otherwise there is just too much drama with deadlocks. If some
kernel code wants to call ltsleep without the biglock, then, *snif*,
it's no longer supported and rump and should be modified to support
newstyle locks anyway.
 1.5 14-Oct-2009  pooka "rumppriv" goes back to "rump" per internal interface naming change.
 1.4 14-Oct-2009  pooka Adjust rump sources for external/internal interfaces.
No functional change.
 1.3 18-Mar-2009  cegger branches: 1.3.2;
Ansify function definitions w/o arguments. Generated with sed.
 1.2 01-Jan-2009  pooka branches: 1.2.2; 1.2.4; 1.2.6;
Define MODULAR for rump core components. This enables module
loading via the kernel module framework (instead of dlopen()).
For now it only works on amd64 and i386, but for the rest it should
just be a matter of including the relevant kobj_machdep.c modules
from the kernel sources.
 1.1 01-Jan-2009  pooka Rename i386 and amd64 {cpu,spl}.c to rump{cpu,spl}.c to avoid
name collisions with other source files in the kernel tree.
 1.2.6.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2.4.3 28-Apr-2009  skrll Sync with HEAD.
 1.2.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.4.1 01-Jan-2009  skrll file rumpcpu.c was added on branch nick-hppapmap on 2009-01-19 13:20:26 +0000
 1.2.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.1 01-Jan-2009  mjf file rumpcpu.c was added on branch mjf-devfs2 on 2009-01-17 13:29:36 +0000
 1.3.2.4 11-Aug-2010  yamt sync with head.
 1.3.2.3 11-Mar-2010  yamt sync with head
 1.3.2.2 04-May-2009  yamt sync with head.
 1.3.2.1 18-Mar-2009  yamt file rumpcpu.c was added on branch yamt-nfs-mp on 2009-05-04 08:14:30 +0000
 1.7.4.1 30-May-2010  rmind sync with head
 1.7.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.9.18.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.18.2 23-Jun-2013  tls resync from head
 1.9.18.1 25-Feb-2013  tls resync with head
 1.9.8.1 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.11.4.1 18-May-2014  rmind sync with head
 1.3 12-Feb-2014  pooka Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.2 06-Feb-2009  pooka branches: 1.2.4; 1.2.16; 1.2.26; 1.2.30;
Rip out the rwlock spl emulation code. It never did anything useful
except keep my feet warm by consuming an insane amount of cpu
cycles -- in rump our current "cpu" context is never interrupted
& we have MULTIPROCESSOR.

(itch i'm scratching: it made the networking stack 10-20% slower.
this is one of the places where fast code actually matters)
 1.1 01-Jan-2009  pooka branches: 1.1.2; 1.1.4;
Rename i386 and amd64 {cpu,spl}.c to rump{cpu,spl}.c to avoid
name collisions with other source files in the kernel tree.
 1.1.4.3 03-Mar-2009  skrll Sync with HEAD.
 1.1.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.4.1 01-Jan-2009  skrll file rumpspl.c was added on branch nick-hppapmap on 2009-01-19 13:20:26 +0000
 1.1.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.2.1 01-Jan-2009  mjf file rumpspl.c was added on branch mjf-devfs2 on 2009-01-17 13:29:36 +0000
 1.2.30.1 18-May-2014  rmind sync with head
 1.2.26.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.16.1 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.2.4.2 04-May-2009  yamt sync with head.
 1.2.4.1 06-Feb-2009  yamt file rumpspl.c was added on branch yamt-nfs-mp on 2009-05-04 08:14:30 +0000
 1.3 12-Feb-2014  pooka Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.2 22-Jan-2013  christos branches: 1.2.2;
use the definitions from lock.h
 1.1 31-May-2010  pooka branches: 1.1.2; 1.1.4; 1.1.6; 1.1.14; 1.1.24;
The x86 kernel ABI depends on __cpu_simple_lock stuff being present.
Since they are practically never used (only when prehistoric code
uses simple_lock()), their efficiency doesn't matter that much and
we can simply adapt the versions from x86 lock.h.
 1.1.24.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.24.1 25-Feb-2013  tls resync with head
 1.1.14.1 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.1.6.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.1.6.1 31-May-2010  uebayasi file spinlock.c was added on branch uebayasi-xip on 2010-08-17 06:48:02 +0000
 1.1.4.2 11-Aug-2010  yamt sync with head.
 1.1.4.1 31-May-2010  yamt file spinlock.c was added on branch yamt-nfs-mp on 2010-08-11 22:55:07 +0000
 1.1.2.2 03-Jul-2010  rmind sync with head
 1.1.2.1 31-May-2010  rmind file spinlock.c was added on branch rmind-uvmplock on 2010-07-03 01:20:03 +0000
 1.2.2.1 18-May-2014  rmind sync with head
 1.2 01-Jan-2009  pooka Rename i386 and amd64 {cpu,spl}.c to rump{cpu,spl}.c to avoid
name collisions with other source files in the kernel tree.
 1.1 29-Dec-2008  pooka Switch i386 away from rump/include/machine. This means that rump
on i386 now uses the native kernel ABI. This in turn means that
rump modules and kernel modules are binary equivalent and can be
used interchangeably.
 1.4 25-Apr-2021  christos mipsn64* is native 64
 1.3 22-Apr-2015  pooka Apparently new source files need to be added to each Makefile.inc
individually. Who comes up with this kind of crappy build infra?
 1.2 12-Feb-2014  pooka branches: 1.2.6;
Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.1 14-Dec-2009  matt branches: 1.1.4; 1.1.14; 1.1.24; 1.1.28;
Make librump play with mips nicely. Define ARCH_ELFSIZE for mips to be 32.
This works for N64 kernels because objcopy them to be 32bit to the bootloaders
can handle them.
 1.1.28.1 18-May-2014  rmind sync with head
 1.1.24.2 03-Dec-2017  jdolecek update from HEAD
 1.1.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.14.1 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.1.4.2 11-Mar-2010  yamt sync with head
 1.1.4.1 14-Dec-2009  yamt file Makefile.inc was added on branch yamt-nfs-mp on 2010-03-11 15:04:38 +0000
 1.2.6.1 06-Jun-2015  skrll Sync with HEAD
 1.6 22-Apr-2015  pooka Apparently new source files need to be added to each Makefile.inc
individually. Who comes up with this kind of crappy build infra?
 1.5 07-Mar-2014  matt branches: 1.5.6;
Be a little more careful checking MLIBDIR
 1.4 07-Mar-2014  matt Use ARCH_ELFSIZE=32 is MLIBDIR == "powerpc"
 1.3 12-Feb-2014  pooka Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.2 24-Nov-2012  pgoyette branches: 1.2.2;
File is common between pp6 and ppc64 ports, so define ARCH_ELFSIZE
accordingly.

From christos@, resolves the latest build break
 1.1 03-Jul-2011  mrg branches: 1.1.2; 1.1.12;
define ARCH_ELFSIZE=32 and add kobj_stubs.c rumpcpu_generic.c.
 1.1.12.3 03-Dec-2017  jdolecek update from HEAD
 1.1.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.12.1 25-Feb-2013  tls resync with head
 1.1.2.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.1.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.2.2.1 18-May-2014  rmind sync with head
 1.5.6.1 06-Jun-2015  skrll Sync with HEAD
 1.2 22-Apr-2015  pooka Define rump_nativeabi_p() under arch, where one would logically expect
it to be defined.
 1.1 12-Feb-2014  pooka branches: 1.1.4; 1.1.6; 1.1.10; 1.1.12;
Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.1.12.1 06-Jun-2015  skrll Sync with HEAD
 1.1.10.3 03-Dec-2017  jdolecek update from HEAD
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 12-Feb-2014  tls file Makefile.inc was added on branch tls-maxphys on 2014-08-20 00:04:41 +0000
 1.1.6.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.1.6.1 12-Feb-2014  yamt file Makefile.inc was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 12-Feb-2014  rmind file Makefile.inc was added on branch rmind-smpnet on 2014-05-18 17:46:19 +0000
 1.2 26-Jan-2016  pooka branches: 1.2.16;
Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.1 22-Apr-2015  pooka branches: 1.1.2;
Define rump_nativeabi_p() under arch, where one would logically expect
it to be defined.
 1.1.2.3 19-Mar-2016  skrll Sync with HEAD
 1.1.2.2 06-Jun-2015  skrll Sync with HEAD
 1.1.2.1 22-Apr-2015  skrll file rump_x86_abi.c was added on branch nick-nhusb on 2015-06-06 14:40:29 +0000
 1.2.16.2 03-Dec-2017  jdolecek update from HEAD
 1.2.16.1 26-Jan-2016  jdolecek file rump_x86_abi.c was added on branch tls-maxphys on 2017-12-03 11:39:16 +0000
 1.5 21-Aug-2022  riastradh rump/x86: Need x86/cpufunc.h for declaration of wbinvd.
 1.4 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.3 22-Apr-2015  pooka Apparently not all ports define struct clockframe in cpu.h, so we cannot
provide our definition that way. Instead, generate the struct clockframe
passed to hardclock() in MD code.
 1.2 15-Mar-2014  pooka branches: 1.2.4; 1.2.6; 1.2.10; 1.2.12;
Allow compile-time optimizations to curlwp. This can have a pretty
staggering impact on performance. When running sendto() in a loop,
the improvement is 200k more calls per second with an inlined __thread
curlwp as opposed to the default. In other words, it shaves off hundreds
of CPU cycles per call (~20%). Even just eliminating the x86_curlwp()
call in favor of an inline gives an improvement of 60k calls per second.
 1.1 12-Feb-2014  pooka Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.2.12.2 19-Mar-2016  skrll Sync with HEAD
 1.2.12.1 06-Jun-2015  skrll Sync with HEAD
 1.2.10.3 03-Dec-2017  jdolecek update from HEAD
 1.2.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.10.1 15-Mar-2014  tls file rump_x86_cpu.c was added on branch tls-maxphys on 2014-08-20 00:04:41 +0000
 1.2.6.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.2.6.1 15-Mar-2014  yamt file rump_x86_cpu.c was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.2.4.2 18-May-2014  rmind sync with head
 1.2.4.1 15-Mar-2014  rmind file rump_x86_cpu.c was added on branch rmind-smpnet on 2014-05-18 17:46:19 +0000
 1.2 15-Jun-2020  msaitoh Serialize rdtsc using with lfence, mfence or cpuid to read TSC more precisely.

x86/x86/tsc.c rev. 1.67 reduced cache problem and got big improvement, but it
still has room. I measured the effect of lfence, mfence, cpuid and rdtscp.
The impact to TSC skew and/or drift is:

AMD: mfence > rdtscp > cpuid > lfence-serialize > lfence = nomodify
Intel: lfence > rdtscp > cpuid > nomodify

So, mfence is the best on AMD and lfence is the best on Intel. If it has no
SSE2, we can use cpuid.

NOTE:
- An AMD's document says DE_CFG_LFENCE_SERIALIZE bit can be used for
serializing, but it's not so good.
- On Intel i386(not amd64), it seems the improvement is very little.
- rdtscp instruct can be used as serializing instruction + rdtsc, but
it's not good as [lm]fence. Both Intel and AMD's document say that
the latency of rdtscp is bigger than rdtsc, so I suspect the difference
of the result comes from it.
 1.1 12-Feb-2014  pooka branches: 1.1.4; 1.1.6; 1.1.10;
Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 12-Feb-2014  tls file rump_x86_cpu_counter.c was added on branch tls-maxphys on 2014-08-20 00:04:41 +0000
 1.1.6.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.1.6.1 12-Feb-2014  yamt file rump_x86_cpu_counter.c was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 12-Feb-2014  rmind file rump_x86_cpu_counter.c was added on branch rmind-smpnet on 2014-05-18 17:46:19 +0000
 1.5 21-Aug-2022  riastradh rump/x86: Add stubs for pmap_resident_count, pmap_wired_count.

These are no longer static inlines, now that struct pmap is private.
 1.4 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.3 17-Apr-2015  pooka Give the kernel/local pmaps actual storage.

That way friendly neighborhood macros won't go scribbling
in the wrong places.
 1.2 03-Apr-2015  pooka Use RUMP_PMAP_KERNEL and RUMP_PMAP_LOCAL to denote
kernel and local client pmaps, respectively.
 1.1 12-Feb-2014  pooka branches: 1.1.4; 1.1.6; 1.1.10; 1.1.12;
Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.1.12.3 19-Mar-2016  skrll Sync with HEAD
 1.1.12.2 06-Jun-2015  skrll Sync with HEAD
 1.1.12.1 06-Apr-2015  skrll Sync with HEAD
 1.1.10.3 03-Dec-2017  jdolecek update from HEAD
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 12-Feb-2014  tls file rump_x86_pmap.c was added on branch tls-maxphys on 2014-08-20 00:04:41 +0000
 1.1.6.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.1.6.1 12-Feb-2014  yamt file rump_x86_pmap.c was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 12-Feb-2014  rmind file rump_x86_pmap.c was added on branch rmind-smpnet on 2014-05-18 17:46:19 +0000
 1.1 12-Feb-2014  pooka branches: 1.1.4; 1.1.6; 1.1.10;
Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 12-Feb-2014  tls file rump_x86_spinlock.c was added on branch tls-maxphys on 2014-08-20 00:04:41 +0000
 1.1.6.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.1.6.1 12-Feb-2014  yamt file rump_x86_spinlock.c was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 12-Feb-2014  rmind file rump_x86_spinlock.c was added on branch rmind-smpnet on 2014-05-18 17:46:19 +0000
 1.2 26-Jan-2016  pooka Put the kernelside rump kernel headers into <rump-sys> instead of
sprinkling them around the faction directories. Avoids having
to add a CPPFLAGS (or several) to pretty much every component
Makefile.

Leave compat headers around in the old locations.

The commit changes some autogenerated files, but I'll fix the
generators shortly and regen.
 1.1 12-Feb-2014  pooka branches: 1.1.4; 1.1.6; 1.1.10; 1.1.12;
Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.1.12.1 19-Mar-2016  skrll Sync with HEAD
 1.1.10.3 03-Dec-2017  jdolecek update from HEAD
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 12-Feb-2014  tls file rump_x86_spl.c was added on branch tls-maxphys on 2014-08-20 00:04:41 +0000
 1.1.6.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.1.6.1 12-Feb-2014  yamt file rump_x86_spl.c was added on branch yamt-pagecache on 2014-05-22 11:41:15 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 12-Feb-2014  rmind file rump_x86_spl.c was added on branch rmind-smpnet on 2014-05-18 17:46:19 +0000
 1.9 15-Nov-2018  riastradh Make the direct-map API always available, but fail if KASAN or rump.

(Only for architectures that support it at all; on others,
__HAVE_MM_MD_DIRECT_MAPPED_PHYS/IO are still undefined and the
functions unimplemented.)

This gives modules like zfs an opportunity to use it.

While here, fix the one caller of mm_md_direct_mapped_phys that
ignored the return value (and make sure to call pmap_kremove/update
before uvm_km_free).
 1.8 12-Feb-2014  pooka branches: 1.8.28; 1.8.30;
Rototill a bit, and attempt to disguise it as non-gratuitous.

Add arch/generic and move non-x86 files from rumpkern/ there. Also,
move files from arch/i386 to arch/x86, and make both i386 and x86_64
use those.

This clarifies the situation with what is MD vs. MI code.

renames:
rumpcpu_generic,kobj_stubs,pmap_stubs => arch/generic/rump_generic_$x
arch/i386/* => arch/x86/rump_x86_$x

(for those who forget, x86 requires MD code because rump kernels
use the same ABI as kernel modules)
 1.7 16-Jun-2010  pooka branches: 1.7.8; 1.7.18; 1.7.22;
Reinstate the blanket pmap.h for archs which do not conform to the
kernel ABI (i.e. not i386 or amd64). Due to the "half function,
half macro, all noodles" nature of pmap.h, it's too entangling and
too brittle to keep up with an ifdeffy MI implementation.
 1.6 31-May-2010  pooka The x86 kernel ABI depends on __cpu_simple_lock stuff being present.
Since they are practically never used (only when prehistoric code
uses simple_lock()), their efficiency doesn't matter that much and
we can simply adapt the versions from x86 lock.h.
 1.5 11-May-2010  pooka add __HAVE_CPU_COUNTER stubs where possible (i.e. where the arch
doesn't think inlines are the second compiling)
 1.4 01-Jan-2009  pooka branches: 1.4.2; 1.4.4; 1.4.8; 1.4.10; 1.4.12;
add missing "arch/" as noted by a few people
 1.3 01-Jan-2009  pooka Define MODULAR for rump core components. This enables module
loading via the kernel module framework (instead of dlopen()).
For now it only works on amd64 and i386, but for the rest it should
just be a matter of including the relevant kobj_machdep.c modules
from the kernel sources.
 1.2 01-Jan-2009  pooka Rename i386 and amd64 {cpu,spl}.c to rump{cpu,spl}.c to avoid
name collisions with other source files in the kernel tree.
 1.1 30-Dec-2008  pooka Switch amd64 rumps to the kernel ABI.
 1.4.12.2 03-Jul-2010  rmind sync with head
 1.4.12.1 30-May-2010  rmind sync with head
 1.4.10.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.4.8.3 11-Aug-2010  yamt sync with head.
 1.4.8.2 04-May-2009  yamt sync with head.
 1.4.8.1 01-Jan-2009  yamt file Makefile.inc was added on branch yamt-nfs-mp on 2009-05-04 08:14:30 +0000
 1.4.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.4.4.1 01-Jan-2009  skrll file Makefile.inc was added on branch nick-hppapmap on 2009-01-19 13:20:26 +0000
 1.4.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.4.2.1 01-Jan-2009  mjf file Makefile.inc was added on branch mjf-devfs2 on 2009-01-17 13:29:36 +0000
 1.7.22.1 18-May-2014  rmind sync with head
 1.7.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7.8.1 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.8.30.1 10-Jun-2019  christos Sync with HEAD
 1.8.28.1 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts

RSS XML Feed