TaiJuWu commented on issue #9531: URL: https://github.com/apache/nuttx/issues/9531#issuecomment-1729930478
> Suspending the holder of a spinlock can cause a myriad of failures. Suspending the holder does not free the spinlock; the spinlock remains locked while the holder is blocked. In the worst case, this can cause deadlocks since the holder of the spinlock is blocked and may not have the priority to run again to release it. > > Another spinlock performance issue: #1488 > > The point of this issue, @mu578 your comments, and #1488 is that better management of spinlocks is needed for them to really work as needed in SMP. And, as @xiaoxiang781216 has pointed out, there are some tricky design issues that would have to be addressed to accomplish that. > > Perhaps we could do something as simple as adding a in-a-spinlock flag in the TCB which would very temporarily lock the scheduler just like lockcount > 0? Very simple but also kind of kludgey. Maybe we can add an address for the spinlock not just a flag. If we have this address we can give up spinlock before context switch and take it again. But It need to add 8bytes per tcb for 64bit machine and 4byte for 32bit machine. Is it valuable? -- 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