cpu/fe310: Use ecall instruction for thread yield#15736
cpu/fe310: Use ecall instruction for thread yield#15736maribu merged 2 commits intoRIOT-OS:masterfrom
Conversation
maribu
left a comment
There was a problem hiding this comment.
Some comments inline, mostly style nits
|
@aabadie: Care to give this a spin on real hardware, to see the performance impact? |
|
@nmeum: Can you confirm that this works as expected with the simulator of yours? |
|
Squash and Murdock? |
b5567d6 to
3ec3e88
Compare
Squashed! |
Sure! |
So that's even faster than master (compared to results given in #15277 (comment)). |
| break; | ||
| } | ||
| default: | ||
| #ifdef DEVELHELP |
There was a problem hiding this comment.
Would this work with if (IS_ACTIVE(DEVELHELP)) { ?
There was a problem hiding this comment.
Probably, but out of scope here. I'll add that to the list of cleanups for this file
|
Shouldn't we also drop the handling of |
Pushed a separate commit to remove it |
|
Let's wait for @nmeum to see if this also fixes his use case. But generally speaking, I like using And also: It is faster :-) |
If it works with QEMU it should, currently a bit busy with other things and can't test it though but I don't see any reason why it shouldn't work ;) |
maribu
left a comment
There was a problem hiding this comment.
ACK. This only affects two boards, which currently are not super wide-spread. Hence, I'd argue this PR has only a minor impact and should be good to go during soft feature freeze.
|
@jia200x: Last chance to block this PR during feature freeze ;-) |
Sure! I'm OK with it |
|
@bergzand: The commit messages are should IMO be prefixed |
dae195d to
5a20341
Compare
|
Thanks for the review and benchmarks! |
Contribution description
This switches the thread yield on the
fe310RISC-V CPU to use the ECALL instruction to trap the core. Currently the software interrupt is used for this, but this is supposed to be used for inter-core interrupts according to the manual.I've kept the option open on the interface to add a number and some context to the ecall and have this passed to the trap handler. This still has to be hooked up to the trap handler itself in the future.
Testing procedure
This is only tested on Qemu as I currently don't have hardware to test this.
Thread switching on an fe310-based board, e.g.
tests/bench_mutex_pingpongI'm also curious about actual numbers, this improves performance for me on Qemu, but no clue if that's also the case on real hardware.
Issues/PRs references
Alternative to #15277