Commit Graph

1733 Commits

Author SHA1 Message Date
pooka
566f7922d9 Add a lockless uniprocessor version of atomic_cas_generic.c, which
is currently used by all the archs that previously used cas_generic.
2010-11-21 21:46:43 +00:00
pooka
bcc1160c88 regen: rump_reboot is gone 2010-11-21 17:35:19 +00:00
pooka
15e3ba0cc7 Realize the >1yo comment above rump_reboot and retire them to make
room for sys_reboot.
2010-11-21 17:34:11 +00:00
pooka
237c2727e8 I can't think of any reason why a rump kernel has to allow vfsusermount
by default, nor do I remember why i originally added it in 2008
==> remove.
2010-11-21 16:19:19 +00:00
pooka
a555936f2e remove no longer necessary code 2010-11-19 17:11:20 +00:00
pooka
1f5c4aaeac Pass routines necessary for multithreaded operation down to rumpuser_sp. 2010-11-19 17:06:56 +00:00
dholland
479d02e2f7 Regen. 2010-11-19 06:45:29 +00:00
dholland
8f6ed30d57 Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

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

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
2010-11-19 06:44:33 +00:00
pooka
e425b7c737 Remove unused rump_set_vmspace. An equivalent needs to come back
later, though, but in its current form it's just unusable garbage.
2010-11-17 21:57:33 +00:00
pooka
5eb7a3a4cc Provide a special rump_proxy_syscall for handling received proxy
syscalls and retire unused rump_syscall.
2010-11-17 21:52:29 +00:00
pooka
dc4938b8f8 regen: -rump_pub_syscall 2010-11-17 21:50:34 +00:00
pooka
56c4db38a8 remove rump_pub_syscall -- unused/unusable 2010-11-17 21:49:52 +00:00
pooka
5e4322985a regen: optimize local syscall path a bit 2010-11-17 21:48:07 +00:00
pooka
3e9c0c4fe1 cleanup some old garbage 2010-11-17 19:54:09 +00:00
pooka
d9aab6f8fc Support destroy in shmif. 2010-11-17 17:51:22 +00:00
pooka
b4e3a3178b Use vmem for keeping track of unit numbers so that wildcard allocation
works correctly.
2010-11-16 20:08:24 +00:00
uebayasi
0905fbeb72 Define uvmexp_pagemask and friends used by sparc to set PAGE_SIZE,
PAGE_MASK, PAGE_SHIFT dynamically.
2010-11-16 01:12:57 +00:00
pooka
891314e269 "fix" completely crackheaded code w/ uninitialized use,
missed as usual by the wonderful -g -O0
2010-11-15 23:59:06 +00:00
pooka
d6787585af remember to commit this file too 2010-11-15 23:51:06 +00:00
pooka
32b08b37e0 un-\240 2010-11-15 22:49:33 +00:00
pooka
9f725ef6cb * make interface a cloner
* use SIOCSLINKSTR for supplying bus filename in case of cloned if

