1. 04 9月, 2020 2 次提交
  2. 01 9月, 2020 3 次提交
  3. 25 8月, 2020 3 次提交
  4. 19 8月, 2020 1 次提交
  5. 22 7月, 2020 1 次提交
  6. 16 7月, 2020 2 次提交
  7. 14 7月, 2020 1 次提交
  8. 11 7月, 2020 1 次提交
  9. 08 7月, 2020 3 次提交
    • D
      samples: bpf: Refactor BPF map performance test with libbpf · cc7f641d
      Daniel T. Lee 提交于
      Previously, in order to set the numa_node attribute at the time of map
      creation using "libbpf", it was necessary to call bpf_create_map_node()
      directly (bpf_load approach), instead of calling bpf_object_load()
      that handles everything on its own, including map creation. And because
      of this problem, this sample had problems with refactoring from bpf_load
      to libbbpf.
      
      However, by commit 1bdb6c9a ("libbpf: Add a bunch of attribute
      getters/setters for map definitions") added the numa_node attribute and
      allowed it to be set in the map.
      
      By using libbpf instead of bpf_load, the inner map definition has
      been explicitly declared with BTF-defined format. Also, the element of
      ARRAY_OF_MAPS was also statically specified using the BTF format. And
      for this reason some logic in fixup_map() was not needed and changed
      or removed.
      Signed-off-by: NDaniel T. Lee <danieltimlee@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAndrii Nakryiko <andriin@fb.com>
      Link: https://lore.kernel.org/bpf/20200707184855.30968-4-danieltimlee@gmail.com
      cc7f641d
    • D
      samples: bpf: Refactor BPF map in map test with libbpf · 88795b4a
      Daniel T. Lee 提交于
      From commit 646f02ff ("libbpf: Add BTF-defined map-in-map
      support"), a way to define internal map in BTF-defined map has been
      added.
      
      Instead of using previous 'inner_map_idx' definition, the structure to
      be used for the inner map can be directly defined using array directive.
      
          __array(values, struct inner_map)
      
      This commit refactors map in map test program with libbpf by explicitly
      defining inner map with BTF-defined format.
      Signed-off-by: NDaniel T. Lee <danieltimlee@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAndrii Nakryiko <andriin@fb.com>
      Link: https://lore.kernel.org/bpf/20200707184855.30968-3-danieltimlee@gmail.com
      88795b4a
    • D
      samples: bpf: Fix bpf programs with kprobe/sys_connect event · af9bd3e3
      Daniel T. Lee 提交于
      Currently, BPF programs with kprobe/sys_connect does not work properly.
      
      Commit 34745aed ("samples/bpf: fix kprobe attachment issue on x64")
      This commit modifies the bpf_load behavior of kprobe events in the x64
      architecture. If the current kprobe event target starts with "sys_*",
      add the prefix "__x64_" to the front of the event.
      
      Appending "__x64_" prefix with kprobe/sys_* event was appropriate as a
      solution to most of the problems caused by the commit below.
      
          commit d5a00528 ("syscalls/core, syscalls/x86: Rename struct
          pt_regs-based sys_*() to __x64_sys_*()")
      
      However, there is a problem with the sys_connect kprobe event that does
      not work properly. For __sys_connect event, parameters can be fetched
      normally, but for __x64_sys_connect, parameters cannot be fetched.
      
          ffffffff818d3520 <__x64_sys_connect>:
          ffffffff818d3520: e8 fb df 32 00        callq   0xffffffff81c01520
          <__fentry__>
          ffffffff818d3525: 48 8b 57 60           movq    96(%rdi), %rdx
          ffffffff818d3529: 48 8b 77 68           movq    104(%rdi), %rsi
          ffffffff818d352d: 48 8b 7f 70           movq    112(%rdi), %rdi
          ffffffff818d3531: e8 1a ff ff ff        callq   0xffffffff818d3450
          <__sys_connect>
          ffffffff818d3536: 48 98                 cltq
          ffffffff818d3538: c3                    retq
          ffffffff818d3539: 0f 1f 80 00 00 00 00  nopl    (%rax)
      
      As the assembly code for __x64_sys_connect shows, parameters should be
      fetched and set into rdi, rsi, rdx registers prior to calling
      __sys_connect.
      
      Because of this problem, this commit fixes the sys_connect event by
      first getting the value of the rdi register and then the value of the
      rdi, rsi, and rdx register through an offset based on that value.
      
      Fixes: 34745aed ("samples/bpf: fix kprobe attachment issue on x64")
      Signed-off-by: NDaniel T. Lee <danieltimlee@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAndrii Nakryiko <andriin@fb.com>
      Link: https://lore.kernel.org/bpf/20200707184855.30968-2-danieltimlee@gmail.com
      af9bd3e3
  10. 16 6月, 2020 1 次提交
  11. 19 5月, 2020 5 次提交
  12. 15 5月, 2020 2 次提交
  13. 14 5月, 2020 1 次提交
    • Y
      samples/bpf: Remove compiler warnings · 03421a92
      Yonghong Song 提交于
      Commit 5fbc2208 ("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: NYonghong Song <yhs@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NAndrii Nakryiko <andriin@fb.com>
      Link: https://lore.kernel.org/bpf/20200513180223.2949987-1-yhs@fb.com
      03421a92
  14. 25 3月, 2020 1 次提交
  15. 24 3月, 2020 2 次提交
  16. 06 2月, 2020 2 次提交
  17. 04 2月, 2020 1 次提交
    • M
      kbuild: rename hostprogs-y/always to hostprogs/always-y · 5f2fb52f
      Masahiro Yamada 提交于
      In old days, the "host-progs" syntax was used for specifying host
      programs. It was renamed to the current "hostprogs-y" in 2004.
      
      It is typically useful in scripts/Makefile because it allows Kbuild to
      selectively compile host programs based on the kernel configuration.
      
      This commit renames like follows:
      
        always       ->  always-y
        hostprogs-y  ->  hostprogs
      
      So, scripts/Makefile will look like this:
      
        always-$(CONFIG_BUILD_BIN2C) += ...
        always-$(CONFIG_KALLSYMS)    += ...
            ...
        hostprogs := $(always-y) $(always-m)
      
      I think this makes more sense because a host program is always a host
      program, irrespective of the kernel configuration. We want to specify
      which ones to compile by CONFIG options, so always-y will be handier.
      
      The "always", "hostprogs-y", "hostprogs-m" will be kept for backward
      compatibility for a while.
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      5f2fb52f
  18. 21 1月, 2020 2 次提交
  19. 17 1月, 2020 1 次提交
  20. 21 12月, 2019 5 次提交