You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/01/03 11:18:23 UTC

[GitHub] [incubator-nuttx] raiden00pl opened a new issue #5142: FlexCAN can_input() should not be called directly from interrupt handler

raiden00pl opened a new issue #5142:
URL: https://github.com/apache/incubator-nuttx/issues/5142


   I noticed that FlexCAN implementation calls can_input() directly from the interrupt handler which is probably wrong. 
   This will raise the assertion in nxsem_trywait.c:75 when CONFIG_DEBUG_ASSERTIONS=y 
   
   The call stack looks like this: xxx_flexcan_interrupt -> xxx_receive -> can_input -> can_callback -> net_trylock -> nxsem_trywait.
   
   I don't have any NXP boards to help solve the problem, so I just open a new issue.
   
   


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



[GitHub] [incubator-nuttx] raiden00pl commented on issue #5142: FlexCAN can_input() should not be called directly from interrupt handler

Posted by GitBox <gi...@apache.org>.
raiden00pl commented on issue #5142:
URL: https://github.com/apache/incubator-nuttx/issues/5142#issuecomment-1004025767


   FYI @PetervdPerk-NXP @michallenc 


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



[GitHub] [incubator-nuttx] PetervdPerk-NXP commented on issue #5142: FlexCAN can_input() should not be called directly from interrupt handler

Posted by GitBox <gi...@apache.org>.
PetervdPerk-NXP commented on issue #5142:
URL: https://github.com/apache/incubator-nuttx/issues/5142#issuecomment-1004162622


   Interesting the comment above the function suggest it wouldn't block and didn't specify it's not allowed to be executed while in an interrupt. https://github.com/apache/incubator-nuttx/blob/9a53601ba993d43684328dcae8750acb00a34cc7/sched/semaphore/sem_trywait.c#L45-L48
   
   The reason why it's called under an interrupt is because Unfortunely using a workqueue it's too slow to react and would cause an CAN RX mailbox overflow. That's why we try to get rid of asap while in the interrupt but only if we can access the lock hence the net_trylock().
   
   A better solution would to figure why scheduling a workqueue with an immediate deadline takes quite to long to be scheduled but I never came to that.


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