CV-Bowen commented on PR #22142:
URL: https://github.com/apache/nuttx/pull/22142#issuecomment-7141148232
@cederom Thanks for the detailed review. What changed in this push:
- (1) the two later fixes for the blocking-read path (`do not clear the
pending
read`, `reply once to a blocking read`) moved into this PR, right after the
commits they fix;
- (2) new commit `keep a blocking read waiting on -EAGAIN`;
- (3) documented in the commit message and the description;
- (7) `split writes` directly follows the fragmentation removal, whose
message now
points at #22234 for reads;
- (8) and the nits fixed; (4), (5) and (6) answered below.
Parts 2 and 3 (#22234, #22235) are rebased on top.
**1 (rpmsgdev_server.c:310)**
Confirmed and reproduced: with a short delay before the `memset()`, the next
READ's
pollfd is wiped and that read never completes. The fix already exists later
in the
series, `rpmsgdev_server: do not clear the pending read` (removes both
`memset()`s;
every field is set again before the next read), plus `reply once to a
blocking read`
(stops the read work from being queued twice). Both move into this PR, right
after
the commit that adds the blocking read path.
**2 (-EAGAIN)**
Confirmed: when another reader takes the data first, the work's
non-blocking `file_read()` returns -EAGAIN and the blocking `read()` fails
with it.
The work now re-arms the poll on -EAGAIN instead of replying, so a blocking
read
waits as before. `rpmsgdev_read_cancel()` now stops the work from polling
again and
cancels it before it tears the poll down. Reproduced with a local reader on
the
server and a delay before the work's `file_read()`: the client's blocking
`read()`
returned -EAGAIN before, and keeps waiting now.
**3 (interruptible)**
Agreed, this is a behaviour change of the blocking path. The client has to
wait in
`rpmsg_wait()`, because the nested-dispatch design relies on it. It is now
documented
in the commit message and the description. Interruption needs a cancel
message, and
we will handle that separately, not in this series.
`read(fd, buf, 0)`: on master the server sent no reply at all for count 0
(its loop
`while (read < msg->count)` never runs), so the call never returned. Now it
returns
0 once the device is readable.
**4 (renumbering)**
Keeping 3 would not give interoperability. Master's server answers a large
READ (3)
with several replies for one cookie, and the new client accepts one reply per
cookie, so mixed images still break. The fragmentation removal also drops
command 4.
Both sides are kernel drivers built from the same tree and upgraded
together, so we
keep the numbering. It also matches the numbering already deployed on the
downstream
tree.
**5 (device_destroy)**
This is intended. Registering an rpmsgdev client means the peer exports that
device,
so the endpoint is expected to bind: requests and the teardown wait for the
binding
instead of failing and leaving the caller to retry. A client towards a core
without
the server is a configuration error. (`/dev/ttyUSB0` in the sim config does
bind:
the generic server matches every `rpdev` name; only `open()` fails, with
-ENOENT.)
**6 (ns_unbind)**
After an unbind open-amp resets `ept->dest_addr` to `RPMSG_ADDR_ANY`, and
`rpmsg_send()` rejects that, so requests after an unbind fail at once rather
than
going to an unbound endpoint. Taking the count back there would turn that
into an
uninterruptible wait for a rebind that may never come, which changes
behaviour that
master already has. A second bind of the same client endpoint without its
rpmsg
device being recreated does not happen with the in-tree server: an export
endpoint
is destroyed only together with its rpmsg device. So no change here.
**7 (fragmentation)**
The split-writes commit now directly follows the fragmentation removal, so
no commit
in between fails large writes. For every in-tree caller the final behaviour
is
master's default: all of them passed 0, so writes were split. Only the
opt-out is
gone; no in-tree user set `RPMSGDEV_NOFRAG_WRITE`, and the BREAKING CHANGE
note covers
the removed flags. "Later in this series" meant the whole series, and reads
are split
again in #22234 (`split large reads again`). The message now says so.
**8 (description)**
The pool rows belong to the shared Testing section (part 2's fix and the test
configuration), now labelled as part 2. No pool or Kconfig change is in this
PR.
apache/nuttx-apps#4102 drops the `flags` argument of `rpmsgdev_register()` in
`testing/drivers/rpmsgdev`; it was merged on 2026-11-22, so nothing has to
land
together.
**Nits**
- Spacing: fixed.
- `rpmsgdev_init_wqueue()`: added a comment; the callers run at bringup only.
- `rpmsg_post()` under the spinlock: every transport's `post()` only posts
semaphores (rpmsg_virtio; rpmsg_port and the router edge have none), so
IRQs off is
fine. But on SMP the post can switch to the woken waiter while the lock is
held, so
`rpmsgdev_fail_cookies()` now takes the lock with
`spin_lock_irqsave_nopreempt()`.
--
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]