Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern autoconf(9): Provide diagnostics for config_detach_...
details: https://anonhg.NetBSD.org/src/rev/f8edebb2773b
branches: trunk
changeset: 368915:f8edebb2773b
user: riastradh <riastradh%NetBSD.org@localhost>
date: Fri Aug 12 16:16:12 2022 +0000
description:
autoconf(9): Provide diagnostics for config_detach_* misuse.
diffstat:
sys/kern/subr_autoconf.c | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
diffs (69 lines):
diff -r e51f63fd1bef -r f8edebb2773b sys/kern/subr_autoconf.c
--- a/sys/kern/subr_autoconf.c Fri Aug 12 15:43:38 2022 +0000
+++ b/sys/kern/subr_autoconf.c Fri Aug 12 16:16:12 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.301 2022/03/28 12:38:59 riastradh Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.302 2022/08/12 16:16:12 riastradh Exp $ */
/*
* Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.301 2022/03/28 12:38:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.302 2022/08/12 16:16:12 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -1919,6 +1919,7 @@
static int
config_detach_enter(device_t dev)
{
+ struct lwp *l __diagused;
int error = 0;
mutex_enter(&config_misc_lock);
@@ -1947,8 +1948,12 @@
* running. Claim the device for detaching. This will cause
* all new attempts to acquire references to block.
*/
- KASSERT(dev->dv_attaching == NULL);
- KASSERT(dev->dv_detaching == NULL);
+ KASSERTMSG((l = dev->dv_attaching) == NULL,
+ "lwp %ld [%s] @ %p attaching",
+ (long)l->l_lid, (l->l_name ? l->l_name : l->l_proc->p_comm), l);
+ KASSERTMSG((l = dev->dv_detaching) == NULL,
+ "lwp %ld [%s] @ %p detaching",
+ (long)l->l_lid, (l->l_name ? l->l_name : l->l_proc->p_comm), l);
dev->dv_detaching = curlwp;
out: mutex_exit(&config_misc_lock);
@@ -1958,9 +1963,12 @@
static void
config_detach_exit(device_t dev)
{
+ struct lwp *l __diagused;
mutex_enter(&config_misc_lock);
- KASSERT(dev->dv_detaching == curlwp);
+ KASSERTMSG((l = dev->dv_detaching) == curlwp,
+ "lwp %ld [%s] @ %p detaching",
+ (long)l->l_lid, (l->l_name ? l->l_name : l->l_proc->p_comm), l);
dev->dv_detaching = NULL;
cv_broadcast(&config_misc_cv);
mutex_exit(&config_misc_lock);
@@ -2171,9 +2179,12 @@
void
config_detach_commit(device_t dev)
{
+ struct lwp *l __diagused;
mutex_enter(&config_misc_lock);
- KASSERT(dev->dv_detaching == curlwp);
+ KASSERTMSG((l = dev->dv_detaching) == curlwp,
+ "lwp %ld [%s] @ %p detaching",
+ (long)l->l_lid, (l->l_name ? l->l_name : l->l_proc->p_comm), l);
dev->dv_detached = true;
cv_broadcast(&config_misc_cv);
mutex_exit(&config_misc_lock);
Home |
Main Index |
Thread Index |
Old Index