aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_mutex.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Tidy up some unused variablesPeter Wemm2002-02-201-5/+0
| | | | Notes: svn path=/head/; revision=90997
* Add kern_giant_ucred to instrument Giant around ucred related operationsMatthew Dillon2002-02-181-0/+2
| | | | | | | such a getgid(), setgid(), etc... Notes: svn path=/head/; revision=90864
* In a threaded world, differnt priorirites become properties ofJulian Elischer2002-02-111-15/+13
| | | | | | | | | different entities. Make it so. Reviewed by: jhb@freebsd.org (john baldwin) Notes: svn path=/head/; revision=90538
* Use the mtx_owner() macro in one spot in _mtx_lock_sleep() to make theJohn Baldwin2002-02-091-1/+1
| | | | | | | code easier to read. Notes: svn path=/head/; revision=90418
* Bump the limits for determining if we've held a spinlock too long as theyJohn Baldwin2002-01-151-2/+2
| | | | | | | | | | seem to be too short for the 500 Mhz DS20 I'm testing on. The rather arbitrary numbers are rather bogus anyways. We should probably have variables for these limits that are calibrated in the MD startup code somehow. Notes: svn path=/head/; revision=89392
* Change the preemption code for software interrupt thread schedules andJohn Baldwin2002-01-051-11/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mutex releases to not require flags for the cases when preemption is not allowed: The purpose of the MTX_NOSWITCH and SWI_NOSWITCH flags is to prevent switching to a higher priority thread on mutex releease and swi schedule, respectively when that switch is not safe. Now that the critical section API maintains a per-thread nesting count, the kernel can easily check whether or not it should switch without relying on flags from the programmer. This fixes a few bugs in that all current callers of swi_sched() used SWI_NOSWITCH, when in fact, only the ones called from fast interrupt handlers and the swi_sched of softclock needed this flag. Note that to ensure that swi_sched()'s in clock and fast interrupt handlers do not switch, these handlers have to be explicitly wrapped in critical_enter/exit pairs. Presently, just wrapping the handlers is sufficient, but in the future with the fully preemptive kernel, the interrupt must be EOI'd before critical_exit() is called. (critical_exit() can switch due to a deferred preemption in a fully preemptive kernel.) I've tested the changes to the interrupt code on i386 and alpha. I have not tested ia64, but the interrupt code is almost identical to the alpha code, so I expect it will work fine. PowerPC and ARM do not yet have interrupt code in the tree so they shouldn't be broken. Sparc64 is broken, but that's been ok'd by jake and tmm who will be fixing the interrupt code for sparc64 shortly. Reviewed by: peter Tested on: i386, alpha Notes: svn path=/head/; revision=88900
* Modify the critical section API as follows:John Baldwin2001-12-181-5/+3
| | | | | | | | | | | | | | | | | | | | | | - The MD functions critical_enter/exit are renamed to start with a cpu_ prefix. - MI wrapper functions critical_enter/exit maintain a per-thread nesting count and a per-thread critical section saved state set when entering a critical section while at nesting level 0 and restored when exiting to nesting level 0. This moves the saved state out of spin mutexes so that interlocking spin mutexes works properly. - Most low-level MD code that used critical_enter/exit now use cpu_critical_enter/exit. MI code such as device drivers and spin mutexes use the MI wrappers. Note that since the MI wrappers store the state in the current thread, they do not have any return values or arguments. - mtx_intr_enable() is replaced with a constant CRITICAL_FORK which is assigned to curthread->td_savecrit during fork_exit(). Tested on: i386, alpha Notes: svn path=/head/; revision=88088
* Remove definition of witness and comment stating that this file implementsJohn Baldwin2001-11-151-22/+1
| | | | | | | witness. Witness moved off to subr_witness.c a while ago. Notes: svn path=/head/; revision=86411
* Add mtx_lock_giant() and mtx_unlock_giant() wrappers for sysctl managementMatthew Dillon2001-10-261-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of Giant during the Giant unwinding phase, and start work on instrumenting Giant for the file and proc mutexes. These wrappers allow developers to turn on and off Giant around various subsystems. DEVELOPERS SHOULD NEVER TURN OFF GIANT AROUND A SUBSYSTEM JUST BECAUSE THE SYSCTL EXISTS! General developers should only considering turning on Giant for a subsystem whos default is off (to help track down bugs). Only developers working on particular subsystems who know what they are doing should consider turning off Giant. These wrappers will greatly improve our ability to unwind Giant and test the kernel on a (mostly) subsystem by subsystem basis. They allow Giant unwinding developers (GUDs) to emplace appropriate subsystem and structural mutexes in the main tree and then request that the larger community test the work by turning off Giant around the subsystem(s), without the larger community having to mess around with patches. These wrappers also allow GUDs to boot into a (more likely to be) working system in the midst of their unwinding work and to test that work under more controlled circumstances. There is a master sysctl, kern.giant.all, which defaults to 0 (off). If turned on it overrides *ALL* other kern.giant sysctls and forces Giant to be turned on for all wrapped subsystems. If turned off then Giant around individual subsystems are controlled by various other kern.giant.XXX sysctls. Code which overlaps multiple subsystems must have all related subsystem Giant sysctls turned off in order to run without Giant. Notes: svn path=/head/; revision=85564
* The mtx_init() and sx_init() functions bzero'd locks before handing themJohn Baldwin2001-10-201-1/+3
| | | | | | | | | off to witness_init() making the check for double intializating a lock by testing the LO_INITIALIZED flag moot. Workaround this by checking the LO_INITIALIZED flag ourself before we bzero the lock structure. Notes: svn path=/head/; revision=85205
* Remove superflous parens after de-macroizing.John Baldwin2001-09-261-2/+2
| | | | Notes: svn path=/head/; revision=83947
* Since we no longer inline any debugging code in the mutex operations, moveJohn Baldwin2001-09-221-4/+24
| | | | | | | | | | | all the debugging code into the function versions of the mutex operations in kern_mutex.c. This reduced the __mtx_* macros to simply wrappers of the _{get,rel}_lock_* macros, so the __mtx_* macros were also abolished in favor of just calling the _{get,rel}_lock_* macros. The tangled hairy mass of macros calling macros is at least a bit more sane now. Notes: svn path=/head/; revision=83841
* Fix a bug in propagate priority: the kse group pointer wasn't beingJohn Baldwin2001-09-191-0/+1
| | | | | | | | updated in the loop so the new thread always seemd to have the same priority as the original thread and no actual priorities were changed. Notes: svn path=/head/; revision=83679
* KSE Milestone 2Julian Elischer2001-09-121-95/+103
| | | | | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha Notes: svn path=/head/; revision=83366
* Force a commit on kern_mutex.c to explain reason for last commit but whileBosko Milekic2001-08-241-0/+5
| | | | | | | | | | | | | | | I'm at it also add a comment in mtx_validate() explaining the purpose of the last change. Basically, this fixes booting kernels compiled with MUTEX_DEBUG. What used to happen is before we setidt from init386() [still using BTX idt], we called mtx_init() on several mutex locks, notably Giant and some others. This is a problem for MUTEX_DEBUG because it enables mtx_validate() which calls kernacc(), some of which in turn requires Giant. Fix by calling kernacc() from mtx_validate() only if (!cold). Notes: svn path=/head/; revision=82304
* *** empty log message ***Bosko Milekic2001-08-241-2/+4
| | | | Notes: svn path=/head/; revision=82302
* If we have already panic'd then don't bother enforcing mutex asserts asJohn Baldwin2001-07-311-0/+3
| | | | | | | | | | things are pretty much shot already and all panic'ing does is hurt our chances of getting a dump. Inspired by: sheldonh Notes: svn path=/head/; revision=80748
* Count the context switch when blocking on a mutex as a voluntary contextJohn Baldwin2001-06-251-0/+3
| | | | | | | | | | | switch. Count the context switch when preempting the current thread to let a higher priority thread blocked on a mutex we just released run as an involuntary context switch. Reported by: bde Notes: svn path=/head/; revision=78766
* - Move state about lock objects out of struct lock_object and into a newJohn Baldwin2001-05-041-39/+4
| | | | | | | | | | | | | | | | | | | | | | | struct lock_instance that is stored in the per-process and per-CPU lock lists. Previously, the lock lists just kept a pointer to each lock held. That pointer is now replaced by a lock instance which contains a pointer to the lock object, the file and line of the last acquisition of a lock, and various flags about a lock including its recursion count. - If we sleep while holding a sleepable lock, then mark that lock instance as having slept and ignore any lock order violations that occur while acquiring Giant when we wake up with slept locks. This is ok because of Giant's special nature. - Allow witness to differentiate between shared and exclusive locks and unlocks of a lock. Witness will now detect the case when a lock is acquired first in one mode and then in another. Mutexes are always locked and unlocked exclusively. Witness will also now detect the case where a process attempts to unlock a shared lock while holding an exclusive lock and vice versa. - Fix a bug in the lock list implementation where we used the wrong constant to detect the case where a lock list entry was full. Notes: svn path=/head/; revision=76272
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inMark Murray2001-05-011-1/+1
| | | | | | | | | | | | | | other "system" header files. Also help the deprecation of lockmgr.h by making it a sub-include of sys/lock.h and removing sys/lockmgr.h form kernel .c files. Sort sys/*.h includes where possible in affected files. OK'ed by: bde (with reservations) Notes: svn path=/head/; revision=76166
* Exit and re-enter the critical section while spinning for a spinlock soJohn Baldwin2001-04-171-0/+3
| | | | | | | that interrupts can come in while we are waiting for a lock. Notes: svn path=/head/; revision=75568
* Handle a rare but fatal race invoked sometimes when SIGSTOP isMark Murray2001-04-131-1/+1
| | | | | | | invoked. Notes: svn path=/head/; revision=75468
* Rework the witness code to work with sx locks as well as mutexes.John Baldwin2001-03-281-1124/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Introduce lock classes and lock objects. Each lock class specifies a name and set of flags (or properties) shared by all locks of a given type. Currently there are three lock classes: spin mutexes, sleep mutexes, and sx locks. A lock object specifies properties of an additional lock along with a lock name and all of the extra stuff needed to make witness work with a given lock. This abstract lock stuff is defined in sys/lock.h. The lockmgr constants, types, and prototypes have been moved to sys/lockmgr.h. For temporary backwards compatability, sys/lock.h includes sys/lockmgr.h. - Replace proc->p_spinlocks with a per-CPU list, PCPU(spinlocks), of spin locks held. By making this per-cpu, we do not have to jump through magic hoops to deal with sched_lock changing ownership during context switches. - Replace proc->p_heldmtx, formerly a list of held sleep mutexes, with proc->p_sleeplocks, which is a list of held sleep locks including sleep mutexes and sx locks. - Add helper macros for logging lock events via the KTR_LOCK KTR logging level so that the log messages are consistent. - Add some new flags that can be passed to mtx_init(): - MTX_NOWITNESS - specifies that this lock should be ignored by witness. This is used for the mutex that blocks a sx lock for example. - MTX_QUIET - this is not new, but you can pass this to mtx_init() now and no events will be logged for this lock, so that one doesn't have to change all the individual mtx_lock/unlock() operations. - All lock objects maintain an initialized flag. Use this flag to export a mtx_initialized() macro that can be safely called from drivers. Also, we on longer walk the all_mtx list if MUTEX_DEBUG is defined as witness performs the corresponding checks using the initialized flag. - The lock order reversal messages have been improved to output slightly more accurate file and line numbers. Notes: svn path=/head/; revision=74912
* - Switch from using save/disable/restore_intr to using critical_enter/exitJohn Baldwin2001-03-281-2/+34
| | | | | | | | | | | | | | | | | | | | and change the u_int mtx_saveintr member of struct mtx to a critical_t mtx_savecrit. - On the alpha we no longer need a custom _get_spin_lock() macro to avoid an extra PAL call, so remove it. - Partially fix using mutexes with WITNESS in modules. Change all the _mtx_{un,}lock_{spin,}_flags() macros to accept explicit file and line parameters and rename them to use a prefix of two underscores. Inside of kern_mutex.c, generate wrapper functions for _mtx_{un,}lock_{spin,}_flags() (only using a prefix of one underscore) that are called from modules. The macros mtx_{un,}lock_{spin,}_flags() are mapped to the __mtx_* macros inside of the kernel to inline the usual case of mutex operations and map to the internal _mtx_* functions in the module case so that modules will use WITNESS and KTR logging if the kernel is compiled with support for it. Notes: svn path=/head/; revision=74900
* Fix mtx_legal2block. The only time that it is bad to block on a mutex isJohn Baldwin2001-03-091-2/+8
| | | | | | | | | | | | | | | | | | | if we hold a spin mutex, since we can trivially get into deadlocks if we start switching out of processes that hold spinlocks. Checking to see if interrupts were disabled was a sort of cheap way of doing this since most of the time interrupts were only disabled when holding a spin lock. At least on the i386. To fix this properly, use a per-process counter p_spinlocks that counts the number of spin locks currently held, and instead of checking to see if interrupts are disabled in the witness code, check to see if we hold any spin locks. Since child processes always start up with the sched lock magically held in fork_exit(), we initialize p_spinlocks to 1 for child processes. Note that proc0 doesn't go through fork_exit(), so it starts with no spin locks held. Consulting from: cp Notes: svn path=/head/; revision=74016
* - Add an extra check in priority_propagation() for UP systems to ensure weJohn Baldwin2001-03-071-1/+9
| | | | | | | | | | | don't end up back at ourselves which would indicate deadlock. - Add the proc lock to the witness dup_list as we may hold more than one process lock at a time. - Don't assert a mutex is owned in _mtx_unlock_sleep() as that is too late. We do the checks in the macros instead. Notes: svn path=/head/; revision=73912
* Shuffle netgraph mutexes a bit and hold a reference on a nodeJulian Elischer2001-02-281-2/+2
| | | | | | | from the function that is calling the destructor. Notes: svn path=/head/; revision=73238
* Sigh. Try to get priorities sorted out. Don't bother trying toJake Burkholder2001-02-281-2/+0
| | | | | | | | | | | | | | update native priority, it is diffcult to get right and likely to end up horribly wrong. Use an honestly wrong fixed value that seems to work; PUSER for user threads, and the interrupt priority for ithreads. Set it once when the process is created and forget about it. Suggested by: bde Pointy hat: me Notes: svn path=/head/; revision=73205
* Initialize native priority to PRI_MAX. It was usually 0 which made aJake Burkholder2001-02-261-11/+2
| | | | | | | | | | | process's priority go through the roof when it released a (contested) mutex. Only set the native priority in mtx_lock if hasn't already been set. Reviewed by: jhb Notes: svn path=/head/; revision=73114
* Remove brackets around variables in a function that used to beJake Burkholder2001-02-251-10/+10
| | | | | | | a macro. Notes: svn path=/head/; revision=73033
* Move netgraph spimlock order entries out ofJulian Elischer2001-02-251-2/+2
| | | | | | | the #ifdef SMP section. They need to be there for UP too. Notes: svn path=/head/; revision=73003
* Grrr, s/INVARIANTS_SUPPORT/INVARIANT_SUPPORT/.John Baldwin2001-02-241-1/+1
| | | | Notes: svn path=/head/; revision=72996
* - Axe RETIP() as it was very i386 specific and unwieldy. Instead, use theJohn Baldwin2001-02-241-13/+12
| | | | | | | | | | | | | | | | | | | | | passed in filename and line number in the KTR tracepoint message. - Even though it is #if 0'd code, change the code to detect that a process is an interrupt thread to check p->p_ithd against NULL rather than checking non-existant process flags from BSD/OS. - Use '%p' to print pointers in KTR log messages instead of assuming sizeof(int) == sizeof(void *). - Don't set p_mtxname to NULL when releasing a mutex. It doesn't hurt to leave it set (we don't clear w_mesg for example) and at least at one time in the past, there used to be race conditions in the kernel that would result in setting this to NULL causing the kernel to dereference NULL. - Make the _mtx_assert() function be compiled in if INVARIANTS_SUPPORT is defined rather than if INVARIANTS is defined so that a KLD compiled with INVARIANTS that uses mtx_assert() can be used with a kernel that just has INVARIANT_SUPPORT compiled in. Notes: svn path=/head/; revision=72994
* Add knowledge of the netgraph spinlocks into the Witness code.Julian Elischer2001-02-241-0/+2
| | | | | | | Well, at least I think that's how it's done. Notes: svn path=/head/; revision=72979
* - Use the NOCPU constant.John Baldwin2001-02-221-3/+3
| | | | | | | | - Move the ithread spin locks before sched lock and clk in preparation for future commits to the ithread code. Notes: svn path=/head/; revision=72836
* Change all instances of `CURPROC' and `CURTHD' to `curproc,' in orderBosko Milekic2001-02-121-10/+10
| | | | | | | | | to stay consistent. Requested by: bde Notes: svn path=/head/; revision=72393
* Implement a unified run queue and adjust priority levels accordingly.Jake Burkholder2001-02-121-41/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - All processes go into the same array of queues, with different scheduling classes using different portions of the array. This allows user processes to have their priorities propogated up into interrupt thread range if need be. - I chose 64 run queues as an arbitrary number that is greater than 32. We used to have 4 separate arrays of 32 queues each, so this may not be optimal. The new run queue code was written with this in mind; changing the number of run queues only requires changing constants in runq.h and adjusting the priority levels. - The new run queue code takes the run queue as a parameter. This is intended to be used to create per-cpu run queues. Implement wrappers for compatibility with the old interface which pass in the global run queue structure. - Group the priority level, user priority, native priority (before propogation) and the scheduling class into a struct priority. - Change any hard coded priority levels that I found to use symbolic constants (TTIPRI and TTOPRI). - Remove the curpriority global variable and use that of curproc. This was used to detect when a process' priority had lowered and it should yield. We now effectively yield on every interrupt. - Activate propogate_priority(). It should now have the desired effect without needing to also propogate the scheduling class. - Temporarily comment out the call to vm_page_zero_idle() in the idle loop. It interfered with propogate_priority() because the idle process needed to do a non-blocking acquire of Giant and then other processes would try to propogate their priority onto it. The idle process should not do anything except idle. vm_page_zero_idle() will return in the form of an idle priority kernel thread which is woken up at apprioriate times by the vm system. - Update struct kinfo_proc to the new priority interface. Deliberately change its size by adjusting the spare fields. It remained the same size, but the layout has changed, so userland processes that use it would parse the data incorrectly. The size constraint should really be changed to an arbitrary version number. Also add a debug.sizeof sysctl node for struct kinfo_proc. Notes: svn path=/head/; revision=72376
* - Place back STR string declarations for lock/unlock strings used for KTR_LOCKBosko Milekic2001-02-111-14/+19
| | | | | | | | | | | | | | | | | | tracing in order to avoid duplication. - Insert some tracepoints back into the mutex acq/rel code, thus ensuring that we can trace all lock acq/rel's again. - All CURPROC != NULL checks are MPASS()es (under MUTEX_DEBUG) because they signify a serious mutex corruption. - Change up some KASSERT()s to MPASS()es, and vice-versa, depending on the type of problem we're debugging (INVARIANTS is used here to check that the API is being used properly whereas MUTEX_DEBUG is used to ensure that something general isn't happening that will have bad impact on mutex locks). Reminded by: jhb, jake, asmodai Notes: svn path=/head/; revision=72344
* Unify the two sleep lock order lists to enforce the process lock ->John Baldwin2001-02-091-2/+2
| | | | | | | uidinfo lock locking order. Notes: svn path=/head/; revision=72256
* - Change the 'witness_list' ddb command to 'show mutexes'. Note that thisJohn Baldwin2001-02-091-18/+59
| | | | | | | | | | | | | | | | | will only display sleep mutexes held by the current process. - Clean up some nits in the witness_display() function and add a ddb command 'show witness' that dumps the hierarchy and order lists to the console. - Use queue(3) macros where appropriate. - Resort the spin lock order list so that "com" is before "sched_lock". Also, add appropriate #ifdef's around SMP and i386-specific mutexes. - Add two new mutexes used to protect the ithread lists and tables to the order list. Requested by: bde (1) Notes: svn path=/head/; revision=72224
* Change and clean the mutex lock interface.Bosko Milekic2001-02-091-546/+402
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mtx_enter(lock, type) becomes: mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks) mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized) similarily, for releasing a lock, we now have: mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN. We change the caller interface for the two different types of locks because the semantics are entirely different for each case, and this makes it explicitly clear and, at the same time, it rids us of the extra `type' argument. The enter->lock and exit->unlock change has been made with the idea that we're "locking data" and not "entering locked code" in mind. Further, remove all additional "flags" previously passed to the lock acquire/release routines with the exception of two: MTX_QUIET and MTX_NOSWITCH The functionality of these flags is preserved and they can be passed to the lock/unlock routines by calling the corresponding wrappers: mtx_{lock, unlock}_flags(lock, flag(s)) and mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN locks, respectively. Re-inline some lock acq/rel code; in the sleep lock case, we only inline the _obtain_lock()s in order to ensure that the inlined code fits into a cache line. In the spin lock case, we inline recursion and actually only perform a function call if we need to spin. This change has been made with the idea that we generally tend to avoid spin locks and that also the spin locks that we do have and are heavily used (i.e. sched_lock) do recurse, and therefore in an effort to reduce function call overhead for some architectures (such as alpha), we inline recursion for this case. Create a new malloc type for the witness code and retire from using the M_DEV type. The new type is called M_WITNESS and is only declared if WITNESS is enabled. Begin cleaning up some machdep/mutex.h code - specifically updated the "optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently need those. Finally, caught up to the interface changes in all sys code. Contributors: jake, jhb, jasone (in no particular order) Notes: svn path=/head/; revision=72200
* Add a new ddb command 'witness_list' that lists the mutexes held byJohn Baldwin2001-01-271-0/+10
| | | | | | | | | curproc. Requested by: peter Notes: svn path=/head/; revision=71709
* Convert all simplelocks to mutexes and remove the simplelock implementations.Jason Evans2001-01-241-0/+6
| | | | Notes: svn path=/head/; revision=71576
* - Don't use a union and fun tricks to shave one extra pointer off of structJohn Baldwin2001-01-241-84/+76
| | | | | | | | | | | | | | | | | | | | | mtx right now as it makes debugging harder. When we are in optimizing mode, we can revisit this. - Fix the KTR trace messages to use %p rather than 0x%p to avoid duplicate 0x's in KTR output. - During witness_fixup, release Giant so that witness doesn't get confused. Also, grab all_mtx while walking the list of mutexes. - Remove w_sleep and w_recurse. Instead, perform checks on mutexes using the mutex's mtx_flags field. - Allow debug.witness_ddb and debug.witness_skipspin to be set from the loader. - Add Giant to the front of existing order_list entries to help ensure Giant is always first. - Add an order entry for the various proc locks. Note that this only helps keep proc in order mostly as the allproc and proctree mutexes are only obtained during a lockmgr operation on the specified mutex. Notes: svn path=/head/; revision=71560
* Print correct file name and line number in mtx_assert().Jason Evans2001-01-221-6/+6
| | | | | | | Noticed by: jake Notes: svn path=/head/; revision=71360
* Move most of sys/mutex.h into kern/kern_mutex.c, thereby making the mutexJason Evans2001-01-211-75/+388
| | | | | | | | | | | | | | inline functions non-inlined. Hide parts of the mutex implementation that should not be exposed. Make sure that WITNESS code is not executed during boot until the mutexes are fully initialized by SI_SUB_MUTEX (the original motivation for this commit). Submitted by: peter Notes: svn path=/head/; revision=71352
* Make the order of the static initializer for all_mtx match the order ofJason Evans2001-01-211-2/+2
| | | | | | | | | fields in struct mtx. Found by: jake Notes: svn path=/head/; revision=71328
* Remove MUTEX_DECLARE() and MTX_COLD. Instead, postpone full mutexJason Evans2001-01-211-29/+81
| | | | | | | | | | | initialization until after malloc() is safe to call, then iterate through all mutexes and complete their initialization. This change is necessary in order to avoid some circular bootstrapping dependencies. Notes: svn path=/head/; revision=71320
* - Make npx_intr INTR_MPSAFE and move acquiring Giant into theJake Burkholder2001-01-201-20/+0
| | | | | | | | | function itself. - Remove a hack to allow acquiring Giant from the npx asm trap vector. Notes: svn path=/head/; revision=71287
* Implement MTX_RECURSE flag for mtx_init().Bosko Milekic2001-01-191-20/+55
| | | | | | | | | | | | | | | | | | | | | | All calls to mtx_init() for mutexes that recurse must now include the MTX_RECURSE bit in the flag argument variable. This change is in preparation for an upcoming (further) mutex API cleanup. The witness code will call panic() if a lock is found to recurse but the MTX_RECURSE bit was not set during the lock's initialization. The old MTX_RECURSE "state" bit (in mtx_lock) has been renamed to MTX_RECURSED, which is more appropriate given its meaning. The following locks have been made "recursive," thus far: eventhandler, Giant, callout, sched_lock, possibly some others declared in the architecture-specific code, all of the network card driver locks in pci/, as well as some other locks in dev/ stuff that I've found to be recursive. Reviewed by: jhb Notes: svn path=/head/; revision=71228