1 Commits
Author SHA1 Message Date
geramyloveless 285ef4bc61 linuxu: hrtimer on the timer service
Implement hrtimer_setup(), hrtimer_start_range_ns(), hrtimer_try_to_cancel(),
hrtimer_cancel(), hrtimer_active(), hrtimer_forward(),
hrtimer_cb_get_time() and __hrtimer_get_remaining() in linuxu/src/timer.c.
The existing worker thread now serves both timer_list (jiffies) and
hrtimer (nanosecond deadlines on CLOCK_MONOTONIC, CLOCK_REALTIME or
CLOCK_BOOTTIME), sleeping until the earliest of either.

Semantics follow kernel/time/hrtimer.c: the timer is dequeued before
its callback, HRTIMER_RESTART re-enqueues it at the expiry the callback
forwarded to, try_to_cancel() returns -1 while the callback runs,
hrtimer_cancel() waits for it, and a NORESTART timer is not touched after
its callback returns. drm_vblank's timer-based vblank and amdgpu_vkms use
this; the hrtimer stubs that called them unreachable are gone.

scripts/test-hrtimer.sh covers one-shot and periodic timers, forward
overrun arithmetic, cancel while running, the drm_vblank
active/try_to_cancel loop and coexistence with timer_list timers. The
timer service test now links timekeeping.c for the clocks.
2026-10-02 20:56:19 -07:00