Commit b80b033b authored by Song Liu's avatar Song Liu Committed by Daniel Borkmann

bpf: Allow bpf_perf_event_read_value in all BPF programs

bpf_perf_event_read_value() is NMI safe. Enable it for all BPF programs.
This can be used in fentry/fexit to profile BPF program and individual
kernel function with hardware counters.
Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20200214234146.2910011-1-songliubraving@fb.com
parent b182a667
...@@ -843,6 +843,8 @@ tracing_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) ...@@ -843,6 +843,8 @@ tracing_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
return &bpf_send_signal_proto; return &bpf_send_signal_proto;
case BPF_FUNC_send_signal_thread: case BPF_FUNC_send_signal_thread:
return &bpf_send_signal_thread_proto; return &bpf_send_signal_thread_proto;
case BPF_FUNC_perf_event_read_value:
return &bpf_perf_event_read_value_proto;
default: default:
return NULL; return NULL;
} }
...@@ -858,8 +860,6 @@ kprobe_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) ...@@ -858,8 +860,6 @@ kprobe_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
return &bpf_get_stackid_proto; return &bpf_get_stackid_proto;
case BPF_FUNC_get_stack: case BPF_FUNC_get_stack:
return &bpf_get_stack_proto; return &bpf_get_stack_proto;
case BPF_FUNC_perf_event_read_value:
return &bpf_perf_event_read_value_proto;
#ifdef CONFIG_BPF_KPROBE_OVERRIDE #ifdef CONFIG_BPF_KPROBE_OVERRIDE
case BPF_FUNC_override_return: case BPF_FUNC_override_return:
return &bpf_override_return_proto; return &bpf_override_return_proto;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment