Home | History | Annotate | Download | only in rumpkern
History log of /src/sys/rump/librump/rumpkern/ltsleep.c
RevisionDateAuthorComments
 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

RSS XML Feed