Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 May 2007 20:37:31 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 120075 for review
Message-ID:  <200705192037.l4JKbVKd051524@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=120075

Change 120075 by jhb@jhb_mutex on 2007/05/19 20:36:47

	IFC @120073

Affected files ...

.. //depot/projects/smpng/sys/arm/include/asm.h#6 integrate
.. //depot/projects/smpng/sys/arm/include/profile.h#7 integrate
.. //depot/projects/smpng/sys/ia64/ia64/pmap.c#85 integrate
.. //depot/projects/smpng/sys/kern/kern_sx.c#49 integrate
.. //depot/projects/smpng/sys/sys/sx.h#28 integrate

Differences ...

==== //depot/projects/smpng/sys/arm/include/asm.h#6 (text+ko) ====

@@ -33,7 +33,7 @@
  *
  *	from: @(#)asm.h	5.5 (Berkeley) 5/7/91
  *
- * $FreeBSD: src/sys/arm/include/asm.h,v 1.5 2006/08/30 11:45:07 cognet Exp $
+ * $FreeBSD: src/sys/arm/include/asm.h,v 1.6 2007/05/19 16:20:37 cognet Exp $
  */
 
 #ifndef _MACHINE_ASM_H_
@@ -80,7 +80,7 @@
 
 #ifdef GPROF
 #  define _PROF_PROLOGUE	\
-	mov ip, lr; bl _mcount
+	mov ip, lr; bl __mcount
 #else
 # define _PROF_PROLOGUE
 #endif

==== //depot/projects/smpng/sys/arm/include/profile.h#7 (text+ko) ====

@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)profile.h	8.1 (Berkeley) 6/11/93
- * $FreeBSD: src/sys/arm/include/profile.h,v 1.6 2005/01/05 21:58:48 imp Exp $
+ * $FreeBSD: src/sys/arm/include/profile.h,v 1.7 2007/05/19 16:20:37 cognet Exp $
  */
 
 #ifndef _MACHINE_PROFILE_H_
@@ -61,9 +61,9 @@
 #define	MCOUNT								\
 	__asm__(".text");						\
 	__asm__(".align	0");						\
-	__asm__(".type	_mcount ,%function");				\
-	__asm__(".global	_mcount");				\
-	__asm__("_mcount:");						\
+	__asm__(".type	__mcount ,%function");				\
+	__asm__(".global	__mcount");				\
+	__asm__("__mcount:");						\
 	/*								\
 	 * Preserve registers that are trashed during mcount		\
 	 */								\

==== //depot/projects/smpng/sys/ia64/ia64/pmap.c#85 (text+ko) ====

@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/ia64/ia64/pmap.c,v 1.184 2007/05/19 13:11:27 marcel Exp $");
+__FBSDID("$FreeBSD: src/sys/ia64/ia64/pmap.c,v 1.185 2007/05/19 18:25:14 marcel Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -1420,14 +1420,14 @@
 				pmap_remove_pte(pmap, pte, va, pv, 1);
 			}
 		}
