On Sun, Jul 21, 2019 at 04:36:00AM +0200, Klemens Nanni wrote:
> Simply omit conversions from timevals to hz and use the proper API.
> First one is trivial, the second one truncates the converted number of
> ticks to at leat one, which timeout_add_*(9) does automatically, so stop
> doing it manually.
Both of these are incorrect. The first conversion doesn't account for
the ongoing tick so the initial interrupt always fires up to one tick
early. The second conversion truncates the interval, so it will fire
a tick early until it has accumulated enough error to fire correctly.
This isn't something you can really fix out at the syscall level. The
timeout(9) backend needs to preserve the granularity of the caller's
request or you'll always be running into these sorts of issues. I'd
focus on converting stuff outside of sys/kern in the meantime. When
we change the backend these issues will go away on their own.