TODO: downing interface, unclone, and some tweaks for robustness
2010-11-15 22:48:06 +00:00
pooka
4a79b4abf7 add -h which prints only the bus header info 2010-11-15 22:45:23 +00:00
pooka
00ab7eeb45 Add a new signal model RUMP_SIGMODEL_RECORD which records all
signals which are posted to a process.
2010-11-15 20:37:21 +00:00
pooka
ab9955e060 apply const 2010-11-15 20:24:09 +00:00
pooka
1ff4490a1c Make interface support ifconfig {down,destroy} and generally make
it a little less eager to panic.
2010-11-15 20:23:11 +00:00
uebayasi
77d80f38cd 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.
2010-11-12 05:23:41 +00:00
pooka
d109ed0795 help me if you can i'm gcc
and i do appreciate work'round-eee'e
help me, get my head out of the ground
won't you please, please help me?
2010-11-11 18:45:09 +00:00
pooka
52bdbe10cf +VOP_REMOVE 2010-11-11 17:33:22 +00:00
pooka
ffb60285ab support read/write & ubc 2010-11-11 17:26:01 +00:00
pooka
f637fc68d9 support vop_pathconf 2010-11-11 16:08:31 +00:00
pooka
30739dcdee support vfs_mount/unmount 2010-11-11 16:01:59 +00:00
pooka
d542ce3403 be friends with genfs 2010-11-11 15:05:54 +00:00
pooka
a51c1c8b1e +posix_fadvise 2010-11-11 14:48:13 +00:00
pooka
01849d1a4b Support non-hostbacked regular files, at least just a little bit. 2010-11-11 14:46:55 +00:00
pooka
b9b9911952 Fix off-by-one in the rpc path of copyinstr() 2010-11-09 20:55:14 +00:00
pooka
8fcead892c fix copystr/copyinstr/copyoutstr to return ENAMETOOLONG where appropriate 2010-11-09 15:22:47 +00:00
pooka
21893685ca print some dmesg blub for etfs files attaching as block devices 2010-11-08 11:01:45 +00:00
pooka
62d92a1913 support compat ioctl's (OOOOOlalaSIOC stuff) 2010-11-07 19:47:18 +00:00
pooka
d8d5e7b0b7 bump rumpuser version 2010-11-04 20:57:00 +00:00
pooka
13e503f148 Refactor the sysproxy code so that rumpuser contains only the server side. 2010-11-04 20:54:07 +00:00
pooka
a3aca72140 regen: standalone client support for rump syscalls 2010-11-04 20:51:18 +00:00
pooka
f8f090bd5e regen: whitespace blues 2010-11-01 16:22:37 +00:00
pooka
5629968a95 Missed a few symbols in previous ...
Also, reorganize rumpuser header inclusion to make sure problem is
caught already by the compiler.
2010-11-01 13:55:19 +00:00
pooka
8fc7f9077e Make librumpuser linkage once again free of librump.
problem pointed out by <he>
2010-11-01 13:49:10 +00:00
pooka
41a10084d4 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
2010-10-29 15:32:23 +00:00
pooka
082af2faa5 minor knf 2010-10-29 15:27:50 +00:00
pooka
2ca5613a5c 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
2010-10-28 11:30:07 +00:00
pooka
993e75b0b4 remove obsolete tests 2010-10-27 20:46:54 +00:00
pooka
b1842c2201 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).
2010-10-27 20:44:49 +00:00
pooka
0f423ad930 "i build dead files". ok, so let's not. 2010-10-27 20:37:11 +00:00
pooka
297882358c regen:
- rump_sysproxy
+ rump_syscall
2010-10-27 20:35:47 +00:00
pooka
b2380889f3 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.
2010-10-27 20:34:50 +00:00
pooka
d9a1fbfce1 Remove old crud which is no longer used (since kern_proc). 2010-10-27 15:50:03 +00:00
pooka
ac9dbb05ed make printed string more accurate 2010-10-25 17:49:36 +00:00
pooka
8660c50d36 Attach swsensor only once (it attaches automatically via MODULE
like everything else that is linked in as a module).
2010-10-20 18:48:13 +00:00
pooka
a500a55cf2 Make virtif a cloner so that it can be brough to life also with
"ifconfig create".  As previously, virt<n> interfaces with the
host's /dev/tap<n> (I guess it could be made explicit with
"ifconfig media", but leave it this way for now).
2010-10-19 19:19:41 +00:00
pooka
cb4b70f7d6 Attach PF_LINK domain. ifconfig wants to play with it, plus there's
no reason not to anyway.
2010-10-19 15:40:15 +00:00
pgoyette
adb48c7f00 Build the new swsensor(4) device and add to set lists 2010-10-19 11:58:00 +00:00
tsutsui
8e16588b0b 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?
2010-10-15 15:55:52 +00:00
haad
e9533dda6f Add files needed to build npf as a RUMP library, original code bu rmind
some modifications done by me.

