Commit Graph

94 Commits

Author SHA1 Message Date
Arnaldo Carvalho de Melo ced4c34c37 core: Remove strings.c, unused
We were using this just for the ctf_encoder, that never really got
complete, so ditch it.

For BTF the strings table is done by libbpf, so we don't need it there
either.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:41:11 -03:00
Arnaldo Carvalho de Melo e2ee753fa7 pahole: Disable incomplete CTF encoder
It was never fully functional and now its getting in the way of further
improvements for loading/encoding BTF and loading DWARF.

Eventually we can use Oracle's libctf library to add an encoder.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-12 09:39:44 -03:00
Arnaldo Carvalho de Melo 41a283c65d core: Protect cus->cus with a mutex
Paving the way for having multiple threads creating CUs and possibly
adding them to cus->cus.

The mutex will also be used to ask elfutils-libdwfl to read the next CU,
after a thread finishes reading one.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-07-28 15:18:16 -03:00
Arnaldo Carvalho de Melo 3ec54ee72f CMakeList.txt: Bump version to the upcoming 1.22 release, not out of the door yet
This is just for CIs to be able to, building from master, encode
variables, that are disabled in the Linux kernel but fixed with what
came after v1.21.

Requested-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-07-27 13:28:19 -03:00
Luca Boccassi f1feaa94c7 libbpf: bump dependency to >= 0.4.0
Required for the new API btf__add_float().

Signed-off-by: Luca Boccassi <bluca@debian.org>
Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-06-14 15:33:57 -03:00
Luca Boccassi 1b50808c29 libbpf: If LIBBPF_EMBEDDED=OFF and libbpf-dev/pkgconfig is not available, fail the build
If using the system library was explicitly requested, ensure it is present
and fail the build if it is not, rather than falling back to the
embedded version (same for pkg-config).

Signed-off-by: Luca Boccassi <bluca@debian.org>
Requested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-06-14 15:33:55 -03:00
Deepak Kumar Mishra aa20277086 CMakeLists.txt: Enable SHARED and STATIC lib creation
CMakeLists.txt does not allow creation of static library and link applications
accordingly.

Creation of SHARED and STATIC should be allowed using -DBUILD_SHARED_LIBS
If -DBUILD_SHARED_LIBS option is not supplied, CMakeLists.txt sets it to ON.

Ex:

  $ cmake -D__LIB=lib -DBUILD_SHARED_LIBS=OFF ..
  $ cmake -D__LIB=lib -DBUILD_SHARED_LIBS=ON ..

Committer testing:

I had to fixup it a bit due to changes related to allowing building with
libbpf-devel, test resuts:

With the default, i.e. creating libdwarves.so and using it:

  ⬢[acme@toolbox pahole]$ rm -f vmlinux.btf ; perf stat -r5 pahole -j vmlinux.btf vmlinux && perf stat -r5 btfdiff vmlinux vmlinux.btf

   Performance counter stats for 'pahole -j vmlinux.btf vmlinux' (5 runs):

            8,612.69 msec task-clock:u              #    1.014 CPUs utilized            ( +-  0.68% )
                   0      context-switches:u        #    0.000 /sec
                   0      cpu-migrations:u          #    0.000 /sec
             775,702      page-faults:u             #   91.330 K/sec                    ( +-  0.00% )
      33,720,048,514      cycles:u                  #    3.970 GHz                      ( +-  0.38% )  (83.33%)
         689,752,139      stalled-cycles-frontend:u #    2.05% frontend cycles idle     ( +-  2.57% )  (83.33%)
       5,070,723,369      stalled-cycles-backend:u  #   15.04% backend cycles idle      ( +-  1.20% )  (83.34%)
      77,270,640,084      instructions:u            #    2.29  insn per cycle
                                                    #    0.07  stalled cycles per insn  ( +-  0.01% )  (83.34%)
      18,164,028,242      branches:u                #    2.139 G/sec                    ( +-  0.04% )  (83.33%)
         150,194,338      branch-misses:u           #    0.83% of all branches          ( +-  0.17% )  (83.32%)

              8.4979 +- 0.0590 seconds time elapsed  ( +-  0.69% )

   Performance counter stats for 'btfdiff vmlinux vmlinux.btf' (5 runs):

            7,001.79 msec task-clock:u              #    1.006 CPUs utilized            ( +-  1.02% )
                   0      context-switches:u        #    0.000 /sec
                   0      cpu-migrations:u          #    0.000 /sec
             727,980      page-faults:u             #  104.736 K/sec                    ( +-  0.00% )
      26,912,307,448      cycles:u                  #    3.872 GHz                      ( +-  0.31% )  (83.33%)
         509,467,882      stalled-cycles-frontend:u #    1.90% frontend cycles idle     ( +-  2.44% )  (83.33%)
       3,602,777,263      stalled-cycles-backend:u  #   13.43% backend cycles idle      ( +-  1.34% )  (83.32%)
      66,192,815,701      instructions:u            #    2.47  insn per cycle
                                                    #    0.06  stalled cycles per insn  ( +-  0.01% )  (83.35%)
      15,753,663,095      branches:u                #    2.267 G/sec                    ( +-  0.02% )  (83.35%)
          98,345,696      branch-misses:u           #    0.62% of all branches          ( +-  0.14% )  (83.34%)

              6.9586 +- 0.0720 seconds time elapsed  ( +-  1.03% )

  ⬢[acme@toolbox pahole]$

Then building with:

  ⬢[acme@toolbox pahole]$ rm -rf build ; mkdir build ; cd build ; cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release .. ; cd .. ; make -C build
  ⬢[acme@toolbox pahole]$ ldd build/pahole
	linux-vdso.so.1 (0x00007ffff0172000)
	libdw.so.1 => /lib64/libdw.so.1 (0x00007fdd3905d000)
	libelf.so.1 => /lib64/libelf.so.1 (0x00007fdd39042000)
	libz.so.1 => /lib64/libz.so.1 (0x00007fdd39028000)
	libc.so.6 => /lib64/libc.so.6 (0x00007fdd38e59000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007fdd38e52000)
	libzstd.so.1 => /lib64/libzstd.so.1 (0x00007fdd38d5c000)
	liblzma.so.5 => /lib64/liblzma.so.5 (0x00007fdd38d2e000)
	libbz2.so.1 => /lib64/libbz2.so.1 (0x00007fdd38d1b000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fdd38cfa000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fdd390ff000)
  ⬢[acme@toolbox pahole]$

