Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 x86: Provide better attribution for syscall...



details:   https://anonhg.NetBSD.org/src/rev/29980873d89b
branches:  trunk
changeset: 363433:29980873d89b
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Mar 12 15:50:53 2022 +0000

description:
x86: Provide better attribution for syscall biglock slippage.

diffstat:

 sys/arch/x86/x86/syscall.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 95676a297f80 -r 29980873d89b sys/arch/x86/x86/syscall.c
--- a/sys/arch/x86/x86/syscall.c        Sat Mar 12 15:50:44 2022 +0000
+++ b/sys/arch/x86/x86/syscall.c        Sat Mar 12 15:50:53 2022 +0000
@@ -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 @@
        }
 #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];



Home | Main Index | Thread Index | Old Index