Robert Watson [Wed, 2 Apr 2003 22:13:56 +0000 (22:13 +0000)]
When kill(-1) returns ESRCH, it could be because the current process
doesn't have a process group, which can occur if you're working with
a custom init that doesn't set up a full tty context. Rather than
refusing to reboot, ignore ESRCH from the kill attempt in reboot(8).
Robert Watson [Wed, 2 Apr 2003 20:22:29 +0000 (20:22 +0000)]
If stat() on the terminal specified in utmp fails due to ENOENT, don't
print a warning, and set the idletime variable for the entry to -1;
then pick up the -1 later in sprint() and lprint() and ignore those
idle times by printing just whitespace. When third party applications,
such as kdm, insert utmp entries, they sometimes use strings like ":0",
which can't be stat()'d and currently result in warnings that are
not helpful to the user.
Maxime Henrion [Wed, 2 Apr 2003 16:47:16 +0000 (16:47 +0000)]
Convert the fxp(4) driver to the busdma API.
This patch is rather big because I had to significantly redesign
the driver to make the busdma conversion possible. Most notably,
hardware and software structures were carefully splitted to get
rid of all the structs overlapping evilness.
Special thanks to phk and Richard Puga <puga@mauibuilt.com> for
providing me with fxp(4) hardware to do this work.
Thanks to marcel for testing this on ia64, and to Fred Clift
<fclift@verio.net> for testing this on alpha.
Need to hold the same SMP lock for (knote) list traversal as for
list manipulation. This lock also protects read-modify-write operations
on the pipe_state field.
Jeff Roberson [Wed, 2 Apr 2003 06:46:43 +0000 (06:46 +0000)]
- Add in support for KSEs with 0 slice values on the run queue. If we try
to select a KSE with a slice of 0 we will update its slice and insert it
onto the next queue.
- Pass the KSE instead of the ksegrp into sched_slice(). This more
accurately reflects the behavior of the code. Slices are granted to kses.
- Add a function kseq_nice_min() which finds the smallest nice value
assigned to the kseg of any KSE on the queue.
- Rewrite the logic in sched_slice(). Add a large comment describing the
new slice selection scheme. To summarize, slices are assigned based on
the nice value. Priorities are still calculated based on the nice and
interactivity of a process. Slice sizes of 0 may be granted for KSEs
whos nice is 20 or futher away from the lowest nice on the run queue.
Other nice values are scaled across the range [min, min+20]. This fixes
ULEs bad behavior with positively niced processes.
Jeff Roberson [Wed, 2 Apr 2003 03:05:39 +0000 (03:05 +0000)]
- Define curthread as _get_curthread() and remove all direct calls to
_get_curthread(). This is similar to the kernel's curthread. Doing
this saves stack overhead and is more convenient to the programmer.
- Pass the pointer to the newly created thread to _thread_init().
- Remove _get_curthread_slow().
- Fix UC_COPY_SIZE. Adding up the size of structure fields doesn't take
alignment into account.
- Return EJUSTRETURN from set_context on success to avoid clobbering the
first 2 out registers with td_retval on sparc64.
- Set the version number in the mcontext in get_mcontext and check it in
set_mcontext.
- Don't make assumptions about the alignment of the mcontext inside of the
ucontext; we have to save the floating point registers to the pcb and then
copy to the mcontext.
Jeff Roberson [Tue, 1 Apr 2003 22:41:41 +0000 (22:41 +0000)]
- Don't drop and reacquire giant in thread_suspend(). Change callers to do
this manually. This will facilitate the unrolling of giant.
- Don't allow giant to recurse anymore. This should never happen.
Jeff Roberson [Tue, 1 Apr 2003 22:39:31 +0000 (22:39 +0000)]
- Restore old mutex code from libc_r. It is more standards compliant.
This was changed because originally we were blocking on the umtx and
allowing the kernel to do the queueing. It was decided that the
lib should queue and start the threads in the order it decides and the
umtx code would just be used like spinlocks.
Observe conservation of packets when entering Fast Recovery while
doing Limited Transmit. Only artificially inflate the congestion
window by 1 segment instead of the usual 3 to take into account
the 2 already sent by Limited Transmit.
Approved in principle by: Mark Allman <mallman@grc.nasa.gov>,
Hari Balakrishnan <hari@nms.lcs.mit.edu>, Sally Floyd <floyd@icir.org>
John Baldwin [Tue, 1 Apr 2003 17:45:27 +0000 (17:45 +0000)]
Complete removal of 320.rdist by removing its entry from periodic.conf and
removing the related 220.backup-distfile script and associatd periodic.conf
entry.
Ruslan Ermilov [Tue, 1 Apr 2003 11:39:04 +0000 (11:39 +0000)]
Parallelize (on the top-level SUBDIR list) the "all" stage of
buildworld. This gives 5-11% percent gain in real buildworld
times on various UP and SMP systems here. I used 4 * hw.ncpu
as an argument to "make -j" in my tests.
- Add a flags field to struct pcb. Use this to keep track of wether or
not the pcb has floating point registers saved in it.
- Implement get_mcontext and set_mcontext.
- Rename pcb_fpstate to pcb_ufp (user floating point), and change it to
a simple array of 64 ints.
- Use a critical section when saving floating point state in cpu_fork
instead of sched_lock.
Jeff Roberson [Tue, 1 Apr 2003 03:46:29 +0000 (03:46 +0000)]
- Add libthr but don't hook it up to the regular build yet. This is an
adaptation of libc_r for the thr system call interface. This is beta
quality code.
Jeff Roberson [Tue, 1 Apr 2003 01:26:20 +0000 (01:26 +0000)]
- Borrow the KSE single threading code for exec and exit. We use the check
if (p->p_numthreads > 1) and not a flag because action is only necessary
if there are other threads. The rest of the system has no need to
identify thr threaded processes.
- In kern_thread.c use thr_exit1() instead of thread_exit() if P_THREADED
is not set.
Jeff Roberson [Tue, 1 Apr 2003 01:10:42 +0000 (01:10 +0000)]
- Add an api for doing smp safe locks in userland.
- umtx_lock() is defined as an inline in umtx.h. It tries to do an
uncontested acquire of a lock which falls back to the _umtx_lock()
system-call if that fails.
- umtx_unlock() is also an inline which falls back to _umtx_unlock() if the
uncontested unlock fails.
- Locks are keyed off of the thr_id_t of the currently running thread which
is currently just the pointer to the 'struct thread' in kernel.
- _umtx_lock() uses the proc pointer to synchronize access to blocked thread
queues which are stored in the first blocked thread.
Jeff Roberson [Tue, 1 Apr 2003 00:30:30 +0000 (00:30 +0000)]
- Add two files to support the thr threading interface.
- sys/thr.h contains the user space visible api that is intended only for
use in threading library packages.
- kern/kern_thr.c contains thr system calls and other thr specific code.
Jeff Roberson [Tue, 1 Apr 2003 00:18:55 +0000 (00:18 +0000)]
- Define a new md function 'casuptr'. This atomically compares and sets
a pointer that is in user space. It will be used as the basic primitive
for a kernel supported user space lock implementation.
- Implement this function in x86's support.s
- Provide stubs that return -1 in all other architectures. Implementations
will follow along shortly.
Jeff Roberson [Tue, 1 Apr 2003 00:16:32 +0000 (00:16 +0000)]
- In npxgetregs() use the td argument to save the fpu state from and not
curthread. Nothing currently depends on this behavior.
- Clean up an extra newline.
Jeff Roberson [Mon, 31 Mar 2003 23:30:41 +0000 (23:30 +0000)]
- Define sigwait, sigtimedwait, and sigwaitinfo in terms of
kern_sigtimedwait() which is capable of supporting all of their semantics.
- These should be POSIX compliant but more careful review is needed before
we announce this.