-
Notifications
You must be signed in to change notification settings - Fork 1k
riscv: allow interrupts to wake the scheduler #1227
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
base: dev
Are you sure you want to change the base?
Conversation
|
Also somewhat related: tinygo/src/runtime/arch_tinygoriscv.go Lines 84 to 90 in 04d097f
Isn't this blocking forever since we are waiting for an interrupt with interrupts disabled? |
|
No. The interrupt is masked, so it will not run immediately. Instead what happens is the wfi finishes when the interrupt is pending, then interrupts are re-enabled, then the interrupt executes. |
|
@jaddr2line All right but then shouldn't the
Because right now we disable interrupts in the lower individual interrupt enable register: tinygo/src/device/riscv/riscv.go Lines 25 to 37 in 04d097f
But maybe I understand this wrong. |
|
Huh. I don't know. |
|
@jaddr2line I will make some tests when I have time, to check if interruptions wake the scheduler as expected. |
08cdfc1 to
6c037d1
Compare
|
Please make sure you rebase against |
|
So, I don't think this is actually safe at this point. Right now, the coroutines implementation may end up with a goroutine suspending in the middle of a critical section due to how returns are implemented. In order to make this safe, we need to modify the coroutine task implementation to loop until it is actually fully suspended. |
|
@deadprogram I will do that thanks. @jaddr2line So it should be safe once #1220 gets merged right? |
|
Yeah. Although I should eventually make coroutines work too. |
6c037d1 to
6ecfa38
Compare
This PR allows interrupts to wake the scheduler for the FE310 and the K210 RISC-V chips.
Depends on #1220