Date: Sat, 19 May 2007 20:40:35 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 120076 for review Message-ID: <200705192040.l4JKeZkR056334@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=120076 Change 120076 by hselasky@hselasky_mini_itx on 2007/05/19 20:39:38 IFC @120073 Affected files ... .. //depot/projects/usb/src/sys/ia64/ia64/pmap.c#7 integrate .. //depot/projects/usb/src/sys/kern/kern_sx.c#6 integrate .. //depot/projects/usb/src/sys/sys/sx.h#5 integrate Differences ... ==== //depot/projects/usb/src/sys/ia64/ia64/pmap.c#7 (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/usb/src/sys/kern/kern_sx.c#6 (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/usb/src/sys/sys/sx.h#5 (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?200705192040.l4JKeZkR056334>