hartmannathan commented on issue #15100:
URL: https://github.com/apache/nuttx/issues/15100#issuecomment-2532642157

   > Good to see all works fine as expected :-)
   > 
   > Guys do you think an `ostest` could be added to detect proper zero-latency 
handling on platforms supported? This way we could catch those problems at 
runtime with a generic test utility :-)
   
   I am working on an idea to check for this in hardware.
   
   If we build a distributed hardware test farm, this can be one of the tests 
that will run to measure jitter in ISR response.
   
   Jitter is how much interrupt latency can vary from one interrupt to another.
   
   With normal interrupts, branching to the ISR may be delayed if interrupts 
are disabled during critical sections or while servicing another interrupt. The 
amount of delay can be more one time, less another time. In some applications, 
this can be significant.
   
   With High Priority, Zero Latency Interrupts, the jitter is limited to the 
time it takes the CPU to finish the current instruction and branch to the ISR. 
Although it is never exactly zero, the length of time it takes the CPU to 
execute an instruction is very small. So the jitter is minimized to the 
absolute minimum.
   
   A test could work like this:
   
   1. Use a hardware timer to toggle a GPIO pin at some fixed rate. 
   2. Jumper this GPIO to another GPIO, which is configured as External 
Interrupt.
   3. Setup this interrupt to use High Priority, Zero Latency Interrupts.
   4. In the interrupt, toggle a second GPIO pin.
   5. Measure the latency between toggling of the two GPIOs using a hardware 
timer/capture peripheral.
   6. Collect the values and compare best-case to worse-case numbers are within 
some known threshold.
   7. During the test, disable and enable normal OS-level interrupts for 
varying amounts of time.
   
   If the Zero Latency Interrupts are ever broken due to a software regression, 
a test like this could detect it automatically. Also if it's not detected 
immediately, we can use `git bisect` to find the commit without too much 
difficulty.
   
   I'm still trying to work out the details. If you have ideas, please share!


-- 
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-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to