mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Jiri Olsa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, paulus@samba.org,
	hpa@zytor.com, mingo@kernel.org, a.p.zijlstra@chello.nl,
	jean.pihet@linaro.org, namhyung@kernel.org, jolsa@redhat.com,
	fweisbec@gmail.com, dsahern@gmail.com, tglx@linutronix.de,
	cjashfor@linux.vnet.ibm.com
Subject: [tip:perf/core] perf tools: Setup default dwarf post unwinder
Date: Thu, 27 Feb 2014 05:29:16 -0800	[thread overview]
Message-ID: <tip-0a4f2b6a3ba5066947a8cbd7cfa26fb8a9280625@git.kernel.org> (raw)
In-Reply-To: <1392825179-5228-6-git-send-email-jolsa@redhat.com>

Commit-ID:  0a4f2b6a3ba5066947a8cbd7cfa26fb8a9280625
Gitweb:     http://git.kernel.org/tip/0a4f2b6a3ba5066947a8cbd7cfa26fb8a9280625
Author:     Jiri Olsa <jolsa@redhat.com>
AuthorDate: Wed, 19 Feb 2014 16:52:58 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 24 Feb 2014 09:29:36 -0300

perf tools: Setup default dwarf post unwinder

Factor NO_LIBDW_DWARF_UNWIND makefile variable and code that selects
default DWARf post unwinder based on detected features (libdw and
libunwind support)

If both are detected the libunwind is selected as default.  Simple
'make' will try to add:

  - libunwind unwinder if present
  - libdw unwinder if present
  - disable dwarf unwind if non of libunwind and libdw
    libraries are present

If one of the DWARF unwind libraries is detected, message is displayed
which one (libunwind/libdw) is compiled in.

