From: visa Date: Tue, 20 Feb 2018 14:46:22 +0000 (+0000) Subject: Make ddb's "show all locks" command show spinlocks in addition X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=83724537edae2e6a1d7b1fd2896a6784e182ec72;p=openbsd Make ddb's "show all locks" command show spinlocks in addition to sleeplocks. OK mpi@ --- diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c index 967f2ffdbf5..36bc45b6e27 100644 --- a/sys/kern/subr_witness.c +++ b/sys/kern/subr_witness.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_witness.c,v 1.5 2017/11/14 14:43:39 visa Exp $ */ +/* $OpenBSD: subr_witness.c,v 1.6 2018/02/20 14:46:22 visa Exp $ */ /*- * Copyright (c) 2008 Isilon Systems, Inc. @@ -30,8 +30,8 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from BSDI $Id: subr_witness.c,v 1.5 2017/11/14 14:43:39 visa Exp $ - * and BSDI $Id: subr_witness.c,v 1.5 2017/11/14 14:43:39 visa Exp $ + * from BSDI $Id: subr_witness.c,v 1.6 2018/02/20 14:46:22 visa Exp $ + * and BSDI $Id: subr_witness.c,v 1.6 2018/02/20 14:46:22 visa Exp $ */ /* @@ -2096,9 +2096,20 @@ db_witness_list(db_expr_t addr, int have_addr, db_expr_t count, char *modif) void db_witness_list_all(db_expr_t addr, int have_addr, db_expr_t count, char *modif) { + CPU_INFO_ITERATOR cii; + struct cpu_info *ci; + struct lock_list_entry *lock_list; struct process *pr; struct proc *p; + CPU_INFO_FOREACH(cii, ci) { + lock_list = witness_cpu[CPU_INFO_UNIT(ci)].wc_spinlocks; + if (lock_list == NULL || lock_list->ll_count == 0) + continue; + db_printf("CPU %d:\n", CPU_INFO_UNIT(ci)); + witness_list_locks(&lock_list, db_printf); + } + /* * It would be nice to list only threads and processes that actually * held sleep locks, but that information is currently not exported