mirror of git://gcc.gnu.org/git/gcc.git
libitm: Fix handling of reentrancy in the HTM fastpath.
PR libitm/57643 * beginend.cc (gtm_thread::begin_transaction): Handle reentrancy in the HTM fastpath. From-SVN: r200250
This commit is contained in:
parent
dcef09b5d1
commit
b1db457bf9
|
@ -1,3 +1,9 @@
|
||||||
|
2013-06-20 Torvald Riegel <triegel@redhat.com>
|
||||||
|
|
||||||
|
PR libitm/57643
|
||||||
|
* beginend.cc (gtm_thread::begin_transaction): Handle reentrancy in
|
||||||
|
the HTM fastpath.
|
||||||
|
|
||||||
2013-03-31 Gerald Pfeifer <gerald@pfeifer.com>
|
2013-03-31 Gerald Pfeifer <gerald@pfeifer.com>
|
||||||
|
|
||||||
PR bootstrap/56714
|
PR bootstrap/56714
|
||||||
|
|
|
@ -197,6 +197,8 @@ GTM::gtm_thread::begin_transaction (uint32_t prop, const gtm_jmpbuf *jb)
|
||||||
// We are executing a transaction now.
|
// We are executing a transaction now.
|
||||||
// Monitor the writer flag in the serial-mode lock, and abort
|
// Monitor the writer flag in the serial-mode lock, and abort
|
||||||
// if there is an active or waiting serial-mode transaction.
|
// if there is an active or waiting serial-mode transaction.
|
||||||
|
// Note that this can also happen due to an enclosing
|
||||||
|
// serial-mode transaction; we handle this case below.
|
||||||
if (unlikely(serial_lock.is_write_locked()))
|
if (unlikely(serial_lock.is_write_locked()))
|
||||||
htm_abort();
|
htm_abort();
|
||||||
else
|
else
|
||||||
|
@ -219,6 +221,14 @@ GTM::gtm_thread::begin_transaction (uint32_t prop, const gtm_jmpbuf *jb)
|
||||||
tx = new gtm_thread();
|
tx = new gtm_thread();
|
||||||
set_gtm_thr(tx);
|
set_gtm_thr(tx);
|
||||||
}
|
}
|
||||||
|
// Check whether there is an enclosing serial-mode transaction;
|
||||||
|
// if so, we just continue as a nested transaction and don't
|
||||||
|
// try to use the HTM fastpath. This case can happen when an
|
||||||
|
// outermost relaxed transaction calls unsafe code that starts
|
||||||
|
// a transaction.
|
||||||
|
if (tx->nesting > 0)
|
||||||
|
break;
|
||||||
|
// Another thread is running a serial-mode transaction. Wait.
|
||||||
serial_lock.read_lock(tx);
|
serial_lock.read_lock(tx);
|
||||||
serial_lock.read_unlock(tx);
|
serial_lock.read_unlock(tx);
|
||||||
// TODO We should probably reset the retry count t here, unless
|
// TODO We should probably reset the retry count t here, unless
|
||||||
|
|
Loading…
Reference in New Issue