This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
HI,
I found a bug in the linux kernel code with rproc driver in ti_k3_dsp_remoteproc.c/ti_k3_r5_remoteproc.c when these drivers use mailbox to send messages.
I doubte why you didn't have this problem.
第一次在TI的社区上发贴子,不知道有没人回复,我用中文也描述一遍。
不知道有没有人用过TI 的TDA4的板子,这个板子会用rpmsg + rproc做核间通信,会用mailbox发消息。
在TI 的K3_XX_remoteproc.c系列的驱动中使用mailbox 貌似有一个bug,就像正文中描述的那样,rproc的kick函数要将mailbox消息发往对端,发送侧申请一个msg buffer作为发送缓冲,可是这个buffer是个临时变量,如果我们在申请mailbox client时设置的发送属性为non-block,则存在问题:mbox_send_message调用后将消息缓冲放在mailbox client的自己的发送缓冲(看代码,是一个深度为20的缓冲哦)后立马返回,因为是局部变量,此时的“msg"这个kick函数中申请的变量将会释放,又因为是异步的,这时候kick提交到mailbox client中待发送的任务可能还没发送,这时候如果重新发送,则用的就是一个已经释放的局部变量,这不就踩踏了吗?
大家看看有没有遇到我类似的问题。
不过有一个差异,我的mailbox是ARM的,mailbox的消息的data长度是7字节,所以我用的是msg[7]的数组. TI原生代码用的一个32位,用的是一个
抱歉回复晚了,请看下面我们e2e工程师的回复。
There are no issues with the TI K3 R5F/DSP remoteproc drivers and their usage of Mailboxes with the OMAP Mailbox driver. The Mailbox subsystem API semantics use a pointer, and this gets translated/deferenced properly by the corresponding platform mailbox driver. So, the behavior is dependent on the Mailbox platform driver and it's clients.
The OMAP Mailbox driver is optimized to directly use the pointer value as the payload. This eliminates all the life-cycle management of having to use pointers, and their transfer of ownership between the Mailbox client and the Mailbox driver.