25 Aug, 2020

1 commit

  • For the problem of increasing fragmentation of the bpf loader programs,
    instead of using bpf_loader.o, which is used in samples/bpf, this
    commit refactors the existing tracepoint tracing programs with libbbpf
    bpf loader.

    - Adding a tracepoint event and attaching a bpf program to it was done
    through bpf_program_attach().
    - Instead of using the existing BPF MAP definition, MAP definition
    has been refactored with the new BTF-defined MAP format.

    Signed-off-by: Daniel T. Lee
    Signed-off-by: Alexei Starovoitov
    Link: https://lore.kernel.org/bpf/20200823085334.9413-4-danieltimlee@gmail.com

    Daniel T. Lee
     

22 Jul, 2020

1 commit

  • A handful of samples and selftests fail to build on s390, because
    after commit 0ebeea8ca8a4 ("bpf: Restrict bpf_probe_read{, str}()
    only to archs where they work") bpf_probe_read is not available
    anymore.

    Fix by using bpf_probe_read_kernel.

    Signed-off-by: Ilya Leoshkevich
    Signed-off-by: Alexei Starovoitov
    Link: https://lore.kernel.org/bpf/20200720114806.88823-1-iii@linux.ibm.com

    Ilya Leoshkevich
     

14 May, 2020

1 commit

  • Commit 5fbc220862fc ("tools/libpf: Add offsetof/container_of macro
    in bpf_helpers.h") added macros offsetof/container_of to
    bpf_helpers.h. Unfortunately, it caused compilation warnings
    below for a few samples/bpf programs:
    In file included from /data/users/yhs/work/net-next/samples/bpf/sockex2_kern.c:4:
    In file included from /data/users/yhs/work/net-next/include/uapi/linux/in.h:24:
    In file included from /data/users/yhs/work/net-next/include/linux/socket.h:8:
    In file included from /data/users/yhs/work/net-next/include/linux/uio.h:8:
    /data/users/yhs/work/net-next/include/linux/kernel.h:992:9: warning: 'container_of' macro redefined [-Wmacro-redefined]
    ^
    /data/users/yhs/work/net-next/tools/lib/bpf/bpf_helpers.h:46:9: note: previous definition is here
    ^
    1 warning generated.
    CLANG-bpf samples/bpf/sockex3_kern.o

    In all these cases, bpf_helpers.h is included first, followed by other
    standard headers. The macro container_of is defined unconditionally
    in kernel.h, causing the compiler warning.

    The fix is to move bpf_helpers.h after standard headers.

    Signed-off-by: Yonghong Song
    Signed-off-by: Alexei Starovoitov
    Acked-by: Andrii Nakryiko
    Link: https://lore.kernel.org/bpf/20200513180223.2949987-1-yhs@fb.com

    Yonghong Song
     

21 Jan, 2020

1 commit

  • Fix all files in samples/bpf to include libbpf header files with the bpf/
    prefix, to be consistent with external users of the library. Also ensure
    that all includes of exported libbpf header files (those that are exported
    on 'make install' of the library) use bracketed includes instead of quoted.

    To make sure no new files are introduced that doesn't include the bpf/
    prefix in its include, remove tools/lib/bpf from the include path entirely,
    and use tools/lib instead.

    Fixes: 6910d7d3867a ("selftests/bpf: Ensure bpf_helper_defs.h are taken from selftests dir")
    Signed-off-by: Toke Høiland-Jørgensen
    Signed-off-by: Alexei Starovoitov
    Acked-by: Jesper Dangaard Brouer
    Acked-by: Andrii Nakryiko
    Link: https://lore.kernel.org/bpf/157952560911.1683545.8795966751309534150.stgit@toke.dk

    Toke Høiland-Jørgensen
     

09 Oct, 2019

1 commit


15 Apr, 2016

1 commit

  • Remove the zero initialization in the sample programs where appropriate.
    Note that this is an optimization which is now possible, old programs
    still doing the zero initialization are just fine as well. Also, make
    sure we don't have padding issues when we don't memset() the entire
    struct anymore.

    Signed-off-by: Daniel Borkmann
    Acked-by: Alexei Starovoitov
    Signed-off-by: David S. Miller

    Daniel Borkmann
     

08 Apr, 2016

1 commit


20 Feb, 2016

1 commit

  • This is simplified version of Brendan Gregg's offwaketime:
    This program shows kernel stack traces and task names that were blocked and
    "off-CPU", along with the stack traces and task names for the threads that woke
    them, and the total elapsed time from when they blocked to when they were woken
    up. The combined stacks, task names, and total time is summarized in kernel
    context for efficiency.

    Example:
    $ sudo ./offwaketime | flamegraph.pl > demo.svg
    Open demo.svg in the browser as FlameGraph visualization.

    Signed-off-by: Alexei Starovoitov
    Signed-off-by: David S. Miller

    Alexei Starovoitov