-		
 	} else {
-		for (va = sva; va < eva; va = va += PAGE_SIZE) {
+		for (va = sva; va < eva; va += PAGE_SIZE) {
 			pte = pmap_find_vhpt(va);
 			if (pte != NULL)
 				pmap_remove_pte(pmap, pte, va, 0, 1);
 		}
 	}
+
 out:
 	vm_page_unlock_queues();
 	pmap_install(oldpmap);

==== //depot/projects/smpng/sys/kern/kern_sx.c#49 (text+ko) ====

@@ -40,7 +40,7 @@
 #include "opt_ddb.h"
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_sx.c,v 1.46 2007/05/18 15:05:41 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_sx.c,v 1.49 2007/05/19 20:18:12 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/ktr.h>
@@ -101,14 +101,6 @@
  */
 #define	sx_recursed(sx)		((sx)->sx_recurse != 0)
 
-/*
- * Return a pointer to the owning thread if the lock is exclusively
- * locked.
- */
-#define	sx_xholder(sx)							\
-	((sx)->sx_lock & SX_LOCK_SHARED ? NULL :			\
-	(struct thread *)SX_OWNER((sx)->sx_lock))
-
 #ifdef DDB
 static void	db_show_sx(struct lock_object *lock);
 #endif
@@ -170,6 +162,9 @@
 {
 	int flags;
 
+	MPASS((opts & ~(SX_QUIET | SX_RECURSE | SX_NOWITNESS | SX_DUPOK |
+	    SX_NOPROFILE | SX_ADAPTIVESPIN)) == 0);
+
 	flags = LO_SLEEPABLE | LO_UPGRADABLE | LO_RECURSABLE;
 	if (opts & SX_DUPOK)
 		flags |= LO_DUPOK;
@@ -180,7 +175,7 @@
 	if (opts & SX_QUIET)
 		flags |= LO_QUIET;
 
-	flags |= opts & SX_ADAPTIVESPIN;
+	flags |= opts & (SX_ADAPTIVESPIN | SX_RECURSE);
 	sx->sx_lock = SX_LOCK_UNLOCKED;
 	sx->sx_recurse = 0;
 	lock_init(&sx->lock_object, &lock_class_sx, description, NULL, flags);
@@ -254,7 +249,7 @@
 	KASSERT(sx->sx_lock != SX_LOCK_DESTROYED,
 	    ("sx_try_xlock() of destroyed sx @ %s:%d", file, line));
 
-	if (sx_xlocked(sx)) {
+	if (sx_xlocked(sx) && (sx->lock_object.lo_flags & SX_RECURSE) != 0) {
 		sx->sx_recurse++;
 		atomic_set_ptr(&sx->sx_lock, SX_LOCK_RECURSED);
 		rval = 1;
@@ -412,6 +407,9 @@
 
 	/* If we already hold an exclusive lock, then recurse. */
 	if (sx_xlocked(sx)) {
+		KASSERT((sx->lock_object.lo_flags & SX_RECURSE) != 0,
+	    ("_sx_xlock_hard: recursed on non-recursive sx %s @ %s:%d\n",
+		    sx->lock_object.lo_name, file, line));		
 		sx->sx_recurse++;
 		atomic_set_ptr(&sx->sx_lock, SX_LOCK_RECURSED);
 		if (LOCK_LOG_TEST(&sx->lock_object, 0))

==== //depot/projects/smpng/sys/sys/sx.h#28 (text+ko) ====

@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  * DAMAGE.
  *
- * $FreeBSD: src/sys/sys/sx.h,v 1.31 2007/05/08 21:51:37 jhb Exp $
+ * $FreeBSD: src/sys/sys/sx.h,v 1.33 2007/05/19 20:18:12 jhb Exp $
  */
 
 #ifndef	_SYS_SX_H_
@@ -213,6 +213,14 @@
 #define	sx_try_upgrade(sx)	_sx_try_upgrade((sx), LOCK_FILE, LOCK_LINE)
 #define	sx_downgrade(sx)	_sx_downgrade((sx), LOCK_FILE, LOCK_LINE)
 
+/*
+ * Return a pointer to the owning thread if the lock is exclusively
+ * locked.
+ */
+#define	sx_xholder(sx)							\
+	((sx)->sx_lock & SX_LOCK_SHARED ? NULL :			\
+	(struct thread *)SX_OWNER((sx)->sx_lock))
+
 #define	sx_xlocked(sx)							\
 	(((sx)->sx_lock & ~(SX_LOCK_FLAGMASK & ~SX_LOCK_SHARED)) ==	\
 	    (uintptr_t)curthread)
@@ -235,6 +243,7 @@
 #define	SX_NOWITNESS		0x04
 #define	SX_QUIET		0x08
 #define	SX_ADAPTIVESPIN		0x10
+#define	SX_RECURSE		0x20
 
 /*
  * XXX: These options should be renamed as SA_*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705192037.l4JKbVKd051524>