Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endless loop in uart pipe #5298

Closed
erwango opened this issue Dec 6, 2017 · 3 comments
Closed

Endless loop in uart pipe #5298

erwango opened this issue Dec 6, 2017 · 3 comments
Assignees
Labels
area: UART Universal Asynchronous Receiver-Transmitter platform: STM32 ST Micro STM32
Milestone

Comments

@erwango
Copy link
Member

erwango commented Dec 6, 2017

Reported in devel mailing list by Dmitri Shmidt.

"The problem is in uart_pipe_isr() logic. It is never-ending (spinning)
after first time entrance: it is still processing RX but its nature doesn't allow any user
threads to get control."

https://lists.zephyrproject.org/pipermail/zephyr-devel/2017-December/008533.html

@erwango erwango self-assigned this Dec 6, 2017
@erwango erwango added platform: STM32 ST Micro STM32 area: UART Universal Asynchronous Receiver-Transmitter labels Dec 6, 2017
@erwango erwango added this to the v1.10.0 milestone Dec 6, 2017
erwango added a commit to erwango/zephyr that referenced this issue Dec 6, 2017
Fix zephyrproject-rtos#5298
irq_is_pending function returned TXE/RXNE flag status
even if IRQ was masked, which led to enless loop
in uart_pipe when no TX was performed. Fix by reporting status only when
IRQ is unmasked.

Signed-Off-by: Erwan Gouriou <[email protected]>
@pfalcon
Copy link
Contributor

pfalcon commented Dec 6, 2017

Note that I saw similar effects in #42, and while working on irq-driven console in general: #49.

@erwango
Copy link
Member Author

erwango commented Dec 6, 2017

while working on irq-driven console in general: #49.

Wouldn't it be because there is always a tx associated to rx in console case?
Hence TXE is set to 0 and while loop is exited.
I have been to reproduce issue by commenting out insert_char() in uart_console_isr, but no issue as is.

@pfalcon
Copy link
Contributor

pfalcon commented Dec 6, 2017

Sure, for the console case it was solved by following invariants later documented in #159 , #281. And I had to patch existing test in #42 to follow them too.

So, my points is that such problems were known, and there's an existing pattern how to resolve them. And my concern that this case wasn't resolved in a way to break previous cases. (I'm going to look at #5299 in detail, from the title, it sounds good).

galak pushed a commit that referenced this issue Dec 6, 2017
Fix #5298
irq_is_pending function returned TXE/RXNE flag status
even if IRQ was masked, which led to enless loop
in uart_pipe when no TX was performed. Fix by reporting status only when
IRQ is unmasked.

Signed-Off-by: Erwan Gouriou <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: UART Universal Asynchronous Receiver-Transmitter platform: STM32 ST Micro STM32
Projects
None yet
Development

No branches or pull requests

2 participants