-
Notifications
You must be signed in to change notification settings - Fork 7.4k
kernel: timeout: add syscall for runtime clk freq #16302
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
kernel: timeout: add syscall for runtime clk freq #16302
Conversation
@nashif CI failures seem to be related to some mocking we have which is pulling in sys_clock.h without generating any syscall headers...what do you recommend about this |
Do we want to back-port this to 1.14? |
@andrewboie thanks for this PR! There's a test failing due to a missing include path apparently |
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.
Make sense. This API really only exists for the benefit of the HPET driver. And note that there's no way to actually set the runtime value of the HPET clock. We just choose to not know what it is at build time and get it from the hardware for, I dunno, cross-device binary portability. Which Zephyr never does in any other context.
I wonder if this might be an appropriate time to yank the whole abstraction out and replace it with a simple assert that CONFIG_SYS_CLOCK_CYCLES_PER_SEC matches the value probed from hardware during timer init....
If the system sets its clock frequency at runtime, this is stored in a variable that can't be directly read by user mode. For this case only, add a system call to fetch its value and modify the definition of sys_clock_hw_cycles_per_sec() to use it. Since this is now a system call, store in a temporary variable inside z_ms_to_ticks(). The syscall overhead only applies when called from user mode, other contexts are completely inlined. Added stub syscall header for mocking framework, to get rid of inclusion errors. Fixes: zephyrproject-rtos#16238 Signed-off-by: Andrew Boie <[email protected]>
d4a0a3f
to
0de849e
Compare
Found the following issues, please fix and resubmit: License issuesIn most cases you do not need to do anything here, especially if the files
|
If the system sets its clock frequency at runtime, this is
stored in a variable that can't be directly read by user
mode. For this case only, add a system call to fetch its
value and modify the definition of
sys_clock_hw_cycles_per_sec() to use it.
Since this is now a system call, store in a temporary variable
inside z_ms_to_ticks(). The syscall overhead only applies
when called from user mode, other contexts are completely
inlined.
Fixes: #16238
Signed-off-by: Andrew Boie [email protected]