[pypy-commit] stmgc default: One very probable bug fix, and one more theoretical

arigo noreply at buildbot.pypy.org
Mon Feb 2 21:15:54 CET 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r1608:10c636ae449e
Date: 2015-02-02 21:15 +0100
http://bitbucket.org/pypy/stmgc/changeset/10c636ae449e/

Log:	One very probable bug fix, and one more theoretical

diff --git a/c7/stm/core.c b/c7/stm/core.c
--- a/c7/stm/core.c
+++ b/c7/stm/core.c
@@ -1111,6 +1111,8 @@
         dprintf(("become_inevitable: %s\n", msg));
 
         timing_fetch_inev();
+        write_fence();    /* make sure others see a correct 'marker_inev'
+                             if they see TS_INEVITABLE */
         wait_for_end_of_inevitable_transaction();
         STM_PSEGMENT->transaction_state = TS_INEVITABLE;
         stm_rewind_jmp_forget(STM_SEGMENT->running_thread);
diff --git a/c7/stm/prof.c b/c7/stm/prof.c
--- a/c7/stm/prof.c
+++ b/c7/stm/prof.c
@@ -32,12 +32,27 @@
     int len0 = 0;
     int len1 = 0;
     if (markers != NULL) {
+        /* Obscure.  In rare cases we see an uninitialized object
+           at 'markers[1]->segment_base + object'.  I *think* it
+           is related to the other thread busy privatizing the
+           page.  We thus need to acquire the privatization_lock
+           here (any will do).
+
+           Note that we have to read the object from the foreign
+           segment.  We can't assume the code object to be already
+           committed at all; maybe it was created during the remote
+           transaction.
+        */
+        acquire_privatization_lock();
+
         if (markers[1].tl != NULL)
             buf.other_thread_num = markers[1].tl->thread_local_counter;
         if (markers[0].odd_number != 0)
             len0 = profiling_expand_marker(&markers[0], buf.extra, 128);
         if (markers[1].odd_number != 0)
             len1 = profiling_expand_marker(&markers[1], buf.extra + len0, 128);
+
+        release_privatization_lock();
     }
     buf.marker_length[0] = len0;
     buf.marker_length[1] = len1;


More information about the pypy-commit mailing list