[PATCH v3 00/10] mailbox: imx: Use threaded handler to avoid kworker in imx's remoteproc
Francesco Dolcini
francesco.dolcini at toradex.com
Mon Nov 16 01:23:41 PST 2026
Hello Sebastian, Peng
On Wed, Jun 17, 2026 at 08:55:25AM +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 in a
> shared-interrupt environment the other interrupt can still fire while
> the first is masked.
>
> The first four patches are result of the sashiko review. Does not look
> critical.
>
> This change was tested on a im93 board with rpmsg-tty driver.
Our CI shows a ~10-15% eMMC sequential read throughput drop on i.MX8QXP
and i.MX8DX (Colibri iMX8X, Cortex-A35), starting with v7.2-rc1 and
still present in v7.4-rc3 (hdparm --direct -t: ~129 MB/s -> 105-120
MB/s on i.MX8DX). i.MX8QM, i.MX8M and i.MX9 are not affected.
5d1c0000.mailbox interrupt count before the test went from ~8k on v6.18
to 60k+ on v7.3/v7.4.
Peng: any idea/suggestion? Does it makes any sense to you?
Francesco
More information about the linux-arm-kernel
mailing list