linguini1 commented on PR #17011:
URL: https://github.com/apache/nuttx/pull/17011#issuecomment-3433983169

   > The code which redirected the ndelay&udelay to oneshot driver ended up 
using systick to implement udelay, which caused e.g. udelay(1) to sleep 
10000-20000 microseconds instead of busylooping for one microsecond. This just 
blew up many places where a short bysyloop was needed, in device drivers 
   
   That I can understand, which is definitely suboptimal. However, drivers 
shouldn't have been relying on up_udelay being accurate either. If the busy 
delay gets interrupted for 1us because of a context switch, you end up sleeping 
for 2+us as well. I don't think these implementations differ in that way. But 
with systick, if you sleep for 1us and get interrupted due to context switch 
for 10us, when CPU is regained you'll see that >2us has passed and stop 
immediately. With busy wait, you'll continue the remaining iterations for 1us 
and total sleep time ends up being 11us. The only time busy wait is better is 
for sub-systick delays where context switching doesn't happen or very rarely 
happens.
   
   I personally think neither of these methods are very good, but I do think 
that the sim architecture needs to adhere to delays.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to