diff options
author | Doug Gilbert <dgilbert@us.ibm.com> | 2011-08-03 13:04:34 -0500 |
---|---|---|
committer | Douglas R. Gilbert <dgilbert@us.ibm.com> | 2011-08-03 15:31:02 -0500 |
commit | 1fa888465e302181368021fefa15a44e1854914f (patch) | |
tree | 0d6f81206e7b6a472a54f67e8f8024185032e861 /src | |
parent | 5867b512c1592fce1a5bab56e4320efd6598645f (diff) | |
download | talos-hostboot-1fa888465e302181368021fefa15a44e1854914f.tar.gz talos-hostboot-1fa888465e302181368021fefa15a44e1854914f.zip |
Hang condition on mutex, try different futex lock code
Change-Id: I5c9e1e54234a9214a70bec0ef87a53da86100195
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/226
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Tested-by: Jenkins Server
Reviewed-by: Douglas R. Gilbert <dgilbert@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/sync.C | 9 | ||||
-rw-r--r-- | src/usr/cxxtest/cxxtestexec.C | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/sync.C b/src/lib/sync.C index 233801ceb..d0d15aeb4 100644 --- a/src/lib/sync.C +++ b/src/lib/sync.C @@ -85,24 +85,28 @@ void mutex_destroy(mutex_t *& i_mutex) void mutex_lock(mutex_t * i_mutex) { -#ifdef __IDEA_1 + uint64_t l_count = __sync_val_compare_and_swap(&(i_mutex->iv_val),0,1); if(l_count != 0) { if (l_count != 2) + { + lwsync(); l_count = __sync_lock_test_and_set(&(i_mutex->iv_val), 2); + } while( l_count != 0 ) { futex_wait( &(i_mutex->iv_val), 2); + lwsync(); l_count = __sync_lock_test_and_set(&(i_mutex->iv_val),2); // if more than one thread gets out - one continues while // the rest get blocked again. } } -#endif +#ifdef __IDEA_2 // Idea # 2 while(1) { @@ -123,6 +127,7 @@ void mutex_lock(mutex_t * i_mutex) } } } +#endif return; } diff --git a/src/usr/cxxtest/cxxtestexec.C b/src/usr/cxxtest/cxxtestexec.C index 63a12c7ca..5470b718a 100644 --- a/src/usr/cxxtest/cxxtestexec.C +++ b/src/usr/cxxtest/cxxtestexec.C @@ -117,8 +117,6 @@ void _start(void *io_pArgs) tidrc = task_exec( vfsItr->module, NULL ); TRACDCOMP( g_trac_cxxtest, "Launched task: tidrc=%d", tidrc ); - //@fixme-try to alleviate cxxtest deadlock - nanosleep( 1, 0 ); //sleep 1 second } } |