tools/testing/selftests/bpf/prog_tests/bpf_verif_scale.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/prog_tests/bpf_verif_scale.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/prog_tests/bpf_verif_scale.c- Extension
.c- Size
- 5268 bytes
- Lines
- 234
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
test_progs.h
Detected Declarations
function libbpf_debug_printfunction check_loadfunction scale_testfunction test_verif_scale1function test_verif_scale2function test_verif_scale3function test_verif_scale_pyperf_globalfunction test_verif_scale_pyperf_subprogsfunction test_verif_scale_pyperf50function test_verif_scale_pyperf100function test_verif_scale_pyperf180function test_verif_scale_pyperf600function test_verif_scale_pyperf600_bpf_loopfunction test_verif_scale_pyperf600_nounrollfunction test_verif_scale_pyperf600_iterfunction test_verif_scale_loop1function test_verif_scale_loop2function test_verif_scale_loop3_failfunction test_verif_scale_loop4function test_verif_scale_loop5function test_verif_scale_loop6function test_verif_scale_strobemetafunction test_verif_scale_strobemeta_bpf_loopfunction test_verif_scale_strobemeta_nounroll1function test_verif_scale_strobemeta_nounroll2function test_verif_scale_strobemeta_subprogsfunction test_verif_scale_sysctl_loop1function test_verif_scale_sysctl_loop2function test_verif_scale_xdp_loopfunction test_verif_scale_seg6_loopfunction test_verif_twfw
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2019 Facebook
#include <test_progs.h>
static int libbpf_debug_print(enum libbpf_print_level level,
const char *format, va_list args)
{
if (level != LIBBPF_DEBUG) {
vprintf(format, args);
return 0;
}
if (!strstr(format, "verifier log"))
return 0;
vprintf("%s", args);
return 0;
}
extern int extra_prog_load_log_flags;
static int check_load(const char *file, enum bpf_prog_type type)
{
struct bpf_object *obj = NULL;
struct bpf_program *prog;
int err;
obj = bpf_object__open_file(file, NULL);
err = libbpf_get_error(obj);
if (err)
return err;
prog = bpf_object__next_program(obj, NULL);
if (!prog) {
err = -ENOENT;
goto err_out;
}
bpf_program__set_type(prog, type);
bpf_program__set_flags(prog, testing_prog_flags());
bpf_program__set_log_level(prog, 4 | extra_prog_load_log_flags);
err = bpf_object__load(obj);
err_out:
bpf_object__close(obj);
return err;
}
static void scale_test(const char *file,
enum bpf_prog_type attach_type,
bool should_fail)
{
libbpf_print_fn_t old_print_fn = NULL;
int err;
if (env.verifier_stats) {
test__force_log();
old_print_fn = libbpf_set_print(libbpf_debug_print);
}
err = check_load(file, attach_type);
if (should_fail)
ASSERT_ERR(err, "expect_error");
else
ASSERT_OK(err, "expect_success");
if (env.verifier_stats)
libbpf_set_print(old_print_fn);
}
void test_verif_scale1()
{
scale_test("test_verif_scale1.bpf.o", BPF_PROG_TYPE_SCHED_CLS, false);
}
void test_verif_scale2()
{
scale_test("test_verif_scale2.bpf.o", BPF_PROG_TYPE_SCHED_CLS, false);
}
void test_verif_scale3()
{
scale_test("test_verif_scale3.bpf.o", BPF_PROG_TYPE_SCHED_CLS, false);
}
void test_verif_scale_pyperf_global()
{
scale_test("pyperf_global.bpf.o", BPF_PROG_TYPE_RAW_TRACEPOINT, false);
}
void test_verif_scale_pyperf_subprogs()
Annotation
- Immediate include surface: `test_progs.h`.
- Detected declarations: `function libbpf_debug_print`, `function check_load`, `function scale_test`, `function test_verif_scale1`, `function test_verif_scale2`, `function test_verif_scale3`, `function test_verif_scale_pyperf_global`, `function test_verif_scale_pyperf_subprogs`, `function test_verif_scale_pyperf50`, `function test_verif_scale_pyperf100`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.