CV-Bowen opened a new pull request, #22237:
URL: https://github.com/apache/nuttx/pull/22237
## Summary
Two rpmsg core changes, in the order they were made:
- `drivers/rpmsg: take ns-bind records from the rpmsg pool when possible`:
a name service announcement that no registered callback matches is
kept in a `struct rpmsg_bind_s` until its service registers. The
record came from `kmm_malloc()`. With `CONFIG_RPMSG_POOL_COUNT > 0`
and pool blocks large enough to hold it, it now comes from the rpmsg
pool. The choice is made at compile time, so a record is always freed
to the allocator it came from. With the pool disabled
(`RPMSG_POOL_COUNT == 0`, the default) `rpmsg_pool_alloc()` is
`alloca()`, so the heap is still used.
- `drivers/rpmsg/rpmsg_virtio: keep an unbound RT endpoint on the ns
queue`: the name service message of an RT endpoint is queued at
`ns_ept`'s priority, but a data message to an RT endpoint that is not
bound yet was queued at `RPMSG_PRIO_RT`. With
`CONFIG_RPMSG_WQUEUE_NUMBER > 1` these are different work queues, so
the data message could be handled first; it sets `dest_addr`, and the
name service message then finds the endpoint bound and skips
`ns_bound_cb()`. The data message of an unbound RT endpoint now uses
`ns_ept`'s priority, so both go through one work queue in order.
## Impact
- No API or Kconfig change. With the default `RPMSG_POOL_COUNT=0`
nothing changes for the first commit.
- With `RPMSG_POOL_COUNT > 0`, pending bind records share the pool with
the other pool users (`rpmsg_heap` cookies). A record for a service
that never registers holds its block until the device goes away, and
when the pool is empty a new announcement is dropped, as it already
was when `kmm_malloc()` failed. Size the pool for both.
- The second commit only affects RT endpoints with more than one rpmsg
work queue.
## 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
Every commit builds sim:rpserver, sim:rpproxy, qemu-armv8a:rpserver and
qemu-armv8a:rpproxy with 0 warnings, plus sim:rpserver with
`CONFIG_OPENAMP_VIRTIO_DEVICE_SUPPORT=n`, and sim:rpserver and
qemu-armv8a:rpproxy with `CONFIG_RPMSG_POOL_COUNT=8` and
`CONFIG_RPMSG_WQUEUE_NUMBER=2`.
**Bind records from the pool.** sim:rpserver + sim:rpproxy, both with
`CONFIG_RPMSG_POOL_COUNT=8`, with a test-only log line (not in this PR)
where a record is allocated. The proxy gets three announcements before
their services register; on master they come from the heap, with this
PR from the pool. Uname, `rpmsg ping` both ways, rpmsgfs mount and read
and `rpmsg dump` pass (6/6) on master and on this PR, on sim and
qemu-armv8a, and on this PR with the pool on sim.
```
master: [proxy] rpmsg_ns_bind: P136T bind record from heap 0xe4f17848
[proxy] rpmsg_ns_bind: P136T bind record from heap 0xe4f17878
[proxy] rpmsg_ns_bind: P136T bind record from heap 0xe4f178c0
this PR: [proxy] rpmsg_bind_alloc: P136T bind record from pool 0x400edcf8
[proxy] rpmsg_bind_alloc: P136T bind record from pool 0x400edcb8
[proxy] rpmsg_bind_alloc: P136T bind record from pool 0x400edc78
```
Not tested at runtime: the RT ordering fix. No in-tree service sends to
an RT endpoint before its name service message is handled; it is
covered by the builds with two work queues only.
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]