Age | Commit message (Collapse) | Author |
|
its basically atomic inc/dec, but it includes magical sleep code
in refcnt_finalise that is better written once than many times.
refcnt_finalise sleeps until all references are released and does
so with sleep_setup and sleep_finalize, which is fairly subtle.
putting this in now so i we can get on with work in the stack, a
proper discussion about visibility and how available intrinsics
should be in the kernel can happen after next week.
with help from guenther@
ok guenther@ deraadt@ mpi@
|
|
and doing VOP_WRITE() from inside tsleep/msleep makes the locking too
complicated, making it harder to move forward on MP changes.
ok deraadt@ kettenis@
|
|
portions of msleep and tsleep to give interrupts a chance to run
on other CPUs.
Tweak and OK kettenis
|
|
during autoconf and after panics.
Tweak and OK guenther, OK miod
|
|
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.
ok tedu@ deraadt@
|
|
ok guenther@
|
|
interrupt context to a taskq running in a thread. however, there
is a concern that if we do that then we allow accidental use of
sleeping APIs in this work, which will make it harder to move the
work back to interrupts in the future.
guenther and kettenis came up with the idea of marking a proc with
CANTSLEEP which the sleep paths can check and panic on.
this builds on that so you create taskqs that run with CANTSLEEP
set except when they need to sleep for more tasks to run.
the taskq_create api is changed to take a flags argument so users
can specify CANTSLEEP. MPSAFE is also passed via this flags field
now. this means archs that defined IPL_MPSAFE to 0 can now create
mpsafe taskqs too.
lots of discussion at s2k15
ok guenther@ miod@ mpi@ tedu@ pelikan@
|
|
don't need to be married.
ok guenther miod beck jsing kettenis
|
|
testing help mpi@
|
|
ok matthew@ phessler@ dlg@
|
|
to guarantee there isn't a window in which you can lose a wakeup. The
exception for tsleep() is when it's just being used to sleep for a period
of time, so permit that too.
ok jsing@ deraadt@
|
|
conditionals you did on timeout_pending can now be done on timeout_del
now that it returns what it did.
ok and a very good fix from kettenis@
|
|
|
|
|
|
aren't being passed to them. Fix UVM_WAIT() to not pass PNORELOCK to
tsleep(), as that flag only does something with msleep().
ok beck@ dlg@
|
|
|
|
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.
Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.
DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.
Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@
|
|
it's now atomic_lock to better reflect its usage, and librthread now
features a new spinlock that's really a ticket lock.
thrlseep can handle both types of lock via a flag in the clock arg.
(temp back compat hack)
remove some old stuff that's accumulated along the way and no longer used.
some feedback from dlg, who is concerned with all things ticket lock.
(you need to boot a new kernel before installing librthread)
|
|
ok deraadt guenther kettenis matthew
|
|
This also makes sure we call cpu_unidle() on the correct cpu, since the
inlining order was wrong and could call it on the old cpu.
ok kettenis@
|
|
priority of the current running process.
In amd64 a call to need_resched() sends an IPI to the other cpu.
This fixes aja@ problem where he would move the mouse and see 60000
IPIs being sent.
Thanks to mikeb@ for bringing that subject up tuesday.
Actually found this after inquiring guenther@ about some changes in
mi_switch().
ok guenther@ aja@
|
|
for the tick that we're already in the middle of.
noted and tested by aja; ok kurt@
|
|
of per-rthread. Handling of per-thread tick and runtime counters
inspired by how FreeBSD does it.
ok kettenis@
|
|
structs timespec, timeval, sigaction, and rlimit.
ok otto@ jsing@
|
|
particularly the "consume the signal you just sent" hang, and putting
the wait queues in userspace.
Do cancellation handling in pthread_cond_*wait(), pthread_join(),
and sem_wait().
Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add
'abort" argument to thrsleep to close cancellation race; make
thr{sleep,wakeup} return errno values via *retval to avoid touching
userspace errno.
|
|
when exec succeeds.
ok jsing@
|
|
declared in .h files, not in each .c. Apply that rule to endtsleep(),
scheduler_start(), updatepri(), and realitexpire()
ok deraadt@ tedu@
|
|
Spotted by miod some time ago.
ok miod guenther
|
|
(not done) hasn't changed, but now it's less work to test things.
ok art deraadt
|
|
does not have to deal with it as a common. Some platforms may be missed
by this commit... if you spot one, fix it the same way.
ok miod
|
|
the already-timed-out case to be the same (EWOULDBLOCK) as when it
times out after sleeping
|
|
race condition and prep for later support of pthread_condattr_setclock()
"get it in" deraadt@, tedu@, cheers by others
|
|
over why the processes were being woken up at splvm after the page daemon
ran - and probably also had the page daemon running at splvm after the first
pass through the loop.
ok art@ weingart@ oga@ ariane@
|
|
the need for casts when calling tsleep(), msleep(), and wakeup().
"I guess so" oga@ "it's masturbation" art@
|
|
- Split up choosing of cpu between fork and "normal" cases. Fork is
very different and should be treated as such.
- Instead of implicitly choosing a cpu in setrunqueue, do it outside
where it actually makes sense.
- Just because a cpu is marked as idle doesn't mean it will be soon.
There could be a thundering herd effect if we call wakeup from an
interrupt handler, so subtract cpus with queued processes when
deciding which cpu is actually idle.
- some simplifications allowed by the above.
kettenis@ ok (except one bugfix that was not in the intial diff)
|
|
- Split up run queues so that every cpu has one.
- Make setrunqueue choose the cpu where we want to make this process
runnable (this should be refined and less brutal in the future).
- When choosing the cpu where we want to run, make some kind of educated
guess where it will be best to run (very naive right now).
Other:
- Set operations for sets of cpus.
- load average calculations per cpu.
- sched_is_idle() -> curcpu_is_idle()
tested, debugged and prodded by many@
|
|
process sleeping on a unique address (wakeup -> wakeup_one)
ok guenther@, tedu@, art@
|
|
|
|
|
|
use the constant for IPL_SCHED, and not splsched(), which doesn't do what
we want.
ok art@. Tested by Paul de Weerd.
|
|
Since mutexes mess around with spl levels, and the sched-lock isn't a
mutex, we need to make sure to fix the IPL when msleep does the locking.
ok art.
|
|
parameter. The mutex is unlocked just before sleep and relocked after
unless P_NORELOCK is in flags, in which case it is left unlocked.
ok art@.
|
|
- Move the functionality of choosing a process from cpu_switch into
a much simpler function: cpu_switchto. Instead of having the locore
code walk the run queues, let the MI code choose the process we
want to run and only implement the context switching itself in MD
code.
- Let MD context switching run without worrying about spls or locks.
- Instead of having the idle loop implemented with special contexts
in MD code, implement one idle proc for each cpu. make the idle
loop MI with MD hooks.
- Change the proc lists from the old style vax queues to TAILQs.
- Change the sleep queue from vax queues to TAILQs. This makes
wakeup() go from O(n^2) to O(n)
there will be some MD fallout, but it will be fixed shortly.
There's also a few cleanups to be done after this.
deraadt@, kettenis@ ok
|
|
have cpu_info now, so kill the option.
eyeballed by jsg@ and grange@
|
|
a new struct. Instead of doing a huge rename and deal with the fallout
for weeks, like other projects that need no mention, we will slowly and
carefully move things out of struct proc into a new struct process.
- Create struct process and the infrastructure to create and remove them.
- Move threads in a process into struct process.
deraadt@, tedu@ ok
|
|
everything into it" function, there are now 6 stages of tsleep with
an on-stack (remember that kernel stacks are not swappable now?)
structure that keeps track of the state.
This way we first setup the sleep, setup the events that might break the
sleep, finish the sleep (actually sleeping) and then take care of the
events that could wake us up.
In the future this will make it easier to implement functionality like:
setup sleep, release lock or check some condition, finish sleep, in a
race-free way and without duplicating or complicating the tsleep function
too much.
miod@, millert@ ok.
|
|
weren't on the sleep queues, the condition we were sleeping on might
have changed, so we need to go back to userland and recheck that condition.
This fixes the majority of lockups and and hanging threads in rthreads
since it fixes a race in the semaphore code.
ok tedu@
|
|
it's a good idea to use atomic.h operations on it. This mechanic
change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling
need_proftick and it's automatically cleared by ADDUPC. There's
no reason for MD handling of that flag since everyone handles it the
same way.
kettenis@ ok
|
|
should never be referenced outside the context of the process to which
this stack belongs unless we do the PHOLD/PRELE dance. Loads of code
doesn't follow the rules here. Instead of trying to track down all
offenders and fix this hairy situation, it makes much more sense
to not swap kernel stacks.
From art@, tested by many some time ago.
|
|
i got carried away and deleted a whole bunch of useless casts
this is C, not C++. ok md5
|