Skip to content

Use portable-atomic#11

Open
chrysn wants to merge 3 commits intoseanmonstar:masterfrom
chrysn-pull-requests:portable-atomic
Open

Use portable-atomic#11
chrysn wants to merge 3 commits intoseanmonstar:masterfrom
chrysn-pull-requests:portable-atomic

Conversation

@chrysn
Copy link
Copy Markdown
Contributor

@chrysn chrysn commented Sep 13, 2024

This should not have run-time impact on platforms that support atomic boolean compare-and-swap, but enables its use on microcontrollers where the user configures portable-atomic in such a way that atomics can be emulated (eg. through disabling interrupts).

I have not tested whether portable-atomics works with the 1.31 version tested in CI. Should that fail, should I rather feature-gate this, can we update the MSRV of this crate, or should I hack CI to use an older version of portable-atomics (because Rust 1.31 was way before cargo became rust-version aware)?

@chrysn
Copy link
Copy Markdown
Contributor Author

chrysn commented Sep 13, 2024

As CI is only run once cleared, I've tested this locally with Rust 1.31. (And found that the minimal version was incorrect, that is now fixed).

Inconveniently, even the oldest usable portable-atomics version (1.3.0) does not work with Rust 1.31.

Is updating the MSRV of this project an option? I haven't bisected, but at least 1.58 works (and works even with portable-atomics 1.70); if we need to stay lower but can move from 1.31, I'm happy to provide a sharper result than "> 1.31 <= 1.58".

@kaspar030
Copy link
Copy Markdown

How can we help getting this merged? (Trying to reduce the number of patches in Ariel OS).

This should not have run-time impact on platforms that support atomic
boolean compare-and-swap, but enables its use on microcontrollers where
the user configures portable-atomic in such a way that atomics can be
emulated (eg. through disabling interrupts).
This restores compatibility with Rust 1.31, but requires actual users
for portable-atomics to set that as a feature.
@chrysn
Copy link
Copy Markdown
Contributor Author

chrysn commented Sep 8, 2025

Rebased onto master after #13, so that tests can run through again -- and fixed other things that now failed:

No version of portable-atomics is suitably compatible with the 1.31 tested MSRV, so unless you're open to updating the MSRV to 1.34, I've updated this PR to feature-gate portable-atomics as off-by-default, with CI running on both variations. (If the MSRV change is an option, I'm happy to updated things).

Please consider reviewing this.

@chrysn
Copy link
Copy Markdown
Contributor Author

chrysn commented Sep 22, 2025

I'm taking the liberty to ping @seanmonstar explicitly (maybe the repo's notification settings are not configured to notify potential reviewers).

If you don't want to deal with this, or the change is a no-go, that's perfectly fine too – just please let us know (so we can go from a patched-version situation either towards an upstream or towards a soft-fork we'd maintain).

@chrysn
Copy link
Copy Markdown
Contributor Author

chrysn commented Oct 21, 2025

As a practical way forward, we have uploaded a soft-fork at https://crates.io/crates/try-lock-portable-atomic/ and moved the relevant dependents over. That crate is essentially try-lock with this patch, plus metadata changes to minimize potential for confusion. We'll keep this PR merged in https://github.com/ariel-os/try-lock-portable-atomic with updates on demand.

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