Skip to content
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

i#6938 sched migrate: Make replay record_index atomic #6995

Merged
merged 3 commits into from
Sep 21, 2024

Conversation

derekbruening
Copy link
Contributor

@derekbruening derekbruening commented Sep 20, 2024

PR #6985 removed the global sched_lock_ which used to synchronize
access to other output's record_index field, leaving a data
race (affecting only the rough timing across outputs where an output
waits if gets ahead of other outputs' timestamps).
Since only the index and not the recorded contents need
synchronization, we use an atomic rather than a mutex to coordinate.

Tested by running an internal test under ThreadSanitizer where a race
is reported without this fix and no race with the fix.

Issue: #6938

PR #6985 removed the global sched_lock_ which used to synchronize
access to other output's record_index field, leaving a data
race. Since only the index and not the recorded contents need
synchronization, we use an atomic rather than a mutex to coordinate.

Tested by running an internal test under ThreadSanitizer where a race
is reported without this fix and no race with the fix.

Issue: #6938
@derekbruening
Copy link
Contributor Author

OSX is #6992

Copy link
Contributor

@brettcoon brettcoon left a comment

Choose a reason for hiding this comment

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

As I understand it, the data race this fixes was harmless, which is why changing record_index to atomic is sufficient to eliminate it. That might be worth mentioning in the PR description.

clients/drcachesim/scheduler/scheduler.h Show resolved Hide resolved
clients/drcachesim/scheduler/scheduler.cpp Outdated Show resolved Hide resolved
@derekbruening
Copy link
Contributor Author

As I understand it, the data race this fixes was harmless, which is why changing record_index to atomic is sufficient to eliminate it. That might be worth mentioning in the PR description.

It could only affect the rough timing across outputs as they try to align with each others' timestamps: you're right that it does not affect actual content of the real records played back.

@derekbruening
Copy link
Contributor Author

Mac docs failure is #6992 with #7001 fixing it soon.

@derekbruening derekbruening merged commit 409bc80 into master Sep 21, 2024
16 of 17 checks passed
@derekbruening derekbruening deleted the i6938-replay-locks branch September 21, 2024 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants