RFR (S): Supporting VM operations
Arthur Eubanks
aeubanks at google.com
Wed May 15 17:34:18 UTC 2019
>
> I don't think this approach fixes all the issues. We want to capture the
> happens-before edge at a safepoint between all Java threads and the VM
> thread, but this approach only captures the edge between the Java thread
> that calls jvmti->IterateThroughHeap() with the VM thread.
>
> Consider the following example:
> T1, T2 are Java threads executing JNI code.
>
> static int sum = 0;
>
> T1:
> sum = 10;
>
> T2:
> jvmti->IterateThroughHeap(&callback, &sum);
>
> VMThread:
> TSAN_RAW_LOCK_ACQUIRED(T2)
> *sum_ptr += 1;
> TSAN_RAW_LOCK_RELEASED(T2)
>
> Then it will still report race between T1 and the VM thread.
>
Is that not a real race? What's the synchronization between T1 and
T2/VMThread?
>
> Another question, should we call TSAN_RAW_LOCK_CREATE and
> TSAN_RAW_LOCK_DESTROY for the fake per-thread lock also?
>
Yes that's probably necessary for correctness since if a thread is
destroyed and another one is created in its place, TSAN will think it's the
same lock (I think?).
>
> -Man
>
More information about the tsan-dev
mailing list