Source-Changes-HG archive

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

[src/netbsd-8]: src/sys Pull up following revision(s) (requested by mrg in ti...



details:   https://anonhg.NetBSD.org/src/rev/e31272552bf9
branches:  netbsd-8
changeset: 435263:e31272552bf9
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Sep 23 17:28:25 2018 +0000

description:
Pull up following revision(s) (requested by mrg in ticket #1024):

        sys/ddb/db_command.c: revision 1.157
        sys/ddb/db_command.c: revision 1.158
        sys/kern/subr_lockdebug.c: revision 1.67

always call lockdebug_dismiss() from DDB -- there are always some
minimal lockdebug checks in place, even without LOCKDEBUG.

adjust lockdebug_abort() to ignore problems after ld_panic is set

so that there's a chance of this working.
this fixes ddb 'reboot' on softiron od1000.

call spl0() before cpu_reboot(), so that there's a chance that:
- interrupts can work afterwards
- this also means if IO stalls, serial break might work again.

this mimics how reboot(2) ends up calling cpu_reboot().

diffstat:

 sys/ddb/db_command.c      |   8 ++++----
 sys/kern/subr_lockdebug.c |  31 ++++++++++++++++---------------
 2 files changed, 20 insertions(+), 19 deletions(-)

diffs (84 lines):

diff -r d0813e944e89 -r e31272552bf9 sys/ddb/db_command.c
--- a/sys/ddb/db_command.c      Sun Sep 23 17:24:59 2018 +0000
+++ b/sys/ddb/db_command.c      Sun Sep 23 17:28:25 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_command.c,v 1.148.8.3 2018/09/07 12:34:18 martin Exp $      */
+/*     $NetBSD: db_command.c,v 1.148.8.4 2018/09/23 17:28:25 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.3 2018/09/07 12:34:18 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.148.8.4 2018/09/23 17:28:25 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -1352,10 +1352,10 @@
         */
        db_recover = 0;
        /* Avoid all mutex errors */
-#ifdef LOCKDEBUG
        lockdebug_dismiss();
-#endif
        panicstr = "reboot forced via kernel debugger";
+       /* Make it possible to break into the debugger again */
+       spl0();
        cpu_reboot((int)bootflags, NULL);
 #else  /* _KERNEL */
        db_printf("This command can only be used in-kernel.\n");
diff -r d0813e944e89 -r e31272552bf9 sys/kern/subr_lockdebug.c
--- a/sys/kern/subr_lockdebug.c Sun Sep 23 17:24:59 2018 +0000
+++ b/sys/kern/subr_lockdebug.c Sun Sep 23 17:28:25 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_lockdebug.c,v 1.57.2.2 2018/09/07 12:34:18 martin Exp $   */
+/*     $NetBSD: subr_lockdebug.c,v 1.57.2.3 2018/09/23 17:28:25 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.2 2018/09/07 12:34:18 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.57.2.3 2018/09/23 17:28:25 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1012,20 +1012,21 @@
 #endif /* LOCKDEBUG */
 
        /*
-        * Complain first on the occurrance only.  Otherwise proceeed to
-        * panic where we will `rendezvous' with other CPUs if the machine
-        * is going down in flames.
+        * Don't make the situation worse if the system is already going
+        * down in flames.  Once a panic is triggered, lockdebug state
+        * becomes stale and cannot be trusted.
         */
-       if (atomic_inc_uint_nv(&ld_panic) == 1) {
-               printf_nolog("%s error: %s,%zu: %s\n\n"
-                   "lock address : %#018lx\n"
-                   "current cpu  : %18d\n"
-                   "current lwp  : %#018lx\n",
-                   ops->lo_name, func, line, msg, (long)lock,
-                   (int)cpu_index(curcpu()), (long)curlwp);
-               (*ops->lo_dump)(lock);
-               printf_nolog("\n");
-       }
+       if (atomic_inc_uint_nv(&ld_panic) > 1)
+               return;
+
+       printf_nolog("%s error: %s,%zu: %s\n\n"
+           "lock address : %#018lx\n"
+           "current cpu  : %18d\n"
+           "current lwp  : %#018lx\n",
+           ops->lo_name, func, line, msg, (long)lock,
+           (int)cpu_index(curcpu()), (long)curlwp);
+       (*ops->lo_dump)(lock);
+       printf_nolog("\n");
 
        panic("lock error: %s: %s,%zu: %s: lock %p cpu %d lwp %p",
            ops->lo_name, func, line, msg, lock, cpu_index(curcpu()), curlwp);



Home | Main Index | Thread Index | Old Index