From owner-cvs-all Wed Mar 28 1: 3:33 2001 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id C2F6537B71A; Wed, 28 Mar 2001 01:03:24 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f2S93OY61544; Wed, 28 Mar 2001 01:03:24 -0800 (PST) (envelope-from jhb) Message-Id: <200103280903.f2S93OY61544@freefall.freebsd.org> From: John Baldwin Date: Wed, 28 Mar 2001 01:03:24 -0800 (PST) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/alpha/alpha machdep.c src/sys/alpha/include globaldata.h src/sys/conf files src/sys/i386/i386 machdep.c mp_machdep.c src/sys/i386/include globaldata.h src/sys/ia64/ia64 machdep.c src/sys/ia64/include globaldata.h src/sys/kern ... X-FreeBSD-CVS-Branch: HEAD Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG jhb 2001/03/28 01:03:24 PST Modified files: sys/alpha/alpha machdep.c sys/alpha/include globaldata.h sys/conf files sys/i386/i386 machdep.c mp_machdep.c sys/i386/include globaldata.h sys/ia64/ia64 machdep.c sys/ia64/include globaldata.h sys/kern kern_condvar.c kern_fork.c kern_mutex.c kern_sx.c kern_synch.c subr_witness.c sys/sys kernel.h lock.h mutex.h proc.h sx.h Log: Rework the witness code to work with sx locks as well as mutexes. - 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. Revision Changes Path 1.119 +2 -3 src/sys/alpha/alpha/machdep.c 1.8 +2 -2 src/sys/alpha/include/globaldata.h 1.504 +2 -1 src/sys/conf/files 1.446 +3 -2 src/sys/i386/i386/machdep.c 1.149 +2 -1 src/sys/i386/i386/mp_machdep.c 1.25 +2 -1 src/sys/i386/include/globaldata.h 1.27 +2 -2 src/sys/ia64/ia64/machdep.c 1.8 +2 -2 src/sys/ia64/include/globaldata.h 1.6 +9 -9 src/sys/kern/kern_condvar.c 1.109 +2 -3 src/sys/kern/kern_fork.c 1.59 +119 -1125 src/sys/kern/kern_mutex.c 1.4 +63 -10 src/sys/kern/kern_sx.c 1.132 +7 -7 src/sys/kern/kern_synch.c 1.59 +707 -1270 src/sys/kern/subr_witness.c 1.85 +2 -2 src/sys/sys/kernel.h 1.28 +173 -187 src/sys/sys/lock.h 1.29 +52 -108 src/sys/sys/mutex.h 1.156 +2 -2 src/sys/sys/proc.h 1.6 +18 -10 src/sys/sys/sx.h To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message