Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
re: What to do about "WARNING: negative runtime; monotonic clock has gone backwards"
one problem i've seen in kern_tc.c when the timecounter returns
a smaller value is that tc_delta() ends up returning a very large
(underflowed) value, and that makes the consumers of it do a very
wrong thing. eg, -2 becomes 2^32-2, and then eg in binuptime:
477 bintime_addx(bt, th->th_scale * tc_delta(th));
or in tc_windup():
933 delta = tc_delta(th);
938 th->th_offset_count += delta;
939 bintime_addx(&th->th_offset, th->th_scale * delta);
i "fixed" the time goes backwards on sparc issue a few years ago
with this change, which avoids the above issue:
http://mail-index.netbsd.org/source-changes/2018/01/12/msg091064.html
but i really think that the way tc_delta() can underflow is a
bad problem we should fix properly, i just wasn't sure of the
right way to do it.
.mrg.
Home |
Main Index |
Thread Index |
Old Index