-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
[Backport v2.7-branch] STM32 UART fixes #43156
[Backport v2.7-branch] STM32 UART fixes #43156
Conversation
all, Sorry for the mess, I chose the wrong branch |
I think I messed up the CI pipelines |
We need a rerun. Would you mind editing your branch with a minor change and force push to trigger CI again? |
A lock was added to manage situation where the API poll_out and irq API are used in same time. Signed-off-by: Julien D'ascenzio <[email protected]>
A dead lock could happen if 2 threads with differents priorities use poll_out. In fact, the lock data->tx_lock could be lock by a thread with lower priority and then a thread with higher priority can't take the lock. There was a race condition here: /* Wait for TXE flag to be raised */ while (1) { if (atomic_cas(&data->tx_lock, 0, 1)) { /* !!!!!!!! RACE CONDITION !!!!!!!!!!!!!! if (LL_USART_IsActiveFlag_TXE(UartInstance)) { break; } atomic_set(&data->tx_lock, 0); } } To fix race condition, the interrupts are locked in poll_out. Signed-off-by: Julien D'ascenzio <[email protected]>
Some tests like: tests/kernel/sched/metairq/kernel.scheduler.metairq tests/kernel/profiling/profiling_api/kernel.common.profiling tests/kernel/sched/schedule_api/kernel.scheduler tests/kernel/sched/schedule_api/kernel.scheduler.multiq tests/kernel/profiling/profiling_api/kernel.common.profiling tests/kernel/workq/work_queue/kernel.workqueue don't support that the current thread change when writing a message with printk (which uses poll_out). So, we remove the call to k_yield which is useful only for optimizing cpu usage by forcing a thread change if the usart send stack is full. Signed-off-by: Julien D'ascenzio <[email protected]>
ed7dfe7
to
1e38435
Compare
I clicked the rebase button |
Looks good - I just wanted to double check that the superceded backport PRs were closed, and it looks like thats the case. |
This backport consists of #40173, #40782 & #41116
Fixes #40775