Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: kernel-patches/bpf
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: af0172e
Choose a base ref
...
head repository: kernel-patches/bpf
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 20e0148
Choose a head ref
  • 7 commits
  • 23 files changed
  • 4 contributors

Commits on Oct 6, 2020

  1. bpf, libbpf: Use valid btf in bpf_program__set_attach_target

    bpf_program__set_attach_target(prog, fd, ...) will always fail when
    fd = 0 (attach to a kernel symbol) because obj->btf_vmlinux is NULL
    and there is no way to set it (at the moment btf_vmlinux is meant
    to be temporary storage for use in bpf_object__load_xattr()).
    
    Fix this by using libbpf_find_vmlinux_btf_id().
    
    At some point we may want to opportunistically cache btf_vmlinux
    so it can be reused with multiple programs.
    
    Signed-off-by: Luigi Rizzo <lrizzo@google.com>
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Acked-by: Andrii Nakryiko <andriin@fb.com>
    Acked-by: Petar Penkov <ppenkov@google.com>
    Link: https://lore.kernel.org/bpf/20201005224528.389097-1-lrizzo@google.com
    Luigi Rizzo authored and Alexei Starovoitov committed Oct 6, 2020
    Configuration menu
    Copy the full SHA
    8cee910 View commit details
    Browse the repository at this point in the history
  2. samples/bpf: Change Makefile to cope with latest llvm

    With latest llvm trunk, bpf programs under samples/bpf
    directory, if using CORE, may experience the following
    errors:
    
    LLVM ERROR: Cannot select: intrinsic %llvm.preserve.struct.access.index
    PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
    Stack dump:
    0.      Program arguments: llc -march=bpf -filetype=obj -o samples/bpf/test_probe_write_user_kern.o
    1.      Running pass 'Function Pass Manager' on module '<stdin>'.
    2.      Running pass 'BPF DAG->DAG Pattern Instruction Selection' on function '@bpf_prog1'
     #0 0x000000000183c26c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
        (/data/users/yhs/work/llvm-project/llvm/build.cur/install/bin/llc+0x183c26c)
    ...
     #7 0x00000000017c375e (/data/users/yhs/work/llvm-project/llvm/build.cur/install/bin/llc+0x17c375e)
     #8 0x00000000016a75c5 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*)
        (/data/users/yhs/work/llvm-project/llvm/build.cur/install/bin/llc+0x16a75c5)
     #9 0x00000000016ab4f8 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*,
        unsigned int) (/data/users/yhs/work/llvm-project/llvm/build.cur/install/bin/llc+0x16ab4f8)
    ...
    Aborted (core dumped) | llc -march=bpf -filetype=obj -o samples/bpf/test_probe_write_user_kern.o
    
    The reason is due to llvm change https://reviews.llvm.org/D87153
    where the CORE relocation global generation is moved from the beginning
    of target dependent optimization (llc) to the beginning
    of target independent optimization (opt).
    
    Since samples/bpf programs did not use vmlinux.h and its clang compilation
    uses native architecture, we need to adjust arch triple at opt level
    to do CORE relocation global generation properly. Otherwise, the above
    error will appear.
    
    This patch fixed the issue by introduce opt and llvm-dis to compilation chain,
    which will do proper CORE relocation global generation as well as O2 level
    optimization. Tested with llvm10, llvm11 and trunk/llvm12.
    
    Signed-off-by: Yonghong Song <yhs@fb.com>
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Acked-by: Andrii Nakryiko <andriin@fb.com>
    Link: https://lore.kernel.org/bpf/20201006043427.1891742-1-yhs@fb.com
    yonghong-song authored and Alexei Starovoitov committed Oct 6, 2020
    Configuration menu
    Copy the full SHA
    9618bde View commit details
    Browse the repository at this point in the history
  3. samples/bpf: Fix a compilation error with fallthrough marking

    Compiling samples/bpf hits an error related to fallthrough marking.
        ...
        CC  samples/bpf/hbm.o
      samples/bpf/hbm.c: In function ‘main’:
      samples/bpf/hbm.c:486:4: error: ‘fallthrough’ undeclared (first use in this function)
          fallthrough;
          ^~~~~~~~~~~
    
    The "fallthrough" is not defined under tools/include directory.
    Rather, it is "__fallthrough" is defined in linux/compiler.h.
    Including "linux/compiler.h" and using "__fallthrough" fixed the issue.
    
    Signed-off-by: Yonghong Song <yhs@fb.com>
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Link: https://lore.kernel.org/bpf/20201006043427.1891805-1-yhs@fb.com
    yonghong-song authored and Alexei Starovoitov committed Oct 6, 2020
    Configuration menu
    Copy the full SHA
    544d6ad View commit details
    Browse the repository at this point in the history
  4. samples: bpf: Split xdpsock stats into new struct

    New statistics will be added in future commits. In preparation for this,
    let's split out the existing statistics into their own struct.
    
    Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Acked-by: Yonghong Song <yhs@fb.com>
    Link: https://lore.kernel.org/bpf/20201002133612.31536-1-ciara.loftus@intel.com
    cloftus authored and Alexei Starovoitov committed Oct 6, 2020
    Configuration menu
    Copy the full SHA
    2e8806f View commit details
    Browse the repository at this point in the history
  5. samples: bpf: Count syscalls in xdpsock

    Categorise and record syscalls issued in the xdpsock sample app. The
    categories recorded are:
    
      rx_empty_polls:    polls when the rx ring is empty
      fill_fail_polls:   polls when failed to get addr from fill ring
      copy_tx_sendtos:   sendtos issued for tx when copy mode enabled
      tx_wakeup_sendtos: sendtos issued when tx ring needs waking up
      opt_polls:         polls issued since the '-p' flag is set
    
    Print the stats using '-a' on the xdpsock command line.
    
    Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Acked-by: Yonghong Song <yhs@fb.com>
    Link: https://lore.kernel.org/bpf/20201002133612.31536-2-ciara.loftus@intel.com
    cloftus authored and Alexei Starovoitov committed Oct 6, 2020
    Configuration menu
    Copy the full SHA
    60dc609 View commit details
    Browse the repository at this point in the history
  6. samples: bpf: Driver interrupt statistics in xdpsock

    Add an option to count the number of interrupts generated per second and
    total number of interrupts during the lifetime of the application for a
    given interface. This information is extracted from /proc/interrupts. Since
    there is no naming convention across drivers, the user must provide the
    string which is specific to their interface in the /proc/interrupts file on
    the command line.
    
    Usage:
    
    ./xdpsock ... -I <irq_str>
    
    eg. for queue 0 of i40e device eth0:
    
    ./xdpsock ... -I i40e-eth0-TxRx-0
    
    Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Link: https://lore.kernel.org/bpf/20201002133612.31536-3-ciara.loftus@intel.com
    cloftus authored and Alexei Starovoitov committed Oct 6, 2020
    Configuration menu
    Copy the full SHA
    67ed375 View commit details
    Browse the repository at this point in the history
  7. adding ci files

    kernel-patches-bot committed Oct 6, 2020
    Configuration menu
    Copy the full SHA
    20e0148 View commit details
    Browse the repository at this point in the history
Loading