Oked by @rmind.
2010-10-14 22:39:30 +00:00
pooka
aeada54307 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.
2010-10-13 11:01:04 +00:00
pooka
04832f614a Don't attach as pseudo device here. This driver does attach in modcmd. 2010-10-12 09:14:43 +00:00
pgoyette
16da219b65 Update error message - no funcitonal change. 2010-10-04 15:57:27 +00:00
rmind
879d5dfb5e 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@
2010-09-24 22:51:50 +00:00
pooka
41dca761e7 * unlock object in "error" branch
* fix typo (not in comment)
* improve indentation tailspin
2010-09-09 12:23:06 +00:00
pooka
9f2621e60c Release PG_PAGEOUT pages in aiodone. 2010-09-09 12:18:39 +00:00
pooka
2e7b2c4b52 Assert that object is locked in page unbusy. 2010-09-09 10:02:14 +00:00
pooka
0e59fd4080 hold object lock across page unbusy 2010-09-09 09:59:48 +00:00
pooka
3b79ed5da9 Use proper locking before unbusying pages.
Caught after yesterday's changes by the test suite (the ffs snapshot
test, to be precise).
2010-09-09 09:50:21 +00:00
pooka
69e5229866 Actually, we want to say "no aobjs" instead of "only vnodes" to
make component boundaries go right.
2010-09-08 21:14:32 +00:00
pooka
73ad216320 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.
2010-09-08 21:02:11 +00:00
pooka
8a2467ef8f 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.
2010-09-07 21:11:10 +00:00
pooka
8fff110d3d 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.
2010-09-07 18:25:38 +00:00
pooka
d00164124d update comments. no code change. 2010-09-07 17:49:23 +00:00
pooka
91ada95af8 regen: rcvp/cdir interfaces go byebye in favour of rump syscalls 2010-09-07 17:14:18 +00:00
pooka
18ec09b711 Retire the prehistoric chroot/cwd interfaces now that there is a
process model in rump.
2010-09-07 17:13:03 +00:00
pooka
a9f67b6a36 regen: getcwd 2010-09-07 17:10:48 +00:00
pooka
4aea95690f Attach only one CPU for the bootstrap phase. 2010-09-07 07:59:48 +00:00
pooka
5862500201 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)
2010-09-07 07:47:36 +00:00
pooka
80374562eb Use rb_tree for page lookup instead of list. Unshockingly, this
makes dealing with large uobjs (files) quite a bit faster.
2010-09-07 06:06:54 +00:00
pooka
ffe3bf49ce Make the pager loops more resilient against the aobj pager which is
lazy and doesn't like to return anything except the bare minimum.
(forgot to commit this earlier)
2010-09-06 21:33:07 +00:00
pooka
90dec69258 Use standard uvm aobj pager. Most of the kernel aobj pager complexity
comes from swap handling, but that is included only with VMSWAP.
2010-09-06 20:10:20 +00:00
pooka
347b0daf87 regen: umask 2010-09-06 20:01:31 +00:00
pooka
bbcc16c9cf add a few more system calls 2010-09-06 18:43:28 +00:00
pooka
6b2c39723d Broadcast instead of signal since the condition is a boolean. 2010-09-06 18:03:57 +00:00
pooka
8664a51e24 pager wants truncated offsets 2010-09-06 17:56:56 +00:00
pooka
cd3531b9f2 simplify and fix len-to-npages calculation 2010-09-06 17:32:38 +00:00
pooka
e6a0920565 renamelock is mandatory 2010-09-06 15:07:33 +00:00
pooka
811ba61255 Try to draw faster than Lucky Locke. 2010-09-06 14:50:34 +00:00
pooka
32cb61f490 proper panic for trying to release implicit lwp 2010-09-01 21:16:56 +00:00
pooka
ce29454f2b use curlwp 2010-09-01 19:57:52 +00:00
pooka
11f8c2f902 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.
2010-09-01 19:37:58 +00:00
pooka
073d0401dd regen: new lwp/proc interfaces 2010-09-01 19:33:04 +00:00
pooka
1d8f8d1bc5 Print generated filenames so i remember which ones to commit. 2010-09-01 19:32:11 +00:00
pooka
41e7b18b68 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).
2010-09-01 19:13:38 +00:00
pooka
55c3091ac6 Make IPLs not equal IPL_NONE to avoid some KASSERTs. 2010-08-30 18:29:52 +00:00
pooka
8357a02c05 doesn't need files.rump 2010-08-30 11:51:29 +00:00
pooka
4c62970c70 * record proc's cred in p_cred too
* account procs for uids
2010-08-30 10:49:40 +00:00
pooka
72a4517ea3 regen: rump syscalls for kern_prot interfaces 2010-08-30 10:34:51 +00:00
pooka
9a611a11e0 Empty commit to show makesyscalls.sh rev 1.99 didn't change anything (yet). 2010-08-30 10:24:42 +00:00
pooka
f0fb0d2ca1 do 5.0 compat for fstat 2010-08-30 10:08:39 +00:00
pooka
e731bd97ef Include kern_prot.c for setuid etc. 2010-08-30 09:44:40 +00:00
pooka
64cced98e7 Use one line per sys/kern source module. no functional change. 2010-08-30 09:44:11 +00:00
pooka
33e9636157 Move the manpage from the kernel sources into lib, 'cause that's
where it's used.
2010-08-27 08:21:43 +00:00
pooka
e50b65b297 update a bit 2010-08-26 22:48:36 +00:00
pooka
5cfa84d3e6 print one line of dmesg per cpu present 2010-08-26 19:56:07 +00:00
pooka
cf0a627569 whoopsie, need to commit this as part of scsitest 2010-08-24 13:19:04 +00:00
pooka
64d9536df5 Implement enough of a SCSI target to be able to perform tests on
our SCSIPI driver stack.  Currently we pretend to be a single CD
controller with an optional host file as the image, but I guess
the sky's the limit.

