Source-Changes-HG archive

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

[src/trunk]: src/sys/kern tsleep(9): Assert kernel lock held.



details:   https://anonhg.NetBSD.org/src/rev/9c9d51159987
branches:  trunk
changeset: 376601:9c9d51159987
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Jun 23 21:19:03 2023 +0000

description:
tsleep(9): Assert kernel lock held.

This is never safe to use without the kernel lock.  It should only
appear in legacy subsystems that still run with the kernel lock.

diffstat:

 sys/kern/kern_synch.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 1e83f8ad80a0 -r 9c9d51159987 sys/kern/kern_synch.c
--- a/sys/kern/kern_synch.c     Fri Jun 23 21:09:44 2023 +0000
+++ b/sys/kern/kern_synch.c     Fri Jun 23 21:19:03 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_synch.c,v 1.354 2023/04/09 12:16:42 riastradh Exp $       */
+/*     $NetBSD: kern_synch.c,v 1.355 2023/06/23 21:19:03 riastradh Exp $       */
 
 /*-
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009, 2019, 2020
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.354 2023/04/09 12:16:42 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.355 2023/06/23 21:19:03 riastradh Exp $");
 
 #include "opt_kstack.h"
 #include "opt_dtrace.h"
@@ -178,6 +178,7 @@ tsleep(wchan_t ident, pri_t priority, co
 
        KASSERT((l->l_pflag & LP_INTR) == 0);
        KASSERT(ident != &lbolt);
+       KASSERT(KERNEL_LOCKED_P());
 
        if (sleepq_dontsleep(l)) {
                (void)sleepq_abort(NULL, 0);



Home | Main Index | Thread Index | Old Index