Module Name: src Committed By: mlelstv Date: Sat Apr 27 08:12:35 UTC 2013
Modified Files: src/sys/kern: kern_lock.c kern_mutex.c kern_rwlock.c subr_lockdebug.c src/sys/sys: lockdebug.h Log Message: Revert change that allowed rw_tryenter(&lock, RW_READER) to recurse for vfs_busy(). This is no longer necessary. To generate a diff of this commit: cvs rdiff -u -r1.153 -r1.154 src/sys/kern/kern_lock.c cvs rdiff -u -r1.53 -r1.54 src/sys/kern/kern_mutex.c cvs rdiff -u -r1.39 -r1.40 src/sys/kern/kern_rwlock.c cvs rdiff -u -r1.48 -r1.49 src/sys/kern/subr_lockdebug.c cvs rdiff -u -r1.13 -r1.14 src/sys/sys/lockdebug.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/kern_lock.c diff -u src/sys/kern/kern_lock.c:1.153 src/sys/kern/kern_lock.c:1.154 --- src/sys/kern/kern_lock.c:1.153 Thu Aug 30 02:23:14 2012 +++ src/sys/kern/kern_lock.c Sat Apr 27 08:12:34 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_lock.c,v 1.153 2012/08/30 02:23:14 matt Exp $ */ +/* $NetBSD: kern_lock.c,v 1.154 2013/04/27 08:12:34 mlelstv Exp $ */ /*- * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.153 2012/08/30 02:23:14 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.154 2013/04/27 08:12:34 mlelstv Exp $"); #include <sys/param.h> #include <sys/proc.h> @@ -175,7 +175,7 @@ _kernel_lock(int nlocks) _KERNEL_LOCK_ASSERT(l->l_blcnt == 0); LOCKDEBUG_WANTLOCK(kernel_lock_dodebug, kernel_lock, RETURN_ADDRESS, - false, false); + 0); if (__cpu_simple_lock_try(kernel_lock)) { ci->ci_biglock_count = nlocks; Index: src/sys/kern/kern_mutex.c diff -u src/sys/kern/kern_mutex.c:1.53 src/sys/kern/kern_mutex.c:1.54 --- src/sys/kern/kern_mutex.c:1.53 Sat Feb 25 22:32:44 2012 +++ src/sys/kern/kern_mutex.c Sat Apr 27 08:12:34 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_mutex.c,v 1.53 2012/02/25 22:32:44 rmind Exp $ */ +/* $NetBSD: kern_mutex.c,v 1.54 2013/04/27 08:12:34 mlelstv Exp $ */ /*- * Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #define __MUTEX_PRIVATE #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.53 2012/02/25 22:32:44 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.54 2013/04/27 08:12:34 mlelstv Exp $"); #include <sys/param.h> #include <sys/atomic.h> @@ -74,7 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_mutex.c #define MUTEX_WANTLOCK(mtx) \ LOCKDEBUG_WANTLOCK(MUTEX_DEBUG_P(mtx), (mtx), \ - (uintptr_t)__builtin_return_address(0), false, false) + (uintptr_t)__builtin_return_address(0), 0) #define MUTEX_LOCKED(mtx) \ LOCKDEBUG_LOCKED(MUTEX_DEBUG_P(mtx), (mtx), NULL, \ (uintptr_t)__builtin_return_address(0), 0) Index: src/sys/kern/kern_rwlock.c diff -u src/sys/kern/kern_rwlock.c:1.39 src/sys/kern/kern_rwlock.c:1.40 --- src/sys/kern/kern_rwlock.c:1.39 Wed Dec 12 14:53:01 2012 +++ src/sys/kern/kern_rwlock.c Sat Apr 27 08:12:35 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_rwlock.c,v 1.39 2012/12/12 14:53:01 yamt Exp $ */ +/* $NetBSD: kern_rwlock.c,v 1.40 2013/04/27 08:12:35 mlelstv Exp $ */ /*- * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.39 2012/12/12 14:53:01 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.40 2013/04/27 08:12:35 mlelstv Exp $"); #define __RWLOCK_PRIVATE @@ -61,9 +61,9 @@ __KERNEL_RCSID(0, "$NetBSD: kern_rwlock. #if defined(LOCKDEBUG) -#define RW_WANTLOCK(rw, op, t) \ +#define RW_WANTLOCK(rw, op) \ LOCKDEBUG_WANTLOCK(RW_DEBUG_P(rw), (rw), \ - (uintptr_t)__builtin_return_address(0), op == RW_READER, t); + (uintptr_t)__builtin_return_address(0), op == RW_READER); #define RW_LOCKED(rw, op) \ LOCKDEBUG_LOCKED(RW_DEBUG_P(rw), (rw), NULL, \ (uintptr_t)__builtin_return_address(0), op == RW_READER); @@ -78,7 +78,7 @@ do { \ #else /* LOCKDEBUG */ -#define RW_WANTLOCK(rw, op, t) /* nothing */ +#define RW_WANTLOCK(rw, op) /* nothing */ #define RW_LOCKED(rw, op) /* nothing */ #define RW_UNLOCKED(rw, op) /* nothing */ #define RW_DASSERT(rw, cond) /* nothing */ @@ -281,7 +281,7 @@ rw_vector_enter(krwlock_t *rw, const krw RW_ASSERT(rw, !cpu_intr_p()); RW_ASSERT(rw, curthread != 0); - RW_WANTLOCK(rw, op, false); + RW_WANTLOCK(rw, op); if (panicstr == NULL) { LOCKDEBUG_BARRIER(&kernel_lock, 1); @@ -555,7 +555,7 @@ rw_vector_tryenter(krwlock_t *rw, const } } - RW_WANTLOCK(rw, op, true); + RW_WANTLOCK(rw, op); RW_LOCKED(rw, op); RW_DASSERT(rw, (op != RW_READER && RW_OWNER(rw) == curthread) || (op == RW_READER && RW_COUNT(rw) != 0)); @@ -647,7 +647,7 @@ rw_downgrade(krwlock_t *rw) } } - RW_WANTLOCK(rw, RW_READER, false); + RW_WANTLOCK(rw, RW_READER); RW_LOCKED(rw, RW_READER); RW_DASSERT(rw, (rw->rw_owner & RW_WRITE_LOCKED) == 0); RW_DASSERT(rw, RW_COUNT(rw) != 0); @@ -683,7 +683,7 @@ rw_tryupgrade(krwlock_t *rw) } RW_UNLOCKED(rw, RW_READER); - RW_WANTLOCK(rw, RW_WRITER, true); + RW_WANTLOCK(rw, RW_WRITER); RW_LOCKED(rw, RW_WRITER); RW_DASSERT(rw, rw->rw_owner & RW_WRITE_LOCKED); RW_DASSERT(rw, RW_OWNER(rw) == curthread); Index: src/sys/kern/subr_lockdebug.c diff -u src/sys/kern/subr_lockdebug.c:1.48 src/sys/kern/subr_lockdebug.c:1.49 --- src/sys/kern/subr_lockdebug.c:1.48 Sat Feb 9 11:04:32 2013 +++ src/sys/kern/subr_lockdebug.c Sat Apr 27 08:12:35 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_lockdebug.c,v 1.48 2013/02/09 11:04:32 njoly Exp $ */ +/* $NetBSD: subr_lockdebug.c,v 1.49 2013/04/27 08:12:35 mlelstv Exp $ */ /*- * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.48 2013/02/09 11:04:32 njoly Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.49 2013/04/27 08:12:35 mlelstv Exp $"); #include "opt_ddb.h" @@ -411,8 +411,7 @@ lockdebug_more(int s) * Process the preamble to a lock acquire. */ void -lockdebug_wantlock(volatile void *lock, uintptr_t where, bool shared, - bool trylock) +lockdebug_wantlock(volatile void *lock, uintptr_t where, int shared) { struct lwp *l = curlwp; lockdebug_t *ld; @@ -432,7 +431,7 @@ lockdebug_wantlock(volatile void *lock, } if ((ld->ld_flags & LD_LOCKED) != 0 || ld->ld_shares != 0) { if ((ld->ld_flags & LD_SLEEPER) != 0) { - if (ld->ld_lwp == l && !(shared && trylock)) + if (ld->ld_lwp == l) recurse = true; } else if (ld->ld_cpu == (uint16_t)cpu_index(curcpu())) recurse = true; Index: src/sys/sys/lockdebug.h diff -u src/sys/sys/lockdebug.h:1.13 src/sys/sys/lockdebug.h:1.14 --- src/sys/sys/lockdebug.h:1.13 Mon Nov 21 04:36:05 2011 +++ src/sys/sys/lockdebug.h Sat Apr 27 08:12:34 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: lockdebug.h,v 1.13 2011/11/21 04:36:05 christos Exp $ */ +/* $NetBSD: lockdebug.h,v 1.14 2013/04/27 08:12:34 mlelstv Exp $ */ /*- * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ void lockdebug_lock_print(void *, void ( bool lockdebug_alloc(volatile void *, lockops_t *, uintptr_t); void lockdebug_free(volatile void *); -void lockdebug_wantlock(volatile void *, uintptr_t, bool, bool); +void lockdebug_wantlock(volatile void *, uintptr_t, int); void lockdebug_locked(volatile void *, void *, uintptr_t, int); void lockdebug_unlocked(volatile void *, uintptr_t, int); void lockdebug_barrier(volatile void *, int); @@ -72,8 +72,8 @@ void lockdebug_wakeup(volatile void *, u #define LOCKDEBUG_ALLOC(lock, ops, addr) lockdebug_alloc(lock, ops, addr) #define LOCKDEBUG_FREE(dodebug, lock) \ if (dodebug) lockdebug_free(lock) -#define LOCKDEBUG_WANTLOCK(dodebug, lock, where, s, t) \ - if (dodebug) lockdebug_wantlock(lock, where, s, t) +#define LOCKDEBUG_WANTLOCK(dodebug, lock, where, s) \ + if (dodebug) lockdebug_wantlock(lock, where, s) #define LOCKDEBUG_LOCKED(dodebug, lock, al, where, s) \ if (dodebug) lockdebug_locked(lock, al, where, s) #define LOCKDEBUG_UNLOCKED(dodebug, lock, where, s) \ @@ -88,7 +88,7 @@ void lockdebug_wakeup(volatile void *, u #define LOCKDEBUG_ALLOC(lock, ops, addr) false #define LOCKDEBUG_FREE(dodebug, lock) /* nothing */ -#define LOCKDEBUG_WANTLOCK(dodebug, lock, where, s, t) /* nothing */ +#define LOCKDEBUG_WANTLOCK(dodebug, lock, where, s) /* nothing */ #define LOCKDEBUG_LOCKED(dodebug, lock, al, where, s) /* nothing */ #define LOCKDEBUG_UNLOCKED(dodebug, lock, where, s) /* nothing */ #define LOCKDEBUG_BARRIER(lock, slp) /* nothing */