dmesg porn:
NetBSD 5.99.39 (RUMP-ROAST) #0: Mon Aug 23 11:38:16 CEST 2010
        pooka@pain-rustique.localhost:/usr/allsrc/src/sys/rump/librump/rumpkern
total memory = unlimited (host limit)
timecounter: Timecounters tick every 10.000 msec
timecounter: Timecounter "rumpclk" frequency 100 Hz quality 0
root file system type: rumpfs
mainbus0 (root)
scsitest0 at mainbus0
scsibus0 at scsitest0: 2 targets, 1 lun per target
cd0 at scsibus0 target 1 lun 0: <RUMPHOBO, It's a LIE, 0.00> cdrom removable
2010-08-24 11:23:35 +00:00
pooka
4d40787853 Split scsipi out of librumpdev_umass into librumpdev_scsipi. umass
still compile time depends on scsipi in the sense of "ifdef
NATAPIBLUES", but I'm not going to fix that now.
2010-08-23 20:49:53 +00:00
pgoyette
85e292c065 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.
2010-08-23 14:00:40 +00:00
pgoyette
0a1d427681 Add the new kern_cfglock.c to rump. 2010-08-21 13:20:43 +00:00
pooka
14ac9d6c4c Use the same base pagerflags for both ubc_uiomove and ubc_zerorange. 2010-08-19 02:07:11 +00:00
pooka
942c727880 Prefault bus pages in driver attachment. This seems to work around
weird corruption I've been seeing (most likely a host kernel bug).

For more details, see thread at:
http://mail-index.netbsd.org/tech-kern/2010/08/17/msg008749.html
2010-08-17 20:42:47 +00:00
pooka
c2fbfedc83 Fix hopefully last off-by-one: if we fill the bus, we must also
advance the "first" pointer.  This problem triggered only if the
bus was filled in the first round, since the first pointer is at
the end-of-bus only for the bootstrap round.
2010-08-17 12:59:53 +00:00
pooka
86ea9bb1a9 * fix off-by-wrap case where current datagram aligns exactly with
the end of the bus
* clarify the "can we still use the device's next pointer" calculation
  and move it to its own routine
* sprinkle dprintf
2010-08-17 11:35:23 +00:00
pooka
1108237392 simplify, improve, etc. 2010-08-16 17:33:52 +00:00
pooka
d2a293bcc2 reset pktsize each loop 2010-08-15 21:57:58 +00:00
pooka
962bc2f851 reset wrap where necessary 2010-08-15 21:41:39 +00:00
pooka
57245467f6 Implement softints properly: they need to have a schedulable entity
per cpu.
2010-08-15 21:28:33 +00:00
pooka
e46b5d009d 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.
2010-08-15 20:23:04 +00:00
pooka
50fa67ff5f Move the lockops together with the interface -- they are needed
only at runtime.
2010-08-15 18:55:03 +00:00
pooka
9ae53a340e Take kernel lock before passing data to if_input. This is in line
with IPL_NET interrupts generally not being MPSAFE.
2010-08-15 18:48:38 +00:00
pooka
dc24e61692 introduce a sleep to trying to grab the bus 2010-08-15 18:47:38 +00:00
pooka
b1559dbb99 Don't do timestamping with buslock held. it's the little things ... 2010-08-15 18:40:41 +00:00
pooka
86d75f6695 truncate pcap output file 2010-08-13 11:45:47 +00:00
pooka
b97bdf9424 Include a timestamp in the frame header. When converting to pcap,
it can give some idea of when packets were sent.

