Repository navigation
drivers: serial: Remove an unnecessary critical section (cs) for SMP - #3860
Merged
Merged
Conversation
Summary: - I thought this cs is needed to avoid data corruption - For example, while executing uart_xmitchar() in the interrupt handler on CPU0, an application running on CPU1 can call uart_putxmitchar() via write()->uart_write(). - In this case, taking xmit.sem in uart_write() will wait for CPU0 to finish uart_xmitchar() because CPU0 has already taken a cs in uart_xmitchar() then nxsem_wait() on CPU0 takes a new cs inside (and release the cs when returning but it's OK) - Then uart_write() on CPU1 disables UART TX, so uart_xmitchar() on CPU0 will not be called while executing uart_write() on CPU1. - So this critical section in uart_putxmitchar() can be removed. Impact: - None Testing: - Tested with spresense:wifi_smp, esp32-devkitc:smp Reported-by: Xiang Xiao <[email protected]> Signed-off-by: Masayuki Ishikawa <[email protected]>
Contributor
Author
|
@xiaoxiang781216 |
xiaoxiang781216
approved these changes
Jun 6, 2021
4 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
handler on CPU0, an application running on CPU1 can call
uart_putxmitchar() via write()->uart_write().
to finish uart_xmitchar() because CPU0 has already taken a cs
in uart_xmitchar() then nxsem_wait() on CPU0 takes a new cs
inside (and release the cs when returning but it's OK)
on CPU0 will not be called while executing uart_write() on CPU1.
Impact
Testing