On 19/11/2024 03:18, Peter Zijlstra wrote:
On Mon, Nov 18, 2024 at 10:52:42AM -0800, Vadim Fedorenko wrote:
@@ -2094,6 +2094,13 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image,
if (insn->src_reg == BPF_PSEUDO_KFUNC_CALL) {
int err;
+ if (imm32 == BPF_CALL_IMM(bpf_get_cpu_cycles)) {
+ if (cpu_feature_enabled(X86_FEATURE_LFENCE_RDTSC))
+ EMIT3(0x0F, 0xAE, 0xE8);
+ EMIT2(0x0F, 0x31);
+ break;
+ }
TSC != cycles. Naming is bad.
Any suggestions?
JIT for other architectures will come after this one is merged and some
of them will be using cycles, so not too far away form the truth..