Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys add a lockdebug_dismiss() function for DDB to use that t...



details:   https://anonhg.NetBSD.org/src/rev/df12053ec77c
branches:  trunk
changeset: 365372:df12053ec77c
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Aug 12 22:05:29 2018 +0000

description:
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.

diffstat:

 sys/ddb/db_command.c      |   8 ++++++--
 sys/kern/subr_lockdebug.c |  17 +++++++++++++++--
 sys/sys/lockdebug.h       |   3 ++-
 3 files changed, 23 insertions(+), 5 deletions(-)

diffs (84 lines):

diff -r e7265743a43e -r df12053ec77c sys/ddb/db_command.c
--- a/sys/ddb/db_command.c      Sun Aug 12 21:48:56 2018 +0000
+++ b/sys/ddb/db_command.c      Sun Aug 12 22:05:29 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_command.c,v 1.154 2018/07/20 08:26:25 msaitoh Exp $ */
+/*     $NetBSD: db_command.c,v 1.155 2018/08/12 22:05:29 mrg 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.154 2018/07/20 08:26:25 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.155 2018/08/12 22:05:29 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -1352,6 +1352,10 @@
         * 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 */
diff -r e7265743a43e -r df12053ec77c sys/kern/subr_lockdebug.c
--- a/sys/kern/subr_lockdebug.c Sun Aug 12 21:48:56 2018 +0000
+++ b/sys/kern/subr_lockdebug.c Sun Aug 12 22:05:29 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_lockdebug.c,v 1.64 2018/03/19 08:41:21 ozaki-r Exp $      */
+/*     $NetBSD: subr_lockdebug.c,v 1.65 2018/08/12 22:05:29 mrg 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.64 2018/03/19 08:41:21 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.65 2018/08/12 22:05:29 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -981,6 +981,19 @@
 #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().
diff -r e7265743a43e -r df12053ec77c sys/sys/lockdebug.h
--- a/sys/sys/lockdebug.h       Sun Aug 12 21:48:56 2018 +0000
+++ b/sys/sys/lockdebug.h       Sun Aug 12 22:05:29 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lockdebug.h,v 1.19 2018/03/19 08:41:21 ozaki-r Exp $   */
+/*     $NetBSD: lockdebug.h,v 1.20 2018/08/12 22:05:29 mrg Exp $       */
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -53,6 +53,7 @@
 #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, const volatile void *,
     lockops_t *, const char *);
 



Home | Main Index | Thread Index | Old Index