We get some performance improvement:

- First is encoding detached BTF, i.e. read DWARF, generate BTF.
- Second is about loading both DWARF and BTF, producing output for both, that must match.

  ⬢[acme@toolbox pahole]$ rm -f vmlinux.btf ; perf stat -r5 pahole -j vmlinux.btf vmlinux && perf stat -r5 btfdiff vmlinux vmlinux.btf

   Performance counter stats for 'pahole -j vmlinux.btf vmlinux' (5 runs):

            8,566.34 msec task-clock:u              #    1.025 CPUs utilized            ( +-  0.85% )
                   0      context-switches:u        #    0.000 /sec
                   0      cpu-migrations:u          #    0.000 /sec
             775,685      page-faults:u             #   92.865 K/sec                    ( +-  0.00% )
      33,333,991,512      cycles:u                  #    3.991 GHz                      ( +-  0.23% )  (83.34%)
         799,187,919      stalled-cycles-frontend:u #    2.42% frontend cycles idle     ( +-  1.95% )  (83.33%)
       5,157,722,792      stalled-cycles-backend:u  #   15.61% backend cycles idle      ( +-  1.25% )  (83.33%)
      76,273,972,066      instructions:u            #    2.31  insn per cycle
                                                    #    0.07  stalled cycles per insn  ( +-  0.03% )  (83.33%)
      17,843,388,470      branches:u                #    2.136 G/sec                    ( +-  0.05% )  (83.33%)
         150,507,690      branch-misses:u           #    0.84% of all branches          ( +-  0.46% )  (83.33%)

              8.3561 +- 0.0729 seconds time elapsed  ( +-  0.87% )

   Performance counter stats for 'btfdiff vmlinux vmlinux.btf' (5 runs):

            6,685.39 msec task-clock:u              #    0.986 CPUs utilized            ( +-  0.54% )
                   0      context-switches:u        #    0.000 /sec
                   0      cpu-migrations:u          #    0.000 /sec
             727,931      page-faults:u             #  107.475 K/sec                    ( +-  0.00% )
      26,149,371,139      cycles:u                  #    3.861 GHz                      ( +-  0.15% )  (83.36%)
         525,918,808      stalled-cycles-frontend:u #    2.00% frontend cycles idle     ( +-  2.96% )  (83.33%)
       3,547,589,546      stalled-cycles-backend:u  #   13.51% backend cycles idle      ( +-  1.28% )  (83.35%)
      65,389,507,702      instructions:u            #    2.49  insn per cycle
                                                    #    0.06  stalled cycles per insn  ( +-  0.03% )  (83.29%)
      15,553,175,605      branches:u                #    2.296 G/sec                    ( +-  0.02% )  (83.34%)
          97,812,971      branch-misses:u           #    0.63% of all branches          ( +-  0.23% )  (83.34%)

              6.7784 +- 0.0359 seconds time elapsed  ( +-  0.53% )

  ⬢[acme@toolbox pahole]$

Signed-off-by: Deepak Kumar Mishra <deepakkumar.mishra@arm.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-06-10 14:23:25 -03:00
Luca Boccassi ae2581647e libbpf: Allow to use packaged version
Add a new CMake option, LIBBPF_EMBEDDED, to switch between the embedded
version and the system version (searched via pkg-config) of libbpf. Set
the embedded version as the default.

Committer testing:

