Merge tag 'perf-core-for-mingo-20160607' of git://git.kernel.org/pub/scm/linux/kernel...
authorIngo Molnar <mingo@kernel.org>
Wed, 8 Jun 2016 07:34:15 +0000 (09:34 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 8 Jun 2016 07:34:15 +0000 (09:34 +0200)
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

User visible changes:

- Support cross unwinding, i.e. collecting '--call-graph dwarf' perf.data files
  in one machine and then doing analysis in another machine of a different
  hardware architecture. This enables, for instance, to do:

perf record -a --call-graph dwarf

  on a x86-32 or aarch64 system and then do 'perf report' on it on a
  x86_64 workstation. (He Kuang)

- Fix crash in build_id_cache__kallsyms_path(), recent regression (Wang Nan)

Infrastructure changes:

- Make tools/lib/bpf use the IS_ERR return facility consistently and also stop
  using the _get_ term for non-reference count methods (Arnaldo Carvalho de Melo)

- 'perf config' refactorings (Taeung Song)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
1  2 
tools/perf/config/Makefile
tools/perf/util/machine.c

@@@ -23,12 -23,6 +23,12 @@@ $(call detected_var,ARCH
  
  NO_PERF_REGS := 1
  
 +# Additional ARCH settings for ppc
 +ifeq ($(ARCH),powerpc)
 +  NO_PERF_REGS := 0
 +  LIBUNWIND_LIBS := -lunwind -lunwind-ppc64
 +endif
 +
  # Additional ARCH settings for x86
  ifeq ($(ARCH),x86)
    $(call detected,CONFIG_X86)
@@@ -73,17 -67,25 +73,25 @@@ endi
  #
  #   make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
  #
+ libunwind_arch_set_flags = $(eval $(libunwind_arch_set_flags_code))
+ define libunwind_arch_set_flags_code
+   FEATURE_CHECK_CFLAGS-libunwind-$(1)  = -I$(LIBUNWIND_DIR)/include
+   FEATURE_CHECK_LDFLAGS-libunwind-$(1) = -L$(LIBUNWIND_DIR)/lib
+ endef
  ifdef LIBUNWIND_DIR
    LIBUNWIND_CFLAGS  = -I$(LIBUNWIND_DIR)/include
    LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib
+   LIBUNWIND_ARCHS = x86 x86_64 arm aarch64 debug-frame-arm debug-frame-aarch64
+   $(foreach libunwind_arch,$(LIBUNWIND_ARCHS),$(call libunwind_arch_set_flags,$(libunwind_arch)))
  endif
- LIBUNWIND_LDFLAGS += $(LIBUNWIND_LIBS)
  
  # Set per-feature check compilation flags
  FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS)
- FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS)
+ FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
  FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS)
- FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS)
+ FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
  
  ifeq ($(NO_PERF_REGS),0)
    CFLAGS += -DHAVE_PERF_REGS_SUPPORT
@@@ -351,10 -353,40 +359,40 @@@ ifeq ($(ARCH),powerpc
  endif
  
  ifndef NO_LIBUNWIND
+   have_libunwind :=
+   ifeq ($(feature-libunwind-x86), 1)
+     $(call detected,CONFIG_LIBUNWIND_X86)
+     CFLAGS += -DHAVE_LIBUNWIND_X86_SUPPORT
+     LDFLAGS += -lunwind-x86
+     have_libunwind = 1
+   endif
+   ifeq ($(feature-libunwind-aarch64), 1)
+     $(call detected,CONFIG_LIBUNWIND_AARCH64)
+     CFLAGS += -DHAVE_LIBUNWIND_AARCH64_SUPPORT
+     LDFLAGS += -lunwind-aarch64
+     have_libunwind = 1
+     $(call feature_check,libunwind-debug-frame-aarch64)
+     ifneq ($(feature-libunwind-debug-frame-aarch64), 1)
+       msg := $(warning No debug_frame support found in libunwind-aarch64);
+       CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME_AARCH64
+     endif
+   endif
    ifneq ($(feature-libunwind), 1)
      msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
+     NO_LOCAL_LIBUNWIND := 1
+   else
+     have_libunwind := 1
+     $(call detected,CONFIG_LOCAL_LIBUNWIND)
+   endif
+   ifneq ($(have_libunwind), 1)
      NO_LIBUNWIND := 1
    endif
+ else
+   NO_LOCAL_LIBUNWIND := 1
  endif
  
  ifndef NO_LIBBPF
@@@ -392,7 -424,7 +430,7 @@@ els
    NO_DWARF_UNWIND := 1
  endif
  
- ifndef NO_LIBUNWIND
+ ifndef NO_LOCAL_LIBUNWIND
    ifeq ($(ARCH),$(filter $(ARCH),arm arm64))
      $(call feature_check,libunwind-debug-frame)
      ifneq ($(feature-libunwind-debug-frame), 1)
      # non-ARM has no dwarf_find_debug_frame() function:
      CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
    endif
-   CFLAGS  += -DHAVE_LIBUNWIND_SUPPORT
    EXTLIBS += $(LIBUNWIND_LIBS)
+   LDFLAGS += $(LIBUNWIND_LIBS)
+ endif
+ ifndef NO_LIBUNWIND
+   CFLAGS  += -DHAVE_LIBUNWIND_SUPPORT
    CFLAGS  += $(LIBUNWIND_CFLAGS)
    LDFLAGS += $(LIBUNWIND_LDFLAGS)
  endif
@@@ -363,7 -363,7 +363,7 @@@ out_err
  }
  
  /*
 - * Caller must eventually drop thread->refcnt returned with a successfull
 + * Caller must eventually drop thread->refcnt returned with a successful
   * lookup/new thread inserted.
   */
  static struct thread *____machine__findnew_thread(struct machine *machine,
@@@ -1353,11 -1353,16 +1353,16 @@@ int machine__process_mmap2_event(struc
        if (map == NULL)
                goto out_problem_map;
  
-       thread__insert_map(thread, map);
+       ret = thread__insert_map(thread, map);
+       if (ret)
+               goto out_problem_insert;
        thread__put(thread);
        map__put(map);
        return 0;
  
+ out_problem_insert:
+       map__put(map);
  out_problem_map:
        thread__put(thread);
  out_problem:
@@@ -1403,11 -1408,16 +1408,16 @@@ int machine__process_mmap_event(struct 
        if (map == NULL)
                goto out_problem_map;
  
-       thread__insert_map(thread, map);
+       ret = thread__insert_map(thread, map);
+       if (ret)
+               goto out_problem_insert;
        thread__put(thread);
        map__put(map);
        return 0;
  
+ out_problem_insert:
+       map__put(map);
  out_problem_map:
        thread__put(thread);
  out_problem: