diff options
author | fsmp <fsmp@FreeBSD.org> | 1997-09-07 22:04:09 +0000 |
---|---|---|
committer | fsmp <fsmp@FreeBSD.org> | 1997-09-07 22:04:09 +0000 |
commit | 877f33cf608a56f37130585cbf62e69a7fa8867e (patch) | |
tree | 6c18f1143fc34dc43e409761227569d2ec2324bc /sys/i386/include | |
parent | 6787a3eb7ff21685017eabc3972f4a5b24109e70 (diff) | |
download | FreeBSD-src-877f33cf608a56f37130585cbf62e69a7fa8867e.zip FreeBSD-src-877f33cf608a56f37130585cbf62e69a7fa8867e.tar.gz |
General cleanup of the lock pushdown code. They are grouped and enabled
from machine/smptests.h:
#define PUSHDOWN_LEVEL_1
#define PUSHDOWN_LEVEL_2
#define PUSHDOWN_LEVEL_3
#define PUSHDOWN_LEVEL_4_NOT
Diffstat (limited to 'sys/i386/include')
-rw-r--r-- | sys/i386/include/cpufunc.h | 10 | ||||
-rw-r--r-- | sys/i386/include/lock.h | 31 | ||||
-rw-r--r-- | sys/i386/include/mptable.h | 22 | ||||
-rw-r--r-- | sys/i386/include/smp.h | 3 | ||||
-rw-r--r-- | sys/i386/include/smptests.h | 118 |
5 files changed, 142 insertions, 42 deletions
diff --git a/sys/i386/include/cpufunc.h b/sys/i386/include/cpufunc.h index df987bd..3b7eb9c 100644 --- a/sys/i386/include/cpufunc.h +++ b/sys/i386/include/cpufunc.h @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: cpufunc.h,v 1.2 1997/09/01 07:37:58 smp Exp smp $ + * $Id: cpufunc.h,v 1.3 1997/09/05 20:20:31 smp Exp smp $ */ /* @@ -58,17 +58,13 @@ static __inline void disable_intr(void) { __asm __volatile("cli" : : : "memory"); -#ifdef SMP - s_lock(&mpintr_lock); -#endif + MPINTR_LOCK(); } static __inline void enable_intr(void) { -#ifdef SMP - s_unlock(&mpintr_lock); -#endif + MPINTR_UNLOCK(); __asm __volatile("sti"); } diff --git a/sys/i386/include/lock.h b/sys/i386/include/lock.h index c94d615..8d95227 100644 --- a/sys/i386/include/lock.h +++ b/sys/i386/include/lock.h @@ -22,25 +22,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: lock.h,v 1.4 1997/09/01 07:37:58 smp Exp smp $ + * $Id: lock.h,v 1.7 1997/09/05 20:20:31 smp Exp smp $ */ #ifndef _MACHINE_LOCK_H_ #define _MACHINE_LOCK_H_ -/* - * XXX some temp debug control of cpl locks - */ -#define REAL_ECPL /* exception.s: SCPL_LOCK/SCPL_UNLOCK */ -#define REAL_ICPL /* ipl.s: CPL_LOCK/CPL_UNLOCK/FAST */ -#define REAL_AICPL /* apic_ipl.s: SCPL_LOCK/SCPL_UNLOCK */ -#define REAL_AVCPL /* apic_vector.s: CPL_LOCK/CPL_UNLOCK */ - -#define REAL_IFCPL /* ipl_funcs.c: SCPL_LOCK/SCPL_UNLOCK */ - -#define REAL_MCPL_NOT /* microtime.s: CPL_LOCK/movl $0,_cpl_lock */ - #ifdef LOCORE @@ -88,9 +76,9 @@ * Variations of CPL_LOCK protect spl updates as a critical region. * Items within this 'region' include: * cpl + * cml * cil * ipending - * ??? */ /* @@ -148,8 +136,13 @@ /* * Locks regions protected in UP kernel via cli/sti. */ +#ifdef USE_MPINTRLOCK #define MPINTR_LOCK() s_lock(&mpintr_lock) #define MPINTR_UNLOCK() s_unlock(&mpintr_lock) +#else +#define MPINTR_LOCK() +#define MPINTR_UNLOCK() +#endif /* USE_MPINTRLOCK */ /* * Protects cpl/cml/cil/ipending data as a critical region. @@ -163,7 +156,10 @@ #define SCPL_LOCK() ss_lock(&cpl_lock) /* INT safe: top end */ #define SCPL_UNLOCK() ss_unlock(&cpl_lock) -/* sio/cy lock */ +/* + * sio/cy lock. + * XXX should rc (RISCom/8) use this? + */ #ifdef USE_COMLOCK #define COM_LOCK() s_lock(&com_lock) #define COM_UNLOCK() s_unlock(&com_lock) @@ -178,7 +174,10 @@ #define COM_ENABLE_INTR() enable_intr() #endif /* USE_COMLOCK */ -/* clock hardware/struct lock */ +/* + * Clock hardware/struct lock. + * XXX pcaudio and friends still need this lock installed. + */ #ifdef USE_CLOCKLOCK #define CLOCK_LOCK() s_lock(&clock_lock) #define CLOCK_UNLOCK() s_unlock(&clock_lock) diff --git a/sys/i386/include/mptable.h b/sys/i386/include/mptable.h index 6b402b1..8d376ae 100644 --- a/sys/i386/include/mptable.h +++ b/sys/i386/include/mptable.h @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: mp_machdep.c,v 1.49 1997/08/31 03:17:47 fsmp Exp $ + * $Id: mp_machdep.c,v 1.38 1997/09/05 20:23:34 smp Exp smp $ */ #include "opt_smp.h" @@ -195,14 +195,18 @@ typedef struct BASETABLE_ENTRY { */ #define MP_BOOTADDRESS_POST 0x10 #define MP_PROBE_POST 0x11 -#define MP_START_POST 0x12 -#define MP_ANNOUNCE_POST 0x13 -#define MPTABLE_PASS1_POST 0x14 +#define MPTABLE_PASS1_POST 0x12 + +#define MP_START_POST 0x13 +#define MP_ENABLE_POST 0x14 #define MPTABLE_PASS2_POST 0x15 -#define MP_ENABLE_POST 0x16 -#define START_ALL_APS_POST 0x17 -#define INSTALL_AP_TRAMP_POST 0x18 -#define START_AP_POST 0x19 + +#define START_ALL_APS_POST 0x16 +#define INSTALL_AP_TRAMP_POST 0x17 +#define START_AP_POST 0x18 + +#define MP_ANNOUNCE_POST 0x19 + /** XXX FIXME: where does this really belong, isa.h/isa.c perhaps? */ int current_postcode; @@ -1445,7 +1449,7 @@ default_mp_table(int type) /* critical region around IO APIC, apic_imen */ struct simplelock imen_lock; -/* critical region around splxx(), cpl, cil, ipending */ +/* critical region around splxx(), cpl, cml, cil, ipending */ struct simplelock cpl_lock; /* Make FAST_INTR() routines sequential */ diff --git a/sys/i386/include/smp.h b/sys/i386/include/smp.h index a7051ff..82a6c34 100644 --- a/sys/i386/include/smp.h +++ b/sys/i386/include/smp.h @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: smp.h,v 1.30 1997/08/26 18:10:37 peter Exp $ + * $Id: smp.h,v 1.27 1997/09/05 18:08:57 smp Exp smp $ * */ @@ -167,6 +167,7 @@ extern volatile int smp_idle_loops; /* 'private' global data in locore.s */ extern volatile u_int cpuid; extern volatile u_int cpu_lockid; +extern int inside_intr; extern volatile u_int other_cpus; #endif /* !LOCORE */ diff --git a/sys/i386/include/smptests.h b/sys/i386/include/smptests.h index 9786984..81432bc 100644 --- a/sys/i386/include/smptests.h +++ b/sys/i386/include/smptests.h @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: smptests.h,v 1.28 1997/09/01 07:37:58 smp Exp smp $ + * $Id: smptests.h,v 1.33 1997/09/07 19:25:23 smp Exp smp $ */ #ifndef _MACHINE_SMPTESTS_H_ @@ -35,6 +35,75 @@ /* + * Control the "giant lock" pushdown by logical steps. + */ +#define PUSHDOWN_LEVEL_1 +#define PUSHDOWN_LEVEL_2 +#define PUSHDOWN_LEVEL_3 +#define PUSHDOWN_LEVEL_4_NOT + + +/* + * XXX some temp debug control of cpl locks + */ +#ifdef PUSHDOWN_LEVEL_2 +#define REAL_ECPL /* exception.s: SCPL_LOCK/SCPL_UNLOCK */ +#define REAL_ICPL /* ipl.s: CPL_LOCK/CPL_UNLOCK/FAST */ +#define REAL_AICPL /* apic_ipl.s: SCPL_LOCK/SCPL_UNLOCK */ +#define REAL_AVCPL /* apic_vector.s: CPL_LOCK/CPL_UNLOCK */ +#define REAL_IFCPL /* ipl_funcs.c: SCPL_LOCK/SCPL_UNLOCK */ +#endif /* PUSHDOWN_LEVEL_2 */ + +#define REAL_MCPL_NOT /* microtime.s: CPL_LOCK/movl $0,_cpl_lock */ + +/* + * The xCPL_LOCK/xCPL_UNLOCK defines control the spinlocks + * that protect cpl/cml/cil and the spl functions. + */ +#ifdef REAL_ECPL +#define ECPL_LOCK SCPL_LOCK +#define ECPL_UNLOCK SCPL_UNLOCK +#else +#define ECPL_LOCK +#define ECPL_UNLOCK +#endif /* REAL_ECPL */ + +#ifdef REAL_ICPL +#define ICPL_LOCK CPL_LOCK +#define ICPL_UNLOCK CPL_UNLOCK +#define FAST_ICPL_UNLOCK movl $0, _cpl_lock +#else +#define ICPL_LOCK +#define ICPL_UNLOCK +#define FAST_ICPL_UNLOCK +#endif /* REAL_ICPL */ + +#ifdef REAL_AICPL +#define AICPL_LOCK SCPL_LOCK +#define AICPL_UNLOCK SCPL_UNLOCK +#else +#define AICPL_LOCK +#define AICPL_UNLOCK +#endif /* REAL_AICPL */ + +#ifdef REAL_AVCPL +#define AVCPL_LOCK CPL_LOCK +#define AVCPL_UNLOCK CPL_UNLOCK +#else +#define AVCPL_LOCK +#define AVCPL_UNLOCK +#endif /* REAL_AVCPL */ + +#ifdef REAL_IFCPL +#define IFCPL_LOCK() SCPL_LOCK() +#define IFCPL_UNLOCK() SCPL_UNLOCK() +#else +#define IFCPL_LOCK() +#define IFCPL_UNLOCK() +#endif /* REAL_IFCPL */ + + +/* * Debug version of simple_lock. This will store the CPU id of the * holding CPU along with the lock. When a CPU fails to get the lock * it compares its own id to the holder id. If they are the same it @@ -48,21 +117,54 @@ * Put FAST_INTR() ISRs at an APIC priority above the regular INTs. * Allow the mp_lock() routines to handle FAST interrupts while spinning. */ +#ifdef PUSHDOWN_LEVEL_1 #define FAST_HI +#endif /* + * These defines enable critical region locking of areas that were + * protected via cli/sti in the UP kernel. * + * MPINTRLOCK protects all the generic areas. + * COMLOCK protects the sio/cy drivers. + * CLOCKLOCK protects clock hardware and data + * known to be incomplete: + * joystick lkm + * ? */ +#ifdef PUSHDOWN_LEVEL_1 +#define USE_MPINTRLOCK #define USE_COMLOCK #define USE_CLOCKLOCK +#endif /* * Regular INTerrupts without the giant lock, NOT READY YET!!! - * + */ +#ifdef PUSHDOWN_LEVEL_4 #define INTR_SIMPLELOCK +#endif + + +/* + * Separate the INTR() portion of cpl into another variable: cml. */ +#ifdef PUSHDOWN_LEVEL_3 +#define CPL_AND_CML +#endif + + +/* + * Forces spl functions to spin while waiting for safe time to change cpl. + * +#define SPL_DEBUG_POSTCODE (slows the system down noticably) + */ +#ifdef PUSHDOWN_LEVEL_3 +#define INTR_SPL +#define SPL_DEBUG +#endif /* @@ -87,7 +189,9 @@ * So I need to restore cpl handling someday, but AFTER * I finish making spl/cpl MP-safe. */ +#ifdef PUSHDOWN_LEVEL_1 #define FAST_WITHOUTCPL +#endif /* @@ -99,7 +203,9 @@ * One optimization on this would be a simple lock per DRIVER, but I'm * not sure how to organize that yet... */ +#ifdef PUSHDOWN_LEVEL_1 #define FAST_SIMPLELOCK +#endif /* @@ -111,9 +217,9 @@ /* * Send CPUSTOP IPI for stop/restart of other CPUs on DDB break. * +#define VERBOSE_CPUSTOP_ON_DDBBREAK */ #define CPUSTOP_ON_DDBBREAK -#define VERBOSE_CPUSTOP_ON_DDBBREAK /* @@ -125,12 +231,6 @@ /* - * Deal with broken smp_idleloop(). - */ -#define IGNORE_IDLEPROCS - - -/* * Misc. counters. * #define COUNT_XINVLTLB_HITS |