anchao opened a new pull request, #20831:
URL: https://github.com/apache/nuttx/pull/20831

   ## Summary                                                                   
                                                                                
                                                                                
                                          
                                                                                
                                                                                
                                                                                
                                          
   Avoid calling `nxsched_switch_context()` from the ARMv8-M exception return 
path when the exception returns to the same running task.                       
                                                                                
                                            
                                                                                
                                                                                
                                                                                
                                          
   Previously, `arm_doirq()` always called 
`nxsched_switch_context(*running_task, tcb)` after interrupt dispatch, even 
when `*running_task == tcb`. This caused scheduler switch bookkeeping to run on 
every exception return, including normal IRQs that did not perform a context 
switch
                                                                                
                                                                                
                                                                                
                                          
   This change only runs the scheduler switch bookkeeping when the running task 
actually changes.                                                               
                                                                                
                                          
                                                                                
                                                                                
                                                                                
                                          
   `regs = tcb->xcp.regs` remains outside the guard so signal delivery can 
still update the return context correctly.                                      
                                                                                
                                               
                                                                                
                                                                                
                                                                                
                                          
   ## Impact                                                                    
                                                                                
                                                                                
                                          
                                                                                
                                                                                
                                                                                
                                          
   - Reduces unnecessary work on the common IRQ/SVC return path.                
                                                                                
                                                                                
                                          
   - Avoids fake same-task suspend/resume scheduler instrumentation.            
                                                                                
                                                                                
                                          
   - Keeps real task switch behavior unchanged.                                 
                                                                                
                                                                                
                                          
   - Preserves signal delivery behavior.                                        
                                                                                
                                                                                
                                          
                                                                                
                                                                                
                                                                                
                                          
   ## Testing                                                                   
                                                                                
                                                                                
                                          
                                                                                
                                                                                
                                                                                
                                          
   Built and ostest successfully with:                                          
                                                                                
                                                                                
                                                     
                                                                                
                                                                                
                                                                                
                                          
   - `ek-ra8m1:nsh`                                                             
                                                                                
                                                                                
                                          
   - `mps3-an547:nsh`                                                           
                                                                                
                                                                                
                                          
   


-- 
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