Conversation
This messy concept here needs to be properly RFCed. Just because an rtos might be doing it doesn't means it's correct or sound.
Why not just keep the unstable ones as |
What's a messy concept to you? RTOS-es? Async drivers? The current state is unsound. You can run the driver in an interrupt executor that has higher priority than the async interrupt handler anyway, so you have a data race, no matter if the driver is Send or not. What is considered a thread boundary (which Send allows to cross) is largely undefined, but I believe it is a property of the OS. An OS can reschedule a thread anywhere it wants, at any point it wants, that's a property of symmetrical multiprocessing. If a driver isn't written to handle this, it's unsound.
Why should we do shotgun surgery keep an incorrect behaviour? |
Moving a thread to another core. The fact that Send/Sync is not well defined. The fact that thread boundaries cannot be reasonable about when writing a driver or library.
Precisely why I'm saying it should be defined for esp-hal.
How does a driver know what to handle when the rules aren't specified?
I thought that's what you're already proposing. |
|
New commits in main has made this PR unmergable. Please resolve the conflicts. |
In #2980 we changed Async driver to be
!Sendto prevent sending them to a different CPU. This was done to ensure that the interrupt handlers run on the same core where the drivers do.This is now being undone for the following reasons:
!Send. This means that we can't make assumptions on which core a particular driver is running, so our solution gave us only a false sense of safety.This PR adds locks for the stable drivers and accepts that the rest may be silently unsound.