nb. it's the sending host's timestamp, not an observer timestamp
like in the typical pcap case.
2010-08-13 10:13:44 +00:00
pooka
ce68b7ae71 Include a pointer to the beginning of the buffer and add support
to the packet dumper.  This helps in situations where the juicy
details are in a bus multiple generations old.
2010-08-12 21:41:47 +00:00
pooka
38800eaa1c further simplify & fix calculations 2010-08-12 18:39:54 +00:00
pooka
6461f6dd05 Recognize ``-'' for stdout. allows piping output to tcpdump -r - 2010-08-12 18:22:40 +00:00
pooka
d5a83df798 * include a magic number in the bus format
* simplify offset calculations by making them start from beginning of data
2010-08-12 18:17:23 +00:00
pooka
36e63e6874 Make shmif memory access slightly more sane. Create a header which
is shared by the interface and the bus analyzer.
2010-08-12 17:33:55 +00:00
pooka
3b2b85fd24 pass Wall 2010-08-12 17:00:41 +00:00
pooka
65028c6bf3 Add a little utility to convert shmif bus traffic to a pcap file
which can be then examined with tcpdump -r, wireshark, etc.
2010-08-11 12:41:09 +00:00
pooka
e2f111efb1 * remove some magic numbers from the code
* include bus version number in header just in case we want to examine
  bus traffic at some point in the future
2010-08-11 12:10:39 +00:00
pgoyette
fa0f1ddde5 Keep condvar wmesg within 8 char limit 2010-08-11 11:51:06 +00:00
pooka
855ec3e9a1 Change bus header a little: reserve only 32bits for the lock and
use 32bit atomic ops to handle it.  Begin data from 0x10 instead
of 0x14.
2010-08-11 10:30:30 +00:00
pooka
6fe4bb4ba8 Support carp. It would be nice to support this as its own component,
but there's about 1000 lines of #ifdef which disagree with my wish.
2010-08-10 21:50:10 +00:00
pooka
10881f3354 Attach 1 loop instead of 0.
not tested on animals
2010-08-10 21:48:23 +00:00
pooka
0c2778236c 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).
2010-08-10 21:32:38 +00:00
pooka
f762b5222f Use correct indices for clock threads and more descriptive ones
for the softint threads.
2010-08-10 19:16:04 +00:00
pooka
066824f414 * use atomic ops instead of __cpu_simple_luck
* this interface is un-IFF_SIMPLEX
2010-08-10 18:17:12 +00:00
pooka
8a20e6b473 * improve diagnostic print
* deal with a tap quirk when it returns 0 bytes
2010-08-10 18:06:10 +00:00
pooka
fffcd29dff Attach component to make it work after defpseudodev conversion
(yea, i need to fix the infrastructure for this).
2010-08-03 19:55:17 +00:00
pooka
316bb4eafe * print interface number, backend path and ethernet address for dmesg
* make kassert more demanding
2010-07-29 22:48:11 +00:00
pooka
334470517a * increase bus size so that we don't wrap so quickly when NFS
flushes writes
* verbosize debug print a bit
2010-07-29 18:30:39 +00:00
hannken
ecb633e650 Correct previous. Skip marker pages in uvm_pagelookup().
Already awake :-)
2010-07-29 15:13:00 +00:00
pooka
a481b222d2 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.
2010-07-29 15:04:04 +00:00
hannken
c84e81cad1 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>
2010-07-29 10:54:50 +00:00
hannken
4d87516177 Regen. LK_INTERLOCK is gone. 2010-07-28 09:32:13 +00:00
pooka
07196c5dd8 Descend into nfsserver, i.e. build & install the kernel nfs server bits. 2010-07-26 15:55:41 +00:00
pooka
dadac8f503 Add select to list on compat syscalls. Makes some code work for
me with a nb5 userland without having to compile with -g ;)
2010-07-26 11:52:25 +00:00
pooka
8b9126ba6d 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).
2010-07-23 19:14:14 +00:00
pooka
f3c8997bfe 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.
2010-07-22 21:00:07 +00:00
pgoyette
01497b95ec Convert swwdog(4) from a simple defpseudo device to a defpseudodev so
that we can attach a power management handler.  The handler prevents
a suspend if the watchdog is active, to be consistent with other
watchdog drivers.

