Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/sys Pullup from trunk:
details: https://anonhg.NetBSD.org/src/rev/67e02ac636b8
branches: netbsd-1-5
changeset: 489070:67e02ac636b8
user: thorpej <thorpej%NetBSD.org@localhost>
date: Fri Aug 11 23:07:39 2000 +0000
description:
Pullup from trunk:
It doesn't make sense to charge simple locks to proc's, because
simple locks are held by CPUs. Remove p_simple_locks (which was
unused anyway, really), and add a LOCKDEBUG check for held simple
locks in mi_switch(). Grow p_locks to an int to take up the space
previously used by p_simple_locks so that the proc structure doens't
change size.
diffstat:
sys/kern/kern_lock.c | 25 ++++++++++++++++++++++++-
sys/kern/kern_synch.c | 11 +++--------
sys/sys/lock.h | 5 +++--
sys/sys/proc.h | 5 ++---
4 files changed, 32 insertions(+), 14 deletions(-)
diffs (104 lines):
diff -r b96ef4f32db5 -r 67e02ac636b8 sys/kern/kern_lock.c
--- a/sys/kern/kern_lock.c Fri Aug 11 22:24:44 2000 +0000
+++ b/sys/kern/kern_lock.c Fri Aug 11 23:07:39 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_lock.c,v 1.32 2000/06/10 18:44:43 sommerfeld Exp $ */
+/* $NetBSD: kern_lock.c,v 1.32.2.1 2000/08/11 23:07:39 thorpej Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -960,4 +960,27 @@
SLOCK_LIST_UNLOCK();
splx(s);
}
+
+void
+simple_lock_switchcheck(void)
+{
+ struct simplelock *alp;
+ cpuid_t cpu_id = cpu_number();
+ int s;
+
+ s = splhigh();
+ SLOCK_LIST_LOCK();
+ for (alp = TAILQ_FIRST(&simplelock_list); alp != NULL;
+ alp = TAILQ_NEXT(alp, list)) {
+ if (alp->lock_holder == cpu_id) {
+ lock_printf("switching with held simple_lock %p "
+ "CPU %lu %s:%s\n",
+ alp, alp->lock_holder, alp->lock_file,
+ alp->lock_line);
+ SLOCK_DEBUGGER();
+ }
+ }
+ SLOCK_LIST_UNLOCK();
+ splx(s);
+}
#endif /* LOCKDEBUG */ /* } */
diff -r b96ef4f32db5 -r 67e02ac636b8 sys/kern/kern_synch.c
--- a/sys/kern/kern_synch.c Fri Aug 11 22:24:44 2000 +0000
+++ b/sys/kern/kern_synch.c Fri Aug 11 23:07:39 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_synch.c,v 1.78 2000/06/10 18:44:44 sommerfeld Exp $ */
+/* $NetBSD: kern_synch.c,v 1.78.2.1 2000/08/11 23:07:39 thorpej Exp $ */
/*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -765,15 +765,10 @@
spc = &p->p_cpu->ci_schedstate;
-#ifdef DEBUG
- if (p->p_simple_locks) {
- printf("p->p_simple_locks %d\n", p->p_simple_locks);
#ifdef LOCKDEBUG
- simple_lock_dump();
+ simple_lock_switchcheck();
#endif
- panic("sleep: holding simple lock");
- }
-#endif
+
/*
* Compute the amount of time during which the current
* process was running, and add that to its total so far.
diff -r b96ef4f32db5 -r 67e02ac636b8 sys/sys/lock.h
--- a/sys/sys/lock.h Fri Aug 11 22:24:44 2000 +0000
+++ b/sys/sys/lock.h Fri Aug 11 23:07:39 2000 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: lock.h,v 1.31 2000/06/07 16:37:24 thorpej Exp $ */
+/* $NetBSD: lock.h,v 1.31.2.1 2000/08/11 23:07:40 thorpej Exp $ */
/*-
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -299,6 +299,7 @@
void simple_lock_init __P((struct simplelock *));
void simple_lock_dump __P((void));
void simple_lock_freecheck __P((void *, void *));
+void simple_lock_switchcheck __P((void));
#elif defined(MULTIPROCESSOR)
#define simple_lock_init(alp) __cpu_simple_lock_init(&(alp)->lock_data)
#define simple_lock(alp) __cpu_simple_lock(&(alp)->lock_data)
diff -r b96ef4f32db5 -r 67e02ac636b8 sys/sys/proc.h
--- a/sys/sys/proc.h Fri Aug 11 22:24:44 2000 +0000
+++ b/sys/sys/proc.h Fri Aug 11 23:07:39 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: proc.h,v 1.98 2000/06/08 05:50:40 thorpej Exp $ */
+/* $NetBSD: proc.h,v 1.98.2.1 2000/08/11 23:07:41 thorpej Exp $ */
/*-
* Copyright (c) 1986, 1989, 1991, 1993
@@ -179,8 +179,7 @@
struct vnode *p_textvp; /* Vnode of executable. */
- short p_locks; /* DEBUG: lockmgr count of held locks */
- short p_simple_locks; /* DEBUG: count of held simple locks */
+ int p_locks; /* DEBUG: lockmgr count of held locks */
int p_holdcnt; /* If non-zero, don't swap. */
struct emul *p_emul; /* Emulation information */
Home |
Main Index |
Thread Index |
Old Index