arch/risc-v/riscv_mtimer: Update the mtimecmp value once per interrup… #12433
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Cache the next timeout value in the drivers instance and update the mtimecmp value once. This is advantageous as the opensbi ecall to set the timer is expensive in systems which don't have the supervisor mode timer extension.
Impact
Mild reduction in the mtimer interrupt time, when CONFIG_SCHED_TICKLESS is used, on the Litex platform.
Before
With this change
Testing
ostest_knsh32_new.txt
ostest_knsh32_old.txt
ostest_knsh64_new.txt
ostest_knsh64_old.txt
ostest_litex.txt
Note: OS test on qemu32 and qemu64 both return -1 before and after this change.
It would be great if this change could be tested on another hardware platform.