Module Name: src Committed By: martin Date: Fri Sep 7 12:34:18 UTC 2018
Modified Files: src/sys/ddb [netbsd-8]: db_command.c src/sys/kern [netbsd-8]: subr_lockdebug.c src/sys/sys [netbsd-8]: lockdebug.h Log Message: Pull up following revision(s) (requested by mrg in ticket #1013): sys/sys/lockdebug.h: revision 1.20 sys/ddb/db_command.c: revision 1.155 sys/kern/subr_lockdebug.c: revision 1.65 add a lockdebug_dismiss() function for DDB to use that tells lockdebug to avoid asserts. use it for the ddb "reboot" command, so that it doesn't matter how ddb was entered, the reboot not trigger mutex checks and not work. To generate a diff of this commit: cvs rdiff -u -r1.148.8.2 -r1.148.8.3 src/sys/ddb/db_command.c cvs rdiff -u -r1.57.2.1 -r1.57.2.2 src/sys/kern/subr_lockdebug.c cvs rdiff -u -r1.15.6.1 -r1.15.6.2 src/sys/sys/lockdebug.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/ddb/db_command.c diff -u src/sys/ddb/db_command.c:1.148.8.2 src/sys/ddb/db_command.c:1.148.8.3 --- src/sys/ddb/db_command.c:1.148.8.2 Tue Jul 31 17:01:20 2018 +++ src/sys/ddb/db_command.c Fri Sep 7 12:34:18 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: db_command.c,v 1.148.8.2 2018/07/31 17:01:20 martin Exp $ */ +/* $NetBSD: db_command.c,v 1.148.8.3 2018/09/07 12:34:18 martin 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.148.8.2 2018/07/31 17:01:20 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.148.8.3 2018/09/07 12:34:18 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_aio.h" @@ -1351,6 +1351,10 @@ db_reboot_cmd(db_expr_t addr, bool have_ * called from cpu_reboot. */ db_recover = 0; + /* Avoid all mutex errors */ +#ifdef LOCKDEBUG + lockdebug_dismiss(); +#endif panicstr = "reboot forced via kernel debugger"; cpu_reboot((int)bootflags, NULL); #else /* _KERNEL */ Index: src/sys/kern/subr_lockdebug.c diff -u src/sys/kern/subr_lockdebug.c:1.57.2.1 src/sys/kern/subr_lockdebug.c:1.57.2.2 --- src/sys/kern/subr_lockdebug.c:1.57.2.1 Mon Apr 2 09:07:52 2018 +++ src/sys/kern/subr_lockdebug.c Fri Sep 7 12:34:18 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_lockdebug.c,v 1.57.2.1 2018/04/02 09:07:52 martin Exp $ */ +/* $NetBSD: subr_lockdebug.c,v 1.57.2.2 2018/09/07 12:34:18 martin Exp $ */ /*- * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.57.2.1 2018/04/02 09:07:52 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.57.2.2 2018/09/07 12:34:18 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -977,6 +977,19 @@ lockdebug_show_lockstats(void (*pr)(cons #endif /* DDB */ /* + * lockdebug_dismiss: + * + * The system is rebooting, and potentially from an unsafe + * place so avoid any future aborts. + */ +void +lockdebug_dismiss(void) +{ + + atomic_inc_uint_nv(&ld_panic); +} + +/* * lockdebug_abort: * * An error has been trapped - dump lock info and call panic(). Index: src/sys/sys/lockdebug.h diff -u src/sys/sys/lockdebug.h:1.15.6.1 src/sys/sys/lockdebug.h:1.15.6.2 --- src/sys/sys/lockdebug.h:1.15.6.1 Mon Apr 2 09:07:53 2018 +++ src/sys/sys/lockdebug.h Fri Sep 7 12:34:18 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: lockdebug.h,v 1.15.6.1 2018/04/02 09:07:53 martin Exp $ */ +/* $NetBSD: lockdebug.h,v 1.15.6.2 2018/09/07 12:34:18 martin Exp $ */ /*- * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -53,6 +53,7 @@ typedef struct lockops { #define LOCKDEBUG_ABORT(f, ln, l, o, m) \ lockdebug_abort(f, ln, l, o, m) +void lockdebug_dismiss(void); void lockdebug_abort(const char *, size_t, volatile void *, lockops_t *, const char *);