The default build works as before:

  ⬢[acme@toolbox pahole]$ rm -rf build ; mkdir build ; cd build ; cmake -DCMAKE_BUILD_TYPE=Release .. ; cd ..
  -- The C compiler identification is GNU 11.1.1
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /usr/bin/cc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Checking availability of DWARF and ELF development libraries
  -- Looking for dwfl_module_build_id in elf
  -- Looking for dwfl_module_build_id in elf - found
  -- Found dwarf.h header: /usr/include
  -- Found elfutils/libdw.h header: /usr/include
  -- Found libdw library: /usr/lib64/libdw.so
  -- Found libelf library: /usr/lib64/libelf.so
  -- Checking availability of DWARF and ELF development libraries - done
  -- Found ZLIB: /usr/lib64/libz.so (found version "1.2.11")
  -- Submodule update
  -- Submodule update - done
  -- Performing Test HAVE_REALLOCARRAY_SUPPORT
  -- Performing Test HAVE_REALLOCARRAY_SUPPORT - Success
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /var/home/acme/git/pahole/build
  ⬢[acme@toolbox pahole]$ make -j28 -C build
  make: Entering directory '/var/home/acme/git/pahole/build'
  make[1]: Entering directory '/var/home/acme/git/pahole/build'
  make[2]: Entering directory '/var/home/acme/git/pahole/build'
  Scanning dependencies of target bpf
  make[2]: Leaving directory '/var/home/acme/git/pahole/build'
  make[2]: Entering directory '/var/home/acme/git/pahole/build'
  [  5%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/btf.c.o
  [  5%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/bpf_prog_linfo.c.o
  [  5%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/bpf.c.o
  [  7%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/libbpf_errno.c.o
  <SNIP>
  make[2]: Leaving directory '/var/home/acme/git/pahole/build'
  [ 98%] Built target ctracer
  [100%] Linking C executable pahole
  make[2]: Leaving directory '/var/home/acme/git/pahole/build'
  [100%] Built target pahole
  make[1]: Leaving directory '/var/home/acme/git/pahole/build'
  make: Leaving directory '/var/home/acme/git/pahole/build'
  ⬢[acme@toolbox pahole]$ ldd build/pahole
  	linux-vdso.so.1 (0x00007ffcf4d92000)
  	libdwarves_reorganize.so.1 => /var/home/acme/git/pahole/build/libdwarves_reorganize.so.1 (0x00007f059c289000)
  	libdwarves.so.1 => /var/home/acme/git/pahole/build/libdwarves.so.1 (0x00007f059c226000)
  	libdw.so.1 => /lib64/libdw.so.1 (0x00007f059c186000)
  	libelf.so.1 => /lib64/libelf.so.1 (0x00007f059c16b000)
  	libz.so.1 => /lib64/libz.so.1 (0x00007f059c151000)
  	libc.so.6 => /lib64/libc.so.6 (0x00007f059bf82000)
  	libdl.so.2 => /lib64/libdl.so.2 (0x00007f059bf79000)
  	libzstd.so.1 => /lib64/libzstd.so.1 (0x00007f059be83000)
  	liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f059be57000)
  	libbz2.so.1 => /lib64/libbz2.so.1 (0x00007f059be44000)
  	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f059be23000)
  	/lib64/ld-linux-x86-64.so.2 (0x00007f059c290000)
  ⬢[acme@toolbox pahole]$

Then, trying to use the libbpf-devel present in Fedora 34:

  ⬢[acme@toolbox pahole]$ rm -rf build ; mkdir build ; cd build ; cmake -DCMAKE_BUILD_TYPE=Release -DLIBBPF_EMBEDDED=Off .. ; cd ..
  -- The C compiler identification is GNU 11.1.1
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /usr/bin/cc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Found PkgConfig: /usr/bin/pkg-config (found version "1.7.3")
  -- Checking for module 'libbpf>=0.3.0'
  --   Found libbpf, version 0.3.0
  -- Checking availability of DWARF and ELF development libraries
  -- Looking for dwfl_module_build_id in elf
  -- Looking for dwfl_module_build_id in elf - found
  -- Found dwarf.h header: /usr/include
  -- Found elfutils/libdw.h header: /usr/include
  -- Found libdw library: /usr/lib64/libdw.so
  -- Found libelf library: /usr/lib64/libelf.so
  -- Checking availability of DWARF and ELF development libraries - done
  -- Found ZLIB: /usr/lib64/libz.so (found version "1.2.11")
  -- Submodule update
  -- Submodule update - done
  -- Performing Test HAVE_REALLOCARRAY_SUPPORT
  -- Performing Test HAVE_REALLOCARRAY_SUPPORT - Success
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /var/home/acme/git/pahole/build
  ⬢[acme@toolbox pahole]$ m
  make: Entering directory '/var/home/acme/git/pahole/build'
  make[1]: Entering directory '/var/home/acme/git/pahole/build'
  make[2]: Entering directory '/var/home/acme/git/pahole/build'
  Scanning dependencies of target dwarves
  make[2]: Leaving directory '/var/home/acme/git/pahole/build'
  make[2]: Entering directory '/var/home/acme/git/pahole/build'
  [  2%] Building C object CMakeFiles/dwarves.dir/dwarves.c.o
  [  5%] Building C object CMakeFiles/dwarves.dir/dwarves_fprintf.c.o
  [  7%] Building C object CMakeFiles/dwarves.dir/gobuffer.c.o
  <SNIP>
  [ 33%] Building C object CMakeFiles/dwarves.dir/rbtree.c.o
  /var/home/acme/git/pahole/btf_encoder.c:84:10: error: ‘BTF_KIND_FLOAT’ undeclared here (not in a function); did you mean ‘BTF_KIND_INT’?
     84 |         [BTF_KIND_FLOAT]        = "FLOAT",
        |          ^~~~~~~~~~~~~~
        |          BTF_KIND_INT
  /var/home/acme/git/pahole/btf_encoder.c:84:10: error: array index in initializer not of integer type
  /var/home/acme/git/pahole/btf_encoder.c:84:10: note: (near initialization for ‘btf_kind_str’)
  /var/home/acme/git/pahole/btf_encoder.c:84:35: warning: excess elements in array initializer
     84 |         [BTF_KIND_FLOAT]        = "FLOAT",
        |                                   ^~~~~~~
  /var/home/acme/git/pahole/btf_encoder.c:84:35: note: (near initialization for ‘btf_kind_str’)
  /var/home/acme/git/pahole/btf_encoder.c: In function ‘btf_encoder__add_float’:
  /var/home/acme/git/pahole/btf_encoder.c:224:22: warning: implicit declaration of function ‘btf__add_float’; did you mean ‘btf__add_var’? [-Wimplicit-function-declaration]
    224 |         int32_t id = btf__add_float(encoder->btf, name, BITS_ROUNDUP_BYTES(bt->bit_size));
        |                      ^~~~~~~~~~~~~~
        |                      btf__add_var
  /var/home/acme/git/pahole/btf_loader.c: In function ‘btf__load_types’:
  /var/home/acme/git/pahole/btf_loader.c:455:22: error: ‘BTF_KIND_FLOAT’ undeclared (first use in this function); did you mean ‘BTF_KIND_INT’?
    455 |                 case BTF_KIND_FLOAT:
        |                      ^~~~~~~~~~~~~~
        |                      BTF_KIND_INT
  /var/home/acme/git/pahole/btf_loader.c:455:22: note: each undeclared identifier is reported only once for each function it appears in
  make[2]: *** [CMakeFiles/dwarves.dir/build.make:173: CMakeFiles/dwarves.dir/btf_encoder.c.o] Error 1
  make[2]: *** Waiting for unfinished jobs....
  make[2]: *** [CMakeFiles/dwarves.dir/build.make:186: CMakeFiles/dwarves.dir/btf_loader.c.o] Error 1
  make[2]: Leaving directory '/var/home/acme/git/pahole/build'
  make[1]: *** [CMakeFiles/Makefile2:173: CMakeFiles/dwarves.dir/all] Error 2
  make[1]: Leaving directory '/var/home/acme/git/pahole/build'
  make: *** [Makefile:149: all] Error 2
  make: Leaving directory '/var/home/acme/git/pahole/build'
  ⬢[acme@toolbox pahole]$

It doesn't build as libbpf is old and doesn't have support for
BTF_KIND_FLOAT.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: dwarves@vger.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-06-09 13:34:18 -03:00
Arnaldo Carvalho de Melo 743f2536d8 btf_encoder: Move libbtf.c to btf_encoder.c, the only user of its functions
All those functions now operate on a 'struct btf_encoder' object, there
is no need to make them visible outside the btf_encoder.c source file,
so move them all there and make them static.

This leads to some savings as the compiler is free to optimize further,
inlining stuff used in just one place, etc:

Before, for encoding then reading we have:

  ⬢[acme@toolbox pahole]$ rm -f vmlinux.btf ; perf stat -r5 pahole -j vmlinux.btf vmlinux && perf stat -r5 btfdiff vmlinux vmlinux.btf

   Performance counter stats for 'pahole -j vmlinux.btf vmlinux' (5 runs):

            8,546.56 msec task-clock:u              #    0.989 CPUs utilized            ( +-  0.71% )
                   0      context-switches:u        #    0.000 /sec
                   0      cpu-migrations:u          #    0.000 /sec
             775,699      page-faults:u             #   89.802 K/sec                    ( +-  0.00% )
      34,082,471,148      cycles:u                  #    3.946 GHz                      ( +-  0.22% )  (83.33%)
         636,039,662      stalled-cycles-frontend:u #    1.87% frontend cycles idle     ( +-  1.69% )  (83.33%)
       4,895,524,778      stalled-cycles-backend:u  #   14.38% backend cycles idle      ( +-  2.10% )  (83.33%)
      77,379,632,646      instructions:u            #    2.27  insn per cycle
                                                    #    0.07  stalled cycles per insn  ( +-  0.04% )  (83.33%)
      18,185,560,802      branches:u                #    2.105 G/sec                    ( +-  0.03% )  (83.34%)
         149,715,849      branch-misses:u           #    0.82% of all branches          ( +-  0.15% )  (83.34%)

              8.6412 +- 0.0612 seconds time elapsed  ( +-  0.71% )

   Performance counter stats for 'btfdiff vmlinux vmlinux.btf' (5 runs):

            7,168.97 msec task-clock:u              #    1.016 CPUs utilized            ( +-  0.50% )
                   0      context-switches:u        #    0.000 /sec
                   0      cpu-migrations:u          #    0.000 /sec
             727,965      page-faults:u             #  103.257 K/sec                    ( +-  0.00% )
      27,339,019,686      cycles:u                  #    3.878 GHz                      ( +-  0.17% )  (83.28%)
         511,689,773      stalled-cycles-frontend:u #    1.88% frontend cycles idle     ( +-  1.84% )  (83.34%)
       3,677,090,126      stalled-cycles-backend:u  #   13.53% backend cycles idle      ( +-  1.47% )  (83.35%)
      66,182,032,226      instructions:u            #    2.44  insn per cycle
                                                    #    0.06  stalled cycles per insn  ( +-  0.02% )  (83.35%)
      15,747,149,247      branches:u                #    2.234 G/sec                    ( +-  0.02% )  (83.36%)
          98,013,024      branch-misses:u           #    0.62% of all branches          ( +-  0.21% )  (83.33%)

              7.0554 +- 0.0357 seconds time elapsed  ( +-  0.51% )

  ⬢[acme@toolbox pahole]$

Then, with this patch:

  ⬢[acme@toolbox pahole]$ rm -f vmlinux.btf ; perf stat -r5 pahole -j vmlinux.btf vmlinux && perf stat -r5 btfdiff vmlinux vmlinux.btf

   Performance counter stats for 'pahole -j vmlinux.btf vmlinux' (5 runs):

            8,280.48 msec task-clock:u              #    0.975 CPUs utilized            ( +-  0.72% )
                   0      context-switches:u        #    0.000 /sec
                   0      cpu-migrations:u          #    0.000 /sec
             775,699      page-faults:u             #   91.481 K/sec                    ( +-  0.00% )
      33,265,078,702      cycles:u                  #    3.923 GHz                      ( +-  0.32% )  (83.32%)
         725,690,346      stalled-cycles-frontend:u #    2.16% frontend cycles idle     ( +-  1.76% )  (83.34%)
       4,803,211,469      stalled-cycles-backend:u  #   14.33% backend cycles idle      ( +-  2.43% )  (83.34%)
      77,162,277,929      instructions:u            #    2.30  insn per cycle
                                                    #    0.07  stalled cycles per insn  ( +-  0.06% )  (83.34%)
      18,139,715,894      branches:u                #    2.139 G/sec                    ( +-  0.03% )  (83.34%)
         149,609,552      branch-misses:u           #    0.82% of all branches          ( +-  0.16% )  (83.33%)

              8.4921 +- 0.0630 seconds time elapsed  ( +-  0.74% )

   Performance counter stats for 'btfdiff vmlinux vmlinux.btf' (5 runs):

            7,018.11 msec task-clock:u              #    1.013 CPUs utilized            ( +-  0.68% )
                   0      context-switches:u        #    0.000 /sec
                   0      cpu-migrations:u          #    0.000 /sec
             727,949      page-faults:u             #  105.207 K/sec                    ( +-  0.00% )
      26,632,191,985      cycles:u                  #    3.849 GHz                      ( +-  0.31% )  (83.35%)
         496,648,058      stalled-cycles-frontend:u #    1.87% frontend cycles idle     ( +-  2.02% )  (83.29%)
       3,437,243,040      stalled-cycles-backend:u  #   12.92% backend cycles idle      ( +-  0.90% )  (83.33%)
      66,192,034,237      instructions:u            #    2.49  insn per cycle
                                                    #    0.05  stalled cycles per insn  ( +-  0.03% )  (83.34%)
      15,750,883,004      branches:u                #    2.276 G/sec                    ( +-  0.03% )  (83.35%)
          97,544,298      branch-misses:u           #    0.62% of all branches          ( +-  0.12% )  (83.36%)

              6.9247 +- 0.0478 seconds time elapsed  ( +-  0.69% )

  ⬢[acme@toolbox pahole]$

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-06-09 13:34:15 -03:00
Sevan Janiyan 872658b880 CMakeLists.txt: Specify the file extension of srcs
cmake complains about policy CMP0115 otherwise.

Signed-off-by: Sevan Janiyan <venture37@geeklan.co.uk>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-05-10 21:32:16 -03:00
Arnaldo Carvalho de Melo 25ad41e7b5 pahole: Prep 1.21
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-04-09 19:39:15 -03:00
Arnaldo Carvalho de Melo 0d415f68c4 pahole: Prep 1.20
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-02-03 21:45:01 -03:00
Arnaldo Carvalho de Melo 7943374ac5 Revert "libbpf: allow to use packaged version"
This reverts commit 82749180b2.

Getting in the way of releasing 1.20, breaking the build of a dwarves
rpm when a libbpf package is installed in a fedora 33 system:

In file included from /home/acme/rpmbuild/BUILD/dwarves-1.20/strings.c:7:
/home/acme/rpmbuild/BUILD/dwarves-1.20/pahole_strings.h:9:10: fatal error: bpf/btf.h: No such file or directory
    9 | #include <bpf/btf.h>
      |          ^~~~~~~~~~~

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-02-03 21:45:00 -03:00
Arnaldo Carvalho de Melo 1279e439b6 cmake: Bump minimum required version to 2.8.12 as per upstream support warning
When calling cmake on the build dir we got this on fedora rawhide (cmake 3.19.4):

  CMake Deprecation Warning at CMakeLists.txt:2 (cmake_minimum_required):
    Compatibility with CMake < 2.8.12 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.

So bump it.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-02-02 09:34:30 -03:00
Luca Boccassi 82749180b2 libbpf: allow to use packaged version
Add a new CMake option, LIBBPF_EMBEDDED, to switch between the
embedded version and the system version (searched via pkg-config)
of libbpf. Set the embedded version as the default.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Cc: dwarves@vger.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-01-21 10:26:25 -03:00
Arnaldo Carvalho de Melo dd15aa4b0a dwarves: Prep v1.19
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-11-23 09:52:44 -03:00
Arnaldo Carvalho de Melo 784c3dfbd6 dwarves: Switch from a string based version to major/minor numbers
Nothing changes now, this continues to work just the same:

  $ pahole --version
  v1.18
  $ pfunct --version
  v1.18
  $

This just paves the way for us to have a '--numeric-version' that will
do away with the dot and the leading 'v' and that can be used in
Makefiles to check if the required minimum version is available, to
avoid what we have now in the Linux kernel:

  config PAHOLE_HAS_SPLIT_BTF
         def_bool $(success, test `$(PAHOLE) --version | sed -E 's/v([0-9]+)\.([0-9]+)/\1\2/'` -ge "119")

With the next cset we'll be able to do just:

	 test `$(PAHOLE) --numeric-version` -ge "119"

Cc: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-11-10 12:41:42 -03:00
Andrii Nakryiko ec3f944102 cmake: Make libbpf's Linux UAPI headers available to all binaries
Now that libbpf is used to implement deduplicated strings container, all
of the binaries will need linux/btf.h header to compile properly. libbpf
is distributed with its own copies of Linux UAPI headers, so use them
during compilation.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Cc: dwarves@vger.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-10-26 16:50:08 -03:00
Arnaldo Carvalho de Melo 75f3520fed strings: Rename strings.h to avoid clashing with /usr/include/strings.h
This was detected with:

  In file included from /home/acme/git/pahole/strings.h:9,
                   from /usr/include/string.h:432,
                   from /home/acme/git/pahole/lib/bpf/src/libbpf_common.h:12,
                   from /home/acme/git/pahole/lib/bpf/src/libbpf.h:20,
                   from /home/acme/git/pahole/lib/bpf/src/ringbuf.c:20:
  /home/acme/git/pahole/lib/bpf/src/btf.h:33:11: error: expected ‘;’ before ‘void’
     33 | LIBBPF_API void btf__free(struct btf *btf);
        |           ^~~~~
        |           ;

libbpf_common.h has:

  #include <string.h>

  #ifndef LIBBPF_API
  #define LIBBPF_API __attribute__((visibility("default")))
  #endif

So before defining LIBBPF_API it includes libc's string.h that in turn
includes pahole's strings.h and now it includes:

  #include "lib/bpf/src/btf.h"

That will need the LIBBPF_API, b00m.

So lets just rename pahole's strings.h to pahole_strings.h to avoid this
pitfall.

This patch was moved to before this problem takes place so that we keep
everything bisectable.

Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-10-20 17:11:34 -03:00
Arnaldo Carvalho de Melo fdc639188c dwarves: Prep v1.18
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-10-02 17:29:59 -03:00
Arnaldo Carvalho de Melo 9f675e7fdb cmake: Use -O0 for debug builds
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-08-05 15:16:19 -03:00
Arnaldo Carvalho de Melo e709afe6a9 dwarves: Prep v1.17
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-03-13 16:36:02 -03:00
Andrii Nakryiko 081f3618a7 dwarves: Add -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 to build libbpf
We need that as the fix in upstream libbpf is in the
tools/lib/bpf/Makefile, that isn't used when building libbpf as part of
pahole, see:

  "Makefile: back-port _FILE_OFFSET_BITS=64 and _LARGEFILE64_SOURCE to Makefile"
  4a50ceb043

That refers to this in the kernel sources:

  71dd77fd4bf7 ("libbpf: use LFS (_FILE_OFFSET_BITS) instead of direct mmap2 syscall")

Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Julia Kartseva <hex@fb.com>
Cc: Yonghong Song <yhs@fb.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-02-03 08:52:26 +01:00
Arnaldo Carvalho de Melo 1c1af2cd19 dwarves: Prep v1.16
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-12-16 11:43:53 -03:00
Alexei Starovoitov 69df73444c dwarves: Add -O2 to CFLAGS
Using the defaults, which uses no -O flags:

  [acme@quaco pahole]$ grep CMAKE_C_FLAGS_RELEASE CMakeLists.txt
  set(CMAKE_C_FLAGS_RELEASE "-Wall")
  [acme@quaco pahole]$ perf stat -r5 pahole -J vmlinux

   Performance counter stats for 'pahole -J vmlinux' (5 runs):

           18,516.09 msec task-clock:u              #    1.000 CPUs utilized            ( +-  0.55% )
                   0      context-switches:u        #    0.000 K/sec
                   0      cpu-migrations:u          #    0.000 K/sec
             548,753      page-faults:u             #    0.030 M/sec                    ( +-  0.00% )
      68,498,897,915      cycles:u                  #    3.699 GHz                      ( +-  0.05% )
     123,209,200,210      instructions:u            #    1.80  insn per cycle           ( +-  0.00% )
      25,484,050,414      branches:u                # 1376.319 M/sec                    ( +-  0.00% )
         366,334,745      branch-misses:u           #    1.44% of all branches          ( +-  0.03% )

              18.518 +- 0.102 seconds time elapsed  ( +-  0.55% )

  [acme@quaco pahole]$

With this patch, using -O2:

  [acme@quaco pahole]$ grep CMAKE_C_FLAGS_RELEASE CMakeLists.txt
  set(CMAKE_C_FLAGS_RELEASE "-Wall -O2")
  [acme@quaco pahole]$ perf stat -r5 pahole -J vmlinux

   Performance counter stats for 'pahole -J vmlinux' (5 runs):

           12,645.96 msec task-clock:u              #    1.000 CPUs utilized            ( +-  0.61% )
                   0      context-switches:u        #    0.000 K/sec
                   0      cpu-migrations:u          #    0.000 K/sec
             548,744      page-faults:u             #    0.043 M/sec                    ( +-  0.00% )
      45,359,248,873      cycles:u                  #    3.587 GHz                      ( +-  0.03% )
      84,051,005,257      instructions:u            #    1.85  insn per cycle           ( +-  0.00% )
      19,755,005,738      branches:u                # 1562.159 M/sec                    ( +-  0.00% )
         365,276,883      branch-misses:u           #    1.85% of all branches          ( +-  0.12% )

             12.6471 +- 0.0771 seconds time elapsed  ( +-  0.61% )

  [acme@quaco pahole]$

Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@fb.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-12-16 11:19:47 -03:00
Arnaldo Carvalho de Melo ba27df9f2f CMakeLists: Use lib/bpf/include/uapi when building libdwarves
To avoid using /usr/include/linux/btf.h, as it has:

  [acme@quaco pahole]$ grep ^# /usr/include/linux/btf.h | head -2
  #ifndef __LINUX_BTF_H__
  #define __LINUX_BTF_H__
  [acme@quaco pahole]$

While:

  [acme@quaco pahole]$ grep ^# lib/bpf/include/uapi/linux/btf.h | head -2
  #ifndef _UAPI__LINUX_BTF_H__
  #define _UAPI__LINUX_BTF_H__
  [acme@quaco pahole]$

Then when both get included we get duplicate definitions, to avoid that
put lib/bpf/include/uapi/ first in the include path for libbdwarves.

Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-10-21 18:25:41 -03:00
Arnaldo Carvalho de Melo 93c3cdf897 cmake: Add -Wall to CFLAGS
And also -Werror for CMAKE_BUILD_TYPE=DEBUG, which is the default.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-07-02 12:33:29 -03:00
Arnaldo Carvalho de Melo 5299035710 v1.15: New release
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-06-27 07:20:37 -03:00
Arnaldo Carvalho de Melo 989dc3f1ba cmake: Install missing devel headers
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-04-23 11:25:41 -03:00
Arnaldo Carvalho de Melo 92a4118812 v1.13: New release
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-04-16 16:13:19 -03:00
Andrii Nakryiko e6c59bd11d libbpf: Build as PIC and statically link into libdwarves
As libbpf is not yet widely available, it's safer to statically link it
into libdwarves for now. Easiest way to define that in cmake is through
OBJECT library with PIC.

Committer testing:

  $ file build/pahole
  build/pahole: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=666c97e5763ac0f4c5eff229be1532f1e60195e6, with debug_info, not stripped
  $ ldd build/pahole
	linux-vdso.so.1 (0x00007ffe5fdf8000)
	libdwarves_reorganize.so.1 => /home/acme/git/pahole/build/libdwarves_reorganize.so.1 (0x00007f1c84fa4000)
	libdwarves.so.1 => /home/acme/git/pahole/build/libdwarves.so.1 (0x00007f1c84f5e000)
	libdw.so.1 => /lib64/libdw.so.1 (0x00007f1c84eee000)
	libelf.so.1 => /lib64/libelf.so.1 (0x00007f1c84ed4000)
	libz.so.1 => /lib64/libz.so.1 (0x00007f1c84eba000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f1c84cf4000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f1c84cec000)
	liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f1c84cc3000)
	libbz2.so.1 => /lib64/libbz2.so.1 (0x00007f1c84cb0000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f1c84fad000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f1c84c8e000)
  $

  $ nm build/libdwarves.so.1.0.0  | grep b[pt]f__
  0000000000028aae T btf__dedup
  0000000000027d44 T btf__fd
  0000000000027a37 T btf__find_by_name
  0000000000027ad9 T btf__free
  0000000000027da8 T btf__get_from_id
  0000000000027f6c T btf__get_map_kv_tids
  0000000000027739 T btf__get_nr_types
  0000000000027d55 T btf__get_raw_data
  0000000000027c2e T btf__load
  0000000000027d77 T btf__name_by_offset
  0000000000027b36 T btf__new
  00000000000277eb T btf__resolve_size
  0000000000027960 T btf__resolve_type
  000000000002774a T btf__type_by_id
  $

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Yonghong Song <yhs@fb.com>
Cc: bpf@vger.kernel.org
Cc: dwarves@vger.kernel.org
Cc: kernel-team@fb.com
[ split from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-02-19 10:21:29 -03:00
Andrii Nakryiko cf4f3e282d cmake: Bump miminum required version to use OBJECT feature
We need to link with libbpf, that is not yet generally available, so we
need to link it into libdwarves for now, to do that we need to use the
OBJECT library with PIC, and that requires we use at least cmake version
2.8.8, so bump the minimum required cmake version.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Yonghong Song <yhs@fb.com>
Cc: bpf@vger.kernel.org
Cc: dwarves@vger.kernel.org
Cc: kernel-team@fb.com
[ split from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-02-19 10:20:42 -03:00
Andrii Nakryiko e6dfd10bcb libbpf: Build as shared lib
Change CMakeLists.txt to build libbpf as shared library to satisfy libdwarves
shared library compilation.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: bpf@vger.kernel.org
Cc: dwarves@vger.kernel.org
Cc: kernel-team@fb.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-02-18 09:57:51 -03:00
Andrii Nakryiko 21507cd3e9 pahole: add libbpf as submodule under lib/bpf
This change allows to use libbpf definitions and APIs from pahole.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Martin KaFai Lau <kafai@fb.com>
Cc: Yonghong Song <yhs@fb.com>
Cc: dwarves@vger.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-02-11 12:56:40 -03:00
Arnaldo Carvalho de Melo 472256d3c5 btf_loader: Introduce a loader for the BTF format
Show 'struct list_head' from DWARF info:

  $ pahole -C list_head ~/git/build/v4.20-rc5+/net/ipv4/tcp.o
  struct list_head {
	  struct list_head *         next;                 /*     0     8 */
	  struct list_head *         prev;                 /*     8     8 */

	  /* size: 16, cachelines: 1, members: 2 */
	  /* last cacheline: 16 bytes */
  };

Try to show it from BTF, on a file without it:

  $ pahole -F btf -C list_head ~/git/build/v4.20-rc5+/net/ipv4/tcp.o
  pahole: /home/acme/git/build/v4.20-rc5+/net/ipv4/tcp.o: No debugging information found

Encode BTF from the DWARF info:

  $ pahole -J ~/git/build/v4.20-rc5+/net/ipv4/tcp.o

Check that it is there:
  $ readelf -SW ~/git/build/v4.20-rc5+/net/ipv4/tcp.o  | grep BTF
  readelf: /home/acme/git/build/v4.20-rc5+/net/ipv4/tcp.o: Warning: possibly corrupt ELF header - it has a non-zero program header offset, but no program headers
    [136] .BTF              PROGBITS        0000000000000000 101d0e 042edf 00      0   0  1

Now try again printing 'struct list_head' from the BTF info just
encoded:

  $ pahole -F btf -C list_head ~/git/build/v4.20-rc5+/net/ipv4/tcp.o  2> /dev/null
  struct list_head {
	  struct list_head *         next;                 /*     0     8 */
	  struct list_head *         prev;                 /*     8     8 */

	  /* size: 16, cachelines: 1, members: 2 */
	  /* last cacheline: 16 bytes */
  };
  $

There is the bitfields case that BTF desn't have the bit_size info for
bitfield members that makes the output from dwarf to be different than
the one from BTF:

  $ pahole -F btf -C sk_buff ~/git/build/v4.20-rc5+/net/ipv4/tcp.o > /tmp/sk_buff.btf
  $ pahole -F dwarf -C sk_buff ~/git/build/v4.20-rc5+/net/ipv4/tcp.o > /tmp/sk_buff.dwarf
  $ diff -u /tmp/sk_buff.dwarf /tmp/sk_buff.btf
  --- /tmp/sk_buff.dwarf	2018-12-20 14:50:51.428653046 -0300
  +++ /tmp/sk_buff.btf	2018-12-20 14:50:46.302601516 -0300
  @@ -38,45 +38,45 @@
   	__u16                      hdr_len;              /*   138     2 */
   	__u16                      queue_mapping;        /*   140     2 */
   	__u8                       __cloned_offset[0];   /*   142     0 */
  -	__u8                       cloned:1;             /*   142: 7  1 */
  -	__u8                       nohdr:1;              /*   142: 6  1 */
  -	__u8                       fclone:2;             /*   142: 4  1 */
  -	__u8                       peeked:1;             /*   142: 3  1 */
  -	__u8                       head_frag:1;          /*   142: 2  1 */
  -	__u8                       xmit_more:1;          /*   142: 1  1 */
  -	__u8                       pfmemalloc:1;         /*   142: 0  1 */
  +	__u8                       cloned;               /*   142     1 */
  +	__u8                       nohdr;                /*   142     1 */
  +	__u8                       fclone;               /*   142     1 */
  +	__u8                       peeked;               /*   142     1 */
  +	__u8                       head_frag;            /*   142     1 */
  +	__u8                       xmit_more;            /*   142     1 */
  +	__u8                       pfmemalloc;           /*   142     1 */

   	/* XXX 1 byte hole, try to pack */

   	__u32                      headers_start[0];     /*   144     0 */
   	__u8                       __pkt_type_offset[0]; /*   144     0 */
  -	__u8                       pkt_type:3;           /*   144: 5  1 */
  -	__u8                       ignore_df:1;          /*   144: 4  1 */
  -	__u8                       nf_trace:1;           /*   144: 3  1 */
  -	__u8                       ip_summed:2;          /*   144: 1  1 */
  -	__u8                       ooo_okay:1;           /*   144: 0  1 */
  -	__u8                       l4_hash:1;            /*   145: 7  1 */
  -	__u8                       sw_hash:1;            /*   145: 6  1 */
  -	__u8                       wifi_acked_valid:1;   /*   145: 5  1 */
  -	__u8                       wifi_acked:1;         /*   145: 4  1 */
  -	__u8                       no_fcs:1;             /*   145: 3  1 */
  -	__u8                       encapsulation:1;      /*   145: 2  1 */
  -	__u8                       encap_hdr_csum:1;     /*   145: 1  1 */
  -	__u8                       csum_valid:1;         /*   145: 0  1 */
  -	__u8                       csum_complete_sw:1;   /*   146: 7  1 */
  -	__u8                       csum_level:2;         /*   146: 5  1 */
  -	__u8                       csum_not_inet:1;      /*   146: 4  1 */
  -	__u8                       dst_pending_confirm:1; /*   146: 3  1 */
  -	__u8                       ndisc_nodetype:2;     /*   146: 1  1 */
  -	__u8                       ipvs_property:1;      /*   146: 0  1 */
  -	__u8                       inner_protocol_type:1; /*   147: 7  1 */
  -	__u8                       remcsum_offload:1;    /*   147: 6  1 */
  -	__u8                       offload_fwd_mark:1;   /*   147: 5  1 */
  -	__u8                       offload_mr_fwd_mark:1; /*   147: 4  1 */
  -	__u8                       tc_skip_classify:1;   /*   147: 3  1 */
  -	__u8                       tc_at_ingress:1;      /*   147: 2  1 */
  -	__u8                       tc_redirected:1;      /*   147: 1  1 */
  -	__u8                       tc_from_ingress:1;    /*   147: 0  1 */
  +	__u8                       pkt_type;             /*   144     1 */
  +	__u8                       ignore_df;            /*   144     1 */
  +	__u8                       nf_trace;             /*   144     1 */
  +	__u8                       ip_summed;            /*   144     1 */
  +	__u8                       ooo_okay;             /*   144     1 */
  +	__u8                       l4_hash;              /*   145     1 */
  +	__u8                       sw_hash;              /*   145     1 */
  +	__u8                       wifi_acked_valid;     /*   145     1 */
  +	__u8                       wifi_acked;           /*   145     1 */
  +	__u8                       no_fcs;               /*   145     1 */
  +	__u8                       encapsulation;        /*   145     1 */
  +	__u8                       encap_hdr_csum;       /*   145     1 */
  +	__u8                       csum_valid;           /*   145     1 */
  +	__u8                       csum_complete_sw;     /*   146     1 */
  +	__u8                       csum_level;           /*   146     1 */
  +	__u8                       csum_not_inet;        /*   146     1 */
  +	__u8                       dst_pending_confirm;  /*   146     1 */
  +	__u8                       ndisc_nodetype;       /*   146     1 */
  +	__u8                       ipvs_property;        /*   146     1 */
  +	__u8                       inner_protocol_type;  /*   147     1 */
  +	__u8                       remcsum_offload;      /*   147     1 */
  +	__u8                       offload_fwd_mark;     /*   147     1 */
  +	__u8                       offload_mr_fwd_mark;  /*   147     1 */
  +	__u8                       tc_skip_classify;     /*   147     1 */
  +	__u8                       tc_at_ingress;        /*   147     1 */
  +	__u8                       tc_redirected;        /*   147     1 */
  +	__u8                       tc_from_ingress;      /*   147     1 */
   	__u16                      tc_index;             /*   148     2 */

   	/* XXX 2 bytes hole, try to pack */
  $

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-12-20 15:23:35 -03:00
Arnaldo Carvalho de Melo 4a21c5c8db v1.12 - New Release
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-08-16 16:15:27 -03:00
Martin KaFai Lau 68645f7fac btf: Add BTF support
This patch introduces BPF Type Format (BTF).

BTF (BPF Type Format) is the meta data format which describes
the data types of BPF program/map.  Hence, it basically focus
on the C programming language which the modern BPF is primary
using.  The first use case is to provide a generic pretty print
capability for a BPF map.

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-07-25 14:42:06 -03:00
Arnaldo Carvalho de Melo 0b81b5ad47 Update version in CMakeLists.txt
The current release is v1.10, but CMakeLists.txt had just v1.9, fix it.

Reported-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-11-20 12:19:06 -03:00
Arnaldo Carvalho de Melo 79536f4f95 cmake: Use INTERFACE_LINK_LIBRARIES
LINK_INTERFACE_LIBRARIES was deprecated.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-09-16 11:31:40 -03:00
Arnaldo Carvalho de Melo dae032ea3f dwarves fprintf: Add extra GNU tags
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-11-20 22:23:14 -02:00
Arnaldo Carvalho de Melo 3a0f0df2e5 cmake: Add ${ELF_LIBRARY} to ctracer, scncopy and pfunct
Noticed on fedora 14, probably we were getting this indirectly, go figure.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-11-20 15:18:01 -02:00
Arnaldo Carvalho de Melo dfbb7dd53d cmake: fix DWARVES_VERSION definition, should be 1.8
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-13 18:02:24 -03:00
Peter Jones c9d1352dfe Add scncopy to CMakeLists.txt
Add scncopy to the build.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-01-12 14:23:54 -02:00
Herton Ronaldo Krzesinski 7bc0b0c656 cmake: Avoid uneeded linking/unused libraries in some dwarves libraries and executables
currently mandriva has a packaging script which checks for uneeded linking in
package built files. For dwarves, it displays:

Warning: unused libraries in /usr/lib64/libdwarves_reorganize.so.1.0.0: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/lib64/libdwarves_emit.so.1.0.0: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/bin/ctracer: libz.so.1
 libdw.so.1

Warning: unused libraries in /usr/bin/syscse: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/bin/pglobal: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/bin/pdwtags: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/bin/prefcnt: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/bin/pfunct: libz.so.1
 libdw.so.1

Warning: unused libraries in /usr/bin/pahole: libz.so.1
 libdw.so.1
 libelf.so.1

Warning: unused libraries in /usr/bin/dtagnames: libdw.so.1
 libelf.so.1
 libz.so.1

Warning: unused libraries in /usr/bin/codiff: libdw.so.1
 libelf.so.1
 libz.so.1

The patch below fixes the issue (removing uneeded specified libraries and using
LINK_INTERFACE_LIBRARIES property, see
http://www.cmake.org/Wiki/CMake_FAQ#Why_are_libraries_linked_to_my_shared_library_included_when_something_links_to_it.3F)

Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-12-17 15:20:27 -02:00
Arnaldo Carvalho de Melo ba928a23ee cmake: set policy for escaping preprocessor definitions to NEW
CMP0005

       Preprocessor definition values are now escaped automatically.
This policy determines whether or not CMake should generate escaped
preprocessor definition values added via add_definitions.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-17 13:05:44 -03:00
Arnaldo Carvalho de Melo e429f8efbb dwarves: Add an rbtree for the functions in a cu
That is used by cus__find_function_by_addr & cu__func_function_by_addr.

First user is pfunct --addr, but this is really for pfunct --annotate, that
will process a perf.data file generated by 'perf report', load the debugging
info and regenerate the functions (pfunct -TVi like) that had hits, using
libdisasm to show the assembly code, etc.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-06-04 14:56:44 -03:00
Arnaldo Carvalho de Melo a693b7fde9 cmake: move headers to /usr/include/dwarves/ and tag 1.8pre1
In reponse to https://bugzilla.redhat.com/show_bug.cgi?id=497285 I
included the header files that are needed by the dwarves*.h files
and moved them to /usr/include/dwarves.h.

The CTF work is not completed yet, but the non-CTF related improvements
(progressive loading of CUs, etc) are worth a release till I can get back to
dedicate solid time for developing these tools again.

Reported-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-23 15:13:50 -03:00
Arnaldo Carvalho de Melo f84bf73d54 dwarves: Move the fprintf code to a new source file.
$ wc -l dwarves.c dwarves_fprintf.c
 1468 dwarves.c
 1554 dwarves_fprintf.c
 3022 total
$

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-04-19 13:48:51 -03:00
Arnaldo Carvalho de Melo 0954d75152 elf_symtab: Introduce elf_symtab
We will need this when encoding the CTF functions section.  Things like lookup
a function by its address when converting from a DW_TAG_subprogram to a CTF
function, for instance.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-24 16:58:44 -03:00
Arnaldo Carvalho de Melo feab8aa5e3 ctf: Include the initial implementation of a ctf encoder
"pahole -Z foo" will create foo.SUNW_ctf, that if objcopy
--add-section'ed to the right word-sized object will work, sans VARARGS,
that will get fixed soon (as in, probably, tomorrow).

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2009-03-19 12:16:07 -03:00