Commit Graph

1930 Commits

Author SHA1 Message Date
ross 2f76dd5371 In getnewvnode(), initialize v_interlock when the vnode comes from the
pool allocator.
1999-08-14 06:23:59 +00:00
wrstuden 14693e0ca1 Modify comments regarding VOP_LOOKUP. Revised lookup description, and also
document both cases which can set PDIRUNLOCK.

Reviewed by Bill Sommerfeld.
1999-08-11 00:20:50 +00:00
thorpej cca4496da7 Use cpuid_t and cpu_number(). 1999-08-10 21:10:20 +00:00
ross ff87f817c1 Call stopprofclock(p) from sys_execve(). 1999-08-09 02:42:20 +00:00
thorpej eb20bbc780 Change the semantics of splsoftclock() to be like other spl*() functions,
that is priority is rasied.  Add a new spllowersoftclock() to provide the
atomic drop-to-softclock semantics that the old splsoftclock() provided,
and update calls accordingly.

This fixes a problem with using the "rnd" pseudo-device from within
interrupt context to extract random data (e.g. from within the softnet
interrupt) where doing so would incorrectly unblock interrupts (causing
all sorts of lossage).

XXX 4 platforms do not have priority-raising capability: newsmips, sparc,
XXX sparc64, and VAX.  This platforms still have this bug until their
XXX spl*() functions are fixed.
1999-08-05 18:08:08 +00:00
sommerfeld 2aa9696fee Implement arp_drain(), which frees packets tied up in the arp cache if
mbufs are in short supply.
Create a (trivial) protocol domain for arp so that the drain routine will
be called from m_reclaim()
1999-08-05 04:04:28 +00:00
sommerfeld b8e4538f80 Create new pool flag PR_LIMITFAIL, indicating that even PR_WAIT
allocations should fail if the pool is at its hard limit.
Document flag in pool(9).
Use it in mbuf.h for the first allocate call for M_GET, M_GETHDR, and
MCLGET, so that m_reclaim gets called even for blocking allocations.
1999-08-05 04:00:03 +00:00
thorpej 428443a130 Add some more diagnostic information to the 3 different `panic("m_copym")'
calls.
1999-08-05 02:24:29 +00:00
mycroft f85ee5e22e The old compaction test had an off-by-one error that caused it to not compact
in some cases where it could have.  Fix this, and the new version as well.
1999-08-04 22:33:20 +00:00
matt 0dc0497a97 Don't compress mbuf clusters which are referenced by multiple
mbufs since you might overwriting valuable data.  (think of
m_copy'ed data from a TCP re-transmission queue.  Since those
might be in clusters and referenced in two sockets).
1999-08-04 21:40:39 +00:00
mycroft 545d8679c0 It's now possible for sbcompress() to compact mbuf clusters, so do it.
This helps prevent mbuf cluster exhaustion when receiving lots of small
packets.
1999-08-04 21:30:12 +00:00
wrstuden 3bf14d81e9 Add support for fcntl(2) to generate VOP_FCNTL calls. Any fcntl
call with F_FSCTL set and F_SETFL calls generate calls to a new
fileop fo_fcntl. Add genfs_fcntl() and soo_fcntl() which return 0
for F_SETFL and EOPNOTSUPP otherwise. Have all leaf filesystems
use genfs_fcntl().

Reviewed by: thorpej
Tested by: wrstuden
1999-08-03 20:19:16 +00:00
wrstuden ae0b6372e0 Regen for revision: 1.19 of vnode_if.src. 1999-08-03 18:20:22 +00:00
wrstuden 5896b56eae Add VOP_FCNTL. 1999-08-03 18:19:08 +00:00
wrstuden cca0c4f6de Modify how lookup walks up mount points. As suggested by Konrad
Schroder <perseant@hitl.washington.edu>, unlock the mounted on
vnode before we call VFS_ROOT so that we cover the case where the new
root vnode shares a lock with the mounted-on vnode. Note that we have
asserted vfs_busy on the new fs before unlocking, so no other process can
steal the mount out from under us.
1999-08-03 18:17:24 +00:00
christos 93146392a8 OpenBSD patch to prevent non-root users who own block or character devices
(typically ttys or ptys) from changing the flags on them. [Commit by cjs.]
1999-07-31 03:18:43 +00:00
sommerfeld 3267e5e87d Probable fix for PR7943: lookups fail spuriously over NFS.
The problem was due to an interaction between the doomed unmounts done by
amd and getnewvnode.
I convinced myself that it's ok for getnewvnode() to do a sleeping vfs_busy().

Tested with multiple builds running while another process attempted to unmount
/usr once a second.
1999-07-29 13:31:45 +00:00
thorpej cb41412726 Fix a thinko in draining of spin locks: bump waitcount in the spin case,
too.  Remove some needless code duplication by adding a "drain" argument
to the ACQUIRE() macro (compiler can [and does] optimize the constant
conditional).
1999-07-28 19:29:39 +00:00
mellon a976011fcf - Correct the definition of the COUNT macro so that it takes the same
number of arguments when compiled without DIAGNOSTIC as with.
1999-07-28 01:59:46 +00:00
thorpej 0b1b32b6ff Make sure the kprintf_slock is initialized, and use the low-level atomic
locking primitive directly to lock it, since those will never attempt
to call printf() to display debugging information (and thus deadlock
on recursion into the kprintf_slock).
1999-07-27 21:50:37 +00:00
thorpej cd992b17df In _pool_put(), call simple_lock_freecheck() if we're LOCKDEBUG before
we put the item on the free list.
1999-07-27 21:31:17 +00:00
thorpej 6390046137 Improve the LOCKDEBUG code:
- Now compatible with MULTIPROCESSOR (requires other changes not yet
  committed, but which will be later today).
- In addition to tracking simple locks, track exclusive spin locks.
- Count spin locks like we do sleep locks (in the cpu_info for this
  CPU).
- Lock debug lists are now TAILQs, so as to make the locking order
  more obvious when dumping the list.

Also, some suggestions from Bill Sommerfeld:
- SIMPLELOCK_LOCKED and SIMPLELOCK_UNLOCKED constants, which may be
  defined in <machine/lock.h> (default to 1 and 0, respectively).  This
  makes it easier to support architectures which use test-and-clear
  rather than test-and-set.
- Add __attribute__((__aligned__)) to the `lock_data' member of the
  simplelock structure.  This makes it easier to support architectures
  which can only perform atomic operations on very-well-aligned memory
  locations.  NOTE: This changes the size of struct simplelock, and
  will cause a version bump.
1999-07-27 21:29:15 +00:00
thorpej c0e24db820 Use wakeup_one() for waking up sleep lock sleepers. 1999-07-26 23:02:53 +00:00
thorpej 1bd7bb28ea Implement wakeup_one(), which wakes up the highest priority process
first in line for the specified identifier.  For use in places where
you don't want a Thundering Herd.

While here, add an optimization to wakeup() suggested by Ross Harvey.
1999-07-26 23:00:58 +00:00
wrstuden eeefc02aec Add VLAYER to tests which will cause VOP_REVOKE to be called in sys_revoke(). 1999-07-26 19:20:09 +00:00
darrenr 8b165c84f7 don't log an error for ktrace if it's EPIPE - an error that should be
expected with fktrace/ktruss (i.e the error is `noise').
1999-07-25 13:59:08 +00:00
thorpej ea8fb3e04a Turn the proclist lock into a read/write spinlock. Update proclist locking
calls to reflect this.  Also, block statclock rather than softclock during
in the proclist locking functions, to address a problem reported on
current-users by Sean Doran.
1999-07-25 06:30:33 +00:00
thorpej 50f9f26fe1 Add a spin lock mode to the lock manager. Provides a read/write
spin lock facility.  Some code and ideas from Ross Harvey.
1999-07-25 06:24:22 +00:00
tron d5442d74c5 Fix NULL pointer access. Patch supplied by Dave Huang in PR kern/8055. 1999-07-24 15:10:02 +00:00
thorpej 014078a731 Garbage collect. 1999-07-22 23:31:07 +00:00
thorpej 2860ae9b30 Add proclist locking where appropriate (forgot to commit this file previously). 1999-07-22 23:00:27 +00:00
thorpej 01a8cffe77 Add a read/write lock to the proclists and PID hash table. Use the
write lock when doing PID allocation, and during the process exit path.
Use a read lock every where else, including within schedcpu() (interrupt
context).  Note that holding the write lock implies blocking schedcpu()
from running (blocks softclock).

PID allocation is now MP-safe.

Note this actually fixes a bug on single processor systems that was probably
extremely difficult to tickle; it was possible that schedcpu() would run
off a bad pointer if the right clock interrupt happened to come in the
middle of a LIST_INSERT_HEAD() or LIST_REMOVE() to/from allproc.
1999-07-22 21:08:30 +00:00
thorpej e8485145c1 Rearrange some code slightly. 1999-07-22 18:28:30 +00:00
thorpej 2715b812d1 Rework the process exit path, in preparation for making process exit
and PID allocation MP-safe.  A new process state is added: SDEAD.  This
state indicates that a process is dead, but not yet a zombie (has not
yet been processed by the process reaper).

SDEAD processes exist on both the zombproc list (via p_list) and deadproc
(via p_hash; the proc has been removed from the pidhash earlier in the exit
path).  When the reaper deals with a process, it changes the state to
SZOMB, so that wait4 can process it.

Add a P_ZOMBIE() macro, which treats a proc in SZOMB or SDEAD as a zombie,
and update various parts of the kernel to reflect the new state.
1999-07-22 18:13:36 +00:00
thorpej 32e1fd0d03 Move the call of cpu_wait() out of the wait4() functions, and into the
body of reaper(), right before the call to uvm_exit().  cpu_wait() must
be done before uvm_exit() because the resources it frees might be located
in the PCB.
1999-07-20 21:54:05 +00:00
chs fce05250f9 more cleanup:
remove simplelockrecurse, lockpausetime and PAUSE():
none of these serve any purpose anymore.
in the LOCKDEBUG functions, expand the splhigh() region to
cover the entire function.  without this there can still be races.
1999-07-19 03:21:11 +00:00
chs 327e64d87b remove simplelockrecurse, it's no longer needed. 1999-07-19 03:17:42 +00:00
thorpej c581bf97c5 A few things to make the Linux clone(2) emulation work a bit better:
- When the exit signal is specified to be 0, don't just assume they
  meant SIGCHLD.  In the Linux world, this appears to mean "don't deliver
  an exit signal at all".
- Simplify P_EXITSIG(); don't check against initproc here, just change
  the exit signal to SIGCHLD if reparenting to initproc.

A very simple clone(2) test program now works, and the MpegTV package
starts, but doesn't run properly yet (I believe there is a separate
bug which keeps it from working properly).
1999-07-15 23:18:41 +00:00
wrstuden a0f2937049 Define VLAYER and make layered fs's set this flag when creating their vnodes.
getnewvnode now checks this bit, and it if's set makes sure a vnode's not
locked before removing it from the free list.

Closes PR 7954 by Alan Barrett <apb@iafrica.com>.
1999-07-15 21:30:31 +00:00
thorpej 5fdbf26214 Regen. 1999-07-12 23:01:47 +00:00
thorpej bee019244f Remove two lines that were apparently added by accident. 1999-07-12 23:01:27 +00:00
kleink dfa5aad003 Regen. 1999-07-12 22:04:00 +00:00
kleink e79a283e47 XSH5: change function signature to `void *sbrk(intptr_t)'. 1999-07-12 21:55:19 +00:00
sommerfeld c4fe7934c5 Fix kern/7944: getcwd permission checking was overly restrictive.
(Don't require start directory to have read permission).
1999-07-11 09:27:23 +00:00
thorpej f9a7668b3f defopt IPSEC and IPSEC_ESP (both into opt_ipsec.h). 1999-07-09 22:57:15 +00:00
wrstuden 379a26972f Modify file systems to deal with struct lock in struct vnode. All leaf
fs's other than nfs use genfs_lock() for locking.

Modify lookup routines to set PDIRUNLOCK when they unlock the parrent.
1999-07-08 01:05:58 +00:00
wrstuden 332bef3064 Regen to reflect WILLPUT & WILLUNLOCK syntax. 1999-07-07 23:33:50 +00:00
wrstuden 99a1c75bcb Update syntax to support WILLUNLOCK and WILLPUT syntax. Change calls which
really vput to indicate that rather than just WILLRELE.
1999-07-07 23:32:50 +00:00
ws 974de8f7f8 Handle misalignment in vmcmd_map_readvn and vmcmd_map_zero correctly. 1999-07-07 20:23:45 +00:00
thorpej 7b3258b6a7 Make the kthread API a bit more friendly to loadable kernel modules. 1999-07-06 21:44:09 +00:00