From owner-cvs-all Fri Oct 20 0:26:42 2000 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 12BA637B4CF; Fri, 20 Oct 2000 00:26:38 -0700 (PDT) Received: (from jhb@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id AAA40906; Fri, 20 Oct 2000 00:26:38 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Message-Id: <200010200726.AAA40906@freefall.freebsd.org> From: John Baldwin Date: Fri, 20 Oct 2000 00:26:38 -0700 (PDT) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/sys mutex.h src/sys/kern kern_mutex.c src/sys/i386/include mutex.h src/sys/i386/i386 synch_machdep.c src/sys/alpha/include mutex.h src/sys/alpha/alpha synch_machdep.c src/sys/ia64/include mutex.h src/sys/ia64/ia64 synch_machdep.c ... X-FreeBSD-CVS-Branch: HEAD Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG jhb 2000/10/20 00:26:37 PDT Modified files: sys/kern kern_mutex.c sys/i386/include mutex.h sys/alpha/include mutex.h sys/ia64/include mutex.h sys/conf files.alpha files.i386 files.ia64 files.pc98 options Added files: sys/sys mutex.h Removed files: sys/i386/i386 synch_machdep.c sys/alpha/alpha synch_machdep.c sys/ia64/ia64 synch_machdep.c Log: - Make the mutex code almost completely machine independent. This greatly 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(). Revision Changes Path 1.6 +596 -11 src/sys/kern/kern_mutex.c 1.11 +26 -515 src/sys/i386/include/mutex.h 1.12 +13 -469 src/sys/alpha/include/mutex.h 1.4 +15 -484 src/sys/ia64/include/mutex.h 1.59 +1 -2 src/sys/conf/files.alpha 1.335 +1 -2 src/sys/conf/files.i386 1.4 +1 -2 src/sys/conf/files.ia64 1.172 +1 -2 src/sys/conf/files.pc98 1.233 +2 -2 src/sys/conf/options To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message