Module Name:    src
Committed By:   riastradh
Date:           Sat Aug 20 23:37:12 UTC 2022

Modified Files:
        src/sys/kern: kern_lock.c

Log Message:
KERNEL_LOCK(9): Limit ipi trace diagnostic to after init has started.


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/sys/kern/kern_lock.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/kern/kern_lock.c
diff -u src/sys/kern/kern_lock.c:1.177 src/sys/kern/kern_lock.c:1.178
--- src/sys/kern/kern_lock.c:1.177	Tue Aug 16 21:23:37 2022
+++ src/sys/kern/kern_lock.c	Sat Aug 20 23:37:12 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lock.c,v 1.177 2022/08/16 21:23:37 riastradh Exp $	*/
+/*	$NetBSD: kern_lock.c,v 1.178 2022/08/20 23:37:12 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2009, 2020 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.177 2022/08/16 21:23:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.178 2022/08/20 23:37:12 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_lockdebug.h"
@@ -253,8 +253,8 @@ _kernel_lock(int nlocks)
 		splx(s);
 		while (__SIMPLELOCK_LOCKED_P(kernel_lock)) {
 #ifdef LOCKDEBUG
-			if (SPINLOCK_SPINOUT(spins)) {
-				extern int start_init_exec;
+			extern int start_init_exec;
+			if (SPINLOCK_SPINOUT(spins) && start_init_exec) {
 				ipi_msg_t msg = {
 					.func = kernel_lock_trace_ipi,
 				};
@@ -262,8 +262,7 @@ _kernel_lock(int nlocks)
 				ipi_unicast(&msg, kernel_lock_holder);
 				ipi_wait(&msg);
 				kpreempt_enable();
-				if (start_init_exec)
-					_KERNEL_LOCK_ABORT("spinout");
+				_KERNEL_LOCK_ABORT("spinout");
 			}
 			SPINLOCK_BACKOFF_HOOK;
 			SPINLOCK_SPIN_HOOK;

Reply via email to