JianyuWang0623 opened a new pull request, #3852:
URL: https://github.com/apache/nuttx-apps/pull/3852

   ## Summary
   
   `trigger X` / `on X` go through a single shared key "default"; once that
   key is shared between instances, one instance's trigger re-runs the same
   "on" actions on the others. Give each init instance its own trigger key
   instead:
   
   - `init.trigger.core<N>` under `CONFIG_BMP` (N from `sched_getcpu()`);
   - `init.trigger.<cpuname>` under `CONFIG_RPMSG_LOCAL_CPUNAME`;
   - `init.trigger` otherwise.
   
   `CONFIG_BMP` takes precedence over `CONFIG_RPMSG_LOCAL_CPUNAME`.
   
   ## Impact
   
   On the in-tree simple backend nothing is persisted or shared, so behavior
   is unchanged apart from the key rename (`default` -> `init.trigger`), which
   is transparent to `trigger X` / `on X`. Cross-core isolation comes with a
   shared property backend.
   
   ## Testing
   
   sim:nsh (host build) and sim:smp (`CONFIG_SMP=y`, 4 simulated CPUs):
   
   * boot sequence unchanged: `on boot` -> `trigger init` -> `on init` ->
     console service starts, nsh prompt works (`uname`, `ps`);
   * `trigger`/`on` chains (`on boot` -> `trigger testevt` -> `on testevt`
     -> `trigger testevt2` -> `on testevt2`) each execute exactly once per
     trigger;
   * debug log shows the new key (previously `key:default`):
   
   ```
   Setprop key:init.trigger value:boot
   Trigger init.trigger==testevt
   executed command 'echo ...' pid 5
   Started service 'console' pid 10
   ```
   
   qemu-armv8a:nsh_smp (`qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic
   -machine virt,virtualization=on,gic-version=3 -kernel nuttx`; NuttX is built
   with `CONFIG_SMP_NCPUS=2`, so it brings up 2 of the 4 QEMU CPUs): same
   results; a single `init_main` instance runs and the key has no `.core<N>`
   suffix, as expected outside BMP.
   
   BMP key path (`init.trigger.core<N>`): compile-time exercise only with
   `-DCONFIG_BMP` (no BMP board config exists in tree). The binary contains
   the `init.trigger.core%d` format string and a sim:smp run logs
   `Setprop key:init.trigger.core0 value:boot`.
   
   All three files pass `tools/checkpatch.sh -f`.
   


-- 
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