NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/59691: tstohz(9) fails to round up on some inputs
>Number: 59691
>Category: kern
>Synopsis: tstohz(9) fails to round up on some inputs
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Oct 05 12:25:01 +0000 2025
>Originator: Taylor R Campbell
>Release: current, 11, 10, 9, ...
>Organization:
The NetTSD Roundation
>Environment:
>Description:
tstohz(9) is supposed to return the number of ticks needed to
sleep before a certain duration, like tvtohz(9) but for struct
timespec rather than struct timeval.
However, it works by first rounding the struct timespec
(nanosecond precision) _down_ to a struct timeval (microsecond
precision), and then calling tvtohz(9). So, for example, while
tvtohz(0.000001 sec) gives 2 ticks (one full tick, plus
whatever time is left between now and the next hardclock tick,
which may be time epsilon away), tstohz(0.000000001 sec) gives
0 ticks (tvtohz returns 0 ticks for 0 time).
This is a likely cause of one source of infinite loops in
timers leading to heartbeat panics:
PR kern/59339: heartbeat watchdog fires since 10.99.14
https://gnats.NetBSD.org/59339
PR kern/59465: Recurring kernel panic with -current (10.99.14):
"heart stopped beating"
https://gnats.NetBSD.org/59465
PR kern/59679: Multiple "heart stopped beating" / "softints
stuck for 16 seconds" panics
https://gnats.NetBSD.org/59679
>How-To-Repeat:
tvtohz(&(struct timespec){.tv_sec = 0, .tv_nsec = 1})
>Fix:
in progress
Home |
Main Index |
Thread Index |
Old Index