-
Notifications
You must be signed in to change notification settings - Fork 8.3k
lib: posix: nanosleep #25559
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
lib: posix: nanosleep #25559
Conversation
|
All checks are passing now. Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages. |
|
I have a feeling there is a conflict with |
I'm not sure what exactly you mean (that native_posix and native_posix_64 boards conflict between each other?), but otherwise it's a known problem that Zephyr POSIX subsys conflicts with native_posix board. It should be understanding why - it's too layery a pie, where Zephyr POSIX subsys sits on top of native Zephyr core, and naive_posix boards tries to implement that in terms of the underlying full-POSIX system. Something doesn't match regularly. Many a POSIX tests/samples simply blacklist native_posix. |
That's what I meant. Sorry, was on mobile when I commented previously. |
|
Should be good to go now |
|
Btw, the variance in latency (in CI / qemu) is pretty drastic between architectures. E.g. on qemu_cortex_r5, it was 500us, on xtensa it was 86 us, and on qemu_cortex_m3 it was 25us. Sample size of 1, not statistically representative, of course. Otherwise, I would have added a more stringent check than Also, not 100% certain if this counts as a system call or a libc function. I assumed that it would be a libc function. There is no corresponding Zephyr system call, atm. However, pointers are passed in (NULL check is made, but otherwise no address space validation). Edit: Even qemu_x86 (I guess with heavy server load?) over 10 ms of latency. Giving up on that upper-bounds test for now, as I don't think it can be reliably proved in CI. |
pfalcon
left a comment
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.
Thanks!
|
@cfriedt, Thanks for the patch. I would personally recommend this merged for 2.3, but per the release freeze rules, 2 reviews are required at this time. I've added @carlescufi who both could review and merged (but definitely busy with a lot of other stuff now, as the release manager for this version), but feel free ping other folks who you know can help with review. |
It would be awesome if nanosleep could actually get relatively close to the exact time (if there is hardware to support it). The high-res timer stuff is pretty important though, and I think it deserves a great deal of care. No rush on that one. The nice thing about it though is that the interface is there, and it's not moving, so just redoing the implementation later will have no unwanted side-effects. |
jukkar
left a comment
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.
Looks good, minor nit about the macro name that was missed from previous cleanup.
|
@carlescufi - rebased off master / using |
|
Was green before. Looks like there is some misra change that breaks things atm |
New swear word in software engineering? ;-) |
This change adds support for nanosleep(2) documented at https://pubs.opengroup.org/onlinepubs/9699919799/functions/nanosleep.html N.B: Currently, this provides no better resolution than k_busy_wait() Fixes #25554 Signed-off-by: Christopher Friedt <[email protected]>
This commit provides test-cases for nanosleep(2) Signed-off-by: Christopher Friedt <[email protected]>
I got such a failure in one of my recent PR. Looks like nondeterministic failure du jour. @cfriedt: Please keep rebasing this, until sweet spot is found. |
This change adds support for nanosleep(2) documented at
https://pubs.opengroup.org/onlinepubs/9699919799/functions/nanosleep.html
Note: Does not achieve any greater resolution than that provided by
k_busy_wait(us)but at least makes the API available.I've not researched it much in Zephyr, but I would say there is still some work to be done for a generic clock API - one that allows querying resolutions, supports multiple system clocks, etc, primarily to support POSIX time APIs.
A nanosleep system call would also require high-res timer support (See #6498)
Fixes #25554