NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/59691 (tstohz(9) fails to round up on some inputs)
Synopsis: tstohz(9) fails to round up on some inputs
State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh%NetBSD.org@localhost
State-Changed-When: Sun, 05 Oct 2025 20:03:14 +0000
State-Changed-Why:
Plus this commit, which didn't get appended here, possibly because it
references too many PRs:
https://mail-index.netbsd.org/source-changes/2025/10/05/msg158450.html
Module Name: src
Committed By: riastradh
Date: Sun Oct 5 18:54:02 UTC 2025
Modified Files:
src/sys/kern: subr_time_arith.c
src/tests/kernel: t_time_arith.c
Log Message:
tstohz(9): Round up, not down.
This is used for timeouts, and it is bad if it returns a timeout that
is too short, particularly if it rounds `wait a little' to `don't
wait at all'.
This still has some substantial rounding errors, e.g. at hz=8191 with
a period of just over 122 085 ns, tstohz(122 084 ns) this returns 3
when it should return 2 because it rounds up to tvtohz(123 us) for
which 3 is the correct answer -- but at least it's still rounding up.
I'll leave those as xfail for now.
PR kern/59691: tstohz(9) fails to round up on some inputs
This was likely the underlying cause of various heartbeat panics
users have been seeing -- I hypothesize that for short timeouts that
reschedule themselves, the itimer callout would call itself in a loop
and never return from callout_softclock because of this rounding
down:
PR kern/59339: heartbeat watchdog fires since 10.99.14
PR kern/59465: Recurring kernel panic with -current (10.99.14):
"heart stopped beating"
PR kern/59679: Multiple "heart stopped beating" / "softints stuck for
16 seconds" panics
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/kern/subr_time_arith.c
cvs rdiff -u -r1.5 -r1.6 src/tests/kernel/t_time_arith.c
Note: some large rounding errors remain in tstohz, but at least now the
direction of rounding is correct.
Home |
Main Index |
Thread Index |
Old Index