Module Name: src
Committed By: ozaki-r
Date: Tue Feb 6 07:46:24 UTC 2018
Modified Files:
src/sys/kern: kern_mutex.c
Log Message:
Check if adaptive mutex isn't called in interrupt context
By this check, we can notice this programming error without LOCKDEBUG.
The same check exists in rw_enter.
To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 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.71 src/sys/kern/kern_mutex.c:1.72
--- src/sys/kern/kern_mutex.c:1.71 Mon Feb 5 04:25:04 2018
+++ src/sys/kern/kern_mutex.c Tue Feb 6 07:46:24 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_mutex.c,v 1.71 2018/02/05 04:25:04 ozaki-r Exp $ */
+/* $NetBSD: kern_mutex.c,v 1.72 2018/02/06 07:46:24 ozaki-r Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
#define __MUTEX_PRIVATE
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.71 2018/02/05 04:25:04 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.72 2018/02/06 07:46:24 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -54,6 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_mutex.c
#include <sys/intr.h>
#include <sys/lock.h>
#include <sys/types.h>
+#include <sys/cpu.h>
#include <dev/lockstat.h>
@@ -515,6 +516,7 @@ mutex_vector_enter(kmutex_t *mtx)
MUTEX_DASSERT(mtx, MUTEX_ADAPTIVE_P(mtx));
MUTEX_ASSERT(mtx, curthread != 0);
+ MUTEX_ASSERT(mtx, !cpu_intr_p());
MUTEX_WANTLOCK(mtx);
if (panicstr == NULL) {