Examples:
  - compile in libdw unwinder if present:

    $ make NO_LIBUNWIND=1

  - compile in libdw (with libdw installation directory) unwinder if present:

    $ make LIBDW_DIR=/opt/elfutils/ NO_LIBUNWIND=1
      BUILD:   Doing 'make -j4' parallel build

    Auto-detecting system features:
    ...                         dwarf: [ on  ]
    ...                         glibc: [ on  ]
    ...                          gtk2: [ on  ]
    ...                      libaudit: [ on  ]
    ...                        libbfd: [ on  ]
    ...                        libelf: [ on  ]
    ...                       libnuma: [ on  ]
    ...                       libperl: [ on  ]
    ...                     libpython: [ on  ]
    ...                      libslang: [ on  ]
    ...                     libunwind: [ on  ]
    ...            libdw-dwarf-unwind: [ on  ]
    ...     DWARF post unwind library: libdw

  - disable post dwarf unwind completely:

    $ make NO_LIBUNWIND=1 NO_LIBDW_DWARF_UNWIND=1
      BUILD:   Doing 'make -j4' parallel build

    Auto-detecting system features:
    ...                         dwarf: [ on  ]
    ...                         glibc: [ on  ]
    ...                          gtk2: [ on  ]
    ...                      libaudit: [ on  ]
    ...                        libbfd: [ on  ]
    ...                        libelf: [ on  ]
    ...                       libnuma: [ on  ]
    ...                       libperl: [ on  ]
    ...                     libpython: [ on  ]
    ...                      libslang: [ on  ]
    ...                     libunwind: [ on  ]
    ...            libdw-dwarf-unwind: [ on  ]
    ...     DWARF post unwind library: libunwind

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1392825179-5228-6-git-send-email-jolsa@redhat.com
[ Add suggestion about setting LIBDW_DIR when not finding libdw ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile.perf     |  5 +--
 tools/perf/arch/x86/Makefile |  6 ++--
 tools/perf/config/Makefile   | 78 ++++++++++++++++++++++++++++++++++----------
 3 files changed, 66 insertions(+), 23 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 2dff0b8..1f7ec48 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -61,9 +61,6 @@ include config/utilities.mak
 # Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support
 # for dwarf backtrace post unwind.
 
-# temporarily disabled
-NO_LIBDW_DWARF_UNWIND := 1
-
 ifeq ($(srctree),)
 srctree := $(patsubst %/,%,$(dir $(shell pwd)))
 srctree := $(patsubst %/,%,$(dir $(srctree)))
@@ -412,7 +409,7 @@ endif
 LIB_OBJS += $(OUTPUT)tests/code-reading.o
 LIB_OBJS += $(OUTPUT)tests/sample-parsing.o
 LIB_OBJS += $(OUTPUT)tests/parse-no-sample-id-all.o
-ifndef NO_LIBUNWIND
+ifndef NO_DWARF_UNWIND
 ifeq ($(ARCH),x86)
 LIB_OBJS += $(OUTPUT)tests/dwarf-unwind.o
 endif
diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
index 37c4652..1641542 100644
--- a/tools/perf/arch/x86/Makefile
+++ b/tools/perf/arch/x86/Makefile
@@ -4,12 +4,14 @@ LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
 ifndef NO_LIBUNWIND
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
 endif
 ifndef NO_LIBDW_DWARF_UNWIND
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o
 endif
+ifndef NO_DWARF_UNWIND
+LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
+LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
+endif
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/tsc.o
 LIB_H += arch/$(ARCH)/util/tsc.h
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index c040d86..f7c81d3 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -159,7 +159,8 @@ CORE_FEATURE_TESTS =			\
 	libunwind			\
 	on-exit				\
 	stackprotector-all		\
-	timerfd
+	timerfd				\
+	libdw-dwarf-unwind
 
 LIB_FEATURE_TESTS =			\
 	dwarf				\
@@ -172,7 +173,8 @@ LIB_FEATURE_TESTS =			\
 	libperl				\
 	libpython			\
 	libslang			\
-	libunwind
+	libunwind			\
+	libdw-dwarf-unwind
 
 VF_FEATURE_TESTS =			\
 	backtrace			\
@@ -280,6 +282,12 @@ else
       msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
     endif
   else
+    ifndef NO_LIBDW_DWARF_UNWIND
+      ifneq ($(feature-libdw-dwarf-unwind),1)
+        NO_LIBDW_DWARF_UNWIND := 1
+        msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR);
+      endif
+    endif
     ifneq ($(feature-dwarf), 1)
       msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev);
       NO_DWARF := 1
@@ -315,25 +323,51 @@ endif # NO_LIBELF
 
 ifndef NO_LIBUNWIND
   ifneq ($(feature-libunwind), 1)
-    msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
+    msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
     NO_LIBUNWIND := 1
+  endif
+endif
+
+dwarf-post-unwind := 1
+dwarf-post-unwind-text := BUG
+
+# setup DWARF post unwinder
+ifdef NO_LIBUNWIND
+  ifdef NO_LIBDW_DWARF_UNWIND
+    msg := $(warning Disabling post unwind, no support found.);
+    dwarf-post-unwind := 0
   else
-    ifeq ($(ARCH),arm)
-      $(call feature_check,libunwind-debug-frame)
-      ifneq ($(feature-libunwind-debug-frame), 1)
-        msg := $(warning No debug_frame support found in libunwind);
-        CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
-      endif
-    else
-      # non-ARM has no dwarf_find_debug_frame() function:
+    dwarf-post-unwind-text := libdw
+  endif
+else
+  dwarf-post-unwind-text := libunwind
+  # Enable libunwind support by default.
+  ifndef NO_LIBDW_DWARF_UNWIND
+    NO_LIBDW_DWARF_UNWIND := 1
+  endif
+endif
+
+ifeq ($(dwarf-post-unwind),1)
+  CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT
+else
+  NO_DWARF_UNWIND := 1
+endif
+
+ifndef NO_LIBUNWIND
+  ifeq ($(ARCH),arm)
+    $(call feature_check,libunwind-debug-frame)
+    ifneq ($(feature-libunwind-debug-frame), 1)
+      msg := $(warning No debug_frame support found in libunwind);
       CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
     endif
