On Fri, May 29, 2026 at 06:01:02PM +0200, Sebastian Andrzej Siewior wrote: > The imx's remoteproc driver uses a kworker from its mailbox callback to > complete the request. The reason is that the imx mailbox driver invokes > the callback from its interrupt handler and the remoteproc callback (at > least the rpmsg-tty) requires a preemptible context. > > This works but is problematic in a PREEMPT_RT environment where the > latency of the invocation is important. By scheduling a kworker the > high task priority from the threaded handler is lost and the kworker > competes for CPU ressources with every SCHED_OTHER task in the system. > This can lead to long delays on a busy system with other RT threads > which are less important than the completion of this request. > > Looking over other mailbox driver, like the arm_mhu for instance, they > use a threaded interrupt handler to invoke the callback. This avoids the > kworker detour. > > The here suggested change utilises a threaded interrupt to invoke the > callback. The primary handler mask the interrupt source so that the > handler can run without getting interrupted by the interrupt again. > Doing so avoids marking the interrupt IRQF_ONESHOT so that that in a > shared-interrupt environment the other interrupt can still fire while > the first one is masked. > > This change was tested on a im93 board with rpmsg-tty driver. > > Signed-off-by: Sebastian Andrzej Siewior <[email protected]> > --- > Sebastian Andrzej Siewior (5): > mailbox: imx: Start splitting the IRQ handler in primary and threaded > handler > mailbox: imx: Move the RX part of the mailbox into the threaded handler > mailbox: imx: Move the RXDB part of the mailbox into the threaded > handler > mailbox: imx: Don't force-thread the primary handler > remoteproc: imx_rproc: Invoke the callback directly > > drivers/mailbox/imx-mailbox.c | 65 > +++++++++++++++++++++++++++++++++--------- > drivers/remoteproc/imx_rproc.c | 33 +--------------------
For imx_rproc.c: Reviewed-by: Mathieu Poirier <[email protected]> You may also want to fix driver/remoteproc/stm32_rproc.c > 2 files changed, 53 insertions(+), 45 deletions(-) > --- > base-commit: 9e171fc1d7d7ab847a750c03571c87ac3c17bd84 > change-id: 20260529-imx_mbox_rproc-7d512f5a6f78 > > Best regards, > -- > Sebastian Andrzej Siewior <[email protected]> >
