summaryrefslogtreecommitdiff
path: root/libitm/method-gl.cc
diff options
context:
space:
mode:
authortorvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4>2016-01-16 22:08:41 +0000
committertorvald <torvald@138bc75d-0d04-0410-961f-82ee72b054a4>2016-01-16 22:08:41 +0000
commit0ca817a713be483e033c0a122621a58fee972298 (patch)
tree6344612f38b36403102234efac1277ca09d2d40b /libitm/method-gl.cc
parent673441b04a9379c7bcb1ede82a4fe2961da658af (diff)
libitm: Ensure proxy privatization safety.
* method-gl.cc (gl_wt_dispatch::trycommit): Ensure proxy privatization safety. * method-ml.cc (ml_wt_dispatch::trycommit): Likewise. * libitm/testsuite/libitm.c/priv-1.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232469 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libitm/method-gl.cc')
-rw-r--r--libitm/method-gl.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/libitm/method-gl.cc b/libitm/method-gl.cc
index b2e2bcad71e6..b51c802f1917 100644
--- a/libitm/method-gl.cc
+++ b/libitm/method-gl.cc
@@ -291,12 +291,18 @@ public:
// See begin_or_restart() for why we need release memory order here.
v = gl_mg::clear_locked(v) + 1;
o_gl_mg.orec.store(v, memory_order_release);
-
- // Need to ensure privatization safety. Every other transaction must
- // have a snapshot time that is at least as high as our commit time
- // (i.e., our commit must be visible to them).
- priv_time = v;
}
+
+ // Need to ensure privatization safety. Every other transaction must have
+ // a snapshot time that is at least as high as our commit time (i.e., our
+ // commit must be visible to them). Because of proxy privatization, we
+ // must ensure that even if we are a read-only transaction. See
+ // ml_wt_dispatch::trycommit() for details: We can't get quite the same
+ // set of problems because we just use one orec and thus, for example,
+ // there cannot be concurrent writers -- but we can still get pending
+ // loads to privatized data when not ensuring privatization safety, which
+ // is problematic if the program unmaps the privatized memory.
+ priv_time = v;
return true;
}