As discussed on tech-kern.
2010-07-22 14:10:14 +00:00
hannken
fb62bef947 Make holding v_interlock mandatory for callers of vget().
Announced some time ago on tech-kern.
2010-07-21 17:52:09 +00:00
pooka
6138a7dfff Regen syscalls to get compat header included. 2010-07-19 15:38:55 +00:00
pooka
6ca15e9cbd regen from ages ago (to get rcsid consistent) 2010-07-19 15:38:28 +00:00
pooka
868e8536ec Add some forward declarations used by the interfaces. 2010-07-19 15:38:03 +00:00
pooka
83ab3e68e5 * move stat syscalls to newstyle compat
* implement compat for pollts
2010-07-19 15:33:16 +00:00
pooka
53ef25afeb regen: stat compat syscalls moved 2010-07-19 15:30:43 +00:00
pooka
7949f6c1c8 Don't provide stat compat syscalls here, they come from
rump_syscalls_compat.h now.  (besides, I always hated how they were
in the rump_pub_sys namespace instead of the rump_sys namespace)
2010-07-19 15:29:44 +00:00
pooka
abfc763eb1 add rump_syscalls_compat.h 2010-07-19 15:28:18 +00:00
pooka
5397c7b6af Ignore errors when copyin/out len == 0. 2010-07-18 12:44:31 +00:00
rmind
bcc65ff09f Split-off IPv4 re-assembly mechanism into a separate module. Abstract
into ip_reass_init(), ip_reass_lookup(), etc (note: abstraction is not
yet complete).  No functional changes to the actual mechanism.

OK matt@
2010-07-13 22:16:10 +00:00
pooka
a6a5da1df4 support dotdot lookups 2010-07-13 18:08:58 +00:00
pooka
70d05149f8 Implement poor man's (or woman's) fault handler (or handlim).
from Stan (or Loretta)
2010-07-12 21:00:47 +00:00
pooka
bc8adcbc79 Assert that l_target_cpu isn't null, just in case we had some memory
corruption issues (like passing wrong size to kmem_free ....).
2010-07-11 16:20:39 +00:00
pooka
6a96ed6578 fd_hold() when creating new threads. This makes the fd code use
multithreaded mode and actually work with a multithreaded process.
2010-07-11 11:37:24 +00:00
pooka
b3a3054f7d Reflect change to pool_drain_end. Makes -DRUMP_USE_UNREAL_ALLOCATORS
compile (and work) again.
2010-07-11 11:27:47 +00:00
hannken
7296ba383a Replace vget() with vref()/vn_lock(), this node already has a reference. 2010-07-09 08:10:50 +00:00
pooka
0882d1cc0e 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".
2010-07-08 11:39:58 +00:00
pooka
15882db1c8 Borrow /dev/mem major from i386 for /dev/null and autogenerate node. 2010-07-07 10:47:39 +00:00
pooka
f8c13e51aa add /dev/putter to "devfs" (forgot to commit this earlier) 2010-07-07 10:46:20 +00:00
pooka
2c9dc3f982 remember to add the new file to the build 2010-07-06 16:13:57 +00:00
pooka
c0f3dfaa52 Fix pointer assignment in previous commit (test compile works better
when you do it with the #defines which actually compile the code
in question).
2010-07-04 15:44:46 +00:00
pooka
54c71dee8c Use a bit more than 1 byte of space for routing messages. 2010-07-04 15:31:04 +00:00
pooka
a98c8e62dd Support VOP_WHITEOUT (mostly so that unionfs tests don't always
need to first mount ffs)
2010-07-03 10:55:47 +00:00
hannken
f4a7cbc30c Regen. LK_TYPEMASK and LK_RELEASE are gone. 2010-07-02 10:45:16 +00:00
hannken
24578944a7 LK_* flags moved to sys/vnode.h 2010-07-02 10:44:26 +00:00
pooka
c9602161d3 Make putter its own component: rumpdev_putter. It was coupled in
with rumpfs_puffs for prehistoric reasons which are no longer valid
(namely, only fs components existed back then and there was no /dev
support in rump fs namespace).
2010-06-30 16:14:18 +00:00
pooka
5551d3c53c add component constructor to create /dev/puffs -> putter symlink 2010-06-30 15:50:20 +00:00
pooka
4ce05210c2 Run vfs component constructors. 2010-06-30 15:48:59 +00:00
pooka
cdb0cb985d plug memory leaks (of course the function i copypasted for the
previous commit was the only one with the leak ...)
2010-06-30 15:40:30 +00:00
pooka
b93b8ba8f5 Implement VOP_SYMLINK/READLINK. The allows me to be a little lazier
in other places.
2010-06-30 14:50:35 +00:00
kefren
826653c190 Add MPLS support, proposed on tech-net@ a couple of days ago
Welcome to 5.99.33
2010-06-26 14:24:27 +00:00
hannken
1423e65b26 Clean up vnode lock operations pass 2:
VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
2010-06-24 12:58:48 +00:00
hannken
da75ace1d5 Regen. LK_EXCLOTHER has gone. 2010-06-24 07:56:22 +00:00
pooka
c15f18f449 As normal, fix breakage from untested commits by rmind. 2010-06-23 08:36:03 +00:00
rmind
fc8b3b7154 Replace tmpfs_pool custom allocator code with a simpler layer for memory
accounting.  Use wired memory (which can be limited) for meta-data, and
kmem(9) for string allocations.

