-
Notifications
You must be signed in to change notification settings - Fork 33
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: keep track of verifier insn_processed'
Dave Marchevsky says: ==================== This is a followup to discussion around RFC patchset "bpf: keep track of prog verification stats" [0]. The RFC elaborates on my usecase, but to summarize: keeping track of verifier stats for programs as they - and the kernels they run on - change over time can help developers of individual programs and BPF kernel folks. The RFC added a verif_stats to the uapi which contained most of the info which verifier prints currently. Feedback here was to avoid polluting uapi with stats that might be meaningless after major changes to the verifier, but that insn_processed or conceptually similar number would exist in the long term and was safe to expose. So let's expose just insn_processed via bpf_prog_info and fdinfo for now and explore good ways of getting more complicated stats in the future. [0] https://lore.kernel.org/bpf/[email protected]/ v2->v3: * Remove unnecessary check in patch 2's test [Andrii] * Go back to adding new u32 in bpf_prog_info (vs using spare bits) [Andrii] * Rebase + add acks [Andrii, John] v1->v2: * Rename uapi field from insn_processed to verified_insns [Daniel] * use 31 bits of existing bitfield space in bpf_prog_info [Daniel] * change underlying type from 64-> 32 bits [Daniel] ==================== Signed-off-by: Andrii Nakryiko <[email protected]>
- Loading branch information
Showing
6 changed files
with
38 additions
and
2 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
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,28 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* Copyright (c) 2021 Facebook */ | ||
|
||
#include <test_progs.h> | ||
|
||
#include "trace_vprintk.lskel.h" | ||
|
||
void test_verif_stats(void) | ||
{ | ||
__u32 len = sizeof(struct bpf_prog_info); | ||
struct bpf_prog_info info = {}; | ||
struct trace_vprintk *skel; | ||
int err; | ||
|
||
skel = trace_vprintk__open_and_load(); | ||
if (!ASSERT_OK_PTR(skel, "trace_vprintk__open_and_load")) | ||
goto cleanup; | ||
|
||
err = bpf_obj_get_info_by_fd(skel->progs.sys_enter.prog_fd, &info, &len); | ||
if (!ASSERT_OK(err, "bpf_obj_get_info_by_fd")) | ||
goto cleanup; | ||
|
||
if (!ASSERT_GT(info.verified_insns, 0, "verified_insns")) | ||
goto cleanup; | ||
|
||
cleanup: | ||
trace_vprintk__destroy(skel); | ||
} |