Fix serial putchar newline deadlock - #306
Merged
Merged
Conversation
Courtney3141
force-pushed
the
fix_putchar_newline_deadlock
branch
from
January 13, 2025 04:43
5a65364 to
d6908c5
Compare
JE-Archer
changed the base branch from
main
to
serial_producer_signal_unconditional
January 14, 2025 07:14
Courtney3141
force-pushed
the
serial_producer_signal_unconditional
branch
2 times, most recently
from
January 15, 2025 07:17
079bbdc to
23a7090
Compare
Courtney3141
force-pushed
the
fix_putchar_newline_deadlock
branch
from
January 15, 2025 07:24
d6908c5 to
b716a8c
Compare
Courtney3141
force-pushed
the
serial_producer_signal_unconditional
branch
from
January 15, 2025 07:26
23a7090 to
0df8f55
Compare
Courtney3141
force-pushed
the
fix_putchar_newline_deadlock
branch
from
January 15, 2025 07:27
b716a8c to
ac14b64
Compare
Courtney3141
force-pushed
the
serial_producer_signal_unconditional
branch
from
January 17, 2025 07:02
0df8f55 to
ea468fb
Compare
Courtney3141
force-pushed
the
fix_putchar_newline_deadlock
branch
from
January 17, 2025 07:03
ac14b64 to
50d849a
Compare
Ivan-Velickovic
force-pushed
the
serial_producer_signal_unconditional
branch
from
January 30, 2025 06:04
ea468fb to
42d5e9a
Compare
Signed-off-by: Courtney Darville <courtneydarville94@outlook.com>
Ivan-Velickovic
force-pushed
the
fix_putchar_newline_deadlock
branch
from
January 30, 2025 06:07
50d849a to
dbc195d
Compare
Ivan-Velickovic
approved these changes
Jan 30, 2025
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.
While making recent changes to the serial subsystem, I notice a potential deadlock in the
_sddf_putcharfunction.Prior to this PR, the function only signals the
TX_CHif the queue is full after inserting a character, or if the character inserted was theFLUSH_CHAR. However, the function only actually inserts a character into the queue if it is not full, or in the case of a\ncharacter, the queue has space for 2 characters.This means that if the queue only has space for one character, and a
\nis attempted to be inserted, the function will immediately return without signalling, and there is no guarantee the function signalled on its previous invocation. This is a potential deadlock, as the virtualiser has potentially not yet been signalled for the remaining characters in the queue, and the system is dependent on the client enqueuing another non\ncharacter for a signal to occur.This PR fixes this deadlock situation by signalling if either the queue is full, the flush character is seen, or if the queue is one from full, which eliminates the scenario that a signal is missed. It also stops any characters from being enqueued if the queue is 1 from full, to prevent against accidental double signals which would interfere with the multiplexing.
Merge after #305.