- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 5.7k
 
Improvements to low-level serialqueue message transmitting #7095
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
base: master
Are you sure you want to change the base?
Conversation
24c691e    to
    9916459      
    Compare
  
    Signed-off-by: Timofey Titovets <[email protected]>
Signed-off-by: Timofey Titovets <[email protected]>
Move the definition of the struct so that it is more clear that it has its own locking. Signed-off-by: Kevin O'Connor <[email protected]>
9916459    to
    1bccedc      
    Compare
  
    | 
           From my small testing under motan dump, it seems that f1dc589 can cause random MCU lost communication. My not-clean master branch, but maybe it would help. From the log, it seems to me like the serialqueue thread just stopped transmitting messages. Thanks.  | 
    
There's no reason to attempt to handle multiple buffer transmissions in a single command_event() call. Handle the transmit case outside of the command building loop. If data is transmitted, then get a new timestamp from the pollreactor and retry before sleeping. Signed-off-by: Kevin O'Connor <[email protected]>
Move the upcoming queue movement logic to a new function. Signed-off-by: Kevin O'Connor <[email protected]>
Maintain the next needed wakeup time for entries in the pending queues. This avoids needing to walk the upcoming queues when it is known that nothing is ready to be released. Signed-off-by: Kevin O'Connor <[email protected]>
Only hold the lock in the serialqueue thread when moving messages to the ready queue and when setting the next need_kick_clock. Only set the need_kick_clock just prior to sleeping. Signed-off-by: Kevin O'Connor <[email protected]>
Keep moving messages from the pending queues to the ready queues even if it's not currently valid to transmit messages to the mcu. This improves the statistics when debugging. Signed-off-by: Kevin O'Connor <[email protected]>
1bccedc    to
    03c6b6c      
    Compare
  
    | 
           Thanks for testing and reporting your findings.  I did find an error in that commit ( Is there a test I could run locally that would likely result in the issue? -Kevin  | 
    
| 
           I literally did simple:  Then it happens with just enabling the dump, without any additional steps from my side. TMC dump would create a lot of query/response requests It should be able to run indefinitely. I would try to reproduce with updated code.  | 
    
| 
           I'm unable to reproduce anything after the fix. Thanks.  | 
    
A few changes to the host C code that transmits messages to the mcus:
sq->transmit_requests.lockis held (from PR Serialqueue lock rework #7055).ready_bytescontinuing to increase during a communication stall.@nefelim4ag - fyi.
-Kevin