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

   ## Summary
   
   This series optimizes the `sched/hrtimer` timer queue and routes the hrtimer 
waiting paths through the spinlock wait policy.
   
   1. **Skip redundant reprogram via head expiration comparison**: snapshot the 
earliest expiration before the queue change in 
`hrtimer_start_absolute()`/`hrtimer_cancel()` and compare it with the one 
after. If unchanged, the hardware timer is already programmed for that target 
and `hrtimer_reprogram()` is skipped. The local comparison needs no persistent 
state and covers both head identity and head value changes, so the 
`g_hrtimer_expected` cache and its invalidation protocol are removed and 
`hrtimer_insert()`/`hrtimer_remove()` lose their `is_head` return values. 
`hrtimer_process()` still reprograms unconditionally at the end: a fired 
one-shot must always be re-armed.
   2. **Remove the guard sentinel from the timer queue**: an empty queue is now 
a first-class state. `hrtimer_get_first()` returns NULL and 
`hrtimer_next_expired()` returns `hrtimer_last_expired() + INT64_MAX` when the 
queue is empty: a far-future deadline anchored at the last `hrtimer_process()` 
time, which cannot collide with a real expiration requested by the user and 
never fires in practice. The hardware is no longer reprogrammed to the sentinel 
deadline for nothing, the NULL-callback guard node is gone, and a timer 
expiring after the guard can no longer be silently shadowed from the queue head.
   3. **Take the new cached head from `RB_NEXT` on removal**: when the removed 
timer is the queue head, capture its in-order successor before the node is 
unlinked instead of recomputing `RB_MIN` after the unlink, following the Linux 
`rb_erase_cached()` pattern.
   4. **Rework loop exits and running marks in `hrtimer_process()`**: bind 
`hrtimer_reprogram()` to the "earliest timer has not expired" exit of the 
processing loop, and claim the running mark before dequeue and release it per 
processed timer, so a `cancel_sync()` waiter is signalled as soon as its own 
callback completes instead of waiting for the rest of the batch and the final 
reprogram.
   5. **Const-qualify `hrtimer_gettime()` and sync the documentation**: the 
function only queries the timer, so it takes a `FAR const hrtimer_t *`; the 
prototype in `Documentation/os/time/time_clock.rst` is updated to match.
   6. **Add branch hints for the non-empty queue case**: the queue is virtually 
never empty in steady state, so the emptiness checks are marked with 
`predict_true()`/`predict_false()` to guide static prediction on in-order cores.
   7. **Use the lock wait policy in the cancel-sync wait**: the cancel-sync 
wait loop sleeps on `SPIN_WAIT()` and the running-mark release signals with 
`SPIN_KICK()` instead of raw `UP_WFE()` and `UP_SEV()`. The wake is issued 
after `hrtimer_unmark_running()` so a woken waiter observes the cleared running 
mark immediately. Under `SPINWAIT_PM` this keeps the WFE/SEV pairing (with the 
DSB-before-SEV ordering); under `SPINWAIT_RELAX` the wait degenerates to the 
relax hint and the kick is empty, matching the spinlock paths. The wait policy 
hooks come from `include/nuttx/spinlock.h`, which is already in the tree.
   
   ## Impact
   
   - **User impact**: Performance, footprint and waiting-power optimizations 
only; no user-visible behavior change.
   - **Build**: No `CONFIG_*` changes, no build system changes and no new or 
removed source files. `sched/hrtimer/hrtimer.h` gains `#include 
<nuttx/spinlock.h>`.
   - **Hardware**: No architecture-specific code; the changes apply to every 
target using the hrtimer queue. The waiting path uses the per-arch hints 
selected by the lock wait policy.
   - **Documentation**: `Documentation/os/time/time_clock.rst` is updated for 
