-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'bpf-llvm-reg-alloc-patterns'
Alexei Starovoitov says: ==================== Make two verifier improvements: - The llvm register allocator may use two different registers representing the same virtual register. Teach the verifier to recognize that. - Track bounded scalar spill/fill. The profiler[123] test in patch 3 will fail to load without patches 1 and 2. The profiler[23] test may fail to load on older llvm due to speculative code motion nd instruction combining optimizations that are fixed in https://reviews.llvm.org/D85570 v1 -> v2: - fixed 32-bit mov issue spotted by John. - allowed r2=r1; r3=r2; sequence as suggested by John. - added comments, acks, more tests. ==================== Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
- Loading branch information
Showing
11 changed files
with
1,591 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* Copyright (c) 2020 Facebook */ | ||
#include <test_progs.h> | ||
#include "progs/profiler.h" | ||
#include "profiler1.skel.h" | ||
#include "profiler2.skel.h" | ||
#include "profiler3.skel.h" | ||
|
||
static int sanity_run(struct bpf_program *prog) | ||
{ | ||
struct bpf_prog_test_run_attr test_attr = {}; | ||
__u64 args[] = {1, 2, 3}; | ||
__u32 duration = 0; | ||
int err, prog_fd; | ||
|
||
prog_fd = bpf_program__fd(prog); | ||
test_attr.prog_fd = prog_fd; | ||
test_attr.ctx_in = args; | ||
test_attr.ctx_size_in = sizeof(args); | ||
err = bpf_prog_test_run_xattr(&test_attr); | ||
if (CHECK(err || test_attr.retval, "test_run", | ||
"err %d errno %d retval %d duration %d\n", | ||
err, errno, test_attr.retval, duration)) | ||
return -1; | ||
return 0; | ||
} | ||
|
||
void test_test_profiler(void) | ||
{ | ||
struct profiler1 *profiler1_skel = NULL; | ||
struct profiler2 *profiler2_skel = NULL; | ||
struct profiler3 *profiler3_skel = NULL; | ||
__u32 duration = 0; | ||
int err; | ||
|
||
profiler1_skel = profiler1__open_and_load(); | ||
if (CHECK(!profiler1_skel, "profiler1_skel_load", "profiler1 skeleton failed\n")) | ||
goto cleanup; | ||
|
||
err = profiler1__attach(profiler1_skel); | ||
if (CHECK(err, "profiler1_attach", "profiler1 attach failed: %d\n", err)) | ||
goto cleanup; | ||
|
||
if (sanity_run(profiler1_skel->progs.raw_tracepoint__sched_process_exec)) | ||
goto cleanup; | ||
|
||
profiler2_skel = profiler2__open_and_load(); | ||
if (CHECK(!profiler2_skel, "profiler2_skel_load", "profiler2 skeleton failed\n")) | ||
goto cleanup; | ||
|
||
err = profiler2__attach(profiler2_skel); | ||
if (CHECK(err, "profiler2_attach", "profiler2 attach failed: %d\n", err)) | ||
goto cleanup; | ||
|
||
if (sanity_run(profiler2_skel->progs.raw_tracepoint__sched_process_exec)) | ||
goto cleanup; | ||
|
||
profiler3_skel = profiler3__open_and_load(); | ||
if (CHECK(!profiler3_skel, "profiler3_skel_load", "profiler3 skeleton failed\n")) | ||
goto cleanup; | ||
|
||
err = profiler3__attach(profiler3_skel); | ||
if (CHECK(err, "profiler3_attach", "profiler3 attach failed: %d\n", err)) | ||
goto cleanup; | ||
|
||
if (sanity_run(profiler3_skel->progs.raw_tracepoint__sched_process_exec)) | ||
goto cleanup; | ||
cleanup: | ||
profiler1__destroy(profiler1_skel); | ||
profiler2__destroy(profiler2_skel); | ||
profiler3__destroy(profiler3_skel); | ||
} |
Oops, something went wrong.