-
Notifications
You must be signed in to change notification settings - Fork 242
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
Changed busy wait to wfe #604
base: main
Are you sure you want to change the base?
Conversation
There have been questions regarding this code when it was introduced, https://github.com/rp-rs/rp-hal/pull/204/files/e9694bbb91c66e67df7150fa900a82d9fad928ff#r756965837 It seems like the current solution was chosen because the C API works the same way. Which might or might not be a good reason. |
If the reading core uses the non-blocking read, Using |
I may have found one issue: From a quick look I'd say that it should still work. While the bootrom doesn't explicitly But analyzing this multi-core interaction between rust and assembly code is tricky. I might be completely wrong, or I might miss some race condition which could lead to occasional deadlocks. So, while I agree that the |
Is it possible you can link to the source code in the RP2040 rom? Perhaps ask a contributor why there's a distinction? |
As I understand it, this is not set up as a high-performance interface, so you should prioritise reliability over performance. If you need to move a lot of data from one core to the other, put it in RAM and send a pointer or some kind of message over the FIFO. Given that, I would err on the side of caution and just do what the C SDK does rather than trying anything fancy. |
And the C SDK code doing the FIFO write is here: https://github.com/raspberrypi/pico-sdk/blob/f396d05f8252d4670d4ea05c8b7ac938ef0cd381/src/rp2_common/pico_multicore/multicore.c#L18
It's not a performance question. If anything, replacing the |
I'm more concerned about the edge case where one core calls a writing block while the other one is panicked, which is the primary reason I made this change. I went ahead and asked the initial committer of the C code as to why, I'm curious myself and if there is a good reason why we need to busywait we should probably know about it. |
👍 |
@Gip-Gip Did you get any reply from the initial committer of the C code? |
Unfortunately not, the dev only has a twitter linked and that twitter is mildly inactive lol |
Why would you ask on twitter though? The natural place to ask questions about code on GitHub is through issues. I certainly don't want people DM'ing me or tagging me on social media for stuff like this. |
I'm not the most professionally minded person was just the first thing that came to mind lol, my bad. I can open up a discussion issue or something along those lines too. I don't mind people reaching out to me tbh but I guess that might be a me thing. |
Didn't know why read_blocking slept the processor but write_blocking just looped, changed it to where both sleep the processor. Tested on my hardware and everything seems to function normally.