Remoteproc write to PRU over rpmsg device blocks even when non-blocking

Hi, folks,

This bug is almost a year old and is still outstanding. This is silly given that the fix is two lines and already exists elsewhere in the codebase. Where do I file to get this fixed?

Thanks.

Hi @buzmeg can you post your patch, and i’ll merge it into our tree…

Regards,

Hi, Robert,

What repository and tag/branch do you want me to pull against so that the patch is easiest to merge?

Thanks.

Hi @buzmeg , use the main branches of GitHub - beagleboard/linux: The official BeagleBoard and BeagleBone kernel repository

just let me know if it’s v4.14.x-ti/v4.19.x-ti/v5.4.x-ti/v5.10.x-ti etc. i assume it’s probally a problem with each major release…

Regards,

Sorry for the lag. I can pull this and patch it, but I can’t compile and test it. For some reason, the BBB that I was using is now dead. :frowning:

Patch for the fix. I have been careful, but I have not compiled and checked it as my board is dead. Created with “git format-patch 4.14.108-ti-r142”:

Date: Wed, 26 May 2021 20:54:17 -0700
Subject: [PATCH] fix bug where rpmsg device blocks even when set to
 non-blocking

---
 drivers/rpmsg/rpmsg_pru.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/rpmsg/rpmsg_pru.c b/drivers/rpmsg/rpmsg_pru.c
index 85f0c726c2e9..91e20b7af72c 100644
--- a/drivers/rpmsg/rpmsg_pru.c
+++ b/drivers/rpmsg/rpmsg_pru.c
@@ -147,7 +147,11 @@ static ssize_t rpmsg_pru_write(struct file *filp, const char __user *buf,
 		return -EFAULT;
 	}
 
-	ret = rpmsg_send(prudev->rpdev->ept, (void *)rpmsg_pru_buf, count);
+	if (filp->f_flags & O_NONBLOCK)
+		ret = rpmsg_trysend(prudev->rpdev->ept, (void *)rpmsg_pru_buf, count);
+	else
+		ret = rpmsg_send(prudev->rpdev->ept, (void *)rpmsg_pru_buf, count);
+
 	if (ret)
 		dev_err(prudev->dev, "rpmsg_send failed: %d\n", ret);
 
-- 
2.31.1

Thanks @buzmeg , i’ve now pushed this out as of:

4.14.108-ti-r143 - fix remoteproc write to pur when set nonblocking · RobertCNelson/ti-linux-kernel-dev@c9bf1c1 · GitHub

Regards,