-
-    CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT -DHAVE_LIBUNWIND_SUPPORT
-    EXTLIBS += $(LIBUNWIND_LIBS)
-    CFLAGS += $(LIBUNWIND_CFLAGS)
-    LDFLAGS += $(LIBUNWIND_LDFLAGS)
-  endif # ifneq ($(feature-libunwind), 1)
+  else
+    # non-ARM has no dwarf_find_debug_frame() function:
+    CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
+  endif
+  CFLAGS  += -DHAVE_LIBUNWIND_SUPPORT
+  EXTLIBS += $(LIBUNWIND_LIBS)
+  CFLAGS  += $(LIBUNWIND_CFLAGS)
+  LDFLAGS += $(LIBUNWIND_LDFLAGS)
 endif
 
 ifndef NO_LIBAUDIT
@@ -620,6 +654,10 @@ endef
 PERF_FEATURES := $(foreach feat,$(LIB_FEATURE_TESTS),feature-$(feat)($(feature-$(feat))))
 PERF_FEATURES_FILE := $(shell touch $(OUTPUT)PERF-FEATURES; cat $(OUTPUT)PERF-FEATURES)
 
+ifeq ($(dwarf-post-unwind),1)
+  PERF_FEATURES += dwarf-post-unwind($(dwarf-post-unwind-text))
+endif
+
 # The $(display_lib) controls the default detection message
 # output. It's set if:
 # - detected features differes from stored features from
@@ -650,6 +688,10 @@ ifeq ($(display_lib),1)
   $(info )
   $(info Auto-detecting system features:)
   $(foreach feat,$(LIB_FEATURE_TESTS),$(call feature_print_status,$(feat),))
+
+  ifeq ($(dwarf-post-unwind),1)
+    $(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text))
+  endif
 endif
 
 ifeq ($(display_vf),1)
@@ -659,6 +701,8 @@ ifeq ($(display_vf),1)
   $(call feature_print_var,bindir)
   $(call feature_print_var,libdir)
   $(call feature_print_var,sysconfdir)
+  $(call feature_print_var,LIBUNWIND_DIR)
+  $(call feature_print_var,LIBDW_DIR)
 endif
 
 ifeq ($(display_lib),1)

  reply	other threads:[~2014-02-27 13:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-19 15:52 [RFC 0/6] perf tools: Factor features display code Jiri Olsa
2014-02-19 15:52 ` [PATCH 1/6] " Jiri Olsa
2014-02-19 21:59   ` Arnaldo Carvalho de Melo
2014-02-20  8:30     ` Jiri Olsa
2014-02-22 16:34       ` Ingo Molnar
2014-02-27 13:28   ` [tip:perf/core] " tip-bot for Jiri Olsa
2014-02-19 15:52 ` [PATCH 2/6] perf tools: Add variable display for VF make output Jiri Olsa
2014-02-27 13:28   ` [tip:perf/core] " tip-bot for Jiri Olsa
2014-02-19 15:52 ` [PATCH 3/6] perf tools: Add feature check for libdw dwarf unwind Jiri Olsa
2014-02-27 13:28   ` [tip:perf/core] " tip-bot for Jiri Olsa
2014-02-19 15:52 ` [PATCH 4/6] perf tools: Add libdw DWARF post unwind support Jiri Olsa
2014-02-27 13:29   ` [tip:perf/core] " tip-bot for Jiri Olsa
2014-02-19 15:52 ` [PATCH 5/6] perf tools: Setup default dwarf post unwinder Jiri Olsa
2014-02-27 13:29   ` tip-bot for Jiri Olsa [this message]
2014-02-19 15:52 ` [PATCH 6/6] perf tests: Add NO_LIBDW_DWARF_UNWIND make test Jiri Olsa
2014-02-27 13:29   ` [tip:perf/core] " tip-bot for Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-0a4f2b6a3ba5066947a8cbd7cfa26fb8a9280625@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=dsahern@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jean.pihet@linaro.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome