CV-Bowen opened a new pull request, #22318:
URL: https://github.com/apache/nuttx/pull/22318

   ## Summary
   
   `drivers/rptun: go back to offline when the start fails before running`:
   `remoteproc_config()` moves the core to `RPROC_READY`. When loading the
   firmware or setting the resource table fails after that,
   `rptun_do_start()` returned with the core still READY. Then:
   
   - `rptun stop` (`rptun_dev_stop()`) refuses a READY core with `-EBUSY`;
   - `rptun start` on a non-OFFLINE core first stops it, so it fails the
     same way, and `remoteproc_config()` would reject a READY core anyway.
   
   The core could not be started again without a reboot. Put it back to
   `RPROC_OFFLINE` on that path, as `remoteproc_shutdown()` does after a
   failed `remoteproc_start()`.
   
   ## Impact
   
   - Only the failure path between `remoteproc_config()` and
     `remoteproc_start()` changes; a successful start is unchanged.
   - 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
   
   Builds sim:rpserver, sim:rpproxy, qemu-armv8a:rpserver and
   qemu-armv8a:rpproxy with 0 warnings.
   
   **Start failure (sim:rpserver + sim:rpproxy).** A test-only change (not
   in this PR) makes the first `RPTUN_GET_RESOURCE()` on the server return
   NULL, so the boot-time start fails after `remoteproc_config()`, and logs
   the state:
   
   | | master | this PR |
   |---|---|---|
   | state after the failed start | 2 (`RPROC_READY`) | 0 (`RPROC_OFFLINE`) |
   | `rptun stop /dev/rptun/proxy`; `echo $?` | 1 (`-EBUSY`) | 0 |
   | `rptun start /dev/rptun/proxy` | refused, `remoteproc_config()` not called 
again | `remoteproc_config ret=0`, start proceeds |
   
   <details><summary>logs</summary>
   
   ```
   master:
   [    0.000454] [server] P152T remoteproc_config ret=0
   [    0.000473] [server] P152T inject: no resource table
   [    0.000483] [server] P152T rptun_do_start ret=-22 state=2
   server> rptun stop /dev/rptun/proxy
   server> echo STOPRET=$?
   STOPRET=1
   server> rptun start /dev/rptun/proxy
   
   this PR:
   [    0.000443] [server] P152T remoteproc_config ret=0
   [    0.000462] [server] P152T inject: no resource table
   [    0.000473] [server] P152T rptun_do_start ret=-22 state=0
   server> rptun stop /dev/rptun/proxy
   server> echo STOPRET=$?
   STOPRET=0
   server> rptun start /dev/rptun/proxy
   [    7.980356] [server] P152T remoteproc_config ret=0
   ```
   </details>
   
   Not tested: the link coming back up after such a restart. On sim the
   proxy is started by the test harness rather than by the server, and
   sim_rptun cannot reconnect a running proxy after a server-side restart,
   on master as well as with this PR.
   
   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]

Reply via email to