Module Name: src
Committed By: riastradh
Date: Sat Mar 12 15:50:53 UTC 2022
Modified Files:
src/sys/arch/x86/x86: syscall.c
Log Message:
x86: Provide better attribution for syscall biglock slippage.
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/x86/x86/syscall.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/x86/x86/syscall.c
diff -u src/sys/arch/x86/x86/syscall.c:1.19 src/sys/arch/x86/x86/syscall.c:1.20
--- src/sys/arch/x86/x86/syscall.c:1.19 Thu Oct 7 12:52:27 2021
+++ src/sys/arch/x86/x86/syscall.c Sat Mar 12 15:50:53 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: syscall.c,v 1.19 2021/10/07 12:52:27 msaitoh Exp $ */
+/* $NetBSD: syscall.c,v 1.20 2022/03/12 15:50:53 riastradh Exp $ */
/*-
* Copyright (c) 1998, 2000, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.19 2021/10/07 12:52:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.20 2022/03/12 15:50:53 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -136,6 +136,13 @@ syscall(struct trapframe *frame)
}
#endif
error = sy_invoke(callp, l, args, rval, code);
+#ifdef DIAGNOSTIC
+ kpreempt_disable(); /* make curcpu() stable */
+ KASSERTMSG(curcpu()->ci_biglock_count == 0,
+ "syscall %ld of emul %s leaked %d kernel locks",
+ (long)code, p->p_emul->e_name, curcpu()->ci_biglock_count);
+ kpreempt_enable();
+#endif
if (__predict_true(error == 0)) {
X86_TF_RAX(frame) = rval[0];