summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2014-02-17 13:32:15 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2014-02-27 11:20:44 -0600
commit850f884974dac7973f22341920fbb7277cf80245 (patch)
tree4a870919aa2b2e8dcfce16ebddbc5cc3cba0dcf8 /src/lib
parent19cd4e5ddb80c98365612590cc58e7d0de49f69c (diff)
downloadtalos-hostboot-850f884974dac7973f22341920fbb7277cf80245.tar.gz
talos-hostboot-850f884974dac7973f22341920fbb7277cf80245.zip
Clean up TODOs in Kernel.
* Ensure that unhandled SRESET will trigger TI. Change-Id: I34807bc357ba6908327ede975afc9c6b6b17c098 RTC: 92848 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/8933 Tested-by: Jenkins Server Reviewed-by: Douglas R. Gilbert <dgilbert@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/sync.C13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/sync.C b/src/lib/sync.C
index 38cd58025..6a79cb4f9 100644
--- a/src/lib/sync.C
+++ b/src/lib/sync.C
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2012 */
+/* COPYRIGHT International Business Machines Corp. 2011,2014 */
/* */
/* p1 */
/* */
@@ -213,9 +213,14 @@ int sync_cond_wait(sync_cond_t * i_cond, mutex_t * i_mutex)
// Can't continue until i_mutex lock is obtained.
- //mutex_lock(i_mutex); <--- Does not work - Havn't figure out why
- // but the followin code does work.
- // this code locks the mutex and makes sure it's contended.
+ // Note:
+ // mutex_lock(i_mutex); <--- This does not work
+ // We have to mark the mutex as contended '2' because there is a race
+ // condition between this thread (eventually) calling mutex_unlock and
+ // the kernel moving tasks from the condition futex to the mutex futex
+ // during a sync_condition_broadcast. By marking contended, we force the
+ // subsequent mutex_unlock to call to the kernel which will obtain a
+ // spinlock to ensure all tasks have been moved to the mutex_futex.
while(0 != __sync_lock_test_and_set(&(i_mutex->iv_val), 2))
{
futex_wait(&(i_mutex->iv_val),2);
OpenPOWER on IntegriCloud