yangsong8-a1 opened a new pull request, #21833:
URL: https://github.com/apache/nuttx/pull/21833
## Summary
With CONFIG_TIMER_ARCH and CONFIG_SCHED_TICKLESS, the scheduler calls the
timespec versions of the interval timer interface: up_timer_cancel() from
sched/wdog/wdog.h, and up_timer_start() from sched/hrtimer/hrtimer.h when
CONFIG_HRTIMER is set. arch_timer.c only provides up_timer_tick_cancel()
and up_timer_tick_start(), so these builds fail to link.
- Add a weak up_timer_cancel() that cancels through update_timeout() and
converts the remaining ticks to a timespec.
- Add a weak up_timer_start() that converts the timespec to ticks and
calls update_timeout().
## Impact
Only builds with CONFIG_TIMER_ARCH and CONFIG_SCHED_TICKLESS, for example
the Cortex-M SysTick boards (mps2-an500, mps3-an547). They now link and
run. Both functions are weak, so arch code that provides its own keeps
using it. Nothing changes for non-tickless builds.
## Testing
Ubuntu 22.04, gcc 13.1, arm-none-eabi-gcc 10.3, QEMU 6.2.
| Config | apache/master | This PR |
|---|---|---|
| mps3-an547:nsh + SCHED_TICKLESS | link error: undefined `up_timer_cancel`
| builds, 0 warnings |
| mps3-an547:nsh + SCHED_TICKLESS + HRTIMER | link error (with only the
first commit: undefined `up_timer_start`) | builds, 0 warnings |
| mps2-an500:nsh + SCHED_TICKLESS | link error: undefined `up_timer_cancel`
| builds, 0 warnings |
| mps2-an500:nsh, mps2-an521:nsh, mps3-an547:nsh,
nrf52832-dk:ostest_tickless, nrf52840-dk:ostest_tickless, sim:nsh, sim:ostest,
qemu-armv7a:nsh, qemu-armv7r:nsh, qemu-armv8a:nsh, rv-virt:nsh,
qemu-intel64:nsh | builds | builds, no new warnings |
Runtime on QEMU mps3-an547 (tickless, SysTick lower half): a test program
measures CLOCK_MONOTONIC around usleep()/sleep(), and every console line is
time-stamped on the host:
| | tickless | tickless + HRTIMER |
|---|---|---|
| usleep(20000) / (100000) / (500000) / (2000000) | 21175 / 100122 / 503626
/ 2001619 us | 21333 / 100493 / 500650 / 2001642 us |
| sleep(3) | 3001853 us | 3004961 us |
| start to end, guest monotonic vs host | 5.63 s vs 5.63 s | 5.63 s vs 5.63
s |
mps2-an500 (tickless) gives the same guest-side numbers. On QEMU that
machine runs about 28% slower than the host clock with this PR and with
apache/master in tick mode alike, so the host comparison only holds on
mps3-an547.
--
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]