Commit Graph

45 Commits

Author SHA1 Message Date
pooka 6a501c9863 Fix typos to match values from rumpuser_config.h
from Hajime Tazaki via rumpkernel-users
2015-09-18 10:56:25 +00:00
pooka 68efe5aa2a With glibc on ARM kthread_exit() aborts because pthread_exit() fails
to unwind the stack.  Add a temporary workaround where we simply don't
allow the thread to exit (a kernel thread exit is a relatively uncommon
event in a rump kernel anyway).
2014-12-16 17:00:17 +00:00
pooka 23dfcd7408 Use autoconf for rump kernel posix hypercall layer.
This gets rid of homegrown hacks and puts all probes in one place.

Tested for NetBSD (build.sh + anita) and Linux (buildrump.sh)
2014-11-04 19:05:17 +00:00
pooka 2f525beeee Hrmph, revert previous pending another fix. I tested it yesterday with
a slightly older tree, and of course it doesn't work anymore ...
2014-06-23 12:38:18 +00:00
pooka fbc749c67d Wrap pthread_create(). Shouldn't really have a functional effect,
apart from testing that rumpuser_thread_create() can actually survive
an unschedule/schedule cycle (which may or may not be necessary with
other hypercall implementations).
2014-06-22 20:17:23 +00:00
justin 95e41b89b5 Add Android support for rump kernel.
Reviewed by pooka@
2014-04-02 17:09:23 +00:00
pooka fe7fe5876f fix braces 2014-03-21 16:03:07 +00:00
pooka bc215c110d use a probe result to decide which pthread_setname_np() to use 2014-03-21 12:28:54 +00:00
pooka fa5f7ef47e set threadname for correct pthread_t 2014-03-21 12:07:10 +00:00
justin cf83766ecf Revert conversion to __thread as breaks on archs without TLS support 2014-03-10 22:37:51 +00:00
justin 587ef2949a Use __thread rather than pthread_getspecific for rumpuser curlwp.
This has better performance and curlwp is a performance bottleneck
in rump kernel code.
2014-03-09 23:01:11 +00:00
rmind d60eb8c12f librumpuser: add some #ifdef __APPLE__ and missing bits to build it on OS X.
OK pooka@
2013-10-27 16:39:46 +00:00
rmind 0f412aba18 Give RUMP mutex and rwlock their own cache-line. Also give a separate
cache-line for the rwlock's reader counter.
2013-09-26 00:41:51 +00:00
rmind 72b022939e rumpuser_rwlock: replace internal pthread_spin_lock (for protecting reader
count) with atomic operations.  As pthread_spin_lock is not adaptive lock, it
can have hugely negative impact if contended here, especially with priority
inversions.  Now contended rwlock(9) no longer falls flat in RUMP kernels.
2013-09-24 23:45:16 +00:00
pooka 4be69cd08b If pthread_create() fails with EAGAIN, try a few more times with short
sleeps in between.  If it helps, good.  If it doesn't, oh well, at
least we tried.  pthread_create() returning EAGAIN has been observed in
real life at least on Linux (buildrump.sh issue #40)
2013-09-23 10:35:20 +00:00
pooka 15dc8bf975 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.
2013-05-15 14:52:49 +00:00
pooka d0d5069c1a Add RUMPUSER_LWP_CLEAR instead of overloading RUMPUSER_LWP_SET.
This simplifies some alternative hypervisor implementations.
2013-05-15 14:07:26 +00:00
pooka 302678cea5 Initialize rw->downgrade when allocating a rwlock.
should/might/etc fix recent test hangs reported by martin & pgoyette
2013-05-05 12:27:38 +00:00
pooka cfbb87e05b Support proper rw_downgrade() semantics. 2013-05-03 00:23:49 +00:00
pooka 92e27cb3c3 reorder for better locality. no functional change. 2013-05-02 22:07:57 +00:00
pooka f950fd3d52 Push rwlock upgrade and downgrade into the hypervisor where there's
at least a chance to implement them with minimal fuss.
2013-05-02 21:35:19 +00:00
pooka 9a6702d07c 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*
2013-05-02 20:33:54 +00:00
pooka 939c69c331 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.
2013-05-02 19:14:59 +00:00
pooka 5fe33bdc4b Clear rwlock's "writer" field when releasing the lock. Otherwise it might
have been possible for "readers" to reach visibility before "writer"
when another CPU took the lock, thus leading the previous owner to
incorrectly think that it still owned the lock in rw_write_held().

Also, remove duplicate clause from assert().
2013-05-02 16:49:08 +00:00
pooka c46eb786b4 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).
2013-04-30 13:29:28 +00:00
pooka be085dcd72 Translate error codes between the hypervisor and rump kernel. 2013-04-30 12:39:20 +00:00
pooka 32a34307fa Make hypercall calling conventions consistent: iff a hypercall can fail,
it returns an int containing the error value.
2013-04-30 00:03:52 +00:00
pooka 5af3856aee Make the rump kernel upcalls which were previous available only to
the sysproxy module available for the entire hypervisor.
2013-04-29 14:51:39 +00:00
pooka 262a3aaf9f Rework how the bio hypercalls work, part 1/n:
Reduce the set of hypercalls to one: "do block i/o".  This not only
eliminates a lot of pseudo-duplicate code, it also gives the
hypervisor a lot more freedom on how to optimize the i/o.
2013-04-29 12:56:03 +00:00
pooka 49bb662cc0 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.
2013-04-28 13:37:51 +00:00
pooka b8f5ee1a3f roll mutex init hypercalls into one (one of them already took a flag anyway) 2013-04-27 16:32:56 +00:00
pooka 93b95ff6a0 * integrate rumpuser_getversion() with the hypervisor initialization
* rename some identifiers to better match reality
2013-04-27 14:59:08 +00:00
pooka bc3aabc030 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.
2013-04-27 13:59:46 +00:00
pooka a3f7afe3bd As reported by several people, the signature of pthread_setname_np() varies
from one Linux distro to another (didn't suspect it to be *that* _np).
Comment out the call on Linux pending autoconf support.
2013-02-11 16:02:31 +00:00
pooka e0f5e00388 Support Cygwin as a hypervisor. 2013-01-14 21:00:16 +00:00
pooka 0d8e694036 PTHREAD_PROCESS_SHARED private doesn't seem to work on DragonFly, so
init the spin lock _PRIVATE (we don't really care which it is).
2012-11-26 17:54:51 +00:00
pooka 6bc4679626 call pthread_setname_np() on Linux too. 2012-10-08 18:02:04 +00:00
pooka 3b3ffd7039 Once again, make the rump kernel hypercall layer work on Linux. 2012-07-27 09:09:05 +00:00
yamt 7597b0c1e6 fix indent. no functional changes. 2011-02-05 13:51:56 +00:00
pooka 48ac8b3849 implement mutex_owner() 2010-12-01 17:22:51 +00:00
pooka 0f9fe55ba4 Umm, delete recursive mutex interface instead of renaming it. 2010-12-01 15:01:52 +00:00
pooka 5e1b7bf36d 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.
2010-12-01 14:59:37 +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 b1b7862792 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.
2010-05-18 14:58:41 +00:00
pooka 6e4a9f9133 librumpuser is not _KERNEL code and does not belong in sys. Move
the source files from src/sys/rump/librump/rumpuser to src/lib/librumpuser
(from where it is already built).  Even so, keep rumpuser.h in
sys/rump/include for kernel source tree self-containment.
2010-02-26 18:54:20 +00:00