Source-Changes-HG archive

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

[src/trunk]: src/sys/arch sys: Skip suspendsched on cpu_reboot if we're in ddb.



details:   https://anonhg.NetBSD.org/src/rev/88084b89305d
branches:  trunk
changeset: 1029198:88084b89305d
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 26 21:33:48 2021 +0000

description:
sys: Skip suspendsched on cpu_reboot if we're in ddb.

If we're in ddb, the scheduler and all other CPUs are quiesced
anyway.  But suspendsched will try to take an adaptive lock, which
causes it to crash and re-enter ddb, which isn't very useful for
rebooting.

diffstat:

 sys/arch/amd64/amd64/machdep.c     |  15 +++++++++++----
 sys/arch/i386/i386/machdep.c       |  15 +++++++++++----
 sys/arch/sparc64/sparc64/machdep.c |  15 +++++++++++----
 3 files changed, 33 insertions(+), 12 deletions(-)

diffs (108 lines):

diff -r d83170fd683a -r 88084b89305d sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c    Sun Dec 26 21:00:51 2021 +0000
+++ b/sys/arch/amd64/amd64/machdep.c    Sun Dec 26 21:33:48 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.360 2021/10/28 10:46:05 riastradh Exp $  */
+/*     $NetBSD: machdep.c,v 1.361 2021/12/26 21:33:48 riastradh Exp $  */
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.360 2021/10/28 10:46:05 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.361 2021/12/26 21:33:48 riastradh Exp $");
 
 #include "opt_modular.h"
 #include "opt_user_ldt.h"
@@ -700,8 +700,15 @@
                       config_detach_all(boothowto) ||
                       vfs_unmount_forceone(curlwp))
                        ;       /* do nothing */
-       } else
-               suspendsched();
+       } else {
+               int ddb = 0;
+#ifdef DDB
+               extern int db_active; /* XXX */
+               ddb = db_active;
+#endif
+               if (!ddb)
+                       suspendsched();
+       }
 
        pmf_system_shutdown(boothowto);
 
diff -r d83170fd683a -r 88084b89305d sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c      Sun Dec 26 21:00:51 2021 +0000
+++ b/sys/arch/i386/i386/machdep.c      Sun Dec 26 21:33:48 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.833 2021/10/28 10:46:05 riastradh Exp $  */
+/*     $NetBSD: machdep.c,v 1.834 2021/12/26 21:33:48 riastradh Exp $  */
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009, 2017
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.833 2021/10/28 10:46:05 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.834 2021/12/26 21:33:48 riastradh Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_freebsd.h"
@@ -766,8 +766,15 @@
                       config_detach_all(boothowto) ||
                       vfs_unmount_forceone(curlwp))
                        ;       /* do nothing */
-       } else
-               suspendsched();
+       } else {
+               int ddb = 0;
+#ifdef DDB
+               extern int db_active; /* XXX */
+               ddb = db_active;
+#endif
+               if (!ddb)
+                       suspendsched();
+       }
 
        pmf_system_shutdown(boothowto);
 
diff -r d83170fd683a -r 88084b89305d sys/arch/sparc64/sparc64/machdep.c
--- a/sys/arch/sparc64/sparc64/machdep.c        Sun Dec 26 21:00:51 2021 +0000
+++ b/sys/arch/sparc64/sparc64/machdep.c        Sun Dec 26 21:33:48 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.303 2021/09/11 10:09:55 riastradh Exp $ */
+/*     $NetBSD: machdep.c,v 1.304 2021/12/26 21:33:48 riastradh Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2019 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.303 2021/09/11 10:09:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.304 2021/12/26 21:33:48 riastradh Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -573,8 +573,15 @@
                       config_detach_all(boothowto) ||
                       vfs_unmount_forceone(l))
                        ;       /* do nothing */
-       } else
-               suspendsched();
+       } else {
+               int ddb = 0;
+#ifdef DDB
+               extern int db_active; /* XXX */
+               ddb = db_active;
+#endif
+               if (!ddb)
+                       suspendsched();
+       }
 
        pmf_system_shutdown(boothowto);
 



Home | Main Index | Thread Index | Old Index