Module Name:    src
Committed By:   ad
Date:           Wed Dec 11 20:34:06 UTC 2019

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

Log Message:
mutex_vector_exit: if the arch doesn't have assembly stubs, we need to
unconditionally release the lock if(cold), so mutexes can be used before
interrupts are set up.  Removed with panicstr checks in 1.81.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/kern/kern_mutex.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_mutex.c
diff -u src/sys/kern/kern_mutex.c:1.84 src/sys/kern/kern_mutex.c:1.85
--- src/sys/kern/kern_mutex.c:1.84	Tue Dec 10 13:36:44 2019
+++ src/sys/kern/kern_mutex.c	Wed Dec 11 20:34:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_mutex.c,v 1.84 2019/12/10 13:36:44 kre Exp $	*/
+/*	$NetBSD: kern_mutex.c,v 1.85 2019/12/11 20:34:06 ad Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 #define	__MUTEX_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.84 2019/12/10 13:36:44 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.85 2019/12/11 20:34:06 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -719,6 +719,14 @@ mutex_vector_exit(kmutex_t *mtx)
 		return;
 	}
 
+#ifndef __HAVE_MUTEX_STUBS
+	if (__predict_false(cold)) {
+		MUTEX_UNLOCKED(mtx);
+		MUTEX_RELEASE(mtx);
+		return;
+	}
+#endif
+
 	curthread = (uintptr_t)curlwp;
 	MUTEX_DASSERT(mtx, curthread != 0);
 	MUTEX_ASSERT(mtx, MUTEX_OWNER(mtx->mtx_owner) == curthread);

Reply via email to