1. 25 Oct, 2022 1 commit
    • Arnaldo Carvalho de Melo's avatar
      perf bpf: Fix build with libbpf 0.7.0 by checking if bpf_program__set_insns() is available · f1bdebbb
      Arnaldo Carvalho de Melo authored
      
      During the transition to libbpf 1.0 some functions that perf used were
      deprecated and finally removed from libbpf, so bpf_program__set_insns()
      was introduced for perf to continue to use its bpf loader.
      
      But when build with LIBBPF_DYNAMIC=1 we now need to check if that
      function is available so that perf can build with older libbpf versions,
      even if the end result is emitting a warning to the user that the use
      of the perf BPF loader requires a newer libbpf, since bpf_program__set_insns()
      touches libbpf objects internal state.
      
      This affects only 'perf trace' when using bpf C code or pre-compiled
      bytecode as an event.
      
      Noticed on RHEL9, that has libbpf 0.7.0, where bpf_program__set_insns()
      isn't available.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f1bdebbb
  2. 10 Aug, 2022 3 commits
    • Roberto Sassu's avatar
      tools build: Switch to new openssl API for test-libcrypto · 5b245985
      Roberto Sassu authored
      Switch to new EVP API for detecting libcrypto, as Fedora 36 returns an
      error when it encounters the deprecated function MD5_Init() and the others.
      
      The error would be interpreted as missing libcrypto, while in reality it is
      not.
      
      Fixes: 6e8ccb4f
      
       ("tools/bpf: properly account for libbfd variations")
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: bpf@vger.kernel.org
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: llvm@lists.linux.dev
      Cc: Martin KaFai Lau <martin.lau@linux.dev>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stanislav Fomichev <sdf@google.com>
      Link: https://lore.kernel.org/r/20220719170555.2576993-4-roberto.sassu@huawei.com
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5b245985
    • Arnaldo Carvalho de Melo's avatar
      Revert "perf build: Suppress openssl v3 deprecation warnings in libcrypto feature test" · 73f8ec59
      Arnaldo Carvalho de Melo authored
      This reverts commit 10fef869
      
      .
      
      Because a proper fix was submitted.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      73f8ec59
    • Roberto Sassu's avatar
      tools, build: Retry detection of bfd-related features · 629b98e2
      Roberto Sassu authored
      
      While separate features have been defined to determine which linking flags
      are required to use libbfd depending on the distribution (libbfd,
      libbfd-liberty and libbfd-liberty-z), the same has not been done for other
      features requiring linking to libbfd.
      
      For example, disassembler-four-args requires linking to libbfd too, but it
      should use the right linking flags. If not all the required ones are
      specified, e.g. -liberty, detection will always fail even if the feature is
      available.
      
      Instead of creating new features, similarly to libbfd, simply retry
      detection with the different set of flags until detection succeeds (or
      fails, if the libraries are missing). In this way, feature detection is
      transparent for the users of this building mechanism (e.g. perf), and those
      users don't have for example to set an appropriate value for the
      FEATURE_CHECK_LDFLAGS-disassembler-four-args variable.
      
      The number of retries and features for which the retry mechanism is
      implemented is low enough to make the increase in the complexity of
      Makefile negligible.
      
      Tested with perf and bpftool on Ubuntu 20.04.4 LTS, Fedora 36 and openSUSE
      Tumbleweed.
      
      Committer notes:
      
      Do the retry for disassembler-init-styled as well.
      Signed-off-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Martin KaFai Lau <martin.lau@linux.dev>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stanislav Fomichev <sdf@google.com>
      Cc: bpf@vger.kernel.org
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20220719170555.2576993-1-roberto.sassu@huawei.com
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      629b98e2
  3. 02 Aug, 2022 1 commit
    • Zixuan Tan's avatar
      perf build: Suppress openssl v3 deprecation warnings in libcrypto feature test · 10fef869
      Zixuan Tan authored
      
      With OpenSSL v3 installed, the libcrypto feature check fails as it use the
      deprecated MD5_* API (and is compiled with -Werror). The error message is
      as follows.
      
      $ make tools/perf
      ```
      Makefile.config:778: No libcrypto.h found, disables jitted code injection,
      please install openssl-devel or libssl-dev
      
      Auto-detecting system features:
      ...                         dwarf: [ on  ]
      ...            dwarf_getlocations: [ on  ]
      ...                         glibc: [ on  ]
      ...                        libbfd: [ on  ]
      ...                libbfd-buildid: [ on  ]
      ...                        libcap: [ on  ]
      ...                        libelf: [ on  ]
      ...                       libnuma: [ on  ]
      ...        numa_num_possible_cpus: [ on  ]
      ...                       libperl: [ on  ]
      ...                     libpython: [ on  ]
      ...                     libcrypto: [ OFF ]
      ...                     libunwind: [ on  ]
      ...            libdw-dwarf-unwind: [ on  ]
      ...                          zlib: [ on  ]
      ...                          lzma: [ on  ]
      ...                     get_cpuid: [ on  ]
      ...                           bpf: [ on  ]
      ...                        libaio: [ on  ]
      ...                       libzstd: [ on  ]
      ...        disassembler-four-args: [ on  ]
      ```
      
      This is very confusing because the suggested library (on my Ubuntu 20.04
      it is libssl-dev) is already installed. As the test only checks for the
      presence of libcrypto, this commit suppresses the deprecation warning to
      allow the test to pass.
      Signed-off-by: default avatarZixuan Tan <tanzixuan.me@gmail.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: KP Singh <kpsingh@kernel.org>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Link: https://lore.kernel.org/r/20220625153439.513559-1-tanzixuan.me@gmail.com
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      10fef869
  4. 01 Aug, 2022 1 commit
  5. 26 May, 2022 6 commits
    • Arnaldo Carvalho de Melo's avatar
      perf build: Stop using __weak bpf_map_create() to handle older libbpf versions · df76e003
      Arnaldo Carvalho de Melo authored
      By adding a feature test for bpf_map_create() and providing a fallback if
      it isn't present in older versions of libbpf.
      
      This also fixes the build with torvalds/master at this point:
      
        $ git log --oneline -5 torvalds/master
        babf0bb9 (torvalds/master) Merge tag 'xfs-5.19-for-linus' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
        e375780b Merge tag 'fsnotify_for_v5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
        8b728edc Merge tag 'fs_for_v5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
        3f306ea2 Merge tag 'dma-mapping-5.19-2022-05-25' of git://git.infradead.org/users/hch/dma-mapping
        fbe86dac Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
        $
      
      Coping with:
      
        $ git log --oneline -2 d16495a9
        d16495a9 libbpf: remove bpf_create_map*() APIs
        e2371b16 libbpf: start 1.0 development cycle
        $
      
      As the __weak function fails to build as it calls the now removed
      bpf_create_map() API.
      
      Testing:
      
        $ rpm -q libbpf-devel
        libbpf-devel-0.4.0-2.fc35.x86_64
        $
        $ make -C tools/perf BUILD_BPF_SKEL=1 LIBBPF_DYNAMIC=1 O=/tmp/build/perf install-bin
        $ cat /tmp/build/perf/feature/test-libbpf-bpf_map_create.make.output
        test-libbpf-bpf_map_create.c: In function ‘main’:
        test-libbpf-bpf_map_create.c:6:16: error: implicit declaration of function ‘bpf_map_create’; did you mean ‘bpf_map_freeze’? [-Werror=implicit-function-declaration]
            6 |         return bpf_map_create(0 /* map_type */, NULL /* map_name */, 0, /* key_size */,
              |                ^~~~~~~~~~~~~~
              |                bpf_map_freeze
        test-libbpf-bpf_map_create.c:6:87: error: expected expression before ‘,’ token
            6 |         return bpf_map_create(0 /* map_type */, NULL /* map_name */, 0, /* key_size */,
              |                                                                                       ^
        cc1: all warnings being treated as errors
        $
        $ objdump -dS /tmp/build/perf/perf | grep '<bpf_map_create>:' -A20
        000000000058b290 <bpf_map_create>:
        {
          58b290:	55                   	push   %rbp
          58b291:	48 89 e5             	mov    %rsp,%rbp
          58b294:	48 83 ec 10          	sub    $0x10,%rsp
          58b298:	64 48 8b 04 25 28 00 	mov    %fs:0x28,%rax
          58b29f:	00 00
          58b2a1:	48 89 45 f8          	mov    %rax,-0x8(%rbp)
          58b2a5:	31 c0                	xor    %eax,%eax
        	return bpf_create_map(map_type, key_size, value_size, max_entries, 0);
          58b2a7:	48 8b 45 f8          	mov    -0x8(%rbp),%rax
          58b2ab:	64 48 2b 04 25 28 00 	sub    %fs:0x28,%rax
          58b2b2:	00 00
          58b2b4:	75 10                	jne    58b2c6 <bpf_map_create+0x36>
        }
          58b2b6:	c9                   	leave
          58b2b7:	89 d6                	mov    %edx,%esi
          58b2b9:	89 ca                	mov    %ecx,%edx
          58b2bb:	44 89 c1             	mov    %r8d,%ecx
        	return bpf_create_map(map_type, key_size, value_size, max_entries, 0);
          58b2be:	45 31 c0             	xor    %r8d,%r8d
        $
      
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ilya Leoshkevich <iii@linux.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: http://lore.kernel.org/linux-perf-users/Yo+XvQNKL4K5khl2@kernel.org
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      df76e003
    • Jiri Olsa's avatar
      perf build: Stop using __weak btf__raw_data() to handle older libbpf versions · 982be477
      Jiri Olsa authored
      
      By adding a feature test for btf__raw_data() and providing a fallback if
      it isn't present in older versions of libbpf.
      
      Committer testing:
      
        $ rpm -q libbpf-devel
        libbpf-devel-0.4.0-2.fc35.x86_64
        $ make -C tools/perf LIBBPF_DYNAMIC=1 O=/tmp/build/perf install-bin
        $ cat /tmp/build/perf/feature/test-libbpf-btf__raw_data.make.output
        test-libbpf-btf__raw_data.c: In function ‘main’:
        test-libbpf-btf__raw_data.c:6:9: error: implicit declaration of function ‘btf__raw_data’; did you mean ‘btf__get_raw_data’? [-Werror=implicit-function-declaration]
            6 |         btf__raw_data(NULL /* btf_ro */, NULL /* size */);
              |         ^~~~~~~~~~~~~
              |         btf__get_raw_data
        cc1: all warnings being treated as errors
        $ objdump -dS /tmp/build/perf/perf | grep '<btf__raw_data>:' -A20
        00000000005b3050 <btf__raw_data>:
        {
          5b3050:	55                   	push   %rbp
          5b3051:	48 89 e5             	mov    %rsp,%rbp
          5b3054:	48 83 ec 10          	sub    $0x10,%rsp
          5b3058:	64 48 8b 04 25 28 00 	mov    %fs:0x28,%rax
          5b305f:	00 00
          5b3061:	48 89 45 f8          	mov    %rax,-0x8(%rbp)
          5b3065:	31 c0                	xor    %eax,%eax
      	  return btf__get_raw_data(btf_ro, size);
          5b3067:	48 8b 45 f8          	mov    -0x8(%rbp),%rax
          5b306b:	64 48 2b 04 25 28 00 	sub    %fs:0x28,%rax
          5b3072:	00 00
          5b3074:	75 06                	jne    5b307c <btf__raw_data+0x2c>
        }
          5b3076:	c9                   	leave
      	  return btf__get_raw_data(btf_ro, size);
          5b3077:	e9 14 99 e5 ff       	jmp    40c990 <btf__get_raw_data@plt>
          5b307c:	e8 af a7 e5 ff       	call   40d830 <__stack_chk_fail@plt>
          5b3081:	66 66 2e 0f 1f 84 00 	data16 cs nopw 0x0(%rax,%rax,1)
          5b3088:	00 00 00 00
          $
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ilya Leoshkevich <iii@linux.ibm.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: http://lore.kernel.org/linux-perf-users/YozLKby7ITEtchC9@krava
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      982be477
    • Jiri Olsa's avatar
      perf build: Stop using __weak bpf_object__next_map() to handle older libbpf versions · 739c9180
      Jiri Olsa authored
      
      By adding a feature test for bpf_object__next_map() and providing a fallback if
      it isn't present in older versions of libbpf.
      
      Committer testing:
      
        $ rpm -q libbpf-devel
        libbpf-devel-0.4.0-2.fc35.x86_64
        $ make -C tools/perf LIBBPF_DYNAMIC=1 O=/tmp/build/perf install-bin
        $ cat /tmp/build/perf/feature/test-libbpf-bpf_object__next_map.make.output
        test-libbpf-bpf_object__next_map.c: In function ‘main’:
        test-libbpf-bpf_object__next_map.c:6:9: error: implicit declaration of function ‘bpf_object__next_map’; did you mean ‘bpf_object__next’? [-Werror=implicit-function-declaration]
            6 |         bpf_object__next_map(NULL /* obj */, NULL /* prev */);
              |         ^~~~~~~~~~~~~~~~~~~~
              |         bpf_object__next
          cc1: all warnings being treated as errors
        $
        $ objdump -dS /tmp/build/perf/perf | grep '<bpf_object__next_map>:' -A20
        00000000005b2e00 <bpf_object__next_map>:
        {
          5b2e00:	55                   	push   %rbp
          5b2e01:	48 89 e5             	mov    %rsp,%rbp
          5b2e04:	48 83 ec 10          	sub    $0x10,%rsp
          5b2e08:	64 48 8b 04 25 28 00 	mov    %fs:0x28,%rax
          5b2e0f:	00 00
          5b2e11:	48 89 45 f8          	mov    %rax,-0x8(%rbp)
          5b2e15:	31 c0                	xor    %eax,%eax
      	  return bpf_map__next(prev, obj);
          5b2e17:	48 8b 45 f8          	mov    -0x8(%rbp),%rax
          5b2e1b:	64 48 2b 04 25 28 00 	sub    %fs:0x28,%rax
          5b2e22:	00 00
          5b2e24:	75 0f                	jne    5b2e35 <bpf_object__next_map+0x35>
        }
          5b2e26:	c9                   	leave
          5b2e27:	49 89 f8             	mov    %rdi,%r8
          5b2e2a:	48 89 f7             	mov    %rsi,%rdi
      	  return bpf_map__next(prev, obj);
          5b2e2d:	4c 89 c6             	mov    %r8,%rsi
          5b2e30:	e9 cb b1 e5 ff       	jmp    40e000 <bpf_map__next@plt>
        $
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ilya Leoshkevich <iii@linux.ibm.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: http://lore.kernel.org/linux-perf-users/YozLKby7ITEtchC9@krava
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      739c9180
    • Jiri Olsa's avatar
      perf build: Stop using __weak bpf_object__next_program() to handle older libbpf versions · 8916d725
      Jiri Olsa authored
      
      By adding a feature test for bpf_object__next_program() and providing a fallback if
      it isn't present in older versions of libbpf.
      
      Committer testing:
      
        $ rpm -q libbpf-devel
        libbpf-devel-0.4.0-2.fc35.x86_64
        $ make -C tools/perf LIBBPF_DYNAMIC=1 O=/tmp/build/perf install-bin
        $ cat /tmp/build/perf/feature/test-libbpf-bpf_object__next_program.make.output
        test-libbpf-bpf_object__next_program.c: In function ‘main’:
        test-libbpf-bpf_object__next_program.c:6:9: error: implicit declaration of function ‘bpf_object__next_program’; did you mean ‘bpf_object__unpin_programs’? [-Werror=implicit-function-declaration]
            6 |         bpf_object__next_program(NULL /* obj */, NULL /* prev */);
              |         ^~~~~~~~~~~~~~~~~~~~~~~~
              |         bpf_object__unpin_programs
        cc1: all warnings being treated as errors
        $
        $ objdump -dS /tmp/build/perf/perf | grep '<bpf_object__next_program>:' -A20
        00000000005b2dc0 <bpf_object__next_program>:
        {
          5b2dc0:	55                   	push   %rbp
          5b2dc1:	48 89 e5             	mov    %rsp,%rbp
          5b2dc4:	48 83 ec 10          	sub    $0x10,%rsp
          5b2dc8:	64 48 8b 04 25 28 00 	mov    %fs:0x28,%rax
          5b2dcf:	00 00
          5b2dd1:	48 89 45 f8          	mov    %rax,-0x8(%rbp)
          5b2dd5:	31 c0                	xor    %eax,%eax
      	  return bpf_program__next(prev, obj);
          5b2dd7:	48 8b 45 f8          	mov    -0x8(%rbp),%rax
          5b2ddb:	64 48 2b 04 25 28 00 	sub    %fs:0x28,%rax
          5b2de2:	00 00
          5b2de4:	75 0f                	jne    5b2df5 <bpf_object__next_program+0x35>
        }
          5b2de6:	c9                   	leave
          5b2de7:	49 89 f8             	mov    %rdi,%r8
          5b2dea:	48 89 f7             	mov    %rsi,%rdi
      	  return bpf_program__next(prev, obj);
          5b2ded:	4c 89 c6             	mov    %r8,%rsi
          5b2df0:	e9 3b b4 e5 ff       	jmp    40e230 <bpf_program__next@plt>
          $
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ilya Leoshkevich <iii@linux.ibm.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: http://lore.kernel.org/linux-perf-users/YozLKby7ITEtchC9@krava
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8916d725
    • Jiri Olsa's avatar
      perf build: Stop using __weak bpf_prog_load() to handle older libbpf versions · 5c83eff3
      Jiri Olsa authored
      
      By adding a feature test for bpf_prog_load() and providing a fallback if
      it isn't present in older versions of libbpf.
      
      Committer testing:
      
        $ rpm -q libbpf-devel
        libbpf-devel-0.4.0-2.fc35.x86_64
        $ make -C tools/perf LIBBPF_DYNAMIC=1 O=/tmp/build/perf install-bin
        $ cat /tmp/build/perf/feature/test-libbpf-bpf_prog_load.make.output
        test-libbpf-bpf_prog_load.c: In function ‘main’:
        test-libbpf-bpf_prog_load.c:6:16: error: implicit declaration of function ‘bpf_prog_load’ [-Werror=implicit-function-declaration]
            6 |         return bpf_prog_load(0 /* prog_type */, NULL /* prog_name */,
              |                ^~~~~~~~~~~~~
        cc1: all warnings being treated as errors
        $
      
        $ objdump -dS /tmp/build/perf/perf | grep '<bpf_prog_load>:' -A20
        00000000005b2d70 <bpf_prog_load>:
        {
          5b2d70:	55                   	push   %rbp
          5b2d71:	48 89 ce             	mov    %rcx,%rsi
          5b2d74:	4c 89 c8             	mov    %r9,%rax
          5b2d77:	49 89 d2             	mov    %rdx,%r10
          5b2d7a:	4c 89 c2             	mov    %r8,%rdx
          5b2d7d:	48 89 e5             	mov    %rsp,%rbp
          5b2d80:	48 83 ec 18          	sub    $0x18,%rsp
          5b2d84:	64 48 8b 0c 25 28 00 	mov    %fs:0x28,%rcx
          5b2d8b:	00 00
          5b2d8d:	48 89 4d f8          	mov    %rcx,-0x8(%rbp)
          5b2d91:	31 c9                	xor    %ecx,%ecx
        	return bpf_load_program(prog_type, insns, insn_cnt, license,
          5b2d93:	41 8b 49 5c          	mov    0x5c(%r9),%ecx
          5b2d97:	51                   	push   %rcx
          5b2d98:	4d 8b 49 60          	mov    0x60(%r9),%r9
          5b2d9c:	4c 89 d1             	mov    %r10,%rcx
          5b2d9f:	44 8b 40 1c          	mov    0x1c(%rax),%r8d
          5b2da3:	e8 f8 aa e5 ff       	call   40d8a0 <bpf_load_program@plt>
        }
        $
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ilya Leoshkevich <iii@linux.ibm.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: http://lore.kernel.org/linux-perf-users/YozLKby7ITEtchC9@krava
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5c83eff3
    • Jiri Olsa's avatar
      perf build: Fix btf__load_from_kernel_by_id() feature check · 73534617
      Jiri Olsa authored
      The btf__load_from_kernel_by_id() only takes one arg, not two.
      
      Committer notes:
      
      I tested it just with an older libbpf, one where
      btf__load_from_kernel_by_id() wasn't introduced yet.
      
      A test with a newer dynamic libbpf would fail because the
      btf__load_from_kernel_by_id() is there, but takes just one arg.
      
      Fixes: 0ae065a5
      
       ("perf build: Fix check for btf__load_from_kernel_by_id() in libbpf")
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ilya Leoshkevich <iii@linux.ibm.com>
      Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: http://lore.kernel.org/linux-perf-users/YozLKby7ITEtchC9@krava
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      73534617
  6. 20 May, 2022 1 commit
    • Arnaldo Carvalho de Melo's avatar
      perf build: Fix check for btf__load_from_kernel_by_id() in libbpf · 0ae065a5
      Arnaldo Carvalho de Melo authored
      Avi Kivity reported a problem where the __weak
      btf__load_from_kernel_by_id() in tools/perf/util/bpf-event.c was being
      used and it called btf__get_from_id() in tools/lib/bpf/btf.c that in
      turn called back to btf__load_from_kernel_by_id(), resulting in an
      endless loop.
      
      Fix this by adding a feature test to check if
      btf__load_from_kernel_by_id() is available when building perf with
      LIBBPF_DYNAMIC=1, and if not then provide the fallback to the old
      btf__get_from_id(), that doesn't call back to btf__load_from_kernel_by_id()
      since at that time it didn't exist at all.
      
      Tested on Fedora 35 where we have libbpf-devel 0.4.0 with LIBBPF_DYNAMIC
      where we don't have btf__load_from_kernel_by_id() and thus its feature
      test fail, not defining HAVE_LIBBPF_BTF__LOAD_FROM_KERNEL_BY_ID:
      
        $ cat /tmp/build/perf-urgent/feature/test-libbpf-btf__load_from_kernel_by_id.make.output
        test-libbpf-btf__load_from_kernel_by_id.c: In function ‘main’:
        test-libbpf-btf__load_from_kernel_by_id.c:6:16: error: implicit declaration of function ‘btf__load_from_kernel_by_id’ [-Werror=implicit-function-declaration]
            6 |         return btf__load_from_kernel_by_id(20151128, NULL);
              |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
        cc1: all warnings being treated as errors
        $
      
        $ nm /tmp/build/perf-urgent/perf | grep btf__load_from_kernel_by_id
        00000000005ba180 T btf__load_from_kernel_by_id
        $
      
        $ objdump --disassemble=btf__load_from_kernel_by_id -S /tmp/build/perf-urgent/perf
      
        /tmp/build/perf-urgent/perf:     file format elf64-x86-64
        <SNIP>
        00000000005ba180 <btf__load_from_kernel_by_id>:
        #include "record.h"
        #include "util/synthetic-events.h"
      
        #ifndef HAVE_LIBBPF_BTF__LOAD_FROM_KERNEL_BY_ID
        struct btf *btf__load_from_kernel_by_id(__u32 id)
        {
          5ba180:	55                   	push   %rbp
          5ba181:	48 89 e5             	mov    %rsp,%rbp
          5ba184:	48 83 ec 10          	sub    $0x10,%rsp
          5ba188:	64 48 8b 04 25 28 00 	mov    %fs:0x28,%rax
          5ba18f:	00 00
          5ba191:	48 89 45 f8          	mov    %rax,-0x8(%rbp)
          5ba195:	31 c0                	xor    %eax,%eax
               struct btf *btf;
        #pragma GCC diagnostic push
        #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
               int err = btf__get_from_id(id, &btf);
          5ba197:	48 8d 75 f0          	lea    -0x10(%rbp),%rsi
          5ba19b:	e8 a0 57 e5 ff       	call   40f940 <btf__get_from_id@plt>
          5ba1a0:	89 c2                	mov    %eax,%edx
        #pragma GCC diagnostic pop
      
               return err ? ERR_PTR(err) : btf;
          5ba1a2:	48 98                	cltq
          5ba1a4:	85 d2                	test   %edx,%edx
          5ba1a6:	48 0f 44 45 f0       	cmove  -0x10(%rbp),%rax
        }
        <SNIP>
      
      Fixes: 218e7b77
      
       ("perf bpf: Provide a weak btf__load_from_kernel_by_id() for older libbpf versions")
      Reported-by: default avatarAvi Kivity <avi@scylladb.com>
      Link: https://lore.kernel.org/linux-perf-users/f0add43b-3de5-20c5-22c4-70aff4af959f@scylladb.com
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/linux-perf-users/YobjjFOblY4Xvwo7@kernel.org
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0ae065a5
  7. 09 Apr, 2022 2 commits
    • Arnaldo Carvalho de Melo's avatar
      tools build: Filter out options and warnings not supported by clang · 41caff45
      Arnaldo Carvalho de Melo authored
      These make the feature check fail when using clang, so remove them just
      like is done in tools/perf/Makefile.config to build perf itself.
      
      Adding -Wno-compound-token-split-by-macro to tools/perf/Makefile.config
      when building with clang is also necessary to avoid these warnings
      turned into errors (-Werror):
      
          CC      /tmp/build/perf/util/scripting-engines/trace-event-perl.o
        In file included from util/scripting-engines/trace-event-perl.c:35:
        In file included from /usr/lib64/perl5/CORE/perl.h:4085:
        In file included from /usr/lib64/perl5/CORE/hv.h:659:
        In file included from /usr/lib64/perl5/CORE/hv_func.h:34:
        In file included from /usr/lib64/perl5/CORE/sbox32_hash.h:4:
        /usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
            ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /usr/lib64/perl5/CORE/zaphod32_hash.h:80:38: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
        #define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START {  \
                                             ^~~~~~~~~~
        /usr/lib64/perl5/CORE/perl.h:737:29: note: expanded from macro 'STMT_START'
        #   define STMT_START   (void)( /* gcc supports "({ STATEMENTS; })" */
                                      ^
        /usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: note: '{' token is here
            ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /usr/lib64/perl5/CORE/zaphod32_hash.h:80:49: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
        #define ZAPHOD32_SCRAMBLE32(v,prime) STMT_START {  \
                                                        ^
        /usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: error: '}' and ')' tokens terminating statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
            ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /usr/lib64/perl5/CORE/zaphod32_hash.h:87:41: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
            v ^= (v>>23);                       \
                                                ^
        /usr/lib64/perl5/CORE/zaphod32_hash.h:150:5: note: ')' token is here
            ZAPHOD32_SCRAMBLE32(state[0],0x9fade23b);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /usr/lib64/perl5/CORE/zaphod32_hash.h:88:3: note: expanded from macro 'ZAPHOD32_SCRAMBLE32'
        } STMT_END
          ^~~~~~~~
        /usr/lib64/perl5/CORE/perl.h:738:21: note: expanded from macro 'STMT_END'
        #   define STMT_END     )
                                ^
      
      Please refer to the discussion on the Link: tag below, where Nathan
      clarifies the situation:
      
      <quote>
      acme> And then get to the problems at the end of this message, which seem
      acme> similar to the problem described here:
      acme>
      acme> From  Nathan Chancellor <>
      acme> Subject	[PATCH] mwifiex: Remove unnecessary braces from HostCmd_SET_SEQ_NO_BSS_INFO
      acme>
      acme> https://lkml.org/lkml/2020/9/1/135
      acme>
      acme> So perhaps in this case its better to disable that
      acme> -Werror,-Wcompound-token-split-by-macro when building with clang?
      
      Yes, I think that is probably the best solution. As far as I can tell,
      at least in this file and context, the warning appears harmless, as the
      "create a GNU C statement expression from two different macros" is very
      much intentional, based on the presence of PERL_USE_GCC_BRACE_GROUPS.
      The warning is fixed in upstream Perl by just avoiding creating GNU C
      statement expressions using STMT_START and STMT_END:
      
        https://github.com/Perl/perl5/issues/18780
        https://github.com/Perl/perl5/pull/18984
      
      
      
      If I am reading the source code correctly, an alternative to disabling
      the warning would be specifying -DPERL_GCC_BRACE_GROUPS_FORBIDDEN but it
      seems like that might end up impacting more than just this site,
      according to the issue discussion above.
      </quote>
      Based-on-a-patch-by: default avatarSedat Dilek <sedat.dilek@gmail.com>
      Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # Debian/Selfmade LLVM-14 (x86-64)
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Keeping <john@metanate.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Link: http://lore.kernel.org/lkml/YkxWcYzph5pC1EK8@kernel.org
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      41caff45
    • Arnaldo Carvalho de Melo's avatar
      tools build: Use $(shell ) instead of `` to get embedded libperl's ccopts · 541f695c
      Arnaldo Carvalho de Melo authored
      Just like its done for ldopts and for both in tools/perf/Makefile.config.
      
      Using `` to initialize PERL_EMBED_CCOPTS somehow precludes using:
      
        $(filter-out SOMETHING_TO_FILTER,$(PERL_EMBED_CCOPTS))
      
      And we need to do it to allow for building with versions of clang where
      some gcc options selected by distros are not available.
      
      Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # Debian/Selfmade LLVM-14 (x86-64)
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Keeping <john@metanate.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Link: http://lore.kernel.org/lkml/YktYX2OnLtyobRYD@kernel.org
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      541f695c
  8. 07 Dec, 2021 1 commit
    • Arnaldo Carvalho de Melo's avatar
      tools build: Remove needless libpython-version feature check that breaks test-all fast path · 3d1d57de
      Arnaldo Carvalho de Melo authored
      Since 66dfdff0 ("perf tools: Add Python 3 support") we don't use
      the tools/build/feature/test-libpython-version.c version in any Makefile
      feature check:
      
        $ find tools/ -type f | xargs grep feature-libpython-version
        $
      
      The only place where this was used was removed in 66dfdff0
      
      :
      
        -        ifneq ($(feature-libpython-version), 1)
        -          $(warning Python 3 is not yet supported; please set)
        -          $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
        -          $(warning If you also have Python 2 installed, then)
        -          $(warning try something like:)
        -          $(warning $(and ,))
        -          $(warning $(and ,)  make PYTHON=python2)
        -          $(warning $(and ,))
        -          $(warning Otherwise, disable Python support entirely:)
        -          $(warning $(and ,))
        -          $(warning $(and ,)  make NO_LIBPYTHON=1)
        -          $(warning $(and ,))
        -          $(error   $(and ,))
        -        else
        -          LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
        -          EXTLIBS += $(PYTHON_EMBED_LIBADD)
        -          LANG_BINDINGS += $(obj-perf)python/perf.so
        -          $(call detected,CONFIG_LIBPYTHON)
        -        endif
      
      And nowadays we either build with PYTHON=python3 or just install the
      python3 devel packages and perf will build against it.
      
      But the leftover feature-libpython-version check made the fast path
      feature detection to break in all cases except when python2 devel files
      were installed:
      
        $ rpm -qa | grep python.*devel
        python3-devel-3.9.7-1.fc34.x86_64
        $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf ;
        $ make -C tools/perf O=/tmp/build/perf install-bin
        make: Entering directory '/var/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j32' parallel build
          HOSTCC  /tmp/build/perf/fixdep.o
        <SNIP>
        $ cat /tmp/build/perf/feature/test-all.make.output
        In file included from test-all.c:18:
        test-libpython-version.c:5:10: error: #error
            5 |         #error
              |          ^~~~~
        $ ldd ~/bin/perf | grep python
      	libpython3.9.so.1.0 => /lib64/libpython3.9.so.1.0 (0x00007fda6dbcf000)
        $
      
      As python3 is the norm these days, fix this by just removing the unused
      feature-libpython-version feature check, making the test-all fast path
      to work with the common case.
      
      With this:
      
        $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf ;
        $ make -C tools/perf O=/tmp/build/perf install-bin |& head
        make: Entering directory '/var/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j32' parallel build
          HOSTCC  /tmp/build/perf/fixdep.o
          HOSTLD  /tmp/build/perf/fixdep-in.o
          LINK    /tmp/build/perf/fixdep
      
        Auto-detecting system features:
        ...                         dwarf: [ on  ]
        ...            dwarf_getlocations: [ on  ]
        ...                         glibc: [ on  ]
        $ ldd ~/bin/perf | grep python
      	libpython3.9.so.1.0 => /lib64/libpython3.9.so.1.0 (0x00007f58800b0000)
        $ cat /tmp/build/perf/feature/test-all.make.output
        $
      Reviewed-by: default avatarJames Clark <james.clark@arm.com>
      Fixes: 66dfdff0 ("perf tools: Add Python 3 support")
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jaroslav Škarvada <jskarvad@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/YaYmeeC6CS2b8OSz@kernel.org
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3d1d57de
  9. 26 Nov, 2021 1 commit
    • Tiezhu Yang's avatar
      bpf, mips: Fix build errors about __NR_bpf undeclared · e32cb12f
      Tiezhu Yang authored
      Add the __NR_bpf definitions to fix the following build errors for mips:
      
        $ cd tools/bpf/bpftool
        $ make
        [...]
        bpf.c:54:4: error: #error __NR_bpf not defined. libbpf does not support your arch.
         #  error __NR_bpf not defined. libbpf does not support your arch.
            ^~~~~
        bpf.c: In function ‘sys_bpf’:
        bpf.c:66:17: error: ‘__NR_bpf’ undeclared (first use in this function); did you mean ‘__NR_brk’?
          return syscall(__NR_bpf, cmd, attr, size);
                         ^~~~~~~~
                         __NR_brk
        [...]
        In file included from gen_loader.c:15:0:
        skel_internal.h: In function ‘skel_sys_bpf’:
        skel_internal.h:53:17: error: ‘__NR_bpf’ undeclared (first use in this function); did you mean ‘__NR_brk’?
          return syscall(__NR_bpf, cmd, attr, size);
                         ^~~~~~~~
                         __NR_brk
      
      We can see the following generated definitions:
      
        $ grep -r "#define __NR_bpf" arch/mips
        arch/mips/include/generated/uapi/asm/unistd_o32.h:#define __NR_bpf (__NR_Linux + 355)
        arch/mips/include/generated/uapi/asm/unistd_n64.h:#define __NR_bpf (__NR_Linux + 315)
        arch/mips/include/generated/uapi/asm/unistd_n32.h:#define __NR_bpf (__NR_Linux + 319)
      
      The __NR_Linux is defined in arch/mips/include/uapi/asm/unistd.h:
      
        $ grep -r "#define __NR_Linux" arch/mips
        arch/mips/include/uapi/asm/unistd.h:#define __NR_Linux	4000
        arch/mips/include/uapi/asm/unistd.h:#define __NR_Linux	5000
        arch/mips/include/uapi/asm/unistd.h:#define __NR_Linux	6000
      
      That is to say, __NR_bpf is:
      
        4000 + 355 = 4355 for mips o32,
        6000 + 319 = 6319 for mips n32,
        5000 + 315 = 5315 for mips n64.
      
      So use the GCC pre-defined macro _ABIO32, _ABIN32 and _ABI64 [1] to define
      the corresponding __NR_bpf.
      
      This patch is similar with commit bad1926d ("bpf, s390: fix build for
      libbpf and selftest suite").
      
        [1] https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/mips/mips.h#l549
      
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/1637804167-8323-1-git-send-email-yangtiezhu@loongson.cn
      e32cb12f
  10. 18 Nov, 2021 1 commit
    • Arnaldo Carvalho de Melo's avatar
      tools build: Fix removal of feature-sync-compare-and-swap feature detection · e8c04ea0
      Arnaldo Carvalho de Melo authored
      The patch removing the feature-sync-compare-and-swap feature detection
      didn't remove the call to main_test_sync_compare_and_swap(), making the
      'test-all' case fail an all the feature tests to be performed
      individually:
      
        $ cat /tmp/build/perf/feature/test-all.make.output
        In file included from test-all.c:18:
        test-libpython-version.c:5:10: error: #error
            5 |         #error
              |          ^~~~~
        test-all.c: In function ‘main’:
        test-all.c:203:9: error: implicit declaration of function ‘main_test_sync_compare_and_swap’ [-Werror=implicit-function-declaration]
          203 |         main_test_sync_compare_and_swap(argc, argv);
              |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        cc1: all warnings being treated as errors
        $
      
      Fix it, now to figure out what is that test-libpython-version.c
      problem...
      
      Fixes: 60fa754b ("tools: Remove feature-sync-compare-and-swap feature detection")
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/lkml/YZU9Fe0sgkHSXeC2@kernel.org
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e8c04ea0
  11. 04 Nov, 2021 1 commit
  12. 26 Oct, 2021 1 commit
  13. 28 Sep, 2021 1 commit
  14. 03 Sep, 2021 1 commit
    • James Clark's avatar
      perf cs-etm: Update OpenCSD decoder for ETE · 212095f7
      James Clark authored
      
      OpenCSD v1.1.1 has a bug fix for the installation of the ETE decoder
      headers. This also means that including headers separately for each
      decoder is unnecessary so remove these.
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Acked-by: default avatarSuzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https //lore.kernel.org/r/20210806134109.1182235-7-james.clark@arm.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      212095f7
  15. 09 Aug, 2021 1 commit
    • Leo Yan's avatar
      tools: Remove feature-sync-compare-and-swap feature detection · 60fa754b
      Leo Yan authored
      
      Since the __sync functions have been removed from perf, it's needless
      for perf tool to test the feature sync-compare-and-swap.
      
      The feature test is not used by any other components, remove it.
      Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrii Nakryiko <andriin@fb.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Daniel Díaz <daniel.diaz@linaro.org>
      Cc: Frank Ch. Eigler <fche@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sedat Dilek <sedat.dilek@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: coresight@lists.linaro.org
      Cc: x86@kernel.org
      Link: http://lore.kernel.org/lkml/20210809111407.596077-10-leo.yan@linaro.org
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      60fa754b
  16. 29 Apr, 2021 1 commit
    • Michael Petlan's avatar
      perf tools: Enable libtraceevent dynamic linking · 56d32d4c
      Michael Petlan authored
      
      Currently we support only static linking with kernel's libtraceevent
      (tools/lib/traceevent). This patch adds libtraceevent package detection
      and support to link perf with it dynamically.
      
        The libtraceevent package status is displayed with:
        $ make VF=1 LIBTRACEEVENT_DYNAMIC=1
        ...
        ...                 libtraceevent: [ on  ]
      
      Default behavior remains the same (static linking).
      
      Committer testing:
      
        $ make LIBTRACEEVENT_DYNAMIC=1 VF=1 O=/tmp/build/perf -C tools/perf install-bin |& grep traceevent
        Makefile.config:1090: *** Error: No libtraceevent devel library found, please install libtraceevent-devel.  Stop.
        $
      Signed-off-by: default avatarMichael Petlan <mpetlan@redhat.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      LPU-Reference: 20210428092023.4009-1-mpetlan@redhat.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      56d32d4c
  17. 29 Jan, 2021 1 commit
    • Sedat Dilek's avatar
      tools: Factor Clang, LLC and LLVM utils definitions · 211a741c
      Sedat Dilek authored
      When dealing with BPF/BTF/pahole and DWARF v5 I wanted to build bpftool.
      
      While looking into the source code I found duplicate assignments in misc tools
      for the LLVM eco system, e.g. clang and llvm-objcopy.
      
      Move the Clang, LLC and/or LLVM utils definitions to tools/scripts/Makefile.include
      file and add missing includes where needed. Honestly, I was inspired by the commit
      c8a950d0
      
       ("tools: Factor HOSTCC, HOSTLD, HOSTAR definitions").
      
      I tested with bpftool and perf on Debian/testing AMD64 and LLVM/Clang v11.1.0-rc1.
      
      Build instructions:
      
      [ make and make-options ]
      MAKE="make V=1"
      MAKE_OPTS="HOSTCC=clang HOSTCXX=clang++ HOSTLD=ld.lld CC=clang LD=ld.lld LLVM=1 LLVM_IAS=1"
      MAKE_OPTS="$MAKE_OPTS PAHOLE=/opt/pahole/bin/pahole"
      
      [ clean-up ]
      $MAKE $MAKE_OPTS -C tools/ clean
      
      [ bpftool ]
      $MAKE $MAKE_OPTS -C tools/bpf/bpftool/
      
      [ perf ]
      PYTHON=python3 $MAKE $MAKE_OPTS -C tools/perf/
      
      I was careful with respecting the user's wish to override custom compiler, linker,
      GNU/binutils and/or LLVM utils settings.
      Signed-off-by: default avatarSedat Dilek <sedat.dilek@gmail.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Acked-by: Jiri Olsa <jolsa@redhat.com> # tools/build and tools/perf
      Link: https://lore.kernel.org/bpf/20210128015117.20515-1-sedat.dilek@gmail.com
      211a741c
  18. 20 Jan, 2021 1 commit
  19. 17 Dec, 2020 1 commit
    • Jiri Olsa's avatar
      tools build: Add missing libcap to test-all.bin target · 09d59c2f
      Jiri Olsa authored
      We're missing -lcap in test-all.bin target, so in case it's the only
      library missing (if more are missing test-all.bin fails anyway), we will
      falsely claim that we detected it and fail build, like:
      
        $ make
        ...
        Auto-detecting system features:
        ...                         dwarf: [ on  ]
        ...            dwarf_getlocations: [ on  ]
        ...                         glibc: [ on  ]
        ...                        libbfd: [ on  ]
        ...                libbfd-buildid: [ on  ]
        ...                        libcap: [ on  ]
        ...                        libelf: [ on  ]
        ...                       libnuma: [ on  ]
        ...        numa_num_possible_cpus: [ on  ]
        ...                       libperl: [ on  ]
        ...                     libpython: [ on  ]
        ...                     libcrypto: [ on  ]
        ...                     libunwind: [ on  ]
        ...            libdw-dwarf-unwind: [ on  ]
        ...                          zlib: [ on  ]
        ...                          lzma: [ on  ]
        ...                     get_cpuid: [ on  ]
        ...                           bpf: [ on  ]
        ...                        libaio: [ on  ]
        ...                       libzstd: [ on  ]
        ...        disassembler-four-args: [ on  ]
      
        ...
      
          CC       builtin-ftrace.o
      
        In file included from builtin-ftrace.c:29:
        util/cap.h:11:10: fatal error: sys/capability.h: No such file or directory
           11 | #include <sys/capability.h>
              |          ^~~~~~~~~~~~~~~~~~
        compilation terminated.
      
      Fixes: 74d5f3d0
      
       ("tools build: Add capability-related feature detection")
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Igor Lubashev <ilubashe@akamai.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20201203230836.3751981-1-jolsa@kernel.org
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      09d59c2f
  20. 03 Nov, 2020 1 commit
    • Arnaldo Carvalho de Melo's avatar
      tools feature: Fixup fast path feature detection · 5d020cbd
      Arnaldo Carvalho de Melo authored
      22dd1ac9 ("tools: Remove feature-libelf-mmap feature detection")
      correctly simplified the this feature detection, but forgot to remove
      the call to the removed function in the main() function for the
      test-all.c fast path feature detection, making it fail and thus do all
      the feature detection individually, fix it.
      
        $ cat /tmp/build/perf/feature/test-all.make.output
        test-all.c: In function ‘main’:
        test-all.c:188:2: error: implicit declaration of function ‘main_test_libelf_mmap’; did you mean ‘main_test_libelf’? [-Werror=implicit-function-declaration]
          188 |  main_test_libelf_mmap();
              |  ^~~~~~~~~~~~~~~~~~~~~
              |  main_test_libelf
        cc1: all warnings being treated as errors
        $ vim tools/build/feature/test-all.c
        $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf ;make V=1 -k O=/tmp/build/perf  -C tools/perf install-bin ; perf test python
        <SNIP>
        $ cat /tmp/build/perf/feature/test-all.make.output
        $
      
      Fixes: 22dd1ac9
      
       ("tools: Remove feature-libelf-mmap feature detection")
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrii Nakryiko <andriin@fb.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5d020cbd
  21. 09 Sep, 2020 1 commit
    • Arnaldo Carvalho de Melo's avatar
      tools feature: Add missing -lzstd to the fast path feature detection · 6c014694
      Arnaldo Carvalho de Melo authored
      We were failing that due to GTK2+ and then for the ZSTD test, which made
      test-all.c, the fast path feature detection file to fail and thus
      trigger building all of the feature tests, slowing down the test.
      
      Eventually the ZSTD test would be built and would succeed, since it had
      the needed -lzstd, avoiding:
      
        $ cat /tmp/build/perf/feature/test-all.make.output
        /usr/bin/ld: /tmp/ccRRJQ4u.o: in function `main_test_libzstd':
        /home/acme/git/perf/tools/build/feature/test-libzstd.c:8: undefined reference to `ZSTD_createCStream'
        /usr/bin/ld: /home/acme/git/perf/tools/build/feature/test-libzstd.c:9: undefined reference to `ZSTD_freeCStream'
        collect2: error: ld returned 1 exit status
        $
      
      Fix it by adding -lzstd to the test-all target.
      
      Now I need an entry to 'perf test' to make sure that
      /tmp/build/perf/feature/test-all.make.output is empty...
      
      Fixes: 3b1c5d96
      
       ("tools build: Implement libzstd feature check, LIBZSTD_DIR and NO_LIBZSTD defines")
      Reviewed-by: default avatarAlexei Budankov <alexey.budankov@linux.intel.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Link: http://lore.kernel.org/lkml/20200904202611.GJ3753976@kernel.org
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6c014694
  22. 04 Sep, 2020 2 commits
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Make GTK2 support opt-in · 4751bddd
      Arnaldo Carvalho de Melo authored
      
      This is bitrotting, nobody is stepping up to work on it, and since we
      treat warnings as errors, feature detection is failing in its main,
      faster test (tools/build/feature/test-all.c) because of the GTK+2
      infobar check.
      
      So make this opt-in, at some point ditch this if nobody volunteers to
      take care of this.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4751bddd
    • Arnaldo Carvalho de Melo's avatar
      tools features: Add feature test to check if libbfd has buildid support · e71e19a9
      Arnaldo Carvalho de Melo authored
      
      Which is needed by the PE executable support, for instance.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jacek Caban <jacek@codeweavers.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Remi Bernon <rbernon@codeweavers.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e71e19a9
  23. 19 Aug, 2020 1 commit
  24. 14 Aug, 2020 1 commit
    • Frank Ch. Eigler's avatar
      perf build-ids: Fall back to debuginfod query if debuginfo not found · c7a14fdc
      Frank Ch. Eigler authored
      During a perf-record, use the -ldebuginfod API to query a debuginfod
      server, should the debug data not be found in the usual system
      locations.  If successful, the usual $HOME/.debug dir is populated.
      
      Tested with:
      
        $ find .
        .
        ./ctags-debuginfo-5.8-26.fc31.x86_64.rpm
        ./usr
        ./usr/lib
        ./usr/lib/debug
        ./usr/lib/debug/.build-id
        ./usr/lib/debug/.build-id/ca
        ./usr/lib/debug/.build-id/ca/46f6ae6a0cee57d85abc1d461c49074248908d
        ./usr/lib/debug/.build-id/ca/46f6ae6a0cee57d85abc1d461c49074248908d.debug
        ./usr/lib/debug/usr
        ./usr/lib/debug/usr/bin
        ./usr/lib/debug/usr/bin/ctags-5.8-26.fc31.x86_64.debug
      
        $ debuginfod  -F .
        ...
      
        $ rm -rf ~/.debug/ ; mkdir ~/.debug
      
        $ perf record make tags
          BUILD:   Doing 'make -j8' parallel build
          GEN      tags
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.107 MB perf.data (1483 samples) ]
      
        $ find ~/.debug | grep ctags
        /home/jolsa/.debug/usr/bin/ctags
        /home/jolsa/.debug/usr/bin/ctags/ca46f6ae6a0cee57d85abc1d461c49074248908d
        /home/jolsa/.debug/usr/bin/ctags/ca46f6ae6a0cee57d85abc1d461c49074248908d/elf
        /home/jolsa/.debug/usr/bin/ctags/ca46f6ae6a0cee57d85abc1d461c49074248908d/probes
      
        $ rm -rf ~/.debug/ ; mkdir ~/.debug
      
        $ DEBUGINFOD_URLS=http://localhost:8002
      
       perf record make tags
          BUILD:   Doing 'make -j8' parallel build
          GEN      tags
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.108 MB perf.data (1531 samples) ]
      
        $ find ~/.debug | grep ctag
        /home/jolsa/.debug/usr/bin/ctags
        /home/jolsa/.debug/usr/bin/ctags/ca46f6ae6a0cee57d85abc1d461c49074248908d
        /home/jolsa/.debug/usr/bin/ctags/ca46f6ae6a0cee57d85abc1d461c49074248908d/debug
        /home/jolsa/.debug/usr/bin/ctags/ca46f6ae6a0cee57d85abc1d461c49074248908d/elf
        /home/jolsa/.debug/usr/bin/ctags/ca46f6ae6a0cee57d85abc1d461c49074248908d/probes
      
      Note the 'debug' file is created in the last run.
      
      Note that currently the debuginfo data are downloaded only on record path,
      we still need add this support to perf build-id/report.. and test ;-)
      Tested-by: default avatarJiri Olsa <jolsa@kernel.org>
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Signed-off-by: default avatarFrank Ch. Eigler <fche@redhat.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c7a14fdc
  25. 31 Jul, 2020 1 commit
    • Thomas Hebb's avatar
      tools build feature: Use CC and CXX from parent · e3232c2f
      Thomas Hebb authored
      commit c8c18867 ("tools build: Use the same CC for feature detection
      and actual build") changed these assignments from unconditional (:=) to
      conditional (?=) so that they wouldn't clobber values from the
      environment. However, conditional assignment does not work properly for
      variables that Make implicitly sets, among which are CC and CXX. To
      quote tools/scripts/Makefile.include, which handles this properly:
      
        # Makefiles suck: This macro sets a default value of $(2) for the
        # variable named by $(1), unless the variable has been set by
        # environment or command line. This is necessary for CC and AR
        # because make sets default values, so the simpler ?= approach
        # won't work as expected.
      
      In other words, the conditional assignments will not run even if the
      variables are not overridden in the environment; Make will set CC to
      "cc" and CXX to "g++" when it starts[1], meaning the variables are not
      empty by the time the conditional assignments are evaluated. This breaks
      cross-compilation when CROSS_COMPILE is set but CC isn't, since "cc"
      gets used for feature detection instead of the cross compiler (and
      likewise for CXX).
      
      To fix the issue, just pass down the values of CC and CXX computed by
      the parent Makefile, which gets included by the Makefile that actually
      builds whatever we're detecting features for and so is guaranteed to
      have good values. This is a better solution anyway, since it means we
      aren't trying to replicate the logic of the parent build system and so
      don't risk it getting out of sync.
      
      Leave PKG_CONFIG alone, since 1) there's no common logic to compute it
      in Makefile.include, and 2) it's not an implicit variable, so
      conditional assignment works properly.
      
      [1] https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html
      
      Fixes: c8c18867
      
       ("tools build: Use the same CC for feature detection and actual build")
      Signed-off-by: default avatarThomas Hebb <tommyhebb@gmail.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: David Carrillo-Cisneros <davidcc@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Igor Lubashev <ilubashe@akamai.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: thomas hebb <tommyhebb@gmail.com>
      Link: http://lore.kernel.org/lkml/0a6e69d1736b0fa231a648f50b0cce5d8a6734ef.1595822871.git.tommyhebb@gmail.com
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e3232c2f
  26. 23 Jun, 2020 1 commit
  27. 29 May, 2020 1 commit
    • Arnaldo Carvalho de Melo's avatar
      perf build: Remove libaudit from the default feature checks · a88f70de
      Arnaldo Carvalho de Melo authored
      
      Ingo reported that the libaudit was always appearing as OFF:
      
        Auto-detecting system features:
        ...                         dwarf: [ on  ]
        ...            dwarf_getlocations: [ on  ]
        ...                         glibc: [ on  ]
        ...                          gtk2: [ on  ]
        ...                      libaudit: [ OFF ]
      
      And everything seemed to work, i.e. we were checking for a feature that
      we don't use, causing confusion for people building perf, so work to
      remove that nuisance while making sure that it works when an arch
      doesn't provide the alternative method to generate the syscall id/name
      conversion tables.
      
      Longer explanation of the new modus operandi:
      
        $ make -C tools/perf O=/tmp/build/perf NO_SYSCALL_TABLE=1
        <SNIP>
        Auto-detecting system features:
        ...                         dwarf: [ on  ]
        ...            dwarf_getlocations: [ on  ]
        ...                         glibc: [ on  ]
        ...                          gtk2: [ on  ]
        ...                        libbfd: [ on  ]
        ...                        libcap: [ on  ]
        ...                        libelf: [ on  ]
        ...                       libnuma: [ on  ]
        ...        numa_num_possible_cpus: [ on  ]
        ...                       libperl: [ on  ]
        ...                     libpython: [ on  ]
        ...                     libcrypto: [ on  ]
        ...                     libunwind: [ on  ]
        ...            libdw-dwarf-unwind: [ on  ]
        ...                          zlib: [ on  ]
        ...                          lzma: [ on  ]
        ...                     get_cpuid: [ on  ]
        ...                           bpf: [ on  ]
        ...                        libaio: [ on  ]
        ...                       libzstd: [ on  ]
        ...        disassembler-four-args: [ on  ]
      
        Makefile.config:665: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
          GEN      /tmp/build/perf/common-cmds.h
          MKDIR    /tmp/build/perf/fd/
          MKDIR    /tmp/build/perf/fs/
        <SNIP>
        $
      
      The libaudit test is forced and it fails when audit-libs-devel isn't available:
      
        $ cat /tmp/build/perf/feature/test-libaudit.make.output
        test-libaudit.c:2:10: fatal error: libaudit.h: No such file or directory
            2 | #include <libaudit.h>
              |          ^~~~~~~~~~~~
        compilation terminated.
        $
      
      If we install audit-libs-devel and rebuild it continues not to be shown as OFF
      in the main auto-detection summary, but again gets tested and this time:
      
        $ rpm -q audit-libs-devel
        audit-libs-devel-3.0-0.15.20191104git1c2f876.fc31.x86_64
        $
      
      The make output for the feature detection comes clean:
      
        $ cat /tmp/build/perf/feature/test-libaudit.make.output
      
      And the feature detection binary is successfully built and is dynamicly linked
      with libaudit:
      
        $ ldd /tmp/build/perf/feature/test-libaudit.bin | grep audit
        	libaudit.so.1 => /lib64/libaudit.so.1 (0x00007f5bf5177000)
        $
      
      As well as the resulting perf binary:
      
        $ ldd /tmp/build/perf/perf | grep audit
        	libaudit.so.1 => /lib64/libaudit.so.1 (0x00007fad511c7000)
        $
      
      And 'perf trace' works using the libaudit method:
      
        $ sudo /tmp/build/perf/perf trace -e nanosleep sleep 1
             0.000 (1000.067 ms): sleep/281872 nanosleep(rqtp: 0x7ffedbbe69d0) = 0
        $
      
      If we leave audit-libs-devel installed but don't disable the use of the best
      method, the one using SYSCALL_TABLE, the default for architectures that provide
      the script to build the syscall id/name mapping using the .tbl files copied
      from the kernel sources, we get:
      
        $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf
        $ make -C tools/perf O=/tmp/build/perf
        Auto-detecting system features:
        ...                         dwarf: [ on  ]
        ...            dwarf_getlocations: [ on  ]
        ...                         glibc: [ on  ]
        ...                          gtk2: [ on  ]
        ...                        libbfd: [ on  ]
        ...                        libcap: [ on  ]
        ...                        libelf: [ on  ]
        ...                       libnuma: [ on  ]
        ...        numa_num_possible_cpus: [ on  ]
        ...                       libperl: [ on  ]
        ...                     libpython: [ on  ]
        ...                     libcrypto: [ on  ]
        ...                     libunwind: [ on  ]
        ...            libdw-dwarf-unwind: [ on  ]
        ...                          zlib: [ on  ]
        ...                          lzma: [ on  ]
        ...                     get_cpuid: [ on  ]
        ...                           bpf: [ on  ]
        ...                        libaio: [ on  ]
        ...                       libzstd: [ on  ]
        ...        disassembler-four-args: [ on  ]
      
          GEN      /tmp/build/perf/common-cmds.h
        <SNIP>
        $
      
      Again, no mention of libaudit being on or OFF and:
      
        $ cat /tmp/build/perf/feature/test-libaudit.make.output
        cat: /tmp/build/perf/feature/test-libaudit.make.output: No such file or directory
        $
      
      We didn't even bother checking for its availability, slightly speeding up the
      build process and:
      
        $ ldd /tmp/build/perf/perf | grep libaudit
        $
      
      We don't link with it, also:
      
        $ sudo /tmp/build/perf/perf trace -e nanosleep sleep 1
             0.000 (1000.053 ms): sleep/299125 nanosleep(rqtp: 0x7ffc24611b50) = 0
        $
      
      And globs become available:
      
        $ sudo /tmp/build/perf/perf trace -e *sleep sleep 1
             0.000 (1000.072 ms): sleep/299136 nanosleep(rqtp: 0x7ffe7a3c4ff0) = 0
        $
      Reported-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a88f70de
  28. 05 May, 2020 2 commits
  29. 21 Apr, 2020 1 commit
  30. 03 Apr, 2020 1 commit
    • Namhyung Kim's avatar
      perf tools: Add file-handle feature test · 49f550ea
      Namhyung Kim authored
      
      The file handle (FHANDLE) support is configurable so some systems might not
      have it.  So add a config feature item to check it on build time so that we
      don't add the cgroup tracking feature based on that.
      
      Committer notes:
      
      Had to make the test use the same construct as its later use in
      synthetic-events.c, in the next patch in this series. i.e. make it be:
      
      	struct {
      		struct file_handle fh;
      		uint64_t cgroup_id;
      	} handle;
      
      To cope with:
      
          CC       /tmp/build/perf/util/cloexec.o
        util/synthetic-events.c:428:22: error: field 'fh' with   CC       /tmp/build/perf/util/call-path.o
        variable sized type 'struct file_handle' not at the end of a struct or class is a GNU
              extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
                        struct file_handle fh;
                                           ^
        1 error generated.
      
      Deal with this at some point, i.e. investigate if the right thing is to
      remove that -Wgnu-variable-sized-type-not-at-end from our CFLAGS, for
      now do the test the same way as it is used looks more sensible.
      Reported-by: default avatarArnaldo Carvalho de Melo <acme@kernel.org>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20200402015249.3800462-1-namhyung@kernel.org
      
      
      [ split from a larger patch, removed blank line at EOF ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      49f550ea