Hi, folks,

The issue is that requests cause the rpmsg channels to the PRU to fill.  
Which is actually fine, the PRU in this case is servicing slow requests and 
the rpmsg being full should exert backpressure.

The problem is that the rpmsg system *HANGS* several second before timing 
out and throws a fairly bizarre error.  Quoting my original message:

> Except that my overrun writes to "/dev/rpmsg_pru30" *still* block for 
several seconds (very bad) and then terminate with an Error 512 (huh?).

This is not good behavior from all manner of perspectives:

1) Why does the write time out *at all* when not O_NONBLOCK?  That's 
certainly not expected behavior.  There is no reason why the PRU might not 
take a couple seconds to service a request.  If that's a problem, you 
either set a timeout manually (usually only valid for file descriptors of 
sockets) or you put the file descriptor into non-blocking mode.  (It 
appears that this is the fault of the rpmsg driver which will time out 
after 15 seconds and then return ERESTARTSYS)

2) Why does the write hang *at all* when in O_NONBLOCK?  That's also not 
expected behavior.  If the queue is full, an attempt to write to it should 
return *IMMEDIATELY* with something like ENOMEM/EAGAIN.  (This appears to 
be the fault of the rpmsg_pru driver).

The file I was looking at is here:
https://github.com/beagleboard/linux/blob/4.19/drivers/rpmsg/rpmsg_pru.c

Two solutions seem to present themselves:

1) Use rpmsg_trysend when O_NONBLOCK is set  (see rpmsg_eptdev_write_iter 
in rpmsg_char.c line 243 for an example)

2) Check the queue for space and return immediately with ENOMEM.  (Saves 
the call to rpmsg_trysend and all its indirections).

3) Do both.  (It's possible that trysend covers other cases than just kfifo 
full--but the kfifo check may be a useful optimization and catch 99%+ or 
all the cases quickly).

Thanks.

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/dcb03907-1c54-4d83-8b42-6d396acbdd5co%40googlegroups.com.

Reply via email to