CV-Bowen opened a new pull request, #22086:
URL: https://github.com/apache/nuttx/pull/22086
## Summary
Two changes to the rpmsg clock driver (`drivers/clk/clk_rpmsg.c`):
- `run the client callback in the rx interrupt`: the client and server
endpoints shared one callback that both handled replies and ran the
clk request handlers, which call into the clk framework and send a
reply. Give each endpoint its own callback. The client one only
stores the result and posts the waiter, so the client endpoint is set
to `RPMSG_PRIO_RT` and rpmsg_virtio calls it straight from the rx
interrupt instead of a worker thread. The server endpoint keeps the
default priority.
- `drop the response flag from the message header`: the flag that told
a request from a reply is no longer needed once each endpoint has its
own callback.
A leading `fix nxstyle errors` commit fixes one indentation error that
is already in the file, so checkpatch passes on the changes.
## Impact
- The clk rpmsg message header loses its 4-byte `response` field, so
the client and server sides of a link must both run this version.
- The client endpoint callback runs in interrupt context on
rpmsg_virtio transports.
- No API or Kconfig 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
sim:rpserver + sim:rpproxy. sim:rpserver already has `CONFIG_CLK_RPMSG`;
on top of both configs: `CONFIG_CLK=y CONFIG_CLK_RPMSG=y` and a
test-only nsh program (not in this PR):
- `p118clk reg` on the server registers `p118_osc` (fixed 24 MHz) ->
`p118_gate` (gate) -> `p118_div` (4-bit divider).
- `p118clk test 1000` on the proxy does `clk_get("server/p118_div")`,
`clk_enable()`, `clk_is_enabled()`, `clk_get_rate()`,
`clk_set_rate(6000000)`, 1000 more `clk_get_rate()`, `clk_disable()`,
all through clk_rpmsg.
| | master | this PR |
|---|---|---|
| enable / is_enabled / rate / set_rate / rate / disable (3 runs) | 1 / 1 /
24000000 / 0 / 6000000 / is_enabled 0 | same |
| proxy `rpmsg-clk` endpoint priority | 127 | 255 |
| server `rpmsg-clk` endpoint priority | 127 | 127 |
<details><summary>this PR, proxy</summary>
```
proxy> p118clk test 1000
p118: clk_get ok
p118: enable 1
p118: is_enabled 1
p118: rate 24000000
p118: set_rate 0
p118: rate 6000000
p118: 1000 get_rate in 10609946 us, 10609 us each
p118: disable
p118: is_enabled 0
p118: done
[proxy] ept rpmsg-clk 0xf324df00: addr=1040 dest=1040 refcnt=1
priority=255 priv=0xf324df00
[server] ept rpmsg-clk 0xef6fe0e8: addr=1040 dest=1040 refcnt=1
priority=127 priv=0xef6fe0e8
```
</details>
The per-call time is not a latency result: on sim every clk_rpmsg round
trip takes about 10 ms with or without this change (10.0 ms on master,
10.6 ms here, 3 runs each), so sim cannot show the effect of skipping
the worker thread. No interrupt-driven board was available.
Each commit builds without warnings on sim:rpserver and sim:rpproxy with
`CONFIG_CLK_RPMSG=y`.
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]