summaryrefslogtreecommitdiff
path: root/sys/ddb/db_command.c
diff options
context:
space:
mode:
authorjoerg <joerg@NetBSD.org>2017-01-11 12:17:34 +0000
committerjoerg <joerg@NetBSD.org>2017-01-11 12:17:34 +0000
commit1d64ea8a7a165f3c7c6f787682008ec49f12f3ba (patch)
tree893c8f76e42af217a32a48e3e71931849ef26593 /sys/ddb/db_command.c
parenta5b0782db3067e90336e29292023c3d689d758ef (diff)
Add ddb command to find a vnode by the address of its lock.
This makes it much easier to convert lockstat traces into understandable data.
Diffstat (limited to 'sys/ddb/db_command.c')
-rw-r--r--sys/ddb/db_command.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c
index 0d4b3e308d9..6d1ec350f18 100644
--- a/sys/ddb/db_command.c
+++ b/sys/ddb/db_command.c
@@ -1,4 +1,4 @@
-/* $NetBSD: db_command.c,v 1.147 2016/04/13 00:47:02 ozaki-r Exp $ */
+/* $NetBSD: db_command.c,v 1.148 2017/01/11 12:17:34 joerg Exp $ */
/*
* Copyright (c) 1996, 1997, 1998, 1999, 2002, 2009 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.147 2016/04/13 00:47:02 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.148 2017/01/11 12:17:34 joerg Exp $");
#ifdef _KERNEL_OPT
#include "opt_aio.h"
@@ -209,6 +209,8 @@ static void db_uvmexp_print_cmd(db_expr_t, bool, db_expr_t, const char *);
static void db_kernhist_print_cmd(db_expr_t, bool, db_expr_t, const char *);
#endif
static void db_vnode_print_cmd(db_expr_t, bool, db_expr_t, const char *);
+static void db_vnode_lock_print_cmd(db_expr_t, bool, db_expr_t,
+ const char *);
static void db_vmem_print_cmd(db_expr_t, bool, db_expr_t, const char *);
static const struct db_command db_show_cmds[] = {
@@ -282,6 +284,9 @@ static const struct db_command db_show_cmds[] = {
#endif
{ DDB_ADD_CMD("vnode", db_vnode_print_cmd, 0,
"Print the vnode at address.", "[/f] address",NULL) },
+ { DDB_ADD_CMD("vnode_lock", db_vnode_lock_print_cmd, 0,
+ "Print the vnode having that address as v_lock.",
+ "[/f] address",NULL) },
{ DDB_ADD_CMD("vmem", db_vmem_print_cmd, 0,
"Print the vmem usage.", "[/a] address", NULL) },
{ DDB_ADD_CMD("vmems", db_show_all_vmems, 0,
@@ -1116,6 +1121,21 @@ db_vnode_print_cmd(db_expr_t addr, bool have_addr,
/*ARGSUSED*/
static void
+db_vnode_lock_print_cmd(db_expr_t addr, bool have_addr,
+ db_expr_t count, const char *modif)
+{
+#ifdef _KERNEL /* XXX CRASH(8) */
+ bool full = false;
+
+ if (modif[0] == 'f')
+ full = true;
+
+ vfs_vnode_lock_print((struct vnode *)(uintptr_t) addr, full, db_printf);
+#endif
+}
+
+/*ARGSUSED*/
+static void
db_vmem_print_cmd(db_expr_t addr, bool have_addr,
db_expr_t count, const char *modif)
{