diff options
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_lock.c | 14 | ||||
-rw-r--r-- | sys/kern/kern_proc.c | 16 |
2 files changed, 19 insertions, 11 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 3b6adb16c93..f067a508bc7 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_lock.c,v 1.51 2017/10/17 14:25:35 visa Exp $ */ +/* $OpenBSD: kern_lock.c,v 1.52 2017/12/04 09:51:03 mpi Exp $ */ /* * Copyright (c) 1995 @@ -96,7 +96,7 @@ _kernel_lock_held(void) { if (panicstr) return 1; - return (__mp_lock_held(&kernel_lock)); + return (__mp_lock_held(&kernel_lock, curcpu())); } #ifdef __USE_MI_MPLOCK @@ -168,7 +168,7 @@ ___mp_lock(struct __mp_lock *mpl LOCK_FL_VARS) unsigned long s; #ifdef WITNESS - if (!__mp_lock_held(mpl)) + if (!__mp_lock_held(mpl, curcpu())) WITNESS_CHECKORDER(&mpl->mpl_lock_obj, LOP_EXCLUSIVE | LOP_NEWORDER, file, line, NULL); #endif @@ -191,7 +191,7 @@ ___mp_unlock(struct __mp_lock *mpl LOCK_FL_VARS) unsigned long s; #ifdef MP_LOCKDEBUG - if (!__mp_lock_held(mpl)) { + if (!__mp_lock_held(mpl, curcpu())) { db_printf("__mp_unlock(%p): not held lock\n", mpl); db_enter(); } @@ -244,7 +244,7 @@ ___mp_release_all_but_one(struct __mp_lock *mpl LOCK_FL_VARS) #endif #ifdef MP_LOCKDEBUG - if (!__mp_lock_held(mpl)) { + if (!__mp_lock_held(mpl, curcpu())) { db_printf("__mp_release_all_but_one(%p): not held lock\n", mpl); db_enter(); } @@ -263,9 +263,9 @@ ___mp_acquire_count(struct __mp_lock *mpl, int count LOCK_FL_VARS) } int -__mp_lock_held(struct __mp_lock *mpl) +__mp_lock_held(struct __mp_lock *mpl, struct cpu_info *ci) { - struct __mp_lock_cpu *cpu = &mpl->mpl_cpus[cpu_number()]; + struct __mp_lock_cpu *cpu = &mpl->mpl_cpus[CPU_INFO_UNIT(ci)]; return (cpu->mplc_ticket == mpl->mpl_ticket && cpu->mplc_depth > 0); } diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 37ad3232b75..785636968be 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_proc.c,v 1.77 2017/09/29 09:36:04 mpi Exp $ */ +/* $OpenBSD: kern_proc.c,v 1.78 2017/12/04 09:51:03 mpi Exp $ */ /* $NetBSD: kern_proc.c,v 1.14 1996/02/09 18:59:41 christos Exp $ */ /* @@ -466,9 +466,10 @@ db_show_all_procs(db_expr_t addr, int haddr, db_expr_t count, char *modif) { char *mode; int skipzomb = 0; + int has_kernel_lock = 0; struct proc *p; struct process *pr, *ppr; - + if (modif[0] == 0) modif[0] = 'n'; /* default == normal mode */ @@ -483,7 +484,7 @@ db_show_all_procs(db_expr_t addr, int haddr, db_expr_t count, char *modif) db_printf("\t/o == show normal info for non-idle SONPROC\n"); return; } - + pr = LIST_FIRST(&allprocess); switch (*mode) { @@ -511,6 +512,12 @@ db_show_all_procs(db_expr_t addr, int haddr, db_expr_t count, char *modif) ppr = pr->ps_pptr; TAILQ_FOREACH(p, &pr->ps_threads, p_thr_link) { +#ifdef MULTIPROCESSOR + if (__mp_lock_held(&kernel_lock, p->p_cpu)) + has_kernel_lock = 1; + else + has_kernel_lock = 0; +#endif if (p->p_stat) { if (*mode == 'o') { if (p->p_stat != SONPROC) @@ -556,10 +563,11 @@ db_show_all_procs(db_expr_t addr, int haddr, db_expr_t count, char *modif) case 'o': db_printf("%5d %5d %#10x %#10x %3d" - " %-31s\n", + "%c %-31s\n", pr->ps_pid, pr->ps_ucred->cr_ruid, pr->ps_flags, p->p_flag, CPU_INFO_UNIT(p->p_cpu), + has_kernel_lock ? 'K' : ' ', pr->ps_comm); break; |