Fix-Point opened a new pull request, #3923:
URL: https://github.com/apache/nuttx-apps/pull/3923

   ## Summary
   
   This nuttx-apps PR is a **companion required by apache/nuttx PR 
[#21001](https://github.com/apache/nuttx/pull/21001)** (the hrtimer fix/inline 
series). It splits two goals:
   
   1. **Fix the build of `testing/ostest/hrtimer.c`.** The test uses 
`spin_lock_irqsave()`/`spin_unlock_irqrestore()`, `up_ndelay()` and the 
`pthread_*` APIs without including the providing headers. `ostest` always 
compiles `hrtimer.c` when `CONFIG_HRTIMER=y`, so every HRTIMER-enabled 
configuration currently fails to build — e.g. the `smartl-c906/sotest` 
defconfig, which enables `CONFIG_HRTIMER=y` by default. `<nuttx/spinlock.h>` 
and `<pthread.h>` are added (mirroring the vela patch "ostest/hrtimer: Add 
missing pthread.h and spinlock.h.").
   
   2. **Sync the hrtimer test with the vela fixes that were never merged 
upstream.** The vela test has evolved after the upstream merge point (Feb 
2026). This PR brings over the subsequent improvements, so the test is reliable 
on real HRTIMER workloads:
      - Decrease the test period to avoid starvation (the previous 
1024-iteration burst starves low-priority test threads on RT throttled cores);
      - Simplify the log output;
      - Fix starvation issues: use `HRTIMER_MODE_ABS` (`now + delay`) starts, 
deduplicate callbacks via an explicit `state` field, and rework the 
rand/rand_cancel wait loops and error checks;
      - Fix `count` type (uint64→uint32) and the priority issue in the callback.
   
   > **Note on `CPU_SETSIZE`:** the vela test later replaced `CONFIG_SMP_NCPUS` 
with `CPU_SETSIZE` in `HRTIMER_TEST_THREAD_NR`. That change is intentionally 
**not** included here (keeping `CONFIG_SMP_NCPUS * 4`), per the pending 
upstream CPU_SETSIZE discussion.
   
   ## Impact
   
   * **User impact:** test-only; no API changes.
   * **Build:** unbreaks every configuration that enables `CONFIG_HRTIMER` 
together with `CONFIG_TESTING_OSTEST` (e.g. `smartl-c906/sotest`, which 
defaults to `CONFIG_HRTIMER=y`).
   * **Hardware:** none (validated on `qemu-armv7a`, see Testing).
   * **Documentation:** none.
   * **Security:** none.
   * **Compatibility:** test behavior becomes stricter (validates ABS-mode 
expiry, deduplication), matching the vela test semantics.
   
   ## Testing
   
   **Host:** x86-64 Linux, `arm-none-eabi-gcc + QEMU (qemu-system-arm)`.
   
   **Config:** `qemu-armv7a:smp` with `CONFIG_HRTIMER=y`, 
`CONFIG_TESTING_OSTEST=y`, `CONFIG_TESTING_OSTEST_LOOPS=512`.
   
   **Result:** full build passes; ostest starts and runs cleanly on 4-core SMP 
with HRTIMER enabled.
   


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