Skip to content

drivers: uart_nrfx_uarte: fix race in runtime device PM usage count#3901

Open
invoxiaamo wants to merge 1 commit intonrfconnect:mainfrom
invoxiaamo:nrfconnect+pm_usage_bug
Open

drivers: uart_nrfx_uarte: fix race in runtime device PM usage count#3901
invoxiaamo wants to merge 1 commit intonrfconnect:mainfrom
invoxiaamo:nrfconnect+pm_usage_bug

Conversation

@invoxiaamo
Copy link
Contributor

If uarte_nrfx_irq_tx_disable is called, pm_device_runtime_put call responsibility is transfer to TXSTOPPED handling through
disable_tx_irq = true;

Yet, if uarte_nrfx_irq_tx_enable is called before TXSTOPPED finally triggers, the pm_device_runtime_put call is lost.

Also protect uarte_nrfx_irq_tx_disable for race with irq.

The corruption happened very easily @ 921600 bauds when transmitting small chunks (< 10bytes) repeatedly but not continuously, with RX also enabled.

If uarte_nrfx_irq_tx_disable is called, pm_device_runtime_put call
responsibility is transfer to TXSTOPPED handling through
	disable_tx_irq = true;

Yet, if uarte_nrfx_irq_tx_enable is called before TXSTOPPED finally
triggers, the pm_device_runtime_put call is lost.

Also protect uarte_nrfx_irq_tx_disable for race with irq.

This fixes corrupted usage count on fast and repeated fixed RX+TX patterns.

Signed-off-by: Arnaud Mouiche <arnaud.mouiche@invoxia.com>
@NordicBuilder
Copy link
Contributor

none

Note: This comment is automatically posted and updated by the Contribs GitHub Action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants