1. 12 Feb, 2022 1 commit
  2. 11 Feb, 2022 6 commits
    • Andrii Nakryiko's avatar
      libbpf: Fix libbpf.map inheritance chain for LIBBPF_0.7.0 · d130e954
      Andrii Nakryiko authored
      Ensure that LIBBPF_0.7.0 inherits everything from LIBBPF_0.6.0.
      
      Fixes: dbdd2c7f ("libbpf: Add API to get/set log_level at per-program level")
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20220211205235.2089104-1-andrii@kernel.org
      d130e954
    • Andrii Nakryiko's avatar
      Merge branch 'bpftool: Switch to new versioning scheme (align on libbpf's)' · 4407fa06
      Andrii Nakryiko authored
      Quentin Monnet says:
      
      ====================
      
      Hi, this set aims at updating the way bpftool versions are numbered.
      Instead of copying the version from the kernel (given that the sources for
      the kernel and bpftool are shipped together), align it on libbpf's version
      number, with a fixed offset (6) to avoid going backwards. Please refer to
      the description of the second commit for details on the motivations.
      
      The patchset also adds the number of the version of libbpf that was used to
      compile to the output of "bpftool version". Bpftool makes such a heavy
      usage of libbpf that it makes sense to indicate what version was used to
      build it.
      
      v3:
      - Compute bpftool's version at compile time, but from the macros exposed by
        libbpf instead of calling a shell to compute $(BPFTOOL_VERSION) in the
        Makefile.
      - Drop the commit which would add a "libbpfversion" target to libbpf's
        Makefile. This is no longer necessary.
      - Use libbpf's major, minor versions with jsonw_printf() to avoid
        offsetting the version string to skip the "v" prefix.
      - Reword documentation change.
      
      v2:
      - Align on libbpf's version number instead of creating an independent
        versioning scheme.
      - Use libbpf_version_string() to retrieve and display libbpf's version.
      - Re-order patches (1 <-> 2).
      ====================
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      4407fa06
    • Quentin Monnet's avatar
      bpftool: Update versioning scheme, align on libbpf's version number · 9910a74d
      Quentin Monnet authored
      Since the notion of versions was introduced for bpftool, it has been
      following the version number of the kernel (using the version number
      corresponding to the tree in which bpftool's sources are located). The
      rationale was that bpftool's features are loosely tied to BPF features
      in the kernel, and that we could defer versioning to the kernel
      repository itself.
      
      But this versioning scheme is confusing today, because a bpftool binary
      should be able to work with both older and newer kernels, even if some
      of its recent features won't be available on older systems. Furthermore,
      if bpftool is ported to other systems in the future, keeping a
      Linux-based version number is not a good option.
      
      Looking at other options, we could either have a totally independent
      scheme for bpftool, or we could align it on libbpf's version number
      (with an offset on the major version number, to avoid going backwards).
      The latter comes with a few drawbacks:
      
      - We may want bpftool releases in-between two libbpf versions. We can
        always append pre-release numbers to distinguish versions, although
        those won't look as "official" as something with a proper release
        number. But at the same time, having bpftool with version numbers that
        look "official" hasn't really been an issue so far.
      
      - If no new feature lands in bpftool for some time, we may move from
        e.g. 6.7.0 to 6.8.0 when libbpf levels up and have two different
        versions which are in fact the same.
      
      - Following libbpf's versioning scheme sounds better than kernel's, but
        ultimately it doesn't make too much sense either, because even though
        bpftool uses the lib a lot, its behaviour is not that much conditioned
        by the internal evolution of the library (or by new APIs that it may
        not use).
      
      Having an independent versioning scheme solves the above, but at the
      cost of heavier maintenance. Developers will likely forget to increase
      the numbers when adding features or bug fixes, and we would take the
      risk of having to send occasional "catch-up" patches just to update the
      version number.
      
      Based on these considerations, this patch aligns bpftool's version
      number on libbpf's. This is not a perfect solution, but 1) it's
      certainly an improvement over the current scheme, 2) the issues raised
      above are all minor at the moment, and 3) we can still move to an
      independent scheme in the future if we realise we need it.
      
      Given that libbpf is currently at version 0.7.0, and bpftool, before
      this patch, was at 5.16, we use an offset of 6 for the major version,
      bumping bpftool to 6.7.0. Libbpf does not export its patch number;
      leave bpftool's patch number at 0 for now.
      
      It remains possible to manually override the version number by setting
      BPFTOOL_VERSION when calling make.
      Signed-off-by: default avatarQuentin Monnet <quentin@isovalent.com>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20220210104237.11649-3-quentin@isovalent.com
      9910a74d
    • Quentin Monnet's avatar
      bpftool: Add libbpf's version number to "bpftool version" output · 61fce969
      Quentin Monnet authored
      To help users check what version of libbpf is being used with bpftool,
      print the number along with bpftool's own version number.
      
      Output:
      
          $ ./bpftool version
          ./bpftool v5.16.0
          using libbpf v0.7
          features: libbfd, libbpf_strict, skeletons
      
          $ ./bpftool version --json --pretty
          {
              "version": "5.16.0",
              "libbpf_version": "0.7",
              "features": {
                  "libbfd": true,
                  "libbpf_strict": true,
                  "skeletons": true
              }
          }
      
      Note that libbpf does not expose its patch number.
      Signed-off-by: default avatarQuentin Monnet <quentin@isovalent.com>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20220210104237.11649-2-quentin@isovalent.com
      61fce969
    • Song Liu's avatar
      bpf: Fix bpf_prog_pack build for ppc64_defconfig · 4cc0991a
      Song Liu authored
      bpf_prog_pack causes build error with powerpc ppc64_defconfig:
      
      kernel/bpf/core.c:830:23: error: variably modified 'bitmap' at file scope
        830 |         unsigned long bitmap[BITS_TO_LONGS(BPF_PROG_CHUNK_COUNT)];
            |                       ^~~~~~
      
      This is because the marco expands as:
      
      unsigned long bitmap[((((((1UL) << (16 + __pte_index_size)) / (1 << 6))) \
           + ((sizeof(long) * 8)) - 1) / ((sizeof(long) * 8)))];
      
      where __pte_index_size is a global variable.
      
      Fix it by turning bitmap into a 0-length array.
      
      Fixes: 57631054 ("bpf: Introduce bpf_prog_pack allocator")
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarSong Liu <song@kernel.org>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20220211024939.2962537-1-song@kernel.org
      4cc0991a
    • Lorenzo Bianconi's avatar
      selftest/bpf: Check invalid length in test_xdp_update_frags · a5a358ab
      Lorenzo Bianconi authored
      Update test_xdp_update_frags adding a test for a buffer size
      set to (MAX_SKB_FRAGS + 2) * PAGE_SIZE. The kernel is supposed
      to return -ENOMEM.
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Acked-by: default avatarYonghong Song <yhs@fb.com>
      Link: https://lore.kernel.org/bpf/3e4afa0ee4976854b2f0296998fe6754a80b62e5.1644366736.git.lorenzo@kernel.org
      a5a358ab
  3. 10 Feb, 2022 30 commits
  4. 09 Feb, 2022 3 commits