Race condition between Linux and M4 app with rpmsg link init

Frieder Schrempf frieder.schrempf at kontron.de
Mon Mar 27 04:49:28 PDT 2023


Hi,

I have a problem with a kind of race condition between Linux
remoteproc/rpmsg on the A53 core and the app on the M4 core when
starting the remote core and initializing the rpmsg link. This is what
happens:

| A53                          |  M4                         |
| ---------------------------- | --------------------------- |
| * load the ELF file          |                             |
| * start the M4 core          |                             |
| rproc_start()                |                             |
|   imx_rproc_start()          |                             |
|                              | * M4 app starts             |
|   rproc_start_subdevices()   |                             |
|                              | * M4 receives mailbox IRQ   |
|                              | * M4 app doesn't handle     |
|                              |   IRQ as they are not       |
|                              |   registered yet            |
|                              | * M4 registers IRQ handlers |


When I add a delay in rproc_start() between the calls to
imx_rproc_start() and rproc_start_subdevices() this give the M4 app
enough time to fully start and register the IRQ handlers. In this case
the rpmsg link is initialized correctly.

What is the proper way to fix this? Is there already a mechanism to
handle such cases?

Thanks for any help!

Best regards
Frieder



More information about the linux-arm-kernel mailing list