CV-Bowen opened a new pull request, #22265:
URL: https://github.com/apache/nuttx/pull/22265
## Summary
Depends on apache/nuttx#22263
- `openamp: export rpmsg_unregister_endpoint()` (patch 0030): a device
being torn down can unregister an endpoint without sending
`NS_DESTROY`, which can no longer reach the remote. Since
apache/nuttx#22263 this also clears `ept->rdev`, so a later
`rpmsg_destroy_ept()` on it is a no-op.
- `drivers/rpmsg: unregister endpoints before destroying the device`:
`rpmsg_device_destroy()` only called `ns_unbind_cb` for endpoints that
have one. rpmsg_socket's callback only marks the connection unbound, so
the endpoint stayed registered with `ept->rdev` pointing at the freed
device, and a later `close()` sent `NS_DESTROY` through it:
```
User Exception: EXCCAUSE=000d task: abufsink@Capture
#0 rpmsg_get_endpoint (rdev=0x1bd6a688) rpmsg.c:295
#1 rpmsg_router_edge_send_offchannel_raw rpmsg_router_edge.c:436
#4 rpmsg_destroy_ept rpmsg.c:430
#6 rpmsg_socket_close rpmsg_sockif.c:1672
```
Each endpoint is now unregistered before its `ns_unbind_cb`.
## Impact
- After a device goes away, endpoints with an `ns_unbind_cb` are
unregistered, so their later `rpmsg_destroy_ept()` sends nothing.
- OpenAMP exports `rpmsg_unregister_endpoint()` (internal header). No
Kconfig or protocol change.
## Testing
Host: Ubuntu 22.04.5 LTS x86_64, QEMU version 10.2.1, sim: cc (Ubuntu
13.1.0-8ubuntu1~22.04) 13.1.0, qemu-armv8a: aarch64-none-elf-gcc (Arm GNU
Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 20221205
Both commits build sim:rpserver, sim:rpproxy, qemu-armv8a:rpserver,
qemu-armv8a:rpproxy, sim:rpserver_uart, sim:rpserver with
`CONFIG_OPENAMP_VIRTIO_DEVICE_SUPPORT=n` and sim:rpserver with
`CONFIG_RPMSG_POOL_COUNT=8` + `CONFIG_RPMSG_WQUEUE_NUMBER=2` with 0
warnings.
Not tested at runtime: the crash itself, which needs an rpmsg socket
left open across the peer going away.
No regression in rpmsg: sim:rpserver/rpproxy and
qemu-armv8a:rpserver/rpproxy boot and pass the fixed rpmsg cases (dump, ping,
rpmsgfs; 15/15). qemu-armv8a was built with LIBC_ENVPATH and BINFMT_CHECKEXEC
disabled, which current master needs for nxinit to start nsh there; unrelated
to this change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]