On Fri, 2024-11-08 at 16:41 -0800, Vadim Fedorenko wrote: > The new helper should be used to convert cycles received by > bpf_get_cpu_cycle() into nanoseconds. > > Signed-off-by: Vadim Fedorenko <vadfed@xxxxxxxx> > --- Tried this with and without invtsc flag for qemu, the switch between call / inlined version occurs as expected. In the off-list discussion Vadim explained that: - mult and shift constants are not updated after boot if constant_tsc feature is present for CPU. - despite gettimeofday.h:vdso_calc_ns() doing more complex calculations to avoid negative time motion, we again assume that this is not needed for BPF use-case (two measurements close in time). (If there would be a v6, it would be nice to have a comment about these differences, I think). Reviewed-by: Eduard Zingerman <eddyz87@xxxxxxxxx> [...]