Kaben123 opened a new pull request, #21922:
URL: https://github.com/apache/nuttx/pull/21922
## Summary
Small cleanups in `sched/init`:
1. **check that the work queue threads are created**: `nx_workqueues()`
ignored the return values of `work_start_highpri()`/`work_start_lowpri()`.
They are now checked with `DEBUGASSERT()`.
2. **change nx_bringup() to return void**: it always returned `OK` and the
only caller wrapped it in `DEBUGVERIFY()`.
3. **remove dead code in the PID hash sizing loop**: in `nx_start()` the
loop that grows the PID hash can never run when
`CONFIG_SMP_NCPUS < CONFIG_PID_INITIAL_COUNT` (Coverity DEADCODE). The
loop
is now compiled only when `CONFIG_SMP_NCPUS >= CONFIG_PID_INITIAL_COUNT`.
Note the `>=`: when both are equal and a power of two, the loop must still
run once so the hash can hold all idle tasks plus later tasks.
## Impact
No functional change on the normal path. `nx_bringup()` is an internal
function declared in `sched/init/init.h`; it has no other callers.
## Testing
Host: Ubuntu 22.04 x86_64, GCC 13.1.0. Base: apache/nuttx master
5c1746778e8, apache/nuttx-apps master 7f4e5382d.
- `sim:nsh` boots, `ps` works.
- `sim:smp` with `CONFIG_SMP_NCPUS=8` and `CONFIG_PID_INITIAL_COUNT=8`
(the boundary case for commit 3) boots and runs 13 tasks:
```
nsh> ps
TID PID PPID CPU PRI POLICY TYPE NPX STATE EVENT SIGMASK
STACK USED FILLED COMMAND
0 0 0 0 0 FIFO Kthread - Assigned
0000000000000000 0066512 0004776 7.1% CPU0 IDLE
1 0 0 1 0 FIFO Kthread - Running
0000000000000000 0066504 0008920 13.4% CPU1 IDLE
2 0 0 2 0 FIFO Kthread - Running
0000000000000000 0066512 0009704 14.5% CPU2 IDLE
3 0 0 3 0 FIFO Kthread - Running
0000000000000000 0066504 0005080 7.6% CPU3 IDLE
4 0 0 4 0 FIFO Kthread - Running
0000000000000000 0066512 0005096 7.6% CPU4 IDLE
5 0 0 5 0 FIFO Kthread - Running
0000000000000000 0066504 0005112 7.6% CPU5 IDLE
6 0 0 6 0 FIFO Kthread - Running
0000000000000000 0066512 0005048 7.5% CPU6 IDLE
7 0 0 7 0 FIFO Kthread - Running
0000000000000000 0066504 0005048 7.5% CPU7 IDLE
8 0 0 --- 224 FIFO Kthread - Waiting Semaphore
0000000000000000 0067456 0000760 1.1% sim_loop_wq 0x74ec46c72020
0x74ec46c720a8
9 0 0 --- 224 FIFO Kthread - Waiting Semaphore
0000000000000000 0067472 0000760 1.1% hpwork 0x4009c080 0x4009c108
10 0 0 --- 100 FIFO Kthread - Waiting Semaphore
0000000000000000 0067464 0000760 1.1% lpwork 0x4009c140 0x4009c1c8
12 12 0 --- 100 FIFO Task - Waiting Semaphore
0000000000000000 0067504 0002728 4.0% init_main
13 13 12 0 100 FIFO Task - Running
0000000000000000 0067496 0003912 5.7% sh
nsh> poweroff
```
- `tools/checkpatch.sh -c -u -m -g` passes.
--
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]