Module Name:    src
Committed By:   riastradh
Date:           Sun Dec 26 21:33:48 UTC 2021

Modified Files:
        src/sys/arch/amd64/amd64: machdep.c
        src/sys/arch/i386/i386: machdep.c
        src/sys/arch/sparc64/sparc64: machdep.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.360 -r1.361 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.833 -r1.834 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.303 -r1.304 src/sys/arch/sparc64/sparc64/machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.360 src/sys/arch/amd64/amd64/machdep.c:1.361
--- src/sys/arch/amd64/amd64/machdep.c:1.360	Thu Oct 28 10:46:05 2021
+++ src/sys/arch/amd64/amd64/machdep.c	Sun Dec 26 21:33:48 2021
@@ -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 @@ cpu_reboot(int howto, char *bootstr)
 		       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);
 

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.833 src/sys/arch/i386/i386/machdep.c:1.834
--- src/sys/arch/i386/i386/machdep.c:1.833	Thu Oct 28 10:46:05 2021
+++ src/sys/arch/i386/i386/machdep.c	Sun Dec 26 21:33:48 2021
@@ -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 @@ cpu_reboot(int howto, char *bootstr)
 		       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);
 

Index: src/sys/arch/sparc64/sparc64/machdep.c
diff -u src/sys/arch/sparc64/sparc64/machdep.c:1.303 src/sys/arch/sparc64/sparc64/machdep.c:1.304
--- src/sys/arch/sparc64/sparc64/machdep.c:1.303	Sat Sep 11 10:09:55 2021
+++ src/sys/arch/sparc64/sparc64/machdep.c	Sun Dec 26 21:33:48 2021
@@ -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 @@ cpu_reboot(int howto, char *user_boot_st
 		       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);
 

Reply via email to