Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Revert commit from Fri Feb 5 06:43:17 UTC 2010 by skrll:
details: https://anonhg.NetBSD.org/src/rev/e7880ab33aea
branches: trunk
changeset: 751506:e7880ab33aea
user: cube <cube%NetBSD.org@localhost>
date: Sat Feb 06 04:50:19 2010 +0000
description:
Revert commit from Fri Feb 5 06:43:17 UTC 2010 by skrll:
Invert the sense of the bit to mark if LOCKDEBUG is enabled to disabled.
This will help my fellow developers spot "use before initialised" problems
that hppa picks up very well.
It has to be done differently, because the semantics of mtx_owner in the non-
LOCKDEBUG case can vary significantly between archs, and thus it is not
possible to simply flip a bit to 1.
Ok core@, as at least i386 is unbootable right now.
diffstat:
sys/kern/kern_mutex.c | 18 +++++++++---------
sys/kern/kern_rwlock.c | 12 ++++++------
sys/sys/mutex.h | 4 ++--
sys/sys/rwlock.h | 12 ++++++------
4 files changed, 23 insertions(+), 23 deletions(-)
diffs (141 lines):
diff -r a8d93432a833 -r e7880ab33aea sys/kern/kern_mutex.c
--- a/sys/kern/kern_mutex.c Sat Feb 06 03:06:42 2010 +0000
+++ b/sys/kern/kern_mutex.c Sat Feb 06 04:50:19 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_mutex.c,v 1.47 2010/02/05 06:43:16 skrll Exp $ */
+/* $NetBSD: kern_mutex.c,v 1.48 2010/02/06 04:50:19 cube 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.47 2010/02/05 06:43:16 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_mutex.c,v 1.48 2010/02/06 04:50:19 cube Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -157,15 +157,15 @@
#define MUTEX_INITIALIZE_ADAPTIVE(mtx, dodebug) \
do { \
- if (!dodebug) \
- (mtx)->mtx_owner |= MUTEX_BIT_NODEBUG; \
+ if (dodebug) \
+ (mtx)->mtx_owner |= MUTEX_BIT_DEBUG; \
} while (/* CONSTCOND */ 0);
#define MUTEX_INITIALIZE_SPIN(mtx, dodebug, ipl) \
do { \
(mtx)->mtx_owner = MUTEX_BIT_SPIN; \
- if (!dodebug) \
- (mtx)->mtx_owner |= MUTEX_BIT_NODEBUG; \
+ if (dodebug) \
+ (mtx)->mtx_owner |= MUTEX_BIT_DEBUG; \
(mtx)->mtx_ipl = makeiplcookie((ipl)); \
__cpu_simple_lock_init(&(mtx)->mtx_lock); \
} while (/* CONSTCOND */ 0)
@@ -180,10 +180,10 @@
#define MUTEX_ADAPTIVE_P(mtx) \
(((mtx)->mtx_owner & MUTEX_BIT_SPIN) == 0)
-#define MUTEX_DEBUG_P(mtx) (((mtx)->mtx_owner & MUTEX_BIT_NODEBUG) == 0)
+#define MUTEX_DEBUG_P(mtx) (((mtx)->mtx_owner & MUTEX_BIT_DEBUG) != 0)
#if defined(LOCKDEBUG)
-#define MUTEX_OWNED(owner) (((owner) & ~MUTEX_BIT_NODEBUG) != 0)
-#define MUTEX_INHERITDEBUG(new, old) (new) |= (old) & MUTEX_BIT_NODEBUG
+#define MUTEX_OWNED(owner) (((owner) & ~MUTEX_BIT_DEBUG) != 0)
+#define MUTEX_INHERITDEBUG(new, old) (new) |= (old) & MUTEX_BIT_DEBUG
#else /* defined(LOCKDEBUG) */
#define MUTEX_OWNED(owner) ((owner) != 0)
#define MUTEX_INHERITDEBUG(new, old) /* nothing */
diff -r a8d93432a833 -r e7880ab33aea sys/kern/kern_rwlock.c
--- a/sys/kern/kern_rwlock.c Sat Feb 06 03:06:42 2010 +0000
+++ b/sys/kern/kern_rwlock.c Sat Feb 06 04:50:19 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_rwlock.c,v 1.34 2010/02/05 06:43:16 skrll Exp $ */
+/* $NetBSD: kern_rwlock.c,v 1.35 2010/02/06 04:50:19 cube 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.34 2010/02/05 06:43:16 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.35 2010/02/06 04:50:19 cube Exp $");
#define __RWLOCK_PRIVATE
@@ -103,10 +103,10 @@
#endif /* DIAGNOSTIC */
-#define RW_SETDEBUG(rw, on) ((rw)->rw_owner |= (on) ? 0 : RW_NODEBUG)
-#define RW_DEBUG_P(rw) (((rw)->rw_owner & RW_NODEBUG) == 0)
+#define RW_SETDEBUG(rw, on) ((rw)->rw_owner |= (on) ? RW_DEBUG : 0)
+#define RW_DEBUG_P(rw) (((rw)->rw_owner & RW_DEBUG) != 0)
#if defined(LOCKDEBUG)
-#define RW_INHERITDEBUG(new, old) (new) |= (old) & RW_NODEBUG
+#define RW_INHERITDEBUG(new, old) (new) |= (old) & RW_DEBUG
#else /* defined(LOCKDEBUG) */
#define RW_INHERITDEBUG(new, old) /* nothing */
#endif /* defined(LOCKDEBUG) */
@@ -218,7 +218,7 @@
rw_destroy(krwlock_t *rw)
{
- RW_ASSERT(rw, (rw->rw_owner & ~RW_NODEBUG) == 0);
+ RW_ASSERT(rw, (rw->rw_owner & ~RW_DEBUG) == 0);
LOCKDEBUG_FREE(RW_DEBUG_P(rw), rw);
}
diff -r a8d93432a833 -r e7880ab33aea sys/sys/mutex.h
--- a/sys/sys/mutex.h Sat Feb 06 03:06:42 2010 +0000
+++ b/sys/sys/mutex.h Sat Feb 06 04:50:19 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mutex.h,v 1.18 2010/02/05 06:43:17 skrll Exp $ */
+/* $NetBSD: mutex.h,v 1.19 2010/02/06 04:50:19 cube Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -160,7 +160,7 @@
#define MUTEX_BIT_SPIN 0x01
#define MUTEX_BIT_WAITERS 0x02
-#define MUTEX_BIT_NODEBUG 0x04
+#define MUTEX_BIT_DEBUG 0x04
#define MUTEX_SPIN_IPL(mtx) ((mtx)->mtx_ipl)
#define MUTEX_SPIN_OLDSPL(ci) ((ci)->ci_mtx_oldspl)
diff -r a8d93432a833 -r e7880ab33aea sys/sys/rwlock.h
--- a/sys/sys/rwlock.h Sat Feb 06 03:06:42 2010 +0000
+++ b/sys/sys/rwlock.h Sat Feb 06 04:50:19 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rwlock.h,v 1.8 2010/02/05 06:43:17 skrll Exp $ */
+/* $NetBSD: rwlock.h,v 1.9 2010/02/06 04:50:19 cube Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -67,15 +67,15 @@
* WRITE_LOCKED bit is clear, then the owner field is actually a count of
* the number of readers. The rw_owner field is laid out like so:
*
- * N 4 3 2 1 0
- * +---------------------------------------------------------+
- * | owner or read count | nodbug | wrlock | wrwant | wait |
- * +---------------------------------------------------------+
+ * N 4 3 2 1 0
+ * +------------------------------------------------------+
+ * | owner or read count | debug | wrlock | wrwant | wait |
+ * +------------------------------------------------------+
*/
#define RW_HAS_WAITERS 0x01UL /* lock has waiters */
#define RW_WRITE_WANTED 0x02UL /* >= 1 waiter is a writer */
#define RW_WRITE_LOCKED 0x04UL /* lock is currently write locked */
-#define RW_NODEBUG 0x08UL /* LOCKDEBUG disabled */
+#define RW_DEBUG 0x08UL /* LOCKDEBUG enabled */
#define RW_READ_COUNT_SHIFT 4
#define RW_READ_INCR (1UL << RW_READ_COUNT_SHIFT)
Home |
Main Index |
Thread Index |
Old Index