This is the mail archive of the
mailing list for the GCC project.
[trans-mem] unlock serial_lock when committing transaction
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: rth at redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Wed, 24 Feb 2010 16:57:13 -0400
- Subject: [trans-mem] unlock serial_lock when committing transaction
There's this sporadic failure on testsuite/libitm.c/simple-2.c in which
we're deadlocking because serial_lock never gets unlocked on a
successful transaction. Also, decide_retry_strategy is not updating the
state when switching to serial mode.
I caught this by inserting printfs in the library and noticing there
were a lot more locks than unlocks :).
I have fixed both of these problems.
Unfortunately... there's an unrelated problem with the Linux futex
implementation on the library. So I had to test with
--disable-linux-futex and use the pthreads mutex code for locks.
Tested by running "make check-target-libitm" (--disable-linux-futex) in
an infinite loop to see if we ever fail. We haven't in the last 10
I will be working on fixing the Linux futex code next.
OK for branch?
* retry.cc (decide_retry_strategy): Set state to STATE_SERIAL when
switching to serial mode.
* beginend.cc (trycommit_and_finalize): Unlock serial_lock.
--- retry.cc (revision 156783)
+++ retry.cc (working copy)
@@ -44,6 +44,7 @@ GTM::gtm_transaction::decide_retry_strat
// acquired with the read.
if ((this->state & STATE_SERIAL) == 0)
+ this->state |= STATE_SERIAL;
--- beginend.cc (revision 156783)
+++ beginend.cc (working copy)
@@ -212,6 +212,10 @@ GTM::gtm_transaction::trycommit_and_fina
+ if (this->state & gtm_transaction::STATE_SERIAL)
+ gtm_transaction::serial_lock.write_unlock ();
+ gtm_transaction::serial_lock.read_unlock ();