diff options
author | Torvald Riegel <triegel@redhat.com> | 2011-12-24 01:42:35 +0000 |
---|---|---|
committer | Torvald Riegel <torvald@gcc.gnu.org> | 2011-12-24 01:42:35 +0000 |
commit | 610e39013598f4f3bc66c117c3402c07b517cfa0 (patch) | |
tree | fd0ffc4afe2a926dc6676559d466c9ae7fad9c2b /libitm/method-serial.cc | |
parent | 799142bf743cb04f3a86df85c69481a3c44c1ad9 (diff) | |
download | gcc-610e39013598f4f3bc66c117c3402c07b517cfa0.tar.gz |
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/method-serial.cc')
-rw-r--r-- | libitm/method-serial.cc | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/libitm/method-serial.cc b/libitm/method-serial.cc index 5e85653a2f4..bf7982650ff 100644 --- a/libitm/method-serial.cc +++ b/libitm/method-serial.cc @@ -239,7 +239,6 @@ void GTM::gtm_thread::serialirr_mode () { struct abi_dispatch *disp = abi_disp (); - bool need_restart = true; if (this->state & STATE_SERIAL) { @@ -254,7 +253,6 @@ GTM::gtm_thread::serialirr_mode () bool ok = disp->trycommit (priv_time); // Given that we're already serial, the trycommit better work. assert (ok); - need_restart = false; } else if (serial_lock.write_upgrade (this)) { @@ -263,18 +261,18 @@ GTM::gtm_thread::serialirr_mode () // would do for an outermost commit. // We have successfully upgraded to serial mode, so we don't need to // ensure privatization safety for other transactions here. + // However, we are still a reader (wrt. privatization safety) until we + // have either committed or restarted, so finish the upgrade after that. gtm_word priv_time = 0; - if (disp->trycommit (priv_time)) - need_restart = false; + if (!disp->trycommit (priv_time)) + restart (RESTART_SERIAL_IRR, true); + gtm_thread::serial_lock.write_upgrade_finish(this); } - - if (need_restart) - restart (RESTART_SERIAL_IRR); else - { - this->state |= (STATE_SERIAL | STATE_IRREVOCABLE); - set_abi_disp (dispatch_serialirr ()); - } + restart (RESTART_SERIAL_IRR, false); + + this->state |= (STATE_SERIAL | STATE_IRREVOCABLE); + set_abi_disp (dispatch_serialirr ()); } void ITM_REGPARM |