yangsong8-a1 opened a new pull request, #22502:
URL: https://github.com/apache/nuttx/pull/22502

   ## Summary
   
   Under BMP every core runs its own scheduler out of one shared image, so a
   plain global is shared between cores.  That is wrong for both the reset
   controller list and its lock: a controller is registered by, and belongs
   to, one core, and a NuttX mutex belongs to one scheduler instance.
   
   Move both into per-CPU storage.  The controller list becomes a dq queue on
   the way: a circular list_node head cannot keep a static initialiser in
   per-CPU storage, while a zeroed dq head is already a valid empty queue.
   Convert the list of reset controls requested from one controller too, so
   the framework uses one list flavour throughout and
   `include/nuttx/reset/reset-controller.h` no longer pulls in both
   `list.h` and `queue.h`.
   
   Nothing changes for AMP or UP builds, where the per-CPU macros collapse
   to plain globals, one per image.
   
   ## Impact
   
   No API changes.  The order of controllers in `/proc/reset` reverses,
   because insertion moves from the head of the list to the tail; nothing
   depends on that order, the list is only walked to match a line id.
   
   Size on `sim:nsh` with the test below (flat, host gcc):
   4080104 -> 4081240 bytes (+1136).
   
   ## Testing
   
   Host GCC, Ubuntu 22.04.  `tools/checkpatch.sh` passes.
   
   **Builds:**
   
   - `sim:nsh` with `CONFIG_RESET=y`, `CONFIG_RESET_PROCFS=y`,
     `CONFIG_FS_PROCFS_REGISTER=y`: built and run.
   - `qemu-armv8a:netnsh` with `CONFIG_RESET=y`: cross build with
     arm-gnu-toolchain-13.2.Rel1, builds clean.
   
   **Runtime:** a test app (two fake controllers, 4 and 2 lines) exercised
   `reset_controller_register()`, `reset_control_get()`,
   `reset_control_reset()`, `reset_control_status()`, an out-of-range
   `reset_control_get()`, the `/proc/reset` dump and
   `reset_controller_unregister()` on master and on this patch.  Identical
   results, including per-op counters, except for the documented controller
   order in `/proc/reset` (tail insertion lists fakea before fakeb):
   
   ```
   === /proc/reset (284 bytes) ===
   fakea:
   0    line0                    state:released
   ...
   counters: reset=1 assert=0 status=7 getline=6
   RESET TEST PASSED


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