Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bpf: Make perf_event_read_output accessible in all program types.

The perf_event_read_event_output helper is currently only available to
tracing protrams, but is useful for other BPF programs like sched_ext
schedulers. When the helper is available, provide its bpf_func_proto
directly from the bpf base_proto.

Signed-off-by: Emil Tsalapatis (Meta) <emil@etsalapatis.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20250318030753.10949-1-emil@etsalapatis.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Emil Tsalapatis and committed by
Alexei Starovoitov
ae0a457f f3f86495

+14
+2
include/linux/bpf.h
··· 2059 2059 const struct bpf_func_proto *bpf_get_trace_printk_proto(void); 2060 2060 const struct bpf_func_proto *bpf_get_trace_vprintk_proto(void); 2061 2061 2062 + const struct bpf_func_proto *bpf_get_perf_event_read_value_proto(void); 2063 + 2062 2064 typedef unsigned long (*bpf_ctx_copy_t)(void *dst, const void *src, 2063 2065 unsigned long off, unsigned long len); 2064 2066 typedef u32 (*bpf_convert_ctx_access_t)(enum bpf_access_type type,
+5
kernel/bpf/core.c
··· 2972 2972 return NULL; 2973 2973 } 2974 2974 2975 + const struct bpf_func_proto * __weak bpf_get_perf_event_read_value_proto(void) 2976 + { 2977 + return NULL; 2978 + } 2979 + 2975 2980 u64 __weak 2976 2981 bpf_event_output(struct bpf_map *map, u64 flags, void *meta, u64 meta_size, 2977 2982 void *ctx, u64 ctx_size, bpf_ctx_copy_t ctx_copy)
+2
kernel/bpf/helpers.c
··· 2056 2056 return &bpf_task_pt_regs_proto; 2057 2057 case BPF_FUNC_trace_vprintk: 2058 2058 return bpf_get_trace_vprintk_proto(); 2059 + case BPF_FUNC_perf_event_read_value: 2060 + return bpf_get_perf_event_read_value_proto(); 2059 2061 default: 2060 2062 return NULL; 2061 2063 }
+5
kernel/trace/bpf_trace.c
··· 607 607 .arg4_type = ARG_CONST_SIZE, 608 608 }; 609 609 610 + const struct bpf_func_proto *bpf_get_perf_event_read_value_proto(void) 611 + { 612 + return &bpf_perf_event_read_value_proto; 613 + } 614 + 610 615 static __always_inline u64 611 616 __bpf_perf_event_output(struct pt_regs *regs, struct bpf_map *map, 612 617 u64 flags, struct perf_raw_record *raw,