opnsense-src/sys/cddl/dev
Mark Johnston 36ae5ce2f2 dtrace/arm64: Fix dtrace_gethrtime()
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
2025-03-09 23:01:13 -04:00
..
dtmalloc sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
dtrace dtrace/arm64: Fix dtrace_gethrtime() 2025-03-09 23:01:13 -04:00
fbt dtrace/arm64: Fix enumeration of FBT return probes 2025-01-29 02:03:02 +00:00
kinst dtrace: Add some more annotations for KMSAN 2024-11-23 02:36:08 +00:00
profile dtrace/profile: Set t_dtrace_trapframe for profile probes 2024-01-07 11:46:13 -05:00
sdt sdt: Tear down probes in kernel modules during kldunload 2024-10-16 13:50:37 -04:00
systrace Update mentions of makesyscalls.lua 2024-10-30 21:04:31 +00:00
prototype.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00