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

Fix erratic cycle detector triggering on some Arm systems #3854

Merged
merged 1 commit into from
Sep 18, 2021

Conversation

SeanTAllen
Copy link
Member

@SeanTAllen SeanTAllen commented Sep 16, 2021

This commit reworks tick usage to be safe with tick values that wrap around.

Most of our tick value sources will provide a monotonically increasing
value. However, our fallbacks, currently used on non Apple Arm CPUs
do not maintain the invariants.

They are implemented using clock_gettime and as such, wrap around fairly
regularly. They shouldn't wrap around quick enough that they are likely
to go around more than once.

This PR adds a "difference" function that will get the amount of ticks
between compared ticks. Within the runtime ticks are used to set
an amount of time to pause when there's no work to do and are used to
determine when to run the cycle detector.

Prior to this patch, on some Arm hardware, the cycle detector would end up running
very infrequently.

@SeanTAllen SeanTAllen force-pushed the tick-wraps-around branch 5 times, most recently from 432ebe6 to 1c90f4b Compare September 16, 2021 21:10
@SeanTAllen SeanTAllen changed the title Rework tick usage to be safe with tick values that wrap around Fix erratic cycle detector triggering on some 32-bit Arm systems Sep 16, 2021
@SeanTAllen SeanTAllen force-pushed the tick-wraps-around branch 2 times, most recently from 7d1eaa6 to cd59b33 Compare September 16, 2021 21:13
@SeanTAllen SeanTAllen added the changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge label Sep 16, 2021
@ponylang-main
Copy link
Contributor

Hi @SeanTAllen,

The changelog - fixed label was added to this pull request; all PRs with a changelog label need to have release notes included as part of the PR. If you haven't added release notes already, please do.

Release notes are added by creating a uniquely named file in the .release-notes directory. We suggest you call the file 3854.md to match the number of this pull request.

The basic format of the release notes (using markdown) should be:

## Title

End user description of changes, why it's important,
problems it solves etc.

If a breaking change, make sure to include 1 or more
examples what code would look like prior to this change
and how to update it to work after this change.

Thanks.

@SeanTAllen SeanTAllen force-pushed the tick-wraps-around branch 3 times, most recently from 0fe4c7a to b333b6b Compare September 16, 2021 21:29
@SeanTAllen SeanTAllen changed the title Fix erratic cycle detector triggering on some 32-bit Arm systems Fix erratic cycle detector triggering on some Arm systems Sep 16, 2021
@SeanTAllen SeanTAllen marked this pull request as ready for review September 16, 2021 21:37
@SeanTAllen SeanTAllen requested a review from a team September 16, 2021 21:37
This commit reworks tick usage to be safe with tick values that wrap around.

Most of our tick value sources will provide a monotonically increasing
value. However, our fallbacks, do not maintain this invariant.

They are implemented using clock_gettime and as such, wrap around fairly
regularly. They shouldn't wrap around quick enough that they are likely
to go around more than once.

This PR adds a "difference" function that will get the amount of ticks
between compared ticks. Within the runtime ticks are used to set
an amount of time to pause when there's no work to do and are used to
determine when to run the cycle detector.

Prior to this patch, on some Arm hardware, the cycle detector would end up running
very infrequently.
@SeanTAllen SeanTAllen merged commit d75fd82 into main Sep 18, 2021
@SeanTAllen SeanTAllen deleted the tick-wraps-around branch September 18, 2021 02:22
github-actions bot pushed a commit that referenced this pull request Sep 18, 2021
github-actions bot pushed a commit that referenced this pull request Sep 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants