Commit eaea45fc authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'perf-tools-fixes-for-v5.18-2022-05-21' of...

Merge tag 'perf-tools-fixes-for-v5.18-2022-05-21' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

Pull perf tools fixes from Arnaldo Carvalho de Melo:

 - Fix and validate CPU map inputs in synthetic PERF_RECORD_STAT events
   in 'perf stat'.

 - Fix x86's arch__intr_reg_mask() for the hybrid platform.

 - Address 'perf bench numa' compiler error on s390.

 - Fix check for btf__load_from_kernel_by_id() in libbpf.

 - Fix "all PMU test" 'perf test' to skip hv_24x7/hv_gpci tests on
   powerpc.

 - Fix session topology test to skip the test in guest environment.

 - Skip BPF 'perf test' if clang is not present.

 - Avoid shell test description infinite loop in 'perf test'.

 - Fix Intel LBR callstack entries and nr print message.

* tag 'perf-tools-fixes-for-v5.18-2022-05-21' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
  perf session: Fix Intel LBR callstack entries and nr print message
  perf test bpf: Skip test if clang is not present
  perf test session topology: Fix test to skip the test in guest environment
  perf bench numa: Address compiler error on s390
  perf test: Avoid shell test description infinite loop
  perf regs x86: Fix arch__intr_reg_mask() for the hybrid platform
  perf test: Fix "all PMU test" to skip hv_24x7/hv_gpci tests on powerpc
  perf stat: Fix and validate CPU map inputs in synthetic PERF_RECORD_STAT events
  perf build: Fix check for btf__load_from_kernel_by_id() in libbpf
parents 4c493b1a 51d0bf99
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ FEATURE_TESTS_EXTRA := \
         llvm-version                   \
         clang                          \
         libbpf                         \
         libbpf-btf__load_from_kernel_by_id \
         libpfm4                        \
         libdebuginfod			\
         clang-bpf-co-re
+4 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ FILES= \
         test-lzma.bin                          \
         test-bpf.bin                           \
         test-libbpf.bin                        \
         test-libbpf-btf__load_from_kernel_by_id.bin	\
         test-get_cpuid.bin                     \
         test-sdt.bin                           \
         test-cxx.bin                           \
@@ -287,6 +288,9 @@ $(OUTPUT)test-bpf.bin:
$(OUTPUT)test-libbpf.bin:
	$(BUILD) -lbpf

$(OUTPUT)test-libbpf-btf__load_from_kernel_by_id.bin:
	$(BUILD) -lbpf

$(OUTPUT)test-sdt.bin:
	$(BUILD)

+7 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
#include <bpf/libbpf.h>

int main(void)
{
	return btf__load_from_kernel_by_id(20151128, NULL);
}
+7 −0
Original line number Diff line number Diff line
@@ -553,9 +553,16 @@ ifndef NO_LIBELF
        ifeq ($(feature-libbpf), 1)
          EXTLIBS += -lbpf
          $(call detected,CONFIG_LIBBPF_DYNAMIC)

          $(call feature_check,libbpf-btf__load_from_kernel_by_id)
          ifeq ($(feature-libbpf-btf__load_from_kernel_by_id), 1)
            CFLAGS += -DHAVE_LIBBPF_BTF__LOAD_FROM_KERNEL_BY_ID
          endif
        else
          dummy := $(error Error: No libbpf devel library found, please install libbpf-devel);
        endif
      else
	CFLAGS += -DHAVE_LIBBPF_BTF__LOAD_FROM_KERNEL_BY_ID
      endif
    endif

+12 −0
Original line number Diff line number Diff line
@@ -9,6 +9,8 @@
#include "../../../util/perf_regs.h"
#include "../../../util/debug.h"
#include "../../../util/event.h"
#include "../../../util/pmu.h"
#include "../../../util/pmu-hybrid.h"

const struct sample_reg sample_reg_masks[] = {
	SMPL_REG(AX, PERF_REG_X86_AX),
@@ -284,12 +286,22 @@ uint64_t arch__intr_reg_mask(void)
		.disabled 		= 1,
		.exclude_kernel		= 1,
	};
	struct perf_pmu *pmu;
	int fd;
	/*
	 * In an unnamed union, init it here to build on older gcc versions
	 */
	attr.sample_period = 1;

	if (perf_pmu__has_hybrid()) {
		/*
		 * The same register set is supported among different hybrid PMUs.
		 * Only check the first available one.
		 */
		pmu = list_first_entry(&perf_pmu__hybrid_pmus, typeof(*pmu), hybrid_list);
		attr.config |= (__u64)pmu->type << PERF_PMU_TYPE_SHIFT;
	}

	event_attr_init(&attr);

	fd = sys_perf_event_open(&attr, 0, -1, -1, 0);
Loading