mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 03:35:32 -04:00
selftests/bpf: Make pyperf600 a success again
pyperf600 has been running into 8K BPF_COMPLEXITY_LIMIT_JMP_SEQ limitations for a long while now, after some internal compiler changes. Until BPF verifier is bestowed with scalar evolution logic, make that test actually work by doing what would anyone should do in such situations: by moving repeatable per-iteration work into independently verified global functions. `void *` argument is a problem for global funcs, but a static function wrapper doing necessary casts and a bit of __arg_nonnull magic dust is all it takes. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Yonghong Song <yonghong.song@linux.dev> Tested-by: Pu Lehui <pulehui@huawei.com> # riscv Reviewed-by: Pu Lehui <pulehui@huawei.com> Link: https://lore.kernel.org/bpf/20260813232943.581283-1-andrii@kernel.org
This commit is contained in:
committed by
Daniel Borkmann
parent
073574da7a
commit
c7e6175529
@@ -85,9 +85,11 @@ static void *get_thread_state(void *tls_base, PidData *pidData)
|
||||
return thread_state;
|
||||
}
|
||||
|
||||
static __always_inline bool get_frame_data(void *frame_ptr, PidData *pidData,
|
||||
FrameData *frame, Symbol *symbol)
|
||||
__weak bool __get_frame_data(long frame_ptr_, PidData *pidData __arg_nonnull,
|
||||
FrameData *frame __arg_nonnull, Symbol *symbol __arg_nonnull)
|
||||
{
|
||||
void *frame_ptr = (void *)frame_ptr_;
|
||||
|
||||
// read data from PyFrameObject
|
||||
bpf_probe_read_user(&frame->f_back,
|
||||
sizeof(frame->f_back),
|
||||
@@ -119,6 +121,12 @@ static __always_inline bool get_frame_data(void *frame_ptr, PidData *pidData,
|
||||
return true;
|
||||
}
|
||||
|
||||
static __always_inline bool get_frame_data(void *frame_ptr, PidData *pidData,
|
||||
FrameData *frame, Symbol *symbol)
|
||||
{
|
||||
return __get_frame_data((long)frame_ptr, pidData, frame, symbol);
|
||||
}
|
||||
|
||||
struct {
|
||||
__uint(type, BPF_MAP_TYPE_HASH);
|
||||
__uint(max_entries, 1);
|
||||
|
||||
Reference in New Issue
Block a user