-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix schedcoop idling and x86 timer interrupts #923
Conversation
Nice fixes, @FedeParola. I will use your test programs to validate the solution, but, just by browsing the code, it makes sense. I would ask you to start the commit messages with capital letter in the two commits of this PR, i.e. @mschlumpp, @mogasergiu, @skuenzer, @marcrittinghaus, please also take a look. |
A wrong check caused the idle thread to keep busy looping instead of halting the cpu when no wakeup time is set (i.e., wake_up_time == 0) Signed-off-by: Federico Parola <federico.parola@polito.it>
To switch the i8254 to sw-triggered strobe mode a value must be written into the counter. Previously the timer remained in rate generator mode and kept generating interrupts until the counter was written (e.g., for a sleep()) Signed-off-by: Federico Parola <federico.parola@polito.it>
✅ Checkpatch passed Beep boop! I ran Unikraft's
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @FedeParola. I tested and, indeed, the problems are as you mentioned and the solutions as you provided. I'm approving this PR.
We'll wait for an approval step from @skuenzer. At that point, I will also add the reviewer tag, conforming to Unikraft's review process.
I've one question related to the i8254 sw-triggered configuration. Why are two writes (outb
) required to TIMER_CNTR
? Indeed, I tried only using on write (outb
) but it did not work.
Hi @razvand and thanks for the review. The i8254 has a 16 bit counter, but the register to program it is only 8 bit, so two |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dear @FedeParola,
a well explained PR with good code examples. Thanks for these fixes!
Approved-by: Simon Kuenzer simon@unikraft.io
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-by: Razvan Deaconescu razvand@unikraft.io
To switch the i8254 to sw-triggered strobe mode a value must be written into the counter. Previously the timer remained in rate generator mode and kept generating interrupts until the counter was written (e.g., for a sleep()) Signed-off-by: Federico Parola <federico.parola@polito.it> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #923
A wrong check caused the idle thread to keep busy looping instead of halting the cpu when no wakeup time is set (i.e., wake_up_time == 0) Signed-off-by: Federico Parola <federico.parola@polito.it> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#923
To switch the i8254 to sw-triggered strobe mode a value must be written into the counter. Previously the timer remained in rate generator mode and kept generating interrupts until the counter was written (e.g., for a sleep()) Signed-off-by: Federico Parola <federico.parola@polito.it> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#923
A wrong check caused the idle thread to keep busy looping instead of halting the cpu when no wakeup time is set (i.e., wake_up_time == 0) Signed-off-by: Federico Parola <federico.parola@polito.it> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#923
To switch the i8254 to sw-triggered strobe mode a value must be written into the counter. Previously the timer remained in rate generator mode and kept generating interrupts until the counter was written (e.g., for a sleep()) Signed-off-by: Federico Parola <federico.parola@polito.it> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#923
Prerequisite checklist
checkpatch.uk
on your commit series before opening this PR;Base target
Additional configuration
Description of changes
880f27c fixes a problem in ukschedcoop in which the idle thread keeps busy looping instead of halting the cpu when no wakeup time is set (i.e., wake_up_time == 0). To test the problem simply apply app-helloworld-diff.txt to the helloworld application (the diff causes the main thread to block) and run it. You will see the CPU usage at 100%.
655ea17 fixes a problem in which the i8254 timer doesn't switch completely to software-triggered strobe in the init function. To switch the i8254 to sw-triggered strobe mode a value must be written into the counter. Previously the timer remained in rate generator mode and kept generating interrupts until the counter was written (e.g., for a sleep()). To test add some debug message in the timer interrupt ISR and run the previous modified helloworld, you will see a lot of interrupts are triggered. E.g., time-diff.txt.