-
Notifications
You must be signed in to change notification settings - Fork 10.5k
🍒[5.5][Concurrency] Add tsan_release edge on task creation #38113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
DougGregor
merged 4 commits into
release/5.5
from
tsan-actor_counters.swift-cherry-pick
Jun 27, 2021
Merged
🍒[5.5][Concurrency] Add tsan_release edge on task creation #38113
DougGregor
merged 4 commits into
release/5.5
from
tsan-actor_counters.swift-cherry-pick
Jun 27, 2021
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(cherry picked from commit 9726681)
Make sure to synchronize on Job address (AsyncTasks are Jobs, but not all Jobs are AsyncTasks). (cherry picked from commit 743e56e)
(cherry picked from commit 8640266)
Move the TSan release edge from `swift_task_create_commonImpl()` to `swift_task_enqueueGlobalImpl()`. Task creation itself is not an event that needs synchronization, but rather that task creation "happens before" execution of that task on another thread. This edge is usually added when the task is scheduled via `swift_task_enqueue()` (which then usually calls `swift_task_enqueueGlobal()`). However, not all task scheduling goes through the `swift_task_enqueue()` funnel as some places call the more specific `swift_task_enqueueGlobal()` directly. So let's annotate this function (duplicate edges aren't harmful) to ensure we cover all schedule events, including newly-created tasks (our original problem here). rdar://78932849 (cherry picked from commit e4e941e)
@swift-ci Please test |
Build failed |
|
@swift-ci Please test Linux |
ktoso
approved these changes
Jun 26, 2021
@swift-ci please nominate |
DougGregor
approved these changes
Jun 26, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation: Ensure new tasks that are not immediately scheduled via
swift_task_enqueue()
on creation still get a tsan_release edge once they are eventually scheduled. Not all task scheduling goes through ourswift_task_enqueue()
funnel, some places callswift_task_enqueueGlobal()
directly instead. So also add an edge there.Reviewer: @ktoso @jckarter
Radar/SR Issue: rdar://78932849
Risk: Small.
Testing: PR testing and CI on main.
Original PR: #38074