You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "nicolas71640 (via GitHub)" <gi...@apache.org> on 2024/03/03 14:21:55 UTC
Re: [PR] arch/xmc4 Add tickless support [nuttx]
nicolas71640 commented on PR #11737:
URL: https://github.com/apache/nuttx/pull/11737#issuecomment-1975179637
Hello Everybody,
Thank you for all your feedbacks.
I might be at the end of the road concerning xmc tickless... The performances are far from being acceptable (compared to tick based nuttx). I have done a little benchmark where I start two small thread supposed to do very short tasks (just waking up basically) at two different periods (10ms and 60ms). When the two thread wake up at different time, there is no issue. I have a jitter my resolution. However, when both of them wake up around them time, I can have a 5 or 6 times my resolution as jitter.
I have profiled the scheduling of my threads (with gpio):
- Thread B => Period = 60ms, Priority = 11
- Thread A => Period = 10ms, Priority = 10
- Start => up_timer_start function from beginning of method to return
- Cancel=> up_timer_cancel function from beginning of method to return
- Sleep => clock_nanosleep function from beginning of method to return
- Interrupt = Interval timer interrupt function from beginning of method to return

Here you can see that everything seems all right. Thread A and Thread B seems scheduled accordingly to their periods.
However the timings are bad. Here I have 60,183ms for the first period of B, and 59.828ms for the second one (My Thread check if he's late or early, and adjust his sleep accordingly).
If we zoom in here what we can see when the threads are scheduled next to each other :

What I understand from that is that Thread B is delayed by Thread A.
From the first interrupt (yellow line) :
1. An interrupt is trigger : the Thread A must be scheduled
2. Start the next timer, to trigger the Thread B (few tens of uS)
3. Start the ThreadA routine
4. The ThreadA gets interrupted by the second interrupt (that we've just started in 2.)
5. Start the next timer, (Must be the delay I've put to end the overall loop)
6. Start the ThreadB routine
7. ThreadB put itself to sleep
8. The scheduler cancel the timer we started in 5.
9. Start the new timer to scheduled the thread B in 60ms
10. Scheduled back the ThreadA that wasn't finished and put itself to sleep
11. Cancel the timer we've started in 9. as this one will be shorter (10ms < 60ms)
12. Start the new one.
This sequence seems to me perfectly normal. Can you confirm ?
So if my implementation of the tickless is correct, it means that I'll always have this kind of delay...
Now what's disturbing is : **Why the scheduler starts another timer to trigger the thread B (after having trigger the thread A) while it's already late**...
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org