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

Systimer improvements #2451

Merged
merged 13 commits into from
Nov 4, 2024
Merged

Systimer improvements #2451

merged 13 commits into from
Nov 4, 2024

Conversation

bugadani
Copy link
Contributor

@bugadani bugadani commented Nov 2, 2024

Closes #2431
Closes #2432

At least in theory, I did not spend time reproducing the race issue. I do not think we can test the race condition easily so I didn't add a test case.

.modify(|_, w| w.update().set_bit());
}
/// Reads the current counter value.
fn read_count(&self) -> u64 {
Copy link
Collaborator

@Dominaezzz Dominaezzz Nov 2, 2024

Choose a reason for hiding this comment

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

Any objections against moving this synchronization logic into Alarm and leaving Unit as the low level API (i.e. update and poll)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not much, besides the desire to not expose footgun parts.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Now that read_count() is expensive, do I have a stronger argument? 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about now, now that it's cheap again? 🙃

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah I don't think I have a strong enough case anymore haha

esp-hal/src/timer/systimer.rs Outdated Show resolved Hide resolved
.modify(|_, w| w.update().set_bit());
}
/// Reads the current counter value.
fn read_count(&self) -> u64 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Now that read_count() is expensive, do I have a stronger argument? 😄

Copy link
Contributor

@bjoernQ bjoernQ left a comment

Choose a reason for hiding this comment

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

Seems I cannot reproduce the original issue, but the changes look good to me

Copy link
Contributor

@JurajSadel JurajSadel left a comment

Choose a reason for hiding this comment

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

Thanks!

@bugadani bugadani added this pull request to the merge queue Nov 4, 2024
Merged via the queue into esp-rs:main with commit 1e6820d Nov 4, 2024
28 checks passed
@bugadani bugadani deleted the systimer branch November 4, 2024 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants