summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* - Use MUTEX_DECLARE() and MTX_COLD for the WITNESS code's internal mutex sojhb2000-10-273-168/+114
| | | | | | | | | | | | | | | | it can function before malloc(9) is up and running. - Add two new options WITNESS_DDB and WITNESS_SKIPSPIN. If WITNESS_SKIPSPIN is enabled, then spin mutexes are ignored by the WITNESS code. If WITNESS_DDB is turned on and DDB is compiled into the kernel, then the kernel will drop into DDB when either a lock hierarchy violation occurs or mutexes are held when going to sleep. - Add some new sysctls: debug.witness_ddb is a read-write sysctl that corresponds to WITNESS_DDB. The kernel option merely changes the default value to on at boot. debug.witness_skipspin is a read-only sysctl that one can use to determine if the kernel was compiled with WITNESS_SKIPSPIN. - Wipe out the BSD/OS-specific lock order lists. We get to build our own lists now as we add mutexes to the kernel.
* unstaticize change_ruid() because it is needed by osf1_setuid()gallatin2000-10-261-3/+1
|
* - Overhaul the software interrupt code to use interrupt threads for eachjhb2000-10-254-230/+170
| | | | | | | | | | | | | | | | | | | type of software interrupt. Roughly, what used to be a bit in spending now maps to a swi thread. Each thread can have multiple handlers, just like a hardware interrupt thread. - Instead of using a bitmask of pending interrupts, we schedule the specific software interrupt thread to run, so spending, NSWI, and the shandlers array are no longer needed. We can now have an arbitrary number of software interrupt threads. When you register a software interrupt thread via sinthand_add(), you get back a struct intrhand that you pass to sched_swi() when you wish to schedule your swi thread to run. - Convert the name of 'struct intrec' to 'struct intrhand' as it is a bit more intuitive. Also, prefix all the members of struct intrhand with 'ih_'. - Make swi_net() a MI function since there is now no point in it being MD. Submitted by: cp
* Quite some warnings.jhb2000-10-253-9/+9
|
* - Make the eventhandler_mutex mutex a private variable injhb2000-10-251-0/+1
| | | | | | subr_eventhandler.c - Move the extra #include's in sys/eventhandler.h to be protected by the #ifndef SYS_EVENTHANDLER/#endif
* Cleanup the rman_make_alignment_flags function to be much clearer and shorterimp2000-10-221-12/+10
| | | | than the prior version.
* Propogate the 'const'ness of mutex descriptions to the witness code tojhb2000-10-203-9/+9
| | | | quiet warnings.
* Actually enable the witness code if the WITNESS kernel option is enabled.jhb2000-10-203-15/+3
|
* Doh. Fix a 64-bit-ism by using uintptr_t for a temporary lock variablejhb2000-10-203-3/+3
| | | | instead of int.
* Introduce the M_ZERO flag to malloc(9)phk2000-10-201-0/+3
| | | | | | | | | | | | | | Instead of: foo = malloc(sizeof(foo), M_WAIT); bzero(foo, sizeof(foo)); You can now (and please do) use: foo = malloc(sizeof(foo), M_WAIT | M_ZERO); In the future this will enable us to do idle-time pre-zeroing of malloc-space.
* Catch up to moving headers:jhb2000-10-2025-36/+28
| | | | | - machine/ipl.h -> sys/ipl.h - machine/mutex.h -> sys/mutex.h
* - GC some #if 0'd code regarding the non-existant safepri variable.jhb2000-10-201-17/+6
| | | | | - Don't dink with the witness state of Giant unless we actually own it during mi_switch().
* - machine/mutex.h -> sys/mutex.hjhb2000-10-201-4/+3
| | | | - Use MUTEX_DECLARE() and MTX_COLD for the malloc_mtx mutex
* - machine/mutex.h -> sys/mutex.hjhb2000-10-201-5/+4
| | | | | - The initial lock_mtx mutex used in the lockmgr code is initialized very early, so use MUTEX_DECLARE() and MTX_COLD.
* - Make the mutex code almost completely machine independent. This greatlyjhb2000-10-203-30/+1785
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | reducues the maintenance load for the mutex code. The only MD portions of the mutex code are in machine/mutex.h now, which include the assembly macros for handling mutexes as well as optionally overriding the mutex micro-operations. For example, we use optimized micro-ops on the x86 platform #ifndef I386_CPU. - Change the behavior of the SMP_DEBUG kernel option. In the new code, mtx_assert() only depends on INVARIANTS, allowing other kernel developers to have working mutex assertiions without having to include all of the mutex debugging code. The SMP_DEBUG kernel option has been renamed to MUTEX_DEBUG and now just controls extra mutex debugging code. - Abolish the ugly mtx_f hack. Instead, we dynamically allocate seperate mtx_debug structures on the fly in mtx_init, except for mutexes that are initiated very early in the boot process. These mutexes are declared using a special MUTEX_DECLARE() macro, and use a new flag MTX_COLD when calling mtx_init. This is still somewhat hackish, but it is less evil than the mtx_f filler struct, and the mtx struct is now the same size with and without mutex debugging code. - Add some micro-micro-operation macros for doing the actual atomic operations on the mutex mtx_lock field to make it easier for other archs to override/optimize mutex ops if needed. These new tiny ops also clean up the code in some places by replacing long atomic operation function calls that spanned 2-3 lines with a short 1-line macro call. - Don't call mi_switch() from mtx_enter_hard() when we block while trying to obtain a sleep mutex. Calling mi_switch() would bogusly release Giant before switching to the next process. Instead, inline most of the code from mi_switch() in the mtx_enter_hard() function. Note that when we finally kill Giant we can back this out and go back to calling mi_switch().
* Reparent a kernel thread to init during kthread_exit() so that the zombiejhb2000-10-191-0/+1
| | | | can be reaped.
* o Introduce new VOP_ACCESS() flag VADMIN, allowing file systems to performrwatson2000-10-192-0/+10
| | | | | | | | | | | | | | | | | | | | "administrative" authorization checks. In most cases, the VADMIN test checks to make sure the credential effective uid is the same as the file owner. o Modify vaccess() to set VADMIN as an available right if the uid is appropriate. o Modify references to uid-based access control operations such that they now always invoke VOP_ACCESS() instead of using hard-coded policy checks. o This allows alternative UFS policies to be implemented by replacing only ufs_access() (such as mandatory system policies). o VOP_ACCESS() requires the caller to hold an exclusive vnode lock on the vnode: I believe that new invocations of VOP_ACCESS() are always called with the lock held. o Some direct checks of the uid remain, largely associated with the QUOTA and SUIDDIR code. Reviewed by: eivind Obtained from: TrustedBSD Project
* Axe the idle_event eventhandler, and add a MD cpu_idle function usedjhb2000-10-191-4/+3
| | | | | | for things such as halting CPU's, idling CPU's, etc. Discussed with: msmith
* EVENTHANDLER_INVOKE() takes two arguments.peter2000-10-181-1/+1
|
* Don't needlessly pass the diagnostic counter to the idle_event eventjhb2000-10-181-1/+1
| | | | handlers.
* Add new bus method 'GET_RESOURCE_LIST' and appropriate genericmdodd2000-10-182-0/+101
| | | | | | | | | | implementation. Add bus_generic_rl_{get,set,delete,release,alloc}_resource() functions which provide generic operations for devices using resource list style resource management. This should simplify a number of bus drivers. Further commits to follow.
* - Wrap the sanity checks for staying in the idle loop for absurdly longjhb2000-10-171-6/+12
| | | | | amounts of time in #ifdef DIAGNOSTIC - Call vm_page_zero_idle() during the idle loop.
* Implement resource alignment as discussed in arch@ a long time ago.imp2000-10-171-1/+23
| | | | | | | This was implemented by Shigeru YAMAMOTO-san and Jonathan Chen. I've cleaned them up somewhat and they seem to work well enough to boot current (but given current's state it can be hard to tell). Doug Rabson also reviewed the design and signed off on it.
* Put the header section in the header file not the c file.n_hibma2000-10-151-1/+1
| | | | | Submitted by: Jonathan Chen <jon@spock.org> PR: 21982
* Remove unneeded #include <machine/clock.h>phk2000-10-151-1/+0
|
* Add nmbcnt sysctl and make it tunable at boottime; nmbcnt is thebmilekic2000-10-151-1/+5
| | | | | | | | | | | | | number of ext_buf counters that are possibly allocatable. Do this because: (i) It will make it easier to influence EXT_COUNTERS for if_sk, if_ti (or similar) users where the driver allocates its own ext_bufs and where it is important for the mbuf system to take it into account when reserving necessary space for counters. (ii) Facilitate some percentile calculation for netstat(1)
* Remove the signal value check from the PT_STEP codepath. Itjwd2000-10-141-1/+1
| | | | | | | can cause an bogus failure. Reviewed by: Sean Eric Fagan <sef@kithrup.com> and no other response to the review request.
* savectx() is now used exclusively by the crash dump system. Move thepeter2000-10-131-3/+0
| | | | | i386 specific gunk (copy %cr3 to the pcb) from the MI dumpsys() to the MD savectx().
* Do not allocate a callout for all crashdumps, not just when you panic.ps2000-10-131-1/+2
|
* o Simplify capability types away from an array of ints to a singlerwatson2000-10-131-2/+9
| | | | | | | | | | | | | | | | | | u_int64_t flag field, bounding the number of capabilities at 64, but substantially cleaning up capability logic (there are currently 43 defined capabilities). o Heads up to anyone actually using capabilities: the constant assignments for various capabilities have been redone, so any persistent binary capability stores (i.e., '$posix1e.cap' EA backing files) must be recreated. If you have one of these, you'll know about it, so if you have no idea what this means, don't worry. o Update libposix1e to reflect this new definition, fixing the exposed functions that directly manipulate the flags fields. Obtained from: TrustedBSD Project
* For lockmgr mutex protection, use an array of mutexes that are allocatedjasone2000-10-122-22/+87
| | | | | | | | | and initialized during boot. This avoids bloating sizeof(struct lock). As a side effect, it is no longer necessary to enforce the assumtion that lockinit()/lockdestroy() calls are paired, so the LK_VALID flag has been removed. Idea taken from: BSD/OS.
* Add a gross hack for ia64 to allocate the backing store for a new program.dfr2000-10-121-0/+16
|
* Blow away the v_specmountpoint define, replacing it with what it waseivind2000-10-092-4/+4
| | | | defined as (rdev->si_mountpoint)
* Do not call lockdestroy() for v_vnlock, which may point to a lock in ajasone2000-10-062-8/+2
| | | | | | deeper vfs stacking layer. Submitted by: bp
* Correct a warning where the r_debug_state() dummy function used to triggerjhb2000-10-062-6/+12
| | | | | | a breakpoint in the kernel didn't use the proper argument list. To avoid having to include the userland link.h header everyhwere that sys/linker.h is used, make r_debug_state() a static function in link_elf.c as well.
* - Change fast interrupts on x86 to push a full interrupt frame and tojhb2000-10-064-33/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | return through doreti to handle ast's. This is necessary for the clock interrupts to work properly. - Change the clock interrupts on the x86 to be fast instead of threaded. This is needed because both hardclock() and statclock() need to run in the context of the current process, not in a separate thread context. - Kill the prevproc hack as it is no longer needed. - We really need Giant when we call psignal(), but we don't want to block during the clock interrupt. Instead, use two p_flag's in the proc struct to mark the current process as having a pending SIGVTALRM or a SIGPROF and let them be delivered during ast() when hardclock() has finished running. - Remove CLKF_BASEPRI, which was #ifdef'd out on the x86 anyways. It was broken on the x86 if it was turned on since cpl is gone. It's only use was to bogusly run softclock() directly during hardclock() rather than scheduling an SWI. - Remove the COM_LOCK simplelock and replace it with a clock_lock spin mutex. Since the spin mutex already handles disabling/restoring interrupts appropriately, this also lets us axe all the *_intr() fu. - Back out the hacks in the APIC_IO x86 cpu_initclocks() code to use temporary fast interrupts for the APIC trial. - Add two new process flags P_ALRMPEND and P_PROFPEND to mark the pending signals in hardclock() that are to be delivered in ast(). Submitted by: jakeb (making statclock safe in a fast interrupt) Submitted by: cp (concept of delaying signals until ast())
* Various whitespace cleanups after the SMPng commit, which jumbled thingsjhb2000-10-061-19/+19
| | | | around a bit in the trap handling code.
* Don't treat a kernel stack fault the same as a general protect fault orjhb2000-10-061-0/+3
| | | | a segment not present fault in the non-vm86 case.
* - Heavyweight interrupt threads on the alpha for device I/O interrupts.jhb2000-10-053-20/+227
| | | | | | | | | | | - Make softinterrupts (SWI's) almost completely MI, and divorce them completely from the x86 hardware interrupt code. - The ihandlers array is now gone. Instead, there is a MI shandlers array that just contains SWI handlers. - Most of the former machine/ipl.h files have moved to a new sys/ipl.h. - Stub out all the spl*() functions on all architectures. Submitted by: dfr
* Style fixes based on comments by bdeeivind2000-10-052-40/+62
|
* Add a workaround for statically linked kernels.dfr2000-10-041-0/+6
|
* Convert lockmgr locks from using simple locks to using mutexes.jasone2000-10-0411-191/+239
| | | | | | Add lockdestroy() and appropriate invocations, which corresponds to lockinit() and must be called to clean up after a lockmgr lock is no longer needed.
* Move KASSERTs which checks value of v_usecount after vnode locking, sobp2000-10-022-4/+8
| | | | it will not produce wrong alarms.
* Treat %X the same as %x (not entirely correct, but close enough).msmith2000-10-021-0/+1
|
* Big mbuf subsystem diff #1: incorporate mutexes and fix things up somewhatbmilekic2000-09-301-254/+207
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to accomodate the changes. Here's a list of things that have changed (I may have left out a few); for a relatively complete list, see http://people.freebsd.org/~bmilekic/mtx_journal * Remove old (once useful) mcluster code for MCLBYTES > PAGE_SIZE which nobody uses anymore. It was great while it lasted, but now we're moving onto bigger and better things (Approved by: wollman). * Practically re-wrote the allocation macros in sys/sys/mbuf.h to accomodate new allocations which grab the necessary lock. * Make sure that necessary mbstat variables are manipulated with corresponding atomic() routines. * Changed the "wait" routines, cleaned it up, made one routine that does the job. * Generalized MWAKEUP() macro. Got rid of m_retry and m_retryhdr, as they are now included in the generalized "wait" routines. * Sleep routines now use msleep(). * Free lists have locks. * etc... probably other stuff I'm missing... Things to look out for and work on later: * find a better way to (dynamically) adjust EXT_COUNTERS * move necessity to recurse on a lock from drain routines by providing lock-free lower-level version of MFREE() (and possibly m_free()?). * checkout include of mutex.h in sys/sys/mbuf.h - probably violating general philosophy here. The code has been reviewed quite a bit, but problems may arise... please, don't panic! Send me Emails: bmilekic@freebsd.org Reviewed by: jlemon, cp, alfred, others?
* Add ia64 support.dfr2000-09-291-1/+1
|
* Don't support dynamic linking on ia64 for now - the tools can't cope.dfr2000-09-292-0/+12
|
* Change the conditionaal so that we only build this on i386 instead ofdfr2000-09-291-1/+1
| | | | trying to build it on all non-alpha arches.
* Check so_error in filt_so{read|write} in order to detect UDP errors.jlemon2000-09-281-0/+4
| | | | PR: 21601
* Do the right thing if bdevvp is called twice for the same device.mckusick2000-09-272-0/+4
| | | | Obtained from: Poul-Henning Kamp <phk@freebsd.org>
OpenPOWER on IntegriCloud