From owner-p4-projects@FreeBSD.ORG Sat Jun 3 19:15:39 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1E71816A53A; Sat, 3 Jun 2006 19:15:39 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 16E7616A521 for ; Sat, 3 Jun 2006 19:15:37 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 758A043D49 for ; Sat, 3 Jun 2006 19:15:36 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k53JE0tY077826 for ; Sat, 3 Jun 2006 19:14:00 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k53JE0vw077822 for perforce@freebsd.org; Sat, 3 Jun 2006 19:14:00 GMT (envelope-from jhb@freebsd.org) Date: Sat, 3 Jun 2006 19:14:00 GMT Message-Id: <200606031914.k53JE0vw077822@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 98413 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jun 2006 19:15:40 -0000 http://perforce.freebsd.org/chv.cgi?CH=98413 Change 98413 by jhb@jhb_mutex on 2006/06/03 19:13:52 Axe BAD_OWNER and just include MTX_UNOWNED in the mask since that happens to work b/c rwlocks require 8-byte aligned struct threads. Requested by: kris Affected files ... .. //depot/projects/smpng/sys/kern/kern_mutex.c#125 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_mutex.c#125 (text+ko) ==== @@ -88,15 +88,10 @@ /* * Internal utility macros. - * - * Note that mtx_owner() can return an invalid pointer - * ((struct thread *)MTX_UNOWNED) if the mutex is unowned. */ #define mtx_unowned(m) ((m)->mtx_lock == MTX_UNOWNED) -#define mtx_owner(m) ((struct thread *)((m)->mtx_lock & MTX_FLAGMASK)) - -#define BAD_OWNER ((struct thread *)MTX_UNOWNED) +#define mtx_owner(m) ((struct thread *)((m)->mtx_lock & (MTX_FLAGMASK|MTX_UNOWNED))) #ifdef DDB static void db_show_mtx(struct lock_object *lock); @@ -641,11 +636,8 @@ else { td = mtx_owner(m); - /* - * If we get the bad owner cookie, the - * mutex is unlocked, so try again. - */ - if (td == BAD_OWNER) + /* If the mutex is unlocked, try again. */ + if (td == NULL) continue; printf( "spin lock %p (%s) held by %p (tid %d) too long\n",