• Alexei Starovoitov's avatar
    bpf: add verifier stats and log_level bit 2 · 06ee7115
    Alexei Starovoitov authored
    In order to understand the verifier bottlenecks add various stats
    and extend log_level:
    log_level 1 and 2 are kept as-is:
    bit 0 - level=1 - print every insn and verifier state at branch points
    bit 1 - level=2 - print every insn and verifier state at every insn
    bit 2 - level=4 - print verifier error and stats at the end of verification
    
    When verifier rejects the program the libbpf is trying to load the program twice.
    Once with log_level=0 (no messages, only error code is reported to user space)
    and second time with log_level=1 to tell the user why the verifier rejected it.
    
    With introduction of bit 2 - level=4 the libbpf can choose to always use that
    level and load programs once, since the verification speed is not affected and
    in case of error the verbose message will be available.
    
    Note that the verifier stats are not part of uapi just like all other
    verbose messages. They're expected to change in the future.
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    06ee7115
verifier.c 230 KB