Skip to content

Fix #13427#13987

Merged
gasche merged 1 commit intoocaml:trunkfrom
OlivierNicole:fix-tsan-false-alarm
May 13, 2025
Merged

Fix #13427#13987
gasche merged 1 commit intoocaml:trunkfrom
OlivierNicole:fix-tsan-false-alarm

Conversation

@OlivierNicole
Copy link
Copy Markdown
Contributor

See discussion in #13427.

@OlivierNicole OlivierNicole added thread-sanitizer Related to data races, thread sanitizer run-thread-sanitizer Makes the CI run the testsuite with TSAN enabled labels Apr 25, 2025
Copy link
Copy Markdown
Member

@gasche gasche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved in principle, see comment on comment.

constitute a data race as this is a volatile load. However, TSan will
wrongly see a race here (see section 3.2 of comment in tsan.c). We
therefore make sure it is never TSan-instrumented. */
value v = volatile_load_uninstrumented(&Field(block, i));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not fond of the redundancy introduced by duplicating the comment. Could you move the comment to the helper function definition, instead of repeating it at the callsite? (It might also be an occasion to clarify it a bit: if I understand correctly, the point is that these loads may race with mutator access, and/but that we have decided that these races are benign. The "does not constitute a data race" part of the comment is a bit confusing to me, I think it suggests that this is not UB?)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(gentle ping)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried to clarify in deae015.

Copy link
Copy Markdown
Member

@gasche gasche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

@OlivierNicole OlivierNicole force-pushed the fix-tsan-false-alarm branch 3 times, most recently from 957fcae to d4be0b1 Compare May 13, 2025 15:39
@OlivierNicole OlivierNicole force-pushed the fix-tsan-false-alarm branch from d4be0b1 to ce595a5 Compare May 13, 2025 15:40
@gasche gasche added this to the 5.4.0 bug fixes milestone May 13, 2025
@gasche gasche merged commit e0154dc into ocaml:trunk May 13, 2025
30 of 34 checks passed
gasche added a commit that referenced this pull request May 13, 2025
@gasche
Copy link
Copy Markdown
Member

gasche commented May 13, 2025

Merged in trunk and backported in 5.4 ( da99532 ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-me run-thread-sanitizer Makes the CI run the testsuite with TSAN enabled thread-sanitizer Related to data races, thread sanitizer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants