aboutsummaryrefslogtreecommitdiff
path: root/libitm/beginend.cc
diff options
context:
space:
mode:
authorTorvald Riegel <triegel@redhat.com>2011-12-24 01:42:35 +0000
committerTorvald Riegel <torvald@gcc.gnu.org>2011-12-24 01:42:35 +0000
commit610e39013598f4f3bc66c117c3402c07b517cfa0 (patch)
treefd0ffc4afe2a926dc6676559d466c9ae7fad9c2b /libitm/beginend.cc
parent799142bf743cb04f3a86df85c69481a3c44c1ad9 (diff)
downloadgcc-610e39013598f4f3bc66c117c3402c07b517cfa0.zip
gcc-610e39013598f4f3bc66c117c3402c07b517cfa0.tar.gz
gcc-610e39013598f4f3bc66c117c3402c07b517cfa0.tar.bz2
libitm: Fix privatization safety during upgrades to serial mode.
libitm/ * beginend.cc (GTM::gtm_thread::restart): Add and handle finish_serial_upgrade parameter. * libitm.h (GTM::gtm_thread::restart): Adapt declaration. * config/linux/rwlock.cc (GTM::gtm_rwlock::write_lock_generic): Don't unset reader flag. (GTM::gtm_rwlock::write_upgrade_finish): New. * config/posix/rwlock.cc: Same. * config/linux/rwlock.h (GTM::gtm_rwlock::write_upgrade_finish): Declare. * config/posix/rwlock.h: Same. * method-serial.cc (GTM::gtm_thread::serialirr_mode): Unset reader flag after commit or after rollback when restarting. From-SVN: r182675
Diffstat (limited to 'libitm/beginend.cc')
-rw-r--r--libitm/beginend.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/libitm/beginend.cc b/libitm/beginend.cc
index d0ad5a7..17f9d74 100644
--- a/libitm/beginend.cc
+++ b/libitm/beginend.cc
@@ -511,11 +511,19 @@ GTM::gtm_thread::trycommit ()
}
void ITM_NORETURN
-GTM::gtm_thread::restart (gtm_restart_reason r)
+GTM::gtm_thread::restart (gtm_restart_reason r, bool finish_serial_upgrade)
{
// Roll back to outermost transaction. Do not reset transaction state because
// we will continue executing this transaction.
rollback ();
+
+ // If we have to restart while an upgrade of the serial lock is happening,
+ // we need to finish this here, after rollback (to ensure privatization
+ // safety despite undo writes) and before deciding about the retry strategy
+ // (which could switch to/from serial mode).
+ if (finish_serial_upgrade)
+ gtm_thread::serial_lock.write_upgrade_finish(this);
+
decide_retry_strategy (r);
// Run dispatch-specific restart code. Retry until we succeed.