mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
This routine returns a monotonic count of the number of nanoseconds elapsed
since the previous call. On arm64 it uses the generic system timer. The
implementation multiplies the counter value by 10**9 then divides by the counter
frequency, but this multiplication can overflow. This can result in trace
records with non-monotonic timestamps, which breaks libdtrace's temporal
ordering algorithm.
An easy fix is to reverse the order of operations, since the counter frequency
will in general be smaller than 10**9. (In fact, it's mandated to be 1Ghz in
ARMv9, which makes life simple.) However, this can give a fair bit of error.
Adopt the calculation used on amd64, with tweaks to handle frequencies as low as
1MHz: the ARM generic timer documentation suggests that ARMv8 timers are
typically in the 1MHz-50MHz range, which is true on arm64 systems that I have
access to.
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D49244
(cherry picked from commit
|
||
|---|---|---|
| .. | ||
| aarch64 | ||
| amd64 | ||
| arm | ||
| i386 | ||
| powerpc | ||
| riscv | ||
| x86 | ||
| dtrace_anon.c | ||
| dtrace_cddl.h | ||
| dtrace_debug.c | ||
| dtrace_hacks.c | ||
| dtrace_ioctl.c | ||
| dtrace_load.c | ||
| dtrace_modevent.c | ||
| dtrace_sysctl.c | ||
| dtrace_test.c | ||
| dtrace_unload.c | ||
| dtrace_vtime.c | ||