the const-qualified `hrtimer_gettime()` prototype.
   - **Security**: No impact.
   - **Compatibility**: `hrtimer_gettime()` is now `uint64_t 
hrtimer_gettime(FAR const hrtimer_t *timer)`. Existing callers keep compiling; 
only code taking its address at the exact old function-pointer type needs to 
adjust. Internally the `g_hrtimer_expected` cache and the guard timer node are 
removed and one per-CPU `g_hrtimer_last_expired` timestamp (64-bit) is added, a 
small net footprint win; no exported symbol is removed.
   
   ## Testing
   
   Build Host: Linux x86_64 (GCC, riscv64-unknown-elf toolchain), QEMU
   Target: rv-virt:smp (rv32), `-smp 8`, `CONFIG_HRTIMER=y` (`HRTIMER_TREE`)
   
   Build: no errors, no new warnings.
   
   Test logs:
   
   ```
   ➜   qemu-system-riscv32 -semihosting -M virt,aclint=on -cpu rv32 -smp 8 
-bios none -nographic -kernel nuttx -s
   nsh> ostest
   stdio_test: write fd=1
   stdio_test: Standard I/O Check: printf
   stdio_test: write fd=2
   stdio_test: Standard I/O Check: fprintf to stderr
   ostest_main: putenv(Variable1=BadValue3)
   ostest_main: setenv(Variable1, GoodValue1, TRUE)
   ostest_main: setenv(Variable2, BadValue1, FALSE)
   ostest_main: setenv(Variable2, GoodValue2, TRUE)
   ostest_main: setenv(Variable3, GoodValue3, FALSE)
   ostest_main: setenv(Variable3, BadValue2, FALSE)
   show_variable: Variable=Variable1 has value=GoodValue1
   show_variable: Variable=Variable2 has value=GoodValue2
   show_variable: Variable=Variable3 has value=GoodValue3
   ostest_main: Started user_main at PID=12
   
   user_main: vfork() test
   vfork_test: Started
   vfork_test: Child 13 ran and exited before the parent resumed
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         1        1
   mxordblk  1fc4128  1fc4128
   uordblks     5074     5074
   fordblks  1fc4128  1fc4128
   
   user_main: Begin argument test
   user_main: Started with argc=5
   user_main: argv[0]="ostest"
   user_main: argv[1]="Arg1"
   user_main: argv[2]="Arg2"
   user_main: argv[3]="Arg3"
   user_main: argv[4]="Arg4"
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         1        1
   mxordblk  1fc4128  1fc4128
   uordblks     5074     5074
   fordblks  1fc4128  1fc4128
   
   user_main: getopt() test
   getopt():  Simple test
   getopt():  Invalid argument
   getopt():  Missing optional argument
   getopt_long():  Simple test
   getopt_long():  No short options
   getopt_long():  Argument for --option=argument
   getopt_long():  Invalid long option
   getopt_long():  Mixed long and short options
   getopt_long():  Invalid short option
   getopt_long():  Missing optional arguments
   getopt_long_only():  Mixed long and short options
   getopt_long_only():  Single hyphen long options
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         1        1
   mxordblk  1fc4128  1fc4128
   uordblks     5074     5074
   fordblks  1fc4128  1fc4128
   
   user_main: libc tests
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         1        1
   mxordblk  1fc4128  1fc4128
   uordblks     5074     5074
   fordblks  1fc4128  1fc4128
   show_variable: Variable=Variable1 has value=GoodValue1
   show_variable: Variable=Variable2 has value=GoodValue2
   show_variable: Variable=Variable3 has value=GoodValue3
   show_variable: Variable=Variable1 has no value
   show_variable: Variable=Variable2 has value=GoodValue2
   show_variable: Variable=Variable3 has value=GoodValue3
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         1        1
   mxordblk  1fc4128  1fc4128
   uordblks     5074     5074
   fordblks  1fc4128  1fc4128
   show_variable: Variable=Variable1 has no value
   show_variable: Variable=Variable2 has no value
   show_variable: Variable=Variable3 has no value
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         1        2
   mxordblk  1fc4128  1fc4128
   uordblks     5074     5044
   fordblks  1fc4128  1fc4158
   
   user_main: setvbuf test
   setvbuf_test: Test NO buffering
   setvbuf_test: Using NO buffering
   setvbuf_test: Test default FULL buffering
   setvbuf_test: Using default FULL buffering
   setvbuf_test: Test FULL buffering, buffer size 64
   setvbuf_test: Using FULL buffering, buffer size 64
   setvbuf_test: Test FULL buffering, pre-allocated buffer
   setvbuf_test: Using FULL buffering, pre-allocated buffer
   setvbuf_test: Test LINE buffering, buffer size 64
   setvbuf_test: Using LINE buffering, buffer size 64
   setvbuf_test: Test FULL buffering, pre-allocated buffer
   setvbuf_test: Using FULL buffering, pre-allocated buffer
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         2        2
   mxordblk  1fc4128  1fc4128
   uordblks     5044     5044
   fordblks  1fc4158  1fc4158
   
   user_main: FPU test
   Starting task FPU#1
   fpu_test: Started task FPU#1 at PID=14
   FPU#1: pass 1
   Starting task FPU#2
   fpu_test: Started task FPU#2 at PID=15
   FPU#2: pass 1
   FPU#1: pass 2
   FPU#2: pass 2
   FPU#1: pass 3
   FPU#2: pass 3
   FPU#1: pass 4
   FPU#2: pass 4
   FPU#1: pass 5
   FPU#2: pass 5
   FPU#1: pass 6
   FPU#2: pass 6
   FPU#1: pass 7
   FPU#2: pass 7
   FPU#1: pass 8
   FPU#2: pass 8
   FPU#1: pass 9
   FPU#2: pass 9
   FPU#1: pass 10
   FPU#2: pass 10
   FPU#1: pass 11
   FPU#2: pass 11
   FPU#1: pass 12
   FPU#2: pass 12
   FPU#1: pass 13
   FPU#2: pass 13
   FPU#1: pass 14
   FPU#2: pass 14
   FPU#1: pass 15
   FPU#2: pass 15
   FPU#1: pass 16
   FPU#2: pass 16
   FPU#1: Succeeded
   FPU#2: Succeeded
   fpu_test: Returning
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         2        2
   mxordblk  1fc4128  1fc4128
   uordblks     5044     5044
   fordblks  1fc4158  1fc4158
   
   user_main: task_restart test
   
   Test task_restart()
   restart_main: setenv(VarName, VarValue, TRUE)
   restart_main: Started restart_main at PID=24
   restart_main: Started with argc=4
   restart_main: argv[0]="ostest"
   restart_main: argv[1]="This is argument 1"
   restart_main: argv[2]="Argument 2 here"
   restart_main: argv[3]="Lastly, the 3rd argument"
   restart_main: Variable=VarName has value=VarValue
   restart_main: I am still here
   restart_main: I am still here
   restart_main: Started restart_main at PID=24
   restart_main: Started with argc=4
   restart_main: argv[0]="ostest"
   restart_main: argv[1]="This is argument 1"
   restart_main: argv[2]="Argument 2 here"
   restart_main: argv[3]="Lastly, the 3rd argument"
   restart_main: Variable=VarName has value=VarValue
   restart_main: Started with argc=4
   restart_main: argv[0]="ostest"
   restart_main: argv[1]="This is argument 1"
   restart_main: argv[2]="Argument 2 here"
   restart_main: argv[3]="Lastly, the 3rd argument"
   restart_main: Variable=VarName has value=VarValue
   restart_main: Exiting
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         2        2
   mxordblk  1fc4128  1fc4108
   uordblks     5044     5084
   fordblks  1fc4158  1fc4118
   
   user_main: waitpid test
   
   Test waitpid()
   waitpid_start_child: Started waitpid_main at PID=29
   waitpid_start_child: Started waitpid_main at PID=30
   waitpid_main: PID 29 Started
   waitpid_main: PID 30 Started
   waitpid_start_child: Started waitpid_main at PID=31
   waitpid_main: PID 31 Started
   waitpid_test: Waiting for PID=29 with waitpid()
   waitpid_main: PID 29 exiting with result=14
   waitpid_main: PID 30 exiting with result=14
   waitpid_main: PID 31 exiting with result=14
   waitpid_test: PID 29 waitpid succeeded with stat_loc=0e00
   waitpid_last: Waiting for PID=31 with waitpid()
   waitpid_last: PASS: PID 31 waitpid succeeded with stat_loc=0e00
   
   Test waitid(P_PID)
   waitpid_start_child: Started waitpid_main at PID=40
   waitpid_start_child: Started waitpid_main at PID=45
   waitpid_main: PID 40 Started
   waitpid_start_child: Started waitpid_main at PID=46
   waitpid_test: Waiting for PID=40 with waitid()
   waitpid_main: PID 45 Started
   waitpid_main: PID 46 Started
   waitpid_main: PID 40 exiting with result=14
   waitpid_main: PID 45 exiting with result=14
   waitpid_test: waitid PID 40 succeeded with si_status=14
   waitpid_last: Waiting for PID=46 with waitpid()
   waitpid_main: PID 46 exiting with result=14
   waitpid_last: PASS: PID 46 waitpid succeeded with stat_loc=0e00
   
   Test waitid(P_ALL)
   waitpid_start_child: Started waitpid_main at PID=47
   waitpid_main: PID 47 Started
   waitpid_start_child: Started waitpid_main at PID=56
   waitpid_main: PID 56 Started
   waitpid_start_child: Started waitpid_main at PID=61
   waitpid_main: PID 61 Started
   waitpid_test: Waiting for any child with waitid()
   waitpid_test: PID 45 waitid succeeded with si_status=14
   waitpid_last: Waiting for PID=61 with waitpid()
   waitpid_main: PID 47 exiting with result=14
   waitpid_main: PID 56 exiting with result=14
   waitpid_main: PID 61 exiting with result=14
   waitpid_last: PASS: PID 61 waitpid succeeded with stat_loc=0e00
   
   Test wait()
   waitpid_start_child: Started waitpid_main at PID=62
   waitpid_main: PID 62 Started
   waitpid_start_child: Started waitpid_main at PID=63
   waitpid_main: PID 63 Started
   waitpid_start_child: Started waitpid_main at PID=72
   waitpid_main: PID 72 Started
   waitpid_test: Waiting for any child with wait()
   waitpid_test: PID 56 wait succeeded with stat_loc=0e00
   waitpid_last: Waiting for PID=72 with waitpid()
   waitpid_main: PID 62 exiting with result=14
   waitpid_main: PID 63 exiting with result=14
   waitpid_main: PID 72 exiting with result=14
   waitpid_last: PASS: PID 72 waitpid succeeded with stat_loc=0e00
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         2        7
   mxordblk  1fc4108  1fbb630
   uordblks     5084     b324
   fordblks  1fc4118  1fbde78
   
   user_main: mutex test
   Initializing mutex
   Starting thread 1
   Starting thread 2
                Thread1 Thread2
        Loops   32      32
        Errors  0       0
   
   Testing moved mutex
   Starting moved mutex thread 1
   Starting moved mutex thread 2
                Thread1 Thread2
        Moved Loops     32      32
        Moved Errors    0       0
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         7        3
   mxordblk  1fbb630  1fc2730
   uordblks     b324     6254
   fordblks  1fbde78  1fc2f48
   
   user_main: timed mutex test
   mutex_test: Initializing mutex
   mutex_test: Starting thread
   pthread:  Started
   pthread:  Waiting for lock or timeout
   mutex_test: Unlocking
   pthread:  Got the lock
   pthread:  Waiting for lock or timeout
   pthread:  Got the timeout.  Terminating
   mutex_test: PASSED
   timedmutex regression test: PASSED
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         3        3
   mxordblk  1fc2730  1fc2730
   uordblks     6254     6254
   fordblks  1fc2f48  1fc2f48
   
   user_main: cancel test
   cancel_test: Test 1a: Normal Cancellation
   cancel_test: Starting thread
   start_thread: Initializing mutex
   start_thread: Initializing cond
   start_thread: Starting thread
   start_thread: Yielding
   sem_waiter: Taking mutex
   sem_waiter: Starting wait for condition
   cancel_test: Canceling thread
   cancel_test: Joining
   cancel_test: waiter exited with result=0xffffffff
   cancel_test: PASS thread terminated with PTHREAD_CANCELED
   cancel_test: Test 2: Asynchronous Cancellation
   ... Skipped
   cancel_test: Test 3: Cancellation of detached thread
   cancel_test: Re-starting thread
   restart_thread: Destroying cond
   restart_thread: Destroying mutex
   restart_thread: Re-starting thread
   start_thread: Initializing mutex
   start_thread: Initializing cond
   start_thread: Starting thread
   start_thread: Yielding
   sem_waiter: Taking mutex
   sem_waiter: Starting wait for condition
   cancel_test: Canceling thread
   cancel_test: Joining
   cancel_test: PASS pthread_join failed with status=ESRCH
   cancel_test: Test 5: Non-cancelable threads
   cancel_test: Re-starting thread (non-cancelable)
   restart_thread: Destroying cond
   restart_thread: Destroying mutex
   restart_thread: Re-starting thread
   start_thread: Initializing mutex
   start_thread: Initializing cond
   start_thread: Starting thread
   start_thread: Yielding
   sem_waiter: Taking mutex
   sem_waiter: Starting wait for condition
   sem_waiter: Setting non-cancelable
   cancel_test: Canceling thread
   cancel_test: Joining
   sem_waiter: Releasing mutex
   sem_waiter: Setting cancelable
   cancel_test: waiter exited with result=0xffffffff
   cancel_test: PASS thread terminated with PTHREAD_CANCELED
   cancel_test: Test 6: Cancel message queue wait
   cancel_test: Starting thread (cancelable)
   Skipped
   cancel_test: Test 7: Cancel signal wait
   cancel_test: Starting thread (cancelable)
   Skipped
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         3        2
   mxordblk  1fc2730  1fc4108
   uordblks     6254     5084
   fordblks  1fc2f48  1fc4118
   
   user_main: semaphore test
   sem_test: Initializing semaphore to 0
   sem_test: Starting waiter thread 1
   sem_test: Set thread 1 priority to 191
   sem_test: Starting waiter thread 2
   waiter_func: Thread 1 Started
   sem_test: Set thread 2 priority to 128
   waiter_func: Thread 1 initial semaphore value = 0
   waiter_func: Thread 1 waiting on semaphore
   waiter_func: Thread 2 Started
   waiter_func: Thread 2 initial semaphore value = -1
   waiter_func: Thread 2 waiting on semaphore
   sem_test: Starting poster thread 3
   sem_test: Set thread 3 priority to 64
   poster_func: Thread 3 started
   poster_func: Thread 3 semaphore value = -2
   poster_func: Thread 3 posting semaphore
   poster_func: Thread 3 new semaphore value = -1
   waiter_func: Thread 1 awakened
   poster_func: Thread 3 semaphore value = -1
   waiter_func: Thread 1 new semaphore value = -1
   poster_func: Thread 3 posting semaphore
   waiter_func: Thread 1 done
   waiter_func: Thread 2 awakened
   poster_func: Thread 3 new semaphore value = 0
   waiter_func: Thread 2 new semaphore value = 0
   poster_func: Thread 3 done
   waiter_func: Thread 2 done
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         2        3
   mxordblk  1fc4108  1fc2f38
   uordblks     5084     596c
   fordblks  1fc4118  1fc3830
   
   user_main: timed semaphore test
   semtimed_test: Initializing semaphore to 0
   semtimed_test: Waiting for two second timeout
   semtimed_test: PASS: first test returned timeout
   BEFORE: (1638316852 sec, 141856500 nsec)
   AFTER:  (1638316854 sec, 142127600 nsec)
   semtimed_test: Starting poster thread
   semtimed_test: Set thread 1 priority to 191
   semtimed_test: Starting poster thread 3
   semtimed_test: Set thread 3 priority to 64
   semtimed_test: Waiting for two second timeout
   poster_func: Waiting for 1 second
   poster_func: Posting
   semtimed_test: PASS: sem_timedwait succeeded
   BEFORE: (1638316854 sec, 143139700 nsec)
   AFTER:  (1638316855 sec, 144276400 nsec)
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         3        2
   mxordblk  1fc2f38  1fc3820
   uordblks     596c     596c
   fordblks  1fc3830  1fc3830
   
   user_main: condition variable test
   cond_test: Initializing mutex
   cond_test: Initializing cond
   cond_test: Starting waiter
   cond_test: Set thread 1 priority to 128
   waiter_thread: Started
   cond_test: Starting signaler
   cond_test: Set thread 2 priority to 64
   thread_signaler: Started
   thread_signaler: Terminating
   cond_test: signaler terminated, now cancel the waiter
   cond_test:   Waiter  Signaler
   cond_test: Loops     32      32
   cond_test: Errors    0       0
   cond_test:
   cond_test: 0 times, waiter did not have to wait for data
   cond_test: 0 times, data was already available when the signaler run
   cond_test: 0 times, the waiter was in an unexpected state when the signaler 
ran
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         2        2
   mxordblk  1fc3820  1fc3820
   uordblks     596c     596c
   fordblks  1fc3830  1fc3830
   
   user_main: pthread_exit() test
   pthread_exit_test: Started pthread_exit_main at PID=142
   pthread_exit_main 142: Starting pthread_exit_thread
   pthread_exit_main 142: Sleeping for 5 seconds
   pthread_exit_thread 143: Sleeping for 10 second
   pthread_exit_thread 143: Still running...
   pthread_exit_main 142: Calling pthread_exit()
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         2        2
   mxordblk  1fc3820  1fc3820
   uordblks     596c     596c
   fordblks  1fc3830  1fc3830
   
   user_main: pthread_rwlock test
   pthread_rwlock: Initializing rwlock
   pthread_exit_thread 143: Exiting
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         2        2
   mxordblk  1fc3820  1fc1d68
   uordblks     596c     597c
   fordblks  1fc3830  1fc3820
   
   user_main: pthread_rwlock_cancel test
   pthread_rwlock_cancel: Starting test
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         2        2
   mxordblk  1fc1d68  1fc1d68
   uordblks     597c     597c
   fordblks  1fc3820  1fc3820
   
   user_main: timed wait test
   thread_waiter: Initializing mutex
   timedwait_test: Initializing cond
   timedwait_test: Starting waiter
   timedwait_test: Set thread 2 priority to 177
   timedwait_test: Joining
   thread_waiter: Taking mutex
   thread_waiter: Starting 5 second wait for condition
   thread_waiter: pthread_cond_timedwait timed out
   thread_waiter: Releasing mutex
   thread_waiter: Exit with status 0x12345678
   timedwait_test: waiter exited with result=0x12345678
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         2        2
   mxordblk  1fc1d68  1fc1d68
   uordblks     597c     597c
   fordblks  1fc3820  1fc3820
   
   user_main: timed message queue test
   timedmqueue_test: Starting sender
   timedmqueue_test: Waiting for sender to complete
   sender_thread: Starting
   sender_thread: mq_timedsend succeeded on msg 0
   sender_thread: mq_timedsend succeeded on msg 1
   sender_thread: mq_timedsend succeeded on msg 2
   sender_thread: mq_timedsend succeeded on msg 3
   sender_thread: mq_timedsend succeeded on msg 4
   sender_thread: mq_timedsend succeeded on msg 5
   sender_thread: mq_timedsend succeeded on msg 6
   sender_thread: mq_timedsend succeeded on msg 7
   sender_thread: mq_timedsend succeeded on msg 8
   sender_thread: mq_timedsend 9 timed out as expected
   sender_thread: returning nerrors=0
   timedmqueue_test: Starting receiver
   timedmqueue_test: Waiting for receiver to complete
   receiver_thread: Starting
   receiver_thread: mq_timedreceive succeed on msg 0
   receiver_thread: mq_timedreceive succeed on msg 1
   receiver_thread: mq_timedreceive succeed on msg 2
   receiver_thread: mq_timedreceive succeed on msg 3
   receiver_thread: mq_timedreceive succeed on msg 4
   receiver_thread: mq_timedreceive succeed on msg 5
   receiver_thread: mq_timedreceive succeed on msg 6
   receiver_thread: mq_timedreceive succeed on msg 7
   receiver_thread: mq_timedreceive succeed on msg 8
   receiver_thread: Receive 9 timed out as expected
   receiver_thread: returning nerrors=0
   timedmqueue_test: Test complete
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         2        2
   mxordblk  1fc1d68  1fc3fa8
   uordblks     597c     50fc
   fordblks  1fc3820  1fc40a0
   
   user_main: sigprocmask test
   sigprocmask_test: SUCCESS
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         2        2
   mxordblk  1fc3fa8  1fc3fa8
   uordblks     50fc     50fc
   fordblks  1fc40a0  1fc40a0
   
   user_main: message queue test
   mqueue_test: Starting receiver
   mqueue_test: Set receiver priority to 128
   mqueue_test: Starting sender
   receiver_thread: Starting
   mqueue_test: Set sender thread priority to 64
   mqueue_test: Waiting for sender to complete
   sender_thread: Starting
   sender_thread: mq_send succeeded on msg 0
   receiver_thread: mq_receive succeeded on msg 0
   sender_thread: mq_send succeeded on msg 1
   receiver_thread: mq_receive succeeded on msg 1
   sender_thread: mq_send succeeded on msg 2
   receiver_thread: mq_receive succeeded on msg 2
   sender_thread: mq_send succeeded on msg 3
   receiver_thread: mq_receive succeeded on msg 3
   sender_thread: mq_send succeeded on msg 4
   receiver_thread: mq_receive succeeded on msg 4
   sender_thread: mq_send succeeded on msg 5
   receiver_thread: mq_receive succeeded on msg 5
   sender_thread: mq_send succeeded on msg 6
   receiver_thread: mq_receive succeeded on msg 6
   sender_thread: mq_send succeeded on msg 7
   receiver_thread: mq_receive succeeded on msg 7
   sender_thread: mq_send succeeded on msg 8
   receiver_thread: mq_receive succeeded on msg 8
   sender_thread: mq_send succeeded on msg 9
   receiver_thread: mq_receive succeeded on msg 9
   sender_thread: returning nerrors=0
   mqueue_test: Killing receiver
   receiver_thread: mq_receive interrupted!
   receiver_thread: returning nerrors=0
   mqueue_test: Canceling receiver
   mqueue_test: receiver has already terminated
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         2        2
   mxordblk  1fc3fa8  1fc1fa0
   uordblks     50fc     71e4
   fordblks  1fc40a0  1fc1fb8
   
   user_main: spinlock test
   spinlock_test: start......
   Thread num: 1, Loop times: 1000000
   
   Test type: spinlock
   spinlock: Test Results:
   spinlock: Final counter: 1000000
   spinlock: Average throughput : 17931462 op/s
   spinlock: Total execution time: 55989900 ns
    
   Test type: rspinlock
   rspinlock: Test Results:
   rspinlock: Final counter: 1000000
   rspinlock: Average throughput : 13954572 op/s
   rspinlock: Total execution time: 71790300 ns
    
   Test type: seqcount
   seqcount: Test Results:
   seqcount: Final counter: 1000000
   seqcount: Average throughput : 18435966 op/s
   seqcount: Total execution time: 54403700 ns
    
   Thread num: 2, Loop times: 1000000
   
   Test type: spinlock
   spinlock: Test Results:
   spinlock: Final counter: 2000000
   spinlock: Average throughput : 5488730 op/s
   spinlock: Total execution time: 182428500 ns
    
   Test type: rspinlock
   rspinlock: Test Results:
   rspinlock: Final counter: 2000000
   rspinlock: Average throughput : 4110412 op/s
   rspinlock: Total execution time: 243566200 ns
    
   Test type: seqcount
   seqcount: Test Results:
   seqcount: Final counter: 2000000
   seqcount: Average throughput : 3417689 op/s
   seqcount: Total execution time: 292956100 ns
    
   Thread num: 3, Loop times: 1000000
   
   Test type: spinlock
   spinlock: Test Results:
   spinlock: Final counter: 3000000
   spinlock: Average throughput : 2135544 op/s
   spinlock: Total execution time: 477597100 ns
    
   Test type: rspinlock
   rspinlock: Test Results:
   rspinlock: Final counter: 3000000
   rspinlock: Average throughput : 1751009 op/s
   rspinlock: Total execution time: 587563600 ns
    
   Test type: seqcount
   seqcount: Test Results:
   seqcount: Final counter: 3000000
   seqcount: Average throughput : 1743511 op/s
   seqcount: Total execution time: 594604100 ns
    
   Thread num: 4, Loop times: 1000000
   
   Test type: spinlock
   spinlock: Test Results:
   spinlock: Final counter: 4000000
   spinlock: Average throughput : 1323961 op/s
   spinlock: Total execution time: 758694400 ns
    
   Test type: rspinlock
   rspinlock: Test Results:
   rspinlock: Final counter: 4000000
   rspinlock: Average throughput : 1048749 op/s
   rspinlock: Total execution time: 974711700 ns
    
   Test type: seqcount
   seqcount: Test Results:
   seqcount: Final counter: 4000000
   seqcount: Average throughput : 1072229 op/s
   seqcount: Total execution time: 949970000 ns
    
   Thread num: 5, Loop times: 1000000
   
   Test type: spinlock
   spinlock: Test Results:
   spinlock: Final counter: 5000000
   spinlock: Average throughput : 995417 op/s
   spinlock: Total execution time: 1009774700 ns
    
   Test type: rspinlock
   rspinlock: Test Results:
   rspinlock: Final counter: 5000000
   rspinlock: Average throughput : 855498 op/s
   rspinlock: Total execution time: 1216477700 ns
    
   Test type: seqcount
   seqcount: Test Results:
   seqcount: Final counter: 5000000
   seqcount: Average throughput : 787357 op/s
   seqcount: Total execution time: 1319195900 ns
    
   Thread num: 6, Loop times: 1000000
   
   Test type: spinlock
   spinlock: Test Results:
   spinlock: Final counter: 6000000
   spinlock: Average throughput : 723587 op/s
   spinlock: Total execution time: 1422869100 ns
    
   Test type: rspinlock
   rspinlock: Test Results:
   rspinlock: Final counter: 6000000
   rspinlock: Average throughput : 584155 op/s
   rspinlock: Total execution time: 1754332000 ns
    
   Test type: seqcount
   seqcount: Test Results:
   seqcount: Final counter: 6000000
   seqcount: Average throughput : 621025 op/s
   seqcount: Total execution time: 1667967400 ns
    
   Thread num: 7, Loop times: 1000000
   
   Test type: spinlock
   spinlock: Test Results:
   spinlock: Final counter: 7000000
   spinlock: Average throughput : 303892 op/s
   spinlock: Total execution time: 3351101200 ns
    
   Test type: rspinlock
   rspinlock: Test Results:
   rspinlock: Final counter: 7000000
   rspinlock: Average throughput : 454393 op/s
   rspinlock: Total execution time: 2258800200 ns
    
   Test type: seqcount
   seqcount: Test Results:
   seqcount: Final counter: 7000000
   seqcount: Average throughput : 429149 op/s
   seqcount: Total execution time: 2378254700 ns
    
   Thread num: 8, Loop times: 1000000
   
   Test type: spinlock
   spinlock: Test Results:
   spinlock: Final counter: 8000000
   spinlock: Average throughput : 360478 op/s
   spinlock: Total execution time: 2860470800 ns
    
   Test type: rspinlock
   rspinlock: Test Results:
   rspinlock: Final counter: 8000000
   rspinlock: Average throughput : 337148 op/s
   rspinlock: Total execution time: 3021336700 ns
    
   Test type: seqcount
   seqcount: Test Results:
   seqcount: Final counter: 8000000
   seqcount: Average throughput : 337600 op/s
   seqcount: Total execution time: 3041837600 ns
    
   spinlock_test: end......
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         2       10
   mxordblk  1fc1fa0  1faa908
   uordblks     71e4    1980c
   fordblks  1fc1fb8  1faf990
   
   user_main: wdog test
   wdog_test start...
   wdtest_once 0 ns
   ...... (identical line x32, collapsed)
   wdtest_once 1 ns
   ...... (identical line x32, collapsed)
   wdtest_once 10 ns
   ...... (identical line x32, collapsed)
   wdtest_once 100 ns
   ...... (identical line x32, collapsed)
   wdtest_once 1000 ns
   ...... (identical line x32, collapsed)
   wdtest_once 10000 ns
   ...... (identical line x32, collapsed)
   wdtest_once 100000 ns
   ...... (identical line x32, collapsed)
   wdtest_once 1000000 ns
   ...... (identical line x32, collapsed)
   wd_start with maximum delay, cancel OK, rest 2305843009213693948
   ...... (identical line x10, collapsed)
   wdtest_recursive 1000000ns
   ...... (identical line x6, collapsed)
   wd_start with maximum delay, cancel OK, rest 2305843009213693948
   wdtest_recursive 1000000ns
   wd_start with maximum delay, cancel OK, rest 2305843009213693948
   ...... (identical line x15, collapsed)
   wdtest_recursive 1000000ns
   wdtest_recursive 1000000ns
   wdtest_recursive 1000000ns
   wd_start with maximum delay, cancel OK, rest 2305843009213693948
   ...... (identical line x6, collapsed)
   wdtest_recursive 1000000ns
   ...... (identical line x22, collapsed)
   recursive wdog triggered 51 times, elapsed tick 102
   ...... (identical line x7, collapsed)
   wdtest_recursive 10000000ns
   ...... (identical line x7, collapsed)
   recursive wdog triggered 51 times, elapsed tick 102
   recursive wdog triggered 51 times, elapsed tick 102
   recursive wdog triggered 51 times, elapsed tick 102
   wdtest_recursive 10000000ns
   wdtest_recursive 10000000ns
   wdtest_recursive 10000000ns
   recursive wdog triggered 51 times, elapsed tick 102
   recursive wdog triggered 51 times, elapsed tick 102
   wdtest_recursive 10000000ns
   wdtest_recursive 10000000ns
   recursive wdog triggered 51 times, elapsed tick 102
   recursive wdog triggered 51 times, elapsed tick 102
   recursive wdog triggered 51 times, elapsed tick 102
   wdtest_recursive 10000000ns
   recursive wdog triggered 51 times, elapsed tick 102
   ...... (identical line x14, collapsed)
   wdtest_recursive 10000000ns
   ...... (identical line x6, collapsed)
   recursive wdog triggered 51 times, elapsed tick 102
   recursive wdog triggered 51 times, elapsed tick 102
   recursive wdog triggered 51 times, elapsed tick 102
   wdtest_recursive 10000000ns
   ...... (identical line x13, collapsed)
   recursive wdog triggered 9 times, elapsed tick 99
   ...... (identical line x32, collapsed)
   wdog_test end...
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks        10       10
   mxordblk  1faa908  1fa07b0
   uordblks    1980c     aacc
   fordblks  1faf990  1fbe6d0
   
   user_main: hrtimer test
   hrtimer_test start...
   hrtimer_test_oneshot: delay = 0 ns
   ...... (identical line x31, collapsed)
   hrtimer_test_oneshot: delay = 1 ns
   hrtimer_test_oneshot: delay = 0 ns
   hrtimer_test_oneshot: delay = 1 ns
   ...... (identical line x31, collapsed)
   hrtimer_test_oneshot: delay = 10 ns
   ...... (identical line x32, collapsed)
   hrtimer_test_oneshot: delay = 100 ns
   ...... (identical line x32, collapsed)
   hrtimer_test_oneshot: delay = 1000 ns
   ...... (identical line x32, collapsed)
   hrtimer_test_oneshot: delay = 10000 ns
   ...... (identical line x32, collapsed)
   hrtimer_test_oneshot: delay = 100000 ns
   ...... (identical line x32, collapsed)
   hrtimer_test_oneshot: delay = 1000000 ns
   ...... (identical line x32, collapsed)
   hrtimer_test_oneshot: delay = 10000000 ns
   ...... (identical line x32, collapsed)
   hrtimer_test_cancel_sync: synchronous cancellation test
   ...... (identical line x10, collapsed)
   hrtimer_test_cancel_periodic:periodic timer cancellation test
   hrtimer_test_cancel_sync: synchronous cancellation test
   hrtimer_test_cancel_sync: synchronous cancellation test
   hrtimer_test_cancel_periodic:periodic timer cancellation test
   hrtimer_test_cancel_sync: synchronous cancellation test
   ...... (identical line x5, collapsed)
   hrtimer_test_cancel_periodic:periodic timer cancellation test
   hrtimer_test_cancel_sync: synchronous cancellation test
   ...... (identical line x13, collapsed)
   hrtimer_test_cancel_periodic:periodic timer cancellation test
   ...... (identical line x7, collapsed)
   hrtimer_test_cancel_sync: synchronous cancellation test
   hrtimer_test_cancel_sync: synchronous cancellation test
   hrtimer_test_cancel_periodic:periodic timer cancellation test
   ...... (identical line x22, collapsed)
   hrtimer_test_maximum: testing with 18446744073709551615 delay
   hrtimer_test_maximum: testing with 18446744073709551615 delay
   hrtimer_test_maximum: testing with 18446744073709551615 delay
   hrtimer_test_maximum: remaining time = 4611686018425006804 ns
   hrtimer_test_maximum: remaining time = 4611686018424875704 ns
   hrtimer_test_period: period = 100000000 ns, iters = 8
   hrtimer_test_period: period = 100000000 ns, iters = 8
   hrtimer_test_maximum: remaining time = 4611686018425675204 ns
   hrtimer_test_period: period = 100000000 ns, iters = 8
   hrtimer_test_maximum: testing with 18446744073709551615 delay
   ...... (identical line x13, collapsed)
   hrtimer_test_maximum: remaining time = 4611686018425931404 ns
   hrtimer_test_maximum: testing with 18446744073709551615 delay
   hrtimer_test_maximum: testing with 18446744073709551615 delay
   hrtimer_test_maximum: testing with 18446744073709551615 delay
   hrtimer_test_maximum: remaining time = 4611686018425209604 ns
   hrtimer_test_period: period = 100000000 ns, iters = 8
   hrtimer_test_maximum: testing with 18446744073709551615 delay
   hrtimer_test_maximum: remaining time = 4611686018425488104 ns
   hrtimer_test_maximum: testing with 18446744073709551615 delay
   ...... (identical line x10, collapsed)
   hrtimer_test_maximum: remaining time = 4611686018425669904 ns
   hrtimer_test_maximum: testing with 18446744073709551615 delay
   hrtimer_test_maximum: remaining time = 4611686018425817904 ns
   hrtimer_test_maximum: remaining time = 4611686018426092804 ns
   hrtimer_test_maximum: remaining time = 4611686018425938904 ns
   hrtimer_test_period: period = 100000000 ns, iters = 8
   hrtimer_test_period: period = 100000000 ns, iters = 8
   hrtimer_test_maximum: remaining time = 4611686018425375704 ns
   hrtimer_test_maximum: remaining time = 4611686018425502604 ns
   hrtimer_test_maximum: remaining time = 4611686018425619704 ns
   hrtimer_test_maximum: remaining time = 4611686018425729904 ns
   hrtimer_test_maximum: remaining time = 4611686018425837104 ns
   hrtimer_test_maximum: remaining time = 4611686018426167004 ns
   hrtimer_test_maximum: remaining time = 4611686018425947604 ns
   hrtimer_test_maximum: remaining time = 4611686018426267304 ns
   hrtimer_test_period: period = 100000000 ns, iters = 8
   hrtimer_test_maximum: testing with 18446744073709551615 delay
   hrtimer_test_maximum: remaining time = 4611686018425217604 ns
   hrtimer_test_maximum: remaining time = 4611686018425889904 ns
   hrtimer_test_maximum: remaining time = 4611686018425670304 ns
   hrtimer_test_maximum: remaining time = 4611686018425986704 ns
   hrtimer_test_period: period = 100000000 ns, iters = 8
   hrtimer_test_period: period = 100000000 ns, iters = 8
   hrtimer_test_period: period = 100000000 ns, iters = 8
   hrtimer_test_maximum: remaining time = 4611686018425402104 ns
   hrtimer_test_maximum: remaining time = 4611686018425487704 ns
   hrtimer_test_maximum: remaining time = 4611686018425622504 ns
   hrtimer_test_maximum: remaining time = 4611686018425750504 ns
   hrtimer_test_maximum: remaining time = 4611686018425903404 ns
   hrtimer_test_maximum: remaining time = 4611686018426177004 ns
   hrtimer_test_maximum: remaining time = 4611686018426039304 ns
   hrtimer_test_period: period = 100000000 ns, iters = 8
   ...... (identical line x8, collapsed)
   hrtimer_test_maximum: remaining time = 4611686018425173604 ns
   hrtimer_test_maximum: remaining time = 4611686018425516404 ns
   hrtimer_test_period: period = 100000000 ns, iters = 8
   ...... (identical line x8, collapsed)
   hrtimer_test_maximum: remaining time = 4611686018425790704 ns
   hrtimer_test_period: period = 100000000 ns, iters = 8
   ...... (identical line x6, collapsed)
   hrtimer_test_period: triggered 8 times, elapsed nsec 800904700
   hrtimer_test_rand: max delay = 12345 ns
   hrtimer_test_period: triggered 8 times, elapsed nsec 800792600
   hrtimer_test_rand: max delay = 12345 ns
   hrtimer_test_period: triggered 8 times, elapsed nsec 800396800
   hrtimer_test_rand: max delay = 12345 ns
   hrtimer_test_rand_cancel: max delay = 67890 ns
   hrtimer_test_rand_cancel: max delay = 67890 ns
   hrtimer_test_period: triggered 8 times, elapsed nsec 800582400
   hrtimer_test_rand: max delay = 12345 ns
   hrtimer_test_rand_cancel: max delay = 67890 ns
   hrtimer_test_period: triggered 8 times, elapsed nsec 800067300
   hrtimer_test_rand: max delay = 12345 ns
   hrtimer_test_period: triggered 8 times, elapsed nsec 800910200
   hrtimer_test_rand: max delay = 12345 ns
   hrtimer_test_rand_cancel: max delay = 67890 ns
   hrtimer_test_period: triggered 8 times, elapsed nsec 800607900
   hrtimer_test_rand: max delay = 12345 ns
   hrtimer_test_period: triggered 8 times, elapsed nsec 800875500
   hrtimer_test_rand: max delay = 12345 ns
   hrtimer_test_period: triggered 8 times, elapsed nsec 800747600
   hrtimer_test_period: triggered 8 times, elapsed nsec 800621800
   hrtimer_test_rand: max delay = 12345 ns
   hrtimer_test_rand: max delay = 12345 ns
   hrtimer_test_rand_cancel: max delay = 67890 ns
   hrtimer_test_rand_cancel: max delay = 67890 ns
   hrtimer_test_period: triggered 8 times, elapsed nsec 800494800
   hrtimer_test_rand: max delay = 12345 ns
   hrtimer_test_period: triggered 8 times, elapsed nsec 800394200
   hrtimer_test_rand: max delay = 12345 ns
   hrtimer_test_period: triggered 8 times, elapsed nsec 800289400
   hrtimer_test_period: triggered 8 times, elapsed nsec 800191800
   hrtimer_test_period: triggered 8 times, elapsed nsec 800091800
   hrtimer_test_rand: max delay = 12345 ns
   hrtimer_test_rand: max delay = 12345 ns
   hrtimer_test_period: triggered 8 times, elapsed nsec 800907000
   hrtimer_test_period: triggered 8 times, elapsed nsec 800785200
   hrtimer_test_rand: max delay = 12345 ns
   hrtimer_test_period: triggered 8 times, elapsed nsec 800669200
   hrtimer_test_period: triggered 8 times, elapsed nsec 800352100
   hrtimer_test_period: triggered 8 times, elapsed nsec 800256100
   hrtimer_test_period: triggered 8 times, elapsed nsec 800161700
   hrtimer_test_rand: max delay = 12345 ns
   ...... (identical line x4, collapsed)
   hrtimer_test_rand_cancel: max delay = 67890 ns
   hrtimer_test_rand: max delay = 12345 ns
   hrtimer_test_period: triggered 8 times, elapsed nsec 800975000
   hrtimer_test_period: triggered 8 times, elapsed nsec 800863000
   hrtimer_test_period: triggered 8 times, elapsed nsec 800677700
   hrtimer_test_period: triggered 8 times, elapsed nsec 800767900
   hrtimer_test_period: triggered 8 times, elapsed nsec 800583700
   hrtimer_test_period: triggered 8 times, elapsed nsec 800383500
   hrtimer_test_period: triggered 8 times, elapsed nsec 800288000
   hrtimer_test_rand_cancel: max delay = 67890 ns
   hrtimer_test_period: triggered 8 times, elapsed nsec 800089100
   hrtimer_test_rand: max delay = 12345 ns
   hrtimer_test_period: triggered 8 times, elapsed nsec 800195500
   hrtimer_test_rand_cancel: max delay = 67890 ns
   hrtimer_test_period: triggered 8 times, elapsed nsec 801184600
   hrtimer_test_period: triggered 8 times, elapsed nsec 801151400
   hrtimer_test_rand: max delay = 12345 ns
   ...... (identical line x11, collapsed)
   hrtimer_test_rand_cancel: max delay = 67890 ns
   ...... (identical line x23, collapsed)
   hrtimer_test end...
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks        10       10
   mxordblk  1fa07b0  1fa3d20
   uordblks     aacc     9014
   fordblks  1fbe6d0  1fc0188
   
   user_main: round-robin scheduler test
   rr_test: Set thread priority to 1
   rr_test: Set thread policy to SCHED_RR
   rr_test: Starting first get_primes_thread
            First get_primes_thread: 531
   rr_test: Starting second get_primes_thread
            Second get_primes_thread: 532
   rr_test: Waiting for 10 time slices of each thread
            If RR scheduling is working, the threads run the same
            number of time slices
   get_primes_thread id=1 started, looking for primes < 30000, running 10 time 
slice(s)
   get_primes_thread id=2 started, looking for primes < 30000, running 10 time 
slice(s)
   get_primes_thread id=2 finished, 10 time slice(s), found 165110 primes
   get_primes_thread id=1 finished, 11 time slice(s), found 182882 primes
   rr_test: thread 1 ran 11 time slices, thread 2 ran 10
   rr_test: Done
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks        10       10
   mxordblk  1fa3d20  1fa3d20
   uordblks     9014     9014
   fordblks  1fc0188  1fc0188
   
   user_main: barrier test
   barrier_test: Initializing barrier
   barrier_test: Thread 0 created
   barrier_test: Thread 1 created
   barrier_test: Thread 2 created
   barrier_func: Thread 0 started
   barrier_test: Thread 3 created
   barrier_func: Thread 1 started
   barrier_func: Thread 2 started
   barrier_func: Thread 3 started
   barrier_test: Thread 4 created
   barrier_func: Thread 4 started
   barrier_test: Thread 5 created
   barrier_func: Thread 5 started
   barrier_test: Thread 6 created
   barrier_func: Thread 6 started
   barrier_test: Thread 7 created
   barrier_func: Thread 7 started
   barrier_func: Thread 0 calling pthread_barrier_wait()
   barrier_func: Thread 1 calling pthread_barrier_wait()
   barrier_func: Thread 2 calling pthread_barrier_wait()
   barrier_func: Thread 3 calling pthread_barrier_wait()
   barrier_func: Thread 4 calling pthread_barrier_wait()
   barrier_func: Thread 5 calling pthread_barrier_wait()
   barrier_func: Thread 6 calling pthread_barrier_wait()
   barrier_func: Thread 7 calling pthread_barrier_wait()
   barrier_func: Thread 0, back with status=0 (I am not special)
   barrier_func: Thread 1, back with status=0 (I am not special)
   barrier_func: Thread 7, back with status=PTHREAD_BARRIER_SERIAL_THREAD (I AM 
SPECIAL)
   barrier_func: Thread 2, back with status=0 (I am not special)
   barrier_func: Thread 4, back with status=0 (I am not special)
   barrier_func: Thread 3, back with status=0 (I am not special)
   barrier_func: Thread 6, back with status=0 (I am not special)
   barrier_func: Thread 5, back with status=0 (I am not special)
   barrier_func: Thread 0 done
   barrier_func: Thread 1 done
   barrier_func: Thread 7 done
   barrier_test: Thread 0 completed with result=0
   barrier_test: Thread 1 completed with result=0
   barrier_func: Thread 2 done
   barrier_func: Thread 4 done
   barrier_func: Thread 3 done
   barrier_func: Thread 6 done
   barrier_func: Thread 5 done
   barrier_test: Thread 2 completed with result=0
   barrier_test: Thread 3 completed with result=0
   barrier_test: Thread 4 completed with result=0
   barrier_test: Thread 5 completed with result=0
   barrier_test: Thread 6 completed with result=0
   barrier_test: Thread 7 completed with result=0
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks        10        9
   mxordblk  1fa3d20  1fa3d20
   uordblks     9014     872c
   fordblks  1fc0188  1fc0a70
   
   user_main: scheduler lock test
   sched_lock: Starting lowpri_thread at 97
   sched_lock: Set lowpri_thread priority to 97
   sched_lock: Starting highpri_thread at 98
   sched_lock: Set highpri_thread priority to 98
   sched_lock: Waiting...
   sched_lock: PASSED No pre-emption occurred while scheduler was locked.
   sched_lock: Starting lowpri_thread at 97
   sched_lock: Set lowpri_thread priority to 97
   sched_lock: Starting highpri_thread at 98
   sched_lock: Set highpri_thread priority to 98
   sched_lock: Waiting...
   sched_lock: PASSED No pre-emption occurred while scheduler was locked.
   sched_lock: Finished
   
   End of test memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         9        9
   mxordblk  1fa3d20  1fa3d20
   uordblks     872c     872c
   fordblks  1fc0a70  1fc0a70
   
   user_main: smp call test
   smp_call_test: Test start
   smp_call_test: Call cpu 0, nowait
   smp_call_test: Call cpu 0, wait
   smp_call_test: Call cpu 1, nowait
   smp_call_test: Call cpu 1, wait
   smp_call_test: Call cpu 2, nowait
   smp_call_test: Call cpu 2, wait
   smp_call_test: Call cpu 3, nowait
   smp_call_test: Call cpu 3, wait
   smp_call_test: Call cpu 4, nowait
   smp_call_test: Call cpu 4, wait
   smp_call_test: Call cpu 5, nowait
   smp_call_test: Call cpu 5, wait
   smp_call_test: Call cpu 6, nowait
   smp_call_test: Call cpu 6, wait
   smp_call_test: Call cpu 7, nowait
   smp_call_test: Call cpu 7, wait
   smp_call_test: Call multi cpu, nowait
   smp_call_test: Call in interrupt, wait
   smp_call_test: Call multi cpu, wait
   smp_call_test: Test success
   
   Final memory usage:
   VARIABLE  BEFORE   AFTER
   ======== ======== ========
   arena     1fc919c  1fc919c
   ordblks         1        9
   mxordblk  1fc4128  1fa3d20
   uordblks     5074     872c
   fordblks  1fc4128  1fc0a70
   user_main: Exiting
   ostest_main: Exiting with status 0
   nsh> 
   ```
   
   Performance (qemu-intel64, TSC deadline timer, QEMU/KVM, `-O3`, measured 
with `CONFIG_HRTIMER_LIST` and `CONFIG_HRTIMER_TREE`; cycles per call):
   
   | Path (cycles per call) | Before | After | Improvement |
   |---|---|---|---|
   | Restart queue head with the same deadline (`CONFIG_HRTIMER_LIST`) | 1178 | 
39 | ~30x |
   | `hrtimer_process()` on an empty queue (`CONFIG_HRTIMER_LIST`) | 1370 | 77 
| ~18x |
   | Restart head of a 64-timer queue, no reprogram (`CONFIG_HRTIMER_TREE`) | 
54 | 52 | ~4% |
   
   - The other `hrtimer_start()`/`hrtimer_cancel()` paths stay at ~40 cycles 
per call, unchanged within noise.
   - The loop-exit/running-mark rework is unchanged within noise on the UP 
build, where the running marks compile out.
   - The branch hints are unchanged within noise on the out-of-order qemu/KVM 
core; they target in-order cores with static prediction.
   
   All measurements are QEMU/KVM, not real hardware.
   


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

  • [PR] sched/hrtimer: optimize ... Fix-Point (via GitHub) via commits

Reply via email to