1. 22 2月, 2020 6 次提交
  2. 21 2月, 2020 7 次提交
  3. 20 2月, 2020 5 次提交
    • A
      selftests/bpf: Fix build of sockmap_ktls.c · 50089780
      Alexei Starovoitov 提交于
      The selftests fails to build with:
      tools/testing/selftests/bpf/prog_tests/sockmap_ktls.c: In function ‘test_sockmap_ktls_disconnect_after_delete’:
      tools/testing/selftests/bpf/prog_tests/sockmap_ktls.c:72:37: error: ‘TCP_ULP’ undeclared (first use in this function)
         72 |  err = setsockopt(cli, IPPROTO_TCP, TCP_ULP, "tls", strlen("tls"));
            |                                     ^~~~~~~
      
      Similar to commit that fixes build of sockmap_basic.c on systems with old
      /usr/include fix the build of sockmap_ktls.c
      
      Fixes: d1ba1204 ("selftests/bpf: Test unhashing kTLS socket after removing from map")
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NJohn Fastabend <john.fastabend@gmail.com>
      Link: https://lore.kernel.org/bpf/20200219205514.3353788-1-ast@kernel.org
      50089780
    • Y
      selftests/bpf: Change llvm flag -mcpu=probe to -mcpu=v3 · 83250f2b
      Yonghong Song 提交于
      The latest llvm supports cpu version v3, which is cpu version v1
      plus some additional 64bit jmp insns and 32bit jmp insn support.
      
      In selftests/bpf Makefile, the llvm flag -mcpu=probe did runtime
      probe into the host system. Depending on compilation environments,
      it is possible that runtime probe may fail, e.g., due to
      memlock issue. This will cause generated code with cpu version v1.
      This may cause confusion as the same compiler and the same C code
      generates different byte codes in different environment.
      
      Let us change the llvm flag -mcpu=probe to -mcpu=v3 so the
      generated code will be the same regardless of the compilation
      environment.
      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/20200219004236.2291125-1-yhs@fb.com
      83250f2b
    • A
      Merge branch 'bpf_read_branch_records' · 03aa3955
      Alexei Starovoitov 提交于
      Daniel Xu says:
      
      ====================
      Branch records are a CPU feature that can be configured to record
      certain branches that are taken during code execution. This data is
      particularly interesting for profile guided optimizations. perf has had
      branch record support for a while but the data collection can be a bit
      coarse grained.
      
      We (Facebook) have seen in experiments that associating metadata with
      branch records can improve results (after postprocessing). We generally
      use bpf_probe_read_*() to get metadata out of userspace. That's why bpf
      support for branch records is useful.
      
      Aside from this particular use case, having branch data available to bpf
      progs can be useful to get stack traces out of userspace applications
      that omit frame pointers.
      
      Changes in v8:
      - Use globals instead of perf buffer
      - Call test_perf_branches__detach() before destroying skeleton
      - Fix typo in docs
      
      Changes in v7:
      - Const-ify and static-ify local var
      - Documentation formatting
      
      Changes in v6:
      - Move #ifdef a little to avoid unused variable warnings on !x86
      - Test negative condition in selftest (-EINVAL on improperly configured
        perf event)
      - Skip positive condition selftest on setups that don't support branch
        records
      
      Changes in v5:
      - Rename bpf_perf_prog_read_branches() -> bpf_read_branch_records()
      - Rename BPF_F_GET_BR_SIZE -> BPF_F_GET_BRANCH_RECORDS_SIZE
      - Squash tools/ bpf.h sync into selftest commit
      
      Changes in v4:
      - Add BPF_F_GET_BR_SIZE flag
      - Return -ENOENT on unsupported architectures
      - Only accept initialized memory in helper
      - Check buffer size is multiple of sizeof(struct perf_branch_entry)
      - Use bpf skeleton in selftest
      - Add commit messages
      - Spelling and formatting
      
      Changes in v3:
      - Document filling unused buffer with zero
      - Formatting fixes
      - Rebase
      
      Changes in v2:
      - Change to a bpf helper instead of context access
      - Avoid mentioning Intel specific things
      ====================
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      03aa3955
    • D
      selftests/bpf: Add bpf_read_branch_records() selftest · 67306f84
      Daniel Xu 提交于
      Add a selftest to test:
      
      * default bpf_read_branch_records() behavior
      * BPF_F_GET_BRANCH_RECORDS_SIZE flag behavior
      * error path on non branch record perf events
      * using helper to write to stack
      * using helper to write to global
      
      On host with hardware counter support:
      
          # ./test_progs -t perf_branches
          #27/1 perf_branches_hw:OK
          #27/2 perf_branches_no_hw:OK
          #27 perf_branches:OK
          Summary: 1/2 PASSED, 0 SKIPPED, 0 FAILED
      
      On host without hardware counter support (VM):
      
          # ./test_progs -t perf_branches
          #27/1 perf_branches_hw:OK
          #27/2 perf_branches_no_hw:OK
          #27 perf_branches:OK
          Summary: 1/2 PASSED, 1 SKIPPED, 0 FAILED
      
      Also sync tools/include/uapi/linux/bpf.h.
      Signed-off-by: NDaniel Xu <dxu@dxuuu.xyz>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NAndrii Nakryiko <andriin@fb.com>
      Link: https://lore.kernel.org/bpf/20200218030432.4600-3-dxu@dxuuu.xyz
      67306f84
    • D
      bpf: Add bpf_read_branch_records() helper · fff7b643
      Daniel Xu 提交于
      Branch records are a CPU feature that can be configured to record
      certain branches that are taken during code execution. This data is
      particularly interesting for profile guided optimizations. perf has had
      branch record support for a while but the data collection can be a bit
      coarse grained.
      
      We (Facebook) have seen in experiments that associating metadata with
      branch records can improve results (after postprocessing). We generally
      use bpf_probe_read_*() to get metadata out of userspace. That's why bpf
      support for branch records is useful.
      
      Aside from this particular use case, having branch data available to bpf
      progs can be useful to get stack traces out of userspace applications
      that omit frame pointers.
      Signed-off-by: NDaniel Xu <dxu@dxuuu.xyz>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NAndrii Nakryiko <andriin@fb.com>
      Link: https://lore.kernel.org/bpf/20200218030432.4600-2-dxu@dxuuu.xyz
      fff7b643
  4. 19 2月, 2020 4 次提交
  5. 18 2月, 2020 18 次提交