Author: marcel
Date: Mon Dec 14 01:26:01 2009
New Revision: 200498
URL: http://svn.freebsd.org/changeset/base/200498

Log:
  Work-around a race condition on ia64 while unlocking a contested lock.
  The race condition is believed to be in UMTX_OP_MUTEX_WAKE. On ia64,
  we simply go to the kernel to unlock.
  The big question is why this is only a race condition on ia64...
  
  MFC after:    3 days

Modified:
  head/lib/libthr/thread/thr_umtx.c

Modified: head/lib/libthr/thread/thr_umtx.c
==============================================================================
--- head/lib/libthr/thread/thr_umtx.c   Mon Dec 14 01:10:05 2009        
(r200497)
+++ head/lib/libthr/thread/thr_umtx.c   Mon Dec 14 01:26:01 2009        
(r200498)
@@ -112,10 +112,13 @@ __thr_umutex_timedlock(struct umutex *mt
 int
 __thr_umutex_unlock(struct umutex *mtx, uint32_t id)
 {
+#ifndef __ia64__
+       /* XXX this logic has a race-condition on ia64. */
        if ((mtx->m_flags & (UMUTEX_PRIO_PROTECT | UMUTEX_PRIO_INHERIT)) == 0) {
                atomic_cmpset_rel_32(&mtx->m_owner, id | UMUTEX_CONTESTED, 
UMUTEX_CONTESTED);
                return _umtx_op_err(mtx, UMTX_OP_MUTEX_WAKE, 0, 0, 0);
        }
+#endif /* __ia64__ */
        return _umtx_op_err(mtx, UMTX_OP_MUTEX_UNLOCK, 0, 0, 0);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to