Close PR/31944.  Fix PR/38361 while here.  OK ad@.
2010-06-22 18:32:07 +00:00
pooka
8b642d489c Remove overeager checks. 2010-06-22 12:33:15 +00:00
pooka
c063f898e1 regen for vnd (or at least something like that since this file
still isn't really generated, just copypasted)
2010-06-21 21:51:22 +00:00
pooka
cb2fa571d5 support zlib 2010-06-21 21:43:28 +00:00
pooka
9cb9168c28 Calculate memory mapping size based on underlying file size, not
our window to it.  This fixes cases like opening a window at offsets
[8,32] to a file, which would cause host file offset [0,32-8] to
be mapped, i.e. [0,16] inside the window.  Obviously, access to
the entire in-window [0,24] range should have been mapped (and
after this fix it is).
2010-06-21 14:25:35 +00:00
hannken
9f66ee5d51 Regen (LK_CANRECURSE is gone). 2010-06-18 16:31:34 +00:00
pooka
b7652de0db Give the kernel pmap a container in case some tries to access it
via some pmap.h macro.
2010-06-17 08:22:02 +00:00
pooka
667d694ddb Fix snafu in previous -- if your test it flawed, it doesn't matter
how many times you pass.
2010-06-17 08:19:32 +00:00
pooka
44b844dd2d * support VOP_SEEK
* correctly handle VOP_OPEN(FREAD|FWRITE)
* fix host file write offset
2010-06-16 19:26:58 +00:00
pooka
e9abc8e26b report actual size from read/write vops 2010-06-16 19:03:08 +00:00
pooka
cd3e4f8ebc 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.
2010-06-16 11:45:21 +00:00
pooka
28e6724056 Implement rumpblk_deregister, for unregistering fake block devices
(from etfs_deregister).  Prompted by use case from njoly.
2010-06-15 18:53:48 +00:00
njoly
eb8e417a7b Fix some rump_etfs_register/rump_etfs_remove memory leaks. 2010-06-15 17:23:31 +00:00
pooka
771f2275a6 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).
2010-06-14 21:04:56 +00:00
pooka
e7d4a69ab6 tty support is finally a standalone component 2010-06-14 14:47:58 +00:00
pooka
e0986a806a Add unadulterated tty support as a rump component. 2010-06-14 14:45:47 +00:00
pooka
d2e364992d ptyfs rump component 2010-06-14 14:36:15 +00:00
njoly
e97daef49a Add rmdir(2) support for rump filsystem.
With help from pooka.
2010-06-14 13:40:25 +00:00
pooka
f51be744dd Remove comment which wasn't supposed to get committed. 2010-06-14 13:28:44 +00:00
pooka
0733340220 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.
2010-06-14 13:25:40 +00:00
pooka
9c6bb4c515 Move FLAWLESSCALL from rump_dev_private.h into rump_private.h
so it can be used outside of devices.
2010-06-13 16:49:01 +00:00
pooka
a2b72aafa2 Fix previous in emul.c -- only numbers are operands for cpp comparisons.
Apparently non-numbers logically produce arch-dependent behaviour.
2010-06-13 15:17:02 +00:00
pooka
7ed9d6c421 deal with sun3's module disability 2010-06-13 11:35:41 +00:00
pooka
83474ef4e9 add rest of sparc pagesize variables 2010-06-13 11:05:58 +00:00
pooka
4df1419c47 Support rumpkern components and rumpkern components depending on vfs init. 2010-06-12 07:13:54 +00:00
pooka
7f57b57dc8 Add infrastructure for kern compnents. This is meant for those
components which are too bloaty to be included in rumpkern (where
bloaty means "can be easily left out without anyone missing"), but
generally do not require the support of the dev/fs/net factions to
function.  As the first one, add ksems.  librumpcrypto will migrate
here too once I get my timeslice to deal with the setlists, as most
likely will tty support.
2010-06-10 21:56:42 +00:00
pooka
eacf4402b9 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"
2010-06-10 21:40:42 +00:00
pooka
df76692de4 regen: ksem syscalls 2010-06-10 19:10:09 +00:00
pooka
451e6b4882 Version rumpuser ABI with a lightweight mechanism. 2010-06-09 14:08:17 +00:00
pooka
4fe99aa4c5 initialize specificdata for lwp0 too 2010-06-09 13:51:02 +00:00
pooka
aad71fb6e2 On amd64, allocate module_map memory from the lowest 2GB. 2010-06-09 12:02:37 +00:00
pooka
3f4944e6bb Add the ability to specify a preferred address the "map anon memory"
hypercall.
2010-06-09 11:35:36 +00:00
pooka
4b8e90305c Similarly to cv_wait, fail if trying to cv_wait_sig() without threads. 2010-06-09 07:54:13 +00:00
pooka
0c93fc168a The previous revision worked brilliantly if all you wanted to test
was autoload *not* working with an alternate path.  This revision
make the code double as good in the sense that it now works also
in case you *do* want it to work.
2010-06-08 21:57:49 +00:00
pooka
1ef2da668c Allow to set a non-standard module_base for host kernel module loading. 2010-06-08 17:17:33 +00:00
pooka
5bc163461f Rump components do not, at least for now, get to tell what's NEEDED. 2010-06-07 13:57:20 +00:00
njoly
e800a040dc 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@.
2010-06-06 20:09:38 +00:00
njoly
edf3b80fb4 Regen for pathconf/fpathconf rumpification. 2010-06-04 16:33:32 +00:00
pooka
c91a51436f Don't use rumpuser_malloc() directly. 2010-06-03 19:36:21 +00:00
pooka
8b0211dc06 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
2010-06-03 10:56:20 +00:00
pooka
03d9f8436f In aiodone, call uvm_pageout_done() with number of PG_PAGEOUT pages
processed.
2010-06-02 12:07:03 +00:00
pooka
8e9f71e9f5 rumpvm_init -> uvm_init to get rid of local prototype.
no functional change
2010-06-02 10:55:18 +00:00
pooka
e3c273abc1 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().
2010-06-01 20:11:33 +00:00
pooka
89600f9afb 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.
2010-06-01 19:18:20 +00:00
pooka
6a58bb3a83 * remove rumpvm_makepage, just use uvm_pagealloc()
* update copyright to reflect reality a little better
2010-06-01 10:29:21 +00:00
pooka
a590bfb92a Support mtsleep() without a biglocked sleeper (uvm uses this in
UVM_UNLOCK_AND_WAIT())
2010-05-31 23:18:33 +00:00
pooka
977a0ef122 Dump rump kernel bootstrap time. 2010-05-31 23:13:17 +00:00
pooka
9970bb9e64 Support KTHREAD_JOINABLE/kthread_join(). Also fixes earlier bug
where all pthreads were created non-detached.
2010-05-31 23:09:29 +00:00
pooka
7210d18f43 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.
2010-05-31 22:31:07 +00:00
pooka
01c45b7fe9 Deal with the "we get a portably arbitrary set of headers on
different archs" problem.
2010-05-28 18:17:24 +00:00
pooka
d11274ecfd 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.
2010-05-28 16:44:14 +00:00
pooka
5f75591d60 regen: rump_vfs_mount_print 2010-05-26 21:51:58 +00:00
pooka
7e5ec0880b Add public namespace helper routine for dumping info on mountpoints. 2010-05-26 21:50:56 +00:00
pooka
c468a8e0bf print vm object refcount 2010-05-26 21:48:20 +00:00
pooka
9df433ebd4 include extattr support 2010-05-20 18:23:59 +00:00
pooka
8cfbddcc72 one more file to commit with regen 2010-05-20 15:58:09 +00:00
pooka
1a99fb9d2c regen: rump_vfs_extattrctl 2010-05-20 15:47:45 +00:00
pooka
e1f101dffa open VFS_EXTATTRCTL to user namespace 2010-05-20 15:46:47 +00:00
martin
d806a53fa5 Add missing include 2010-05-18 20:18:18 +00:00
pooka
0f6a90c207 Whoops, default to MP locking. 2010-05-18 16:30:22 +00:00
pooka
d47455e39d 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.
2010-05-18 16:29:36 +00:00
pooka
a955550ec3 Namespace rump-only kernel biglock routines appropriately.
No functional change.
2010-05-18 15:16:10 +00:00