forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/kernel: Simplify timer spinning
There is actually nothing wrong with this test code idiom. But it's tickling a qemu emulator bug with the hpet driver and x86_64[1]. The rapidly spinning calls to k_uptime_get_32() need to disable interrupts, read timer hardware state and enable them. Something goes wrong in qemu with this process and the timer interrupt gets lost. The counter blows right past the comparator without delivering its interrupt, and thus the interrupt won't be delivered until the counter is next reset in idle after exit from the busy loop, which is obviously too late to interrupt the timeslicing thread. Just replace the loops with a single call to k_busy_wait(). The resulting code ends up being much simpler anyway. An added bonus is that we can remove the special case handling for native_posix (which was an entirely unrelated thing, but with a similar symptom). [1] But oddly not the same emulated hardware running with the same driver under the same qemu binary when used with a 32 bit kernel. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
- Loading branch information
Showing
3 changed files
with
4 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters