beagleboard / beagleboard/linux
PRU /dev/rpmsg_pruXX is not closed when PRU stopped and queue was fully consumed
- Dominant language
- C
- Stars
- 810
- Forks
- 582
- PR merge metrics
- No merged PRs in 30d
Description
To reproduce the problem:
```shell
cd /tmp
git clone git://git.ti.com/pru-software-support-package/pru-software-support-package.git
cd /tmp/pru-software-support-package/examples/am335x/PRU_RPMsg_Echo_Interrupt0
export PRU_CGT=/usr/share/ti/cgt-pru
make
cp gen/PRU_RPMsg_Echo_Interrupt0.out /lib/firmware/am335x-pru0-fw
echo start > /sys/class/remoteproc/remoteproc1/state
```
Now `dmesg` will show:
```
[ 142.480770] remoteproc remoteproc1: powering up 4a334000.pru
[ 142.487884] remoteproc remoteproc1: Booting fw image am335x-pru0-fw, size 74432
[ 142.500918] pruss 4a300000.pruss: configured system_events[63-0] = 0x00000000.00030000
[ 142.511928] pruss 4a300000.pruss: configured intr_channels = 0x00000005 host_intr = 0x00000005
[ 142.528225] remoteproc remoteproc1: registered virtio0 (type 7)
[ 142.540164] remoteproc remoteproc1: remote processor 4a334000.pru is now up
[ 142.597314] virtio_rpmsg_bus virtio0: creating channel rpmsg-pru addr 0x1e
[ 142.605230] virtio_rpmsg_bus virtio0: rpmsg host is online
[ 142.641390] rpmsg_pru virtio0.rpmsg-pru.-1.30: new rpmsg_pru device: /dev/rpmsg_pru30
```
Then do:
```shell
echo hello > /dev/rpmsg_pru30
```
And open a new console and execute this without killing `cat`, keep it active:
```shell
# cat /dev/rpmsg_pru30
hello
```
Now stop the PRU:
```shell
echo stop > /sys/class/remoteproc/remoteproc1/state
```
`dmesg` will show:
```
[ 163.736825] pruss 4a300000.pruss: unconfigured system_events[63-0] = 0x00000000.00030000
[ 163.755473] pruss 4a300000.pruss: unconfigured host_intr = 0x00000005
[ 163.773323] remoteproc remoteproc1: stopped remote processor 4a334000.pru
```
And now `/dev/rpmsg_pru30` is removed but `cat` has the file descriptor opened. The problem is `cat` DOESN'T STOP. I think the correct kernel behaviour is to close the file descriptor after the PRU is stopped and the queue is fully consumed, so the user-space program has a way to know it needs to finish.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.