bpf: Allow tracing programs to use bpf_jiffies64() helper
authorYonghong Song <yhs@fb.com>
Tue, 23 Jun 2020 23:08:08 +0000 (16:08 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 25 Jun 2020 01:37:58 +0000 (18:37 -0700)
/proc/net/tcp{4,6} uses jiffies for various computations.
Let us add bpf_jiffies64() helper to tracing program
so bpf_iter and other programs can use it.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20200623230808.3988073-1-yhs@fb.com
kernel/trace/bpf_trace.c

index b44505f..0159f12 100644 (file)
@@ -1135,6 +1135,8 @@ bpf_tracing_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
                return &bpf_ringbuf_discard_proto;
        case BPF_FUNC_ringbuf_query:
                return &bpf_ringbuf_query_proto;
+       case BPF_FUNC_jiffies64:
+               return &bpf_jiffies64_proto;
        default:
                return NULL;
        }