diff options
Diffstat (limited to 'kern')
-rw-r--r-- | kern/lock.c | 4 | ||||
-rw-r--r-- | kern/lock.h | 5 | ||||
-rw-r--r-- | kern/lock_mon.c | 8 | ||||
-rw-r--r-- | kern/thread.h | 4 |
4 files changed, 17 insertions, 4 deletions
diff --git a/kern/lock.c b/kern/lock.c index 81c6a129..f076c328 100644 --- a/kern/lock.c +++ b/kern/lock.c @@ -673,7 +673,11 @@ void db_show_all_slocks(void) #else /* MACH_SLOCKS && NCPUS == 1 */ void db_show_all_slocks(void) { +#if MACH_LOCK_MON + lip(); +#else db_printf("simple lock info not available\n"); +#endif } #endif /* MACH_SLOCKS && NCPUS == 1 */ #endif /* MACH_KDB */ diff --git a/kern/lock.h b/kern/lock.h index 4fcbe8ab..48976196 100644 --- a/kern/lock.h +++ b/kern/lock.h @@ -39,6 +39,11 @@ #if NCPUS > 1 #include <machine/lock.h>/*XXX*/ +#if MACH_LOCK_MON == 0 +#define simple_lock _simple_lock +#define simple_lock_try _simple_lock_try +#define simple_unlock _simple_unlock +#endif #endif #define MACH_SLOCKS ((NCPUS > 1) || MACH_LDEBUG) diff --git a/kern/lock_mon.c b/kern/lock_mon.c index a963ec05..bb446b7a 100644 --- a/kern/lock_mon.c +++ b/kern/lock_mon.c @@ -45,7 +45,8 @@ #include <mach/boolean.h> #include <kern/thread.h> #include <kern/lock.h> - +#include <machine/ipl.h> +#include <ddb/db_sym.h> def_simple_lock_data(extern , kdb_lock) def_simple_lock_data(extern , printf_lock) @@ -93,7 +94,6 @@ decl_simple_lock_data(, **lock) { struct lock_info *li = &(lock_info[HASH_LOCK(*lock)].info[0]); int i; - my_cpu = cpu_number(); for (i=0; i < LOCK_INFO_PER_BUCKET; i++, li++) if (li->lock) { @@ -114,7 +114,7 @@ void simple_lock(lock) decl_simple_lock_data(, *lock) { struct lock_info *li = locate_lock_info(&lock); - my_cpu = cpu_number(); + int my_cpu = cpu_number(); if (current_thread()) li->stack = current_thread()->lock_stack++; @@ -133,7 +133,7 @@ int simple_lock_try(lock) decl_simple_lock_data(, *lock) { struct lock_info *li = locate_lock_info(&lock); - my_cpu = cpu_number(); + int my_cpu = cpu_number(); if (curr_ipl[my_cpu]) li->masked++; diff --git a/kern/thread.h b/kern/thread.h index a5abefcc..f8232d1a 100644 --- a/kern/thread.h +++ b/kern/thread.h @@ -229,6 +229,10 @@ struct thread { #if NCPUS > 1 processor_t last_processor; /* processor this last ran on */ #endif /* NCPUS > 1 */ + +#if MACH_LOCK_MON + int lock_stack; +#endif }; /* typedef of thread_t is in kern/kern_types.h */ |