yangsong8-a1 opened a new pull request, #22156: URL: https://github.com/apache/nuttx/pull/22156
## Summary The serial upper half calls `dmatxavail()`, `dmasend()` and `send()` with `uart_spinlock()` held (since #21746), and from interrupt context through `uart_putchars()`. `uart_rpmsg_raw` took a mutex in `dmatxavail()` and waited for a TX buffer and sent in `dmasend()`. If no TX buffer was free, `dmasend()` also returned with `dmatx.length` still set, so TX stopped for good. Send from a work, like the netdev console: `dmasend()` only queues it; the work gets a TX buffer without waiting (retry after 10 ms), sends, and completes the transfer under the uart spinlock. The mutex now only orders the work and `device_destroy()`. `uart_rpmsg_raw_init()` creates one work queue for all devices (`CONFIG_RPMSG_WQUEUE_PRIORITY`, `CONFIG_RPMSG_WQUEUE_STACKSIZE`), since boards such as `imx93-qsb:rpmsg` have no HPWORK or LPWORK. ## Impact `CONFIG_RPMSG_UART_RAW` users (in tree: `imx93-qsb:rpmsg`). One more kernel thread. The data and the protocol are unchanged. ## Testing Ubuntu 22.04, gcc 13.1.0, arm-none-eabi-gcc 10.3.1. - Build: `imx93-qsb:rpmsg`, `sim:rpserver`, `sim:rpproxy`, no warnings. - Runtime on `sim:rpserver` + `sim:rpproxy` with `CONFIG_RPMSG_UART_RAW=y` and a local (not included) `rpmsg_serialrawinit()` in `sim_bringup.c` that creates `/dev/ttyraw` (256 bytes) on both sides. The server reads `/dev/ttyraw` into a hostfs file while the proxy, through `cu /dev/ttyproxy`, writes 200 numbered 46-byte lines; then the server writes 50 lines that the proxy prints. | | master | this PR | |-|-|-| | SMP=n | 200/200, 50/50 | 200/200, 50/50 | | SMP=2 | both instances hang (proxy console is `uart_rpmsg`, see the companion PR) | 200/200, 50/50, 3 of 3 runs (with the `uart_rpmsg` PR applied) | Not tested: the Linux `tty_rpmsg` peer, imx93 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]
