yangsong8-a1 opened a new pull request, #22157: URL: https://github.com/apache/nuttx/pull/22157
## Summary The serial upper half calls `dmatxavail()`, `dmasend()`, `send()` and `rxflowcontrol()` with `uart_spinlock()` held (since #21746), and `send()`/`dmatxavail()` from interrupt context through `uart_putchars()`. `uart_rpmsg` took a mutex there, waited for a TX buffer in `dmasend()` and called `rpmsg_send()` in `rxflowcontrol()`. On SMP a task that blocks there can resume on another CPU and spin on the lock it holds itself. Send from works, without changing the protocol: `dmasend()` queues txwork, which gets a TX buffer without waiting (retry after 10 ms) and sends the WRITE message; the transfer still completes on the remote's response. `rxflowcontrol()` queues the WAKEUP message. The response and WAKEUP handlers take the uart spinlock instead of the mutex. `uart_rpmsg_init()` creates one work queue for all devices (`CONFIG_RPMSG_WQUEUE_PRIORITY`, `CONFIG_RPMSG_WQUEUE_STACKSIZE`). ## Impact `CONFIG_RPMSG_UART` users. One more kernel thread. Wire protocol unchanged. ## Testing Ubuntu 22.04, gcc 13.1.0. Build: `sim:rpserver`, `sim:rpproxy`, no warnings. Runtime on `sim:rpserver` + `sim:rpproxy` (proxy console is `/dev/ttyproxy`, reached with `cu`), with `CONFIG_RPMSG_UART_RAW` and a local `/dev/ttyraw` for traffic (see the `uart_rpmsg_raw` PR): 200 lines proxy to server, 50 lines server to proxy shown through `cu`. | | master | this PR (with the `uart_rpmsg_raw` PR) | |-|-|-| | SMP=n | 200/200, 50/50 | 200/200, 50/50 | | SMP=2 | 5 of 5 runs: both instances stop, 3 of them with the assertion below | 200/200, 50/50, 5 of 5 runs (3 more after rebase) | master, SMP=2: ``` [ 7.060120] [CPU1] [proxy] dump_assert_info: Assertion failed : at file: include/nuttx/spinlock.h:1096 task(CPU1): sh process: sh 0x40076580 ``` (`spinlock.h:1096` is the owner check in `rspin_unlock()`.) Not tested: real AMP hardware. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
