On Tue, Mar 18, 2025 at 1:17 AM Vadim Fedorenko <vadim.fedorenko@xxxxxxxxx> wrote: > > >> > >> + if (insn->src_reg == BPF_PSEUDO_KFUNC_CALL && > >> + IS_ENABLED(CONFIG_BPF_SYSCALL) && > > > > why? > > > > It's true that JIT can be compiled in even when there is no sys_bpf, > > but why gate this? > > Both bpf_get_cpu_time_counter() and bpf_cpu_time_counter_to_ns() are > defined in helpers.c which is compiled only when CONFIG_BPF_SYSCALL is > enabled. Otherwise these symbols are absent and compilation fails. > See kernel test bot report: > https://lore.kernel.org/bpf/202503131640.opwmXIvU-lkp@xxxxxxxxx/ put in core.c then? > >> +__bpf_kfunc u64 bpf_get_cpu_time_counter(void) > >> +{ > >> + return ktime_get_raw_fast_ns(); > > > > Why 'raw' ? > > Is it faster than 'mono' ? > > This needs a comment at least. > > 'raw' is the closest analogue to what is implemented in JIT. The access > time is the same as for 'mono', but the slope of 'raw' is not affected > by NTP adjustments, and with stable tsc it can provide less jitter in > short term measurements. fair enough. the comment is needed.