8000 stm32/rfcore: Fix race condition with C2 accessing free buffer list. by dpgeorge · Pull Request #7110 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

Conversation

dpgeorge
Copy link
Member
@dpgeorge dpgeorge commented 8000 Apr 12, 2021

Prior to this commit, if C2 was busy (eg lots of BLE activity) then it may
not have had time to respond to the notification on the IPCC_CH_MM channel
by the time additional memory was available to put on that buffer. In such
a case C1 would modify the free buffer list while C2 was potentially
accessing it, and this would eventually lead to lost memory buffers (or a
corrupt linked list). If all buffers become lost then ACL packets
(asynchronous events) can no longer be delivered from C2 to C1.

This commit fixes this issue by waiting for C2 to indicate that it has
finished using the free buffer list.

Work done in collaboration @jimmo.

Prior to this commit, if C2 was busy (eg lots of BLE activity) then it may
not have had time to respond to the notification on the IPCC_CH_MM channel
by the time additional memory was available to put on that buffer.  In such
a case C1 would modify the free buffer list while C2 was potentially
accessing it, and this would eventually lead to lost memory buffers (or a
corrupt linked list).  If all buffers become lost then ACL packets
(asynchronous events) can no longer be delivered from C2 to C1.

This commit fixes this issue by waiting for C2 to indicate that it has
finished using the free buffer list.

Work done in collaboration with Jim Mussared aka @jimmo.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge dpgeorge force-pushed the stm32-rfcore-fix-ipcc-ch-mm branch from e58a142 to dd62c52 Compare April 12, 2021 11:43
@dpgeorge dpgeorge merged commit dd62c52 into micropython:master Apr 12, 2021
@dpgeorge dpgeorge deleted the stm32-rfcore-fix-ipcc-ch-mm branch April 12, 2021 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0