All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features
@ 2013-04-02  3:54 David Ahern
  2013-04-02  3:54 ` [PATCH 01/23] perf: initial infrasructure for kconfig David Ahern
                   ` (22 more replies)
  0 siblings, 23 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian,
	linux-kbuild

Patches can also be retrieved from:
  https://github.com/dsahern/linux.git perf-config

I still need to add the conf build targets from the top level Makefile.

For this RFC series, you can run the commands manually to generate the
.config file for perf and the corresponding include/config/auto.conf and
include/generated/autoconf.h files.

To build conf (if it already exists in kernel tree jump to the conf
commands below):

BLDDIR=/tmp/perf-build
SRCDIR=/path/to/kernel.git

BLDDIR=/tmp/perf
SRCDIR=/opt/sw/perf/ahern.git

mkdir $BLDDIR
cd $BLDDIR
mkdir -p include/config include/generated
rsync -av $SRCDIR/scripts/ scripts/
ln -s $SRCDIR source
cd $SRCDIR
make O=$BLDDIR V=1 scripts/kconfig conf

Ignore the .config errors - those relate to the kernel build.
What matters here is that conf is built.

cd $BLDDIR
touch .config
PATH=$BLDDIR/scripts/kconfig:$PATH ARCH=x86 conf --silentoldconfig $SRCDIR/tools/perf/Pconfig

At this point you are asked what options to enable:

Enable newt-based TUI (NEWT) [N/y] (NEW) y
Enable GTK-based UI (GTK2) [N/y] (NEW) n
Enable support for Bionic (e.g., Android platform) (BIONIC) [N/y] (NEW)
Development support for libc is available - glibc or bionic (LIBC) [N/y] (NEW) y
  Enable support for libelf (LIBELF) [N/y] (NEW) y
    Enable support for libunwind (LIBUNWIND) [N/y] (NEW) y
    Enable support for dwarf (DWARF) [N/y] (NEW) y
    Enable support for demangle (DEMANGLE) [N/y] (NEW) y
Enable support for perl scripting engine (LIBPERL) [N/y] (NEW) y
Enable support for python scripting engine (LIBPYTHON) [N/y] (NEW) y
Enable support for libaudit (LIBAUDIT) [N/y/?] (NEW) y
Enable support for libnuma (LIBNUMA) [N/y/?] (NEW) y
Enable support for stack backtrace debugging (BACKTRACE) [N/y] (NEW) y
\#
\# configuration written to .config
\#

Now build it:
cd $SRCDIR

make -C tools/perf O=$BLDDIR DESTDIR=/tmp/perf-install -j 4

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Cc: linux-kbuild@vger.kernel.org
---
David Ahern (23):
  perf: initial infrasructure for kconfig
  perf: make perl support based on CONFIG_LIBPERL
  perf: make python support based on CONFIG_LIBPYTHON
  perf: make gtk2 support based on CONFIG_GTK2
  perf: make newt support based on CONFIG_NEWT
  perf: remove NEWT_SUPPORT in favor of CONFIG_NEWT
  perf: remove GTK2_SUPPORT in favor of CONFIG_GTK2
  perf: make elf support based on CONFIG_LIBELF
  perf: make cfi unwind support based on CONFIG_LIBUNWIND
  perf: make demangle support based on CONFIG_DEMANGLE
  perf: make dwarf support based on CONFIG_DWARF
  perf: config: add BIONIC config option
  perf config: make numa support based on CONFIG_LIBNUMA
  perf config: make backtrace support based on CONFIG_BACKTRACE
  perf: make libaudit support based on CONFIG_LIBAUDIT
  perf: consolidate CONFIG_LIBUNWIND checks in Makefile
  perf: remove LIBUNWIND_SUPPORT in favor of CONFIG_LIBUNWIND
  perf: deprecate LIBELF_SUPPORT in favor of CONFIG_LIBELF
  perf: deprecate DWARF_SUPPORT in favor of CONFIG_DWARF
  perf: consolidate CONFIG_LIBELF checks in Makefile
  perf: consolidate CONFIG_DWARF checks in Makefile
  perf: Makefile: only add elf to EXTLIBS if CONFIG_LIBELF is set
  perf: only add elf-based object files if CONFIG_LIBELF is set

 tools/perf/Makefile                     |  512 ++++++++++++++-----------------
 tools/perf/Pconfig                      |   59 ++++
 tools/perf/arch/arm/Makefile            |    2 +-
 tools/perf/arch/powerpc/Makefile        |    2 +-
 tools/perf/arch/s390/Makefile           |    2 +-
 tools/perf/arch/sh/Makefile             |    2 +-
 tools/perf/arch/sparc/Makefile          |    2 +-
 tools/perf/arch/x86/Makefile            |    4 +-
 tools/perf/builtin-bench.c              |    5 +-
 tools/perf/builtin-inject.c             |    3 +-
 tools/perf/builtin-probe.c              |   15 +-
 tools/perf/builtin-record.c             |   11 +-
 tools/perf/builtin-script.c             |    5 +-
 tools/perf/config/feature-tests.mak     |   18 +-
 tools/perf/perf.c                       |    5 +-
 tools/perf/ui/ui.h                      |    5 +-
 tools/perf/util/annotate.h              |    5 +-
 tools/perf/util/generate-cmdlist.sh     |    4 +-
 tools/perf/util/hist.h                  |    5 +-
 tools/perf/util/include/dwarf-regs.h    |    4 +-
 tools/perf/util/map.c                   |    3 +-
 tools/perf/util/probe-event.c           |    5 +-
 tools/perf/util/probe-finder.h          |    5 +-
 tools/perf/util/symbol.h                |    7 +-
 tools/perf/util/trace-event-scripting.c |   30 +-
 tools/perf/util/unwind.h                |    5 +-
 tools/perf/util/util.c                  |    5 +-
 27 files changed, 379 insertions(+), 351 deletions(-)
 create mode 100644 tools/perf/Pconfig

-- 
1.7.10.1


^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 01/23] perf: initial infrasructure for kconfig
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  8:22   ` Paul Bolle
  2013-04-02  3:54 ` [PATCH 02/23] perf: make perl support based on CONFIG_LIBPERL David Ahern
                   ` (21 subsequent siblings)
  22 siblings, 1 reply; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian,
	linux-kbuild

Add Pconfig file which will hold the build options.
Update Makefile with new config files.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Cc: linux-kbuild@vger.kernel.org
---
 tools/perf/Makefile |    5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 tools/perf/Pconfig

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index bb74c79..4e54d05 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -5,6 +5,9 @@ all:
 
 include config/utilities.mak
 
+# Read in config if it exists
+-include $(OUTPUT)include/config/auto.conf
+
 # Define V to have a more verbose compile.
 #
 # Define O to save output files in a separate directory.
@@ -203,6 +206,7 @@ ifneq ($(OUTPUT),)
 endif
 
 BASIC_CFLAGS = \
+	-I$(OUTPUT)include \
 	-Iutil/include \
 	-Iarch/$(ARCH)/include \
 	$(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \
@@ -409,6 +413,7 @@ LIB_H += ui/helpline.h
 LIB_H += ui/progress.h
 LIB_H += ui/util.h
 LIB_H += ui/ui.h
+LIB_H += $(OUTPUT)include/generated/autoconf.h
 
 LIB_OBJS += $(OUTPUT)util/abspath.o
 LIB_OBJS += $(OUTPUT)util/alias.o
diff --git a/tools/perf/Pconfig b/tools/perf/Pconfig
new file mode 100644
index 0000000..e69de29
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 02/23] perf: make perl support based on CONFIG_LIBPERL
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
  2013-04-02  3:54 ` [PATCH 01/23] perf: initial infrasructure for kconfig David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  3:54 ` [PATCH 03/23] perf: make python support based on CONFIG_LIBPYTHON David Ahern
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile                     |   34 ++++++++++++++-----------------
 tools/perf/Pconfig                      |    2 ++
 tools/perf/builtin-script.c             |    3 ++-
 tools/perf/config/feature-tests.mak     |    4 ++--
 tools/perf/util/trace-event-scripting.c |   13 ++++++------
 5 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 4e54d05..af7b746 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -16,8 +16,6 @@ include config/utilities.mak
 #
 # Define CROSS_COMPILE as prefix name of compiler if you want cross-builds.
 #
-# Define NO_LIBPERL to disable perl script extension.
-#
 # Define NO_LIBPYTHON to disable python script extension.
 #
 # Define PYTHON to point to the python binary if the default
@@ -718,23 +716,21 @@ ifndef NO_GTK2
 	endif
 endif
 
-ifdef NO_LIBPERL
-	BASIC_CFLAGS += -DNO_LIBPERL
-else
-       PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
-       PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
-       PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
-	PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
-	FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
-
-	ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED),perl),y)
-		BASIC_CFLAGS += -DNO_LIBPERL
-	else
-               ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS)
-               EXTLIBS += $(PERL_EMBED_LIBADD)
-		LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o
-		LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o
-	endif
+ifdef CONFIG_LIBPERL
+    PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
+    PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
+    PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
+    PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
+    FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
+
+    ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED)),y)
+        $(error perl module ExtUtils::Embed not installed. Install it or unset CONFIG_LIBPERL to continue)
+    endif
+
+    ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS)
+    EXTLIBS += $(PERL_EMBED_LIBADD)
+    LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o
+    LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o
 endif
 
 disable-python = $(eval $(disable-python_code))
diff --git a/tools/perf/Pconfig b/tools/perf/Pconfig
index e69de29..a636af3 100644
--- a/tools/perf/Pconfig
+++ b/tools/perf/Pconfig
@@ -0,0 +1,2 @@
+config LIBPERL
+    bool "Enable support for perl scripting engine"
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 92d4658..7841533 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -16,6 +16,7 @@
 #include "util/evsel.h"
 #include "util/sort.h"
 #include <linux/bitmap.h>
+#include <linux/kconfig.h>
 
 static char const		*script_name;
 static char const		*generate_script_lang;
@@ -1110,7 +1111,7 @@ int find_scripts(char **scripts_array, char **scripts_path_array)
 	for_each_lang(scripts_path, scripts_dir, lang_dirent, lang_next) {
 		snprintf(lang_path, MAXPATHLEN, "%s/%s", scripts_path,
 			 lang_dirent.d_name);
-#ifdef NO_LIBPERL
+#ifndef CONFIG_LIBPERL
 		if (strstr(lang_path, "perl"))
 			continue;
 #endif
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
index b4eabb4..1222b33 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -102,7 +102,7 @@ int main(void)
 endef
 endif
 
-ifndef NO_LIBPERL
+ifdef CONFIG_LIBPERL
 define SOURCE_PERL_EMBED
 #include <EXTERN.h>
 #include <perl.h>
@@ -235,4 +235,4 @@ int main(void)
 	numa_available();
 	return 0;
 }
-endef
\ No newline at end of file
+endef
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c
index 8715a10..3343d97 100644
--- a/tools/perf/util/trace-event-scripting.c
+++ b/tools/perf/util/trace-event-scripting.c
@@ -27,6 +27,7 @@
 #include "../perf.h"
 #include "util.h"
 #include "trace-event.h"
+#include <linux/kconfig.h>
 
 struct scripting_context *scripting_context;
 
@@ -110,7 +111,7 @@ void setup_python_scripting(void)
 static void print_perl_unsupported_msg(void)
 {
 	fprintf(stderr, "Perl scripting not supported."
-		"  Install libperl and rebuild perf to enable it.\n"
+		"  Enable CONFIG_LIBPERL and rebuild perf.\n"
 		"For example:\n  # apt-get install libperl-dev (ubuntu)"
 		"\n  # yum install 'perl(ExtUtils::Embed)' (Fedora)"
 		"\n  etc.\n");
@@ -156,16 +157,16 @@ static void register_perl_scripting(struct scripting_ops *scripting_ops)
 	scripting_context = malloc(sizeof(struct scripting_context));
 }
 
-#ifdef NO_LIBPERL
+#ifdef CONFIG_LIBPERL
+extern struct scripting_ops perl_scripting_ops;
+
 void setup_perl_scripting(void)
 {
-	register_perl_scripting(&perl_scripting_unsupported_ops);
+	register_perl_scripting(&perl_scripting_ops);
 }
 #else
-extern struct scripting_ops perl_scripting_ops;
-
 void setup_perl_scripting(void)
 {
-	register_perl_scripting(&perl_scripting_ops);
+	register_perl_scripting(&perl_scripting_unsupported_ops);
 }
 #endif
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 03/23] perf: make python support based on CONFIG_LIBPYTHON
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
  2013-04-02  3:54 ` [PATCH 01/23] perf: initial infrasructure for kconfig David Ahern
  2013-04-02  3:54 ` [PATCH 02/23] perf: make perl support based on CONFIG_LIBPERL David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  3:54 ` [PATCH 04/23] perf: make gtk2 support based on CONFIG_GTK2 David Ahern
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile                     |  105 +++++++++++++++----------------
 tools/perf/Pconfig                      |    3 +
 tools/perf/builtin-script.c             |    2 +-
 tools/perf/config/feature-tests.mak     |    2 +-
 tools/perf/util/trace-event-scripting.c |   17 +++--
 5 files changed, 61 insertions(+), 68 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index af7b746..2225c3d 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -16,8 +16,6 @@ include config/utilities.mak
 #
 # Define CROSS_COMPILE as prefix name of compiler if you want cross-builds.
 #
-# Define NO_LIBPYTHON to disable python script extension.
-#
 # Define PYTHON to point to the python binary if the default
 # `python' is not correct; for example: PYTHON=python2
 #
@@ -733,69 +731,64 @@ ifdef CONFIG_LIBPERL
     LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o
 endif
 
-disable-python = $(eval $(disable-python_code))
-define disable-python_code
-  BASIC_CFLAGS += -DNO_LIBPYTHON
-  $(if $(1),$(warning No $(1) was found))
-  $(warning Python support will not be built)
-endef
+ifdef CONFIG_LIBPYTHON
+    override PYTHON := \
+        $(call get-executable-or-default,PYTHON,python)
 
-override PYTHON := \
-  $(call get-executable-or-default,PYTHON,python)
+    ifndef PYTHON
+        $(error python interpreter not found. Install it or unset CONFIG_LIBPYTHON to continue.)
+    endif
 
-ifndef PYTHON
-  $(call disable-python,python interpreter)
-else
+    PYTHON_WORD := $(call shell-wordify,$(PYTHON))
 
-  PYTHON_WORD := $(call shell-wordify,$(PYTHON))
+    # python extension build directories
+    PYTHON_EXTBUILD     := $(OUTPUT)python_ext_build/
+    PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
+    PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
+    export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
 
-  ifdef NO_LIBPYTHON
-    $(call disable-python)
-  else
+    python-clean := rm -rf $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so
 
     override PYTHON_CONFIG := \
-      $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config)
+        $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config)
 
     ifndef PYTHON_CONFIG
-      $(call disable-python,python-config tool)
-    else
-
-      PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
-
-      PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
-      PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
-      PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
-      PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
-      FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
-
-      ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED),python),y)
-        $(call disable-python,Python.h (for Python 2.x))
-      else
-
-        ifneq ($(call try-cc,$(SOURCE_PYTHON_VERSION),$(FLAGS_PYTHON_EMBED),python version),y)
-          $(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
-          ALL_LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
-          EXTLIBS += $(PYTHON_EMBED_LIBADD)
-          LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o
-          LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o
-          LANG_BINDINGS += $(OUTPUT)python/perf.so
-        endif
-
-      endif
+        $(error python-config not found. Install it or unset CONFIG_LIBPYTHON to continue.)
     endif
-  endif
+
+    PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
+
+    PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
+    PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
+    PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
+    PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
+    FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
+
+    ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED)),y)
+        $(warning Failed to detect python development kit.)
+        $(warning Install it or unset CONFIG_LIBPYTHON to continue.)
+        $(warning e.g., apt-get install python-dev (ubuntu).)
+        $(warning       yum install python-devel (Fedora).)
+        $(error )
+    endif
+
+    ifneq ($(call try-cc,$(SOURCE_PYTHON_VERSION),$(FLAGS_PYTHON_EMBED),python version),y)
+        $(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 by unsetting CONFIG_LIBPYTHON.)
+        $(error   $(and ,))
+    endif
+
+    ALL_LDFLAGS   += $(PYTHON_EMBED_LDFLAGS)
+    EXTLIBS       += $(PYTHON_EMBED_LIBADD)
+    LIB_OBJS      += $(OUTPUT)util/scripting-engines/trace-event-python.o
+    LIB_OBJS      += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o
+    LANG_BINDINGS += $(OUTPUT)python/perf.so
 endif
 
 ifdef NO_DEMANGLE
diff --git a/tools/perf/Pconfig b/tools/perf/Pconfig
index a636af3..67ae110 100644
--- a/tools/perf/Pconfig
+++ b/tools/perf/Pconfig
@@ -1,2 +1,5 @@
 config LIBPERL
     bool "Enable support for perl scripting engine"
+
+config LIBPYTHON
+    bool "Enable support for python scripting engine"
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 7841533..e57b87d 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1115,7 +1115,7 @@ int find_scripts(char **scripts_array, char **scripts_path_array)
 		if (strstr(lang_path, "perl"))
 			continue;
 #endif
-#ifdef NO_LIBPYTHON
+#ifndef CONFIG_LIBPYTHON
 		if (strstr(lang_path, "python"))
 			continue;
 #endif
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
index 1222b33..2a2fa3b 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -115,7 +115,7 @@ return 0;
 endef
 endif
 
-ifndef NO_LIBPYTHON
+ifdef CONFIG_LIBPYTHON
 define SOURCE_PYTHON_VERSION
 #include <Python.h>
 #if PY_VERSION_HEX >= 0x03000000
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c
index 3343d97..932d480 100644
--- a/tools/perf/util/trace-event-scripting.c
+++ b/tools/perf/util/trace-event-scripting.c
@@ -46,11 +46,8 @@ static void process_event_unsupported(union perf_event *event __maybe_unused,
 
 static void print_python_unsupported_msg(void)
 {
-	fprintf(stderr, "Python scripting not supported."
-		"  Install libpython and rebuild perf to enable it.\n"
-		"For example:\n  # apt-get install python-dev (ubuntu)"
-		"\n  # yum install python-devel (Fedora)"
-		"\n  etc.\n");
+	fprintf(stderr, "Python scripting not supported.\n"
+		"Enable CONFIG_LIBPYTHON and rebuild perf to enable it.\n");
 }
 
 static int python_start_script_unsupported(const char *script __maybe_unused,
@@ -94,17 +91,17 @@ static void register_python_scripting(struct scripting_ops *scripting_ops)
 	scripting_context = malloc(sizeof(struct scripting_context));
 }
 
-#ifdef NO_LIBPYTHON
+#ifdef CONFIG_LIBPYTHON
+extern struct scripting_ops python_scripting_ops;
+
 void setup_python_scripting(void)
 {
-	register_python_scripting(&python_scripting_unsupported_ops);
+	register_python_scripting(&python_scripting_ops);
 }
 #else
-extern struct scripting_ops python_scripting_ops;
-
 void setup_python_scripting(void)
 {
-	register_python_scripting(&python_scripting_ops);
+	register_python_scripting(&python_scripting_unsupported_ops);
 }
 #endif
 
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 04/23] perf: make gtk2 support based on CONFIG_GTK2
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (2 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 03/23] perf: make python support based on CONFIG_LIBPYTHON David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  3:54 ` [PATCH 05/23] perf: make newt support based on CONFIG_NEWT David Ahern
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile                 |   39 ++++++++++++++++-------------------
 tools/perf/Pconfig                  |    3 +++
 tools/perf/config/feature-tests.mak |    2 +-
 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 2225c3d..01e2abf 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -36,8 +36,6 @@ include config/utilities.mak
 #
 # Define NO_NEWT if you do not want TUI support.
 #
-# Define NO_GTK2 if you do not want GTK+ GUI support.
-#
 # Define NO_DEMANGLE if you do not want C++ symbol demangling.
 #
 # Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
@@ -693,25 +691,24 @@ ifndef NO_NEWT
 	endif
 endif
 
-ifndef NO_GTK2
-	FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
-	ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y)
-		msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
-	else
-		ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y)
-			BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR
-		endif
-		BASIC_CFLAGS += -DGTK2_SUPPORT
-		BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
-		EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
-		LIB_OBJS += $(OUTPUT)ui/gtk/browser.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/hists.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/setup.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/util.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/progress.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/annotate.o
-	endif
+ifdef CONFIG_GTK2
+    FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
+    ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y)
+        $(error GTK2 not found. Please install gtk2-devel or libgtk2.0-dev or unset CONFIG_GTK2)
+    endif
+    ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y)
+        BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR
+    endif
+    BASIC_CFLAGS += -DGTK2_SUPPORT
+    BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
+    EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
+    LIB_OBJS += $(OUTPUT)ui/gtk/browser.o
+    LIB_OBJS += $(OUTPUT)ui/gtk/hists.o
+    LIB_OBJS += $(OUTPUT)ui/gtk/setup.o
+    LIB_OBJS += $(OUTPUT)ui/gtk/util.o
+    LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o
+    LIB_OBJS += $(OUTPUT)ui/gtk/progress.o
+    LIB_OBJS += $(OUTPUT)ui/gtk/annotate.o
 endif
 
 ifdef CONFIG_LIBPERL
diff --git a/tools/perf/Pconfig b/tools/perf/Pconfig
index 67ae110..79e1fc3 100644
--- a/tools/perf/Pconfig
+++ b/tools/perf/Pconfig
@@ -1,3 +1,6 @@
+config GTK2
+    bool "Enable GTK-based UI"
+
 config LIBPERL
     bool "Enable support for perl scripting engine"
 
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
index 2a2fa3b..bf906e8 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -74,7 +74,7 @@ int main(void)
 endef
 endif
 
-ifndef NO_GTK2
+ifdef CONFIG_GTK2
 define SOURCE_GTK2
 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
 #include <gtk/gtk.h>
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 05/23] perf: make newt support based on CONFIG_NEWT
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (3 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 04/23] perf: make gtk2 support based on CONFIG_GTK2 David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  3:54 ` [PATCH 06/23] perf: remove NEWT_SUPPORT in favor of CONFIG_NEWT David Ahern
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile                 |   46 +++++++++++++++++------------------
 tools/perf/Pconfig                  |    3 +++
 tools/perf/config/feature-tests.mak |    2 +-
 3 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 01e2abf..f4c3b02 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -34,8 +34,6 @@ include config/utilities.mak
 #
 # Define WERROR=0 to disable treating any warnings as errors.
 #
-# Define NO_NEWT if you do not want TUI support.
-#
 # Define NO_DEMANGLE if you do not want C++ symbol demangling.
 #
 # Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
@@ -666,29 +664,29 @@ ifndef NO_LIBAUDIT
 	endif
 endif
 
-ifndef NO_NEWT
+ifdef CONFIG_NEWT
 	FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt
-	ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT),libnewt),y)
-		msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev);
-	else
-		# Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
-		BASIC_CFLAGS += -I/usr/include/slang
-		BASIC_CFLAGS += -DNEWT_SUPPORT
-		EXTLIBS += -lnewt -lslang
-		LIB_OBJS += $(OUTPUT)ui/browser.o
-		LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
-		LIB_OBJS += $(OUTPUT)ui/browsers/hists.o
-		LIB_OBJS += $(OUTPUT)ui/browsers/map.o
-		LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o
-		LIB_OBJS += $(OUTPUT)ui/tui/setup.o
-		LIB_OBJS += $(OUTPUT)ui/tui/util.o
-		LIB_OBJS += $(OUTPUT)ui/tui/helpline.o
-		LIB_OBJS += $(OUTPUT)ui/tui/progress.o
-		LIB_H += ui/browser.h
-		LIB_H += ui/browsers/map.h
-		LIB_H += ui/keysyms.h
-		LIB_H += ui/libslang.h
-	endif
+    ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT),libnewt),y)
+        $(error newt not found. Please install newt-devel or libnewt-dev or disable CONFIG_NEWT)
+    endif
+
+    # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
+    BASIC_CFLAGS += -I/usr/include/slang
+    BASIC_CFLAGS += -DNEWT_SUPPORT
+    EXTLIBS += -lnewt -lslang
+    LIB_OBJS += $(OUTPUT)ui/browser.o
+    LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
+    LIB_OBJS += $(OUTPUT)ui/browsers/hists.o
+    LIB_OBJS += $(OUTPUT)ui/browsers/map.o
+    LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o
+    LIB_OBJS += $(OUTPUT)ui/tui/setup.o
+    LIB_OBJS += $(OUTPUT)ui/tui/util.o
+    LIB_OBJS += $(OUTPUT)ui/tui/helpline.o
+    LIB_OBJS += $(OUTPUT)ui/tui/progress.o
+    LIB_H += ui/browser.h
+    LIB_H += ui/browsers/map.h
+    LIB_H += ui/keysyms.h
+    LIB_H += ui/libslang.h
 endif
 
 ifdef CONFIG_GTK2
diff --git a/tools/perf/Pconfig b/tools/perf/Pconfig
index 79e1fc3..367cc65 100644
--- a/tools/perf/Pconfig
+++ b/tools/perf/Pconfig
@@ -1,3 +1,6 @@
+config NEWT
+    bool "Enable newt-based TUI"
+
 config GTK2
     bool "Enable GTK-based UI"
 
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
index bf906e8..7ec044f 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -61,7 +61,7 @@ int main(void)
 }
 endef
 
-ifndef NO_NEWT
+ifdef CONFIG_NEWT
 define SOURCE_NEWT
 #include <newt.h>
 
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 06/23] perf: remove NEWT_SUPPORT in favor of CONFIG_NEWT
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (4 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 05/23] perf: make newt support based on CONFIG_NEWT David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  3:54 ` [PATCH 07/23] perf: remove GTK2_SUPPORT in favor of CONFIG_GTK2 David Ahern
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        |    1 -
 tools/perf/ui/ui.h         |    3 ++-
 tools/perf/util/annotate.h |    3 ++-
 tools/perf/util/hist.h     |    3 ++-
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index f4c3b02..0cee87c 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -672,7 +672,6 @@ ifdef CONFIG_NEWT
 
     # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
     BASIC_CFLAGS += -I/usr/include/slang
-    BASIC_CFLAGS += -DNEWT_SUPPORT
     EXTLIBS += -lnewt -lslang
     LIB_OBJS += $(OUTPUT)ui/browser.o
     LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
diff --git a/tools/perf/ui/ui.h b/tools/perf/ui/ui.h
index d86359c..b030017 100644
--- a/tools/perf/ui/ui.h
+++ b/tools/perf/ui/ui.h
@@ -4,6 +4,7 @@
 #include <pthread.h>
 #include <stdbool.h>
 #include <linux/compiler.h>
+#include <linux/kconfig.h>
 
 extern pthread_mutex_t ui__lock;
 
@@ -12,7 +13,7 @@ extern int use_browser;
 void setup_browser(bool fallback_to_pager);
 void exit_browser(bool wait_for_ok);
 
-#ifdef NEWT_SUPPORT
+#ifdef CONFIG_NEWT
 int ui__init(void);
 void ui__exit(bool wait_for_ok);
 #else
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index c422440..0435758 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -10,6 +10,7 @@
 #include <linux/list.h>
 #include <linux/rbtree.h>
 #include <pthread.h>
+#include <linux/kconfig.h>
 
 struct ins;
 
@@ -141,7 +142,7 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx,
 			 bool print_lines, bool full_paths, int min_pcnt,
 			 int max_lines);
 
-#ifdef NEWT_SUPPORT
+#ifdef CONFIG_NEWT
 int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
 			 struct hist_browser_timer *hbt);
 #else
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 226a4ae..83c1627 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -5,6 +5,7 @@
 #include <pthread.h>
 #include "callchain.h"
 #include "header.h"
+#include <linux/kconfig.h>
 
 extern struct callchain_param callchain_param;
 
@@ -175,7 +176,7 @@ struct hist_browser_timer {
 	int refresh;
 };
 
-#ifdef NEWT_SUPPORT
+#ifdef CONFIG_NEWT
 #include "../ui/keysyms.h"
 int hist_entry__tui_annotate(struct hist_entry *he, int evidx,
 			     struct hist_browser_timer *hbt);
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 07/23] perf: remove GTK2_SUPPORT in favor of CONFIG_GTK2
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (5 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 06/23] perf: remove NEWT_SUPPORT in favor of CONFIG_NEWT David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  3:54 ` [PATCH 08/23] perf: make elf support based on CONFIG_LIBELF David Ahern
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        |    1 -
 tools/perf/ui/ui.h         |    2 +-
 tools/perf/util/annotate.h |    2 +-
 tools/perf/util/hist.h     |    2 +-
 4 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 0cee87c..0060275 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -696,7 +696,6 @@ ifdef CONFIG_GTK2
     ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y)
         BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR
     endif
-    BASIC_CFLAGS += -DGTK2_SUPPORT
     BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
     EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
     LIB_OBJS += $(OUTPUT)ui/gtk/browser.o
diff --git a/tools/perf/ui/ui.h b/tools/perf/ui/ui.h
index b030017..5f3465c 100644
--- a/tools/perf/ui/ui.h
+++ b/tools/perf/ui/ui.h
@@ -24,7 +24,7 @@ static inline int ui__init(void)
 static inline void ui__exit(bool wait_for_ok __maybe_unused) {}
 #endif
 
-#ifdef GTK2_SUPPORT
+#ifdef CONFIG_GTK2
 int perf_gtk__init(void);
 void perf_gtk__exit(bool wait_for_ok);
 #else
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index 0435758..2a2e413 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -156,7 +156,7 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,
 }
 #endif
 
-#ifdef GTK2_SUPPORT
+#ifdef CONFIG_GTK2
 int symbol__gtk_annotate(struct symbol *sym, struct map *map, int evidx,
 			 struct hist_browser_timer *hbt);
 
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 83c1627..e1c2182 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -214,7 +214,7 @@ static inline int script_browse(const char *script_opt __maybe_unused)
 #define K_SWITCH_INPUT_DATA -3000
 #endif
 
-#ifdef GTK2_SUPPORT
+#ifdef CONFIG_GTK2
 int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help,
 				  struct hist_browser_timer *hbt __maybe_unused);
 #else
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 08/23] perf: make elf support based on CONFIG_LIBELF
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (6 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 07/23] perf: remove GTK2_SUPPORT in favor of CONFIG_GTK2 David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  3:54 ` [PATCH 09/23] perf: make cfi unwind support based on CONFIG_LIBUNWIND David Ahern
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Add CONFIG_LIBC as well. It is only used to determine if lack of elf
support is due to support missing for libc or libelf.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile |  103 +++++++++++++++++++++++----------------------------
 tools/perf/Pconfig  |    7 ++++
 2 files changed, 54 insertions(+), 56 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 0060275..9bb12b5 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -36,8 +36,6 @@ include config/utilities.mak
 #
 # Define NO_DEMANGLE if you do not want C++ symbol demangling.
 #
-# Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
-#
 # Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
 # backtrace post unwind.
 #
@@ -545,30 +543,22 @@ ifneq ($(MAKECMDGOALS),tags)
 # because maintaining the nesting to match is a pain.  If
 # we had "elif" things would have been much nicer...
 
-ifdef NO_LIBELF
-	NO_DWARF := 1
-	NO_DEMANGLE := 1
-	NO_LIBUNWIND := 1
-else
-FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
-ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
-	FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
-	ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
-		LIBC_SUPPORT := 1
-	endif
-	ifeq ($(BIONIC),1)
-		LIBC_SUPPORT := 1
-	endif
-	ifeq ($(LIBC_SUPPORT),1)
-		msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev);
+ifdef CONFIG_LIBELF
+    FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+
+    # try to compile with libelf support ...
+    ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
+        FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
+        # ... it failed. Is the failure due to missing libc or libelf
+        # development support?
+        ifneq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
+            $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static or disable CONFIG_LIBC)
+        endif
+
+        # libelf not installed
+        $(error No libelf found, please install elfutils-libelf-devel/libelf-dev or disable CONFIG_LIBELF);
+    endif
 
-		NO_LIBELF := 1
-		NO_DWARF := 1
-		NO_DEMANGLE := 1
-	else
-		msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
-	endif
-else
 	# for linking with debug library, run like:
 	# make DEBUG=1 LIBDW_DIR=/opt/libdw/
 	ifdef LIBDW_DIR
@@ -576,13 +566,17 @@ else
 		LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
 	endif
 
+    # libelf supported - what about dwarf?
 	FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
 	ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y)
 		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
-	endif # Dwarf support
-endif # SOURCE_LIBELF
-endif # NO_LIBELF
+	endif
+else
+    NO_DWARF := 1
+    NO_DEMANGLE := 1
+    NO_LIBUNWIND := 1
+endif
 
 # There's only x86 (both 32 and 64) support for CFI unwind so far
 ifneq ($(ARCH),x86)
@@ -610,41 +604,38 @@ ifneq ($(OUTPUT),)
 	BASIC_CFLAGS += -I$(OUTPUT)
 endif
 
-ifdef NO_LIBELF
-EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
+ifdef CONFIG_LIBELF
+    BASIC_CFLAGS += -DLIBELF_SUPPORT
 
-# Remove ELF/DWARF dependent codes
-LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS))
-LIB_OBJS := $(filter-out $(OUTPUT)util/dwarf-aux.o,$(LIB_OBJS))
-LIB_OBJS := $(filter-out $(OUTPUT)util/probe-event.o,$(LIB_OBJS))
-LIB_OBJS := $(filter-out $(OUTPUT)util/probe-finder.o,$(LIB_OBJS))
+    FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+    ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
+	    BASIC_CFLAGS += -DLIBELF_MMAP
+    endif
 
-BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS))
+    ifndef NO_DWARF
+        ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
+	        msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
+        else
+            BASIC_CFLAGS := -DDWARF_SUPPORT $(LIBDW_CFLAGS) $(BASIC_CFLAGS)
+            BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS)
+            EXTLIBS += -lelf -ldw
+            LIB_OBJS += $(OUTPUT)util/probe-finder.o
+            LIB_OBJS += $(OUTPUT)util/dwarf-aux.o
+        endif # PERF_HAVE_DWARF_REGS
+    endif # NO_DWARF
 
-# Use minimal symbol handling
-LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
+else
+    EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
 
-else # NO_LIBELF
-BASIC_CFLAGS += -DLIBELF_SUPPORT
+    # Remove ELF/DWARF dependent codes
+    LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS))
+    LIB_OBJS := $(filter-out $(OUTPUT)util/probe-event.o,$(LIB_OBJS))
+    BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS))
 
-FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
-ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
-	BASIC_CFLAGS += -DLIBELF_MMAP
+    # Use minimal symbol handling
+    LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
 endif
 
-ifndef NO_DWARF
-ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
-	msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
-else
-	BASIC_CFLAGS := -DDWARF_SUPPORT $(LIBDW_CFLAGS) $(BASIC_CFLAGS)
-	BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS)
-	EXTLIBS += -lelf -ldw
-	LIB_OBJS += $(OUTPUT)util/probe-finder.o
-	LIB_OBJS += $(OUTPUT)util/dwarf-aux.o
-endif # PERF_HAVE_DWARF_REGS
-endif # NO_DWARF
-endif # NO_LIBELF
-
 ifndef NO_LIBUNWIND
 	BASIC_CFLAGS += -DLIBUNWIND_SUPPORT
 	EXTLIBS += $(LIBUNWIND_LIBS)
diff --git a/tools/perf/Pconfig b/tools/perf/Pconfig
index 367cc65..334674c 100644
--- a/tools/perf/Pconfig
+++ b/tools/perf/Pconfig
@@ -4,6 +4,13 @@ config NEWT
 config GTK2
     bool "Enable GTK-based UI"
 
+config LIBC
+    bool "Development support for libc is available - glibc or bionic"
+
+config LIBELF
+    bool "Enable support for libelf"
+    depends on LIBC
+
 config LIBPERL
     bool "Enable support for perl scripting engine"
 
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 09/23] perf: make cfi unwind support based on CONFIG_LIBUNWIND
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (7 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 08/23] perf: make elf support based on CONFIG_LIBELF David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  9:32   ` Paul Bolle
  2013-04-02  3:54 ` [PATCH 10/23] perf: make demangle support based on CONFIG_DEMANGLE David Ahern
                   ` (13 subsequent siblings)
  22 siblings, 1 reply; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile                 |   20 ++++++++++----------
 tools/perf/Pconfig                  |   15 +++++++++++++++
 tools/perf/arch/x86/Makefile        |    2 +-
 tools/perf/config/feature-tests.mak |    2 +-
 4 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 9bb12b5..5c060c8 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -36,9 +36,6 @@ include config/utilities.mak
 #
 # Define NO_DEMANGLE if you do not want C++ symbol demangling.
 #
-# Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
-# backtrace post unwind.
-#
 # Define NO_BACKTRACE if you do not want stack backtrace debug feature
 #
 # Define NO_LIBNUMA if you do not want numa perf benchmark
@@ -575,15 +572,19 @@ ifdef CONFIG_LIBELF
 else
     NO_DWARF := 1
     NO_DEMANGLE := 1
-    NO_LIBUNWIND := 1
+    ifdef CONFIG_LIBUNWIND
+        $(error CONFIG_LIBUNWIND depends on LIBELF)
+    endif
 endif
 
 # There's only x86 (both 32 and 64) support for CFI unwind so far
 ifneq ($(ARCH),x86)
-	NO_LIBUNWIND := 1
+ifdef CONFIG_LIBUNWIND
+	$(error CONFIG_LIBUNWIND only supported for x86 architecture)
+endif
 endif
 
-ifndef NO_LIBUNWIND
+ifdef CONFIG_LIBUNWIND
 # for linking with debug library, run like:
 # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
 ifdef LIBUNWIND_DIR
@@ -593,10 +594,9 @@ endif
 
 FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
 ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y)
-	msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99);
-	NO_LIBUNWIND := 1
+    $(error No libunwind found. Please install libunwind-dev[el] >= 0.99 or disable CONFIG_LIBUNWIND)
 endif # Libunwind support
-endif # NO_LIBUNWIND
+endif
 
 -include arch/$(ARCH)/Makefile
 
@@ -636,7 +636,7 @@ else
     LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
 endif
 
-ifndef NO_LIBUNWIND
+ifdef CONFIG_LIBUNWIND
 	BASIC_CFLAGS += -DLIBUNWIND_SUPPORT
 	EXTLIBS += $(LIBUNWIND_LIBS)
 	BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS)
diff --git a/tools/perf/Pconfig b/tools/perf/Pconfig
index 334674c..d6e067e 100644
--- a/tools/perf/Pconfig
+++ b/tools/perf/Pconfig
@@ -1,3 +1,14 @@
+config ARCH
+    string
+    option env="ARCH"
+
+config X86
+    def_bool y if ARCH = "x86"
+    select HAVE_CFI_UNWIND_SUPPORT
+
+config HAVE_CFI_UNWIND_SUPPORT
+    bool
+
 config NEWT
     bool "Enable newt-based TUI"
 
@@ -11,6 +22,10 @@ config LIBELF
     bool "Enable support for libelf"
     depends on LIBC
 
+config LIBUNWIND
+    bool "Enable support for libunwind"
+    depends on HAVE_CFI_UNWIND_SUPPORT && LIBELF
+
 config LIBPERL
     bool "Enable support for perl scripting engine"
 
diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
index 815841c..3a6dc3d 100644
--- a/tools/perf/arch/x86/Makefile
+++ b/tools/perf/arch/x86/Makefile
@@ -2,7 +2,7 @@ ifndef NO_DWARF
 PERF_HAVE_DWARF_REGS := 1
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
-ifndef NO_LIBUNWIND
+ifdef CONFIG_LIBUNWIND
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind.o
 endif
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
index 7ec044f..b0c28b2 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -167,7 +167,7 @@ int main(void)
 }
 endef
 
-ifndef NO_LIBUNWIND
+ifdef CONFIG_LIBUNWIND
 define SOURCE_LIBUNWIND
 #include <libunwind.h>
 #include <stdlib.h>
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 10/23] perf: make demangle support based on CONFIG_DEMANGLE
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (8 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 09/23] perf: make cfi unwind support based on CONFIG_LIBUNWIND David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  9:26   ` Paul Bolle
  2013-04-02  3:54 ` [PATCH 11/23] perf: make dwarf support based on CONFIG_DWARF David Ahern
                   ` (12 subsequent siblings)
  22 siblings, 1 reply; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile      |   70 ++++++++++++++++++++++------------------------
 tools/perf/Pconfig       |    4 +++
 tools/perf/util/symbol.h |    3 +-
 3 files changed, 39 insertions(+), 38 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 5c060c8..65283e6 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -34,8 +34,6 @@ include config/utilities.mak
 #
 # Define WERROR=0 to disable treating any warnings as errors.
 #
-# Define NO_DEMANGLE if you do not want C++ symbol demangling.
-#
 # Define NO_BACKTRACE if you do not want stack backtrace debug feature
 #
 # Define NO_LIBNUMA if you do not want numa perf benchmark
@@ -571,7 +569,9 @@ ifdef CONFIG_LIBELF
 	endif
 else
     NO_DWARF := 1
-    NO_DEMANGLE := 1
+    ifdef CONFIG_DEMANGLE
+        $(error CONFIG_DEMANGLE depends on LIBELF)
+    endif
     ifdef CONFIG_LIBUNWIND
         $(error CONFIG_LIBUNWIND depends on LIBELF)
     endif
@@ -775,41 +775,37 @@ ifdef CONFIG_LIBPYTHON
     LANG_BINDINGS += $(OUTPUT)python/perf.so
 endif
 
-ifdef NO_DEMANGLE
-	BASIC_CFLAGS += -DNO_DEMANGLE
-else
-        ifdef HAVE_CPLUS_DEMANGLE
-		EXTLIBS += -liberty
-		BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
+ifdef CONFIG_DEMANGLE
+    ifdef HAVE_CPLUS_DEMANGLE
+        EXTLIBS += -liberty
+        BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
+    else
+        FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd
+        has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd)
+        ifeq ($(has_bfd),y)
+            EXTLIBS += -lbfd
         else
-		FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd
-		has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd)
-		ifeq ($(has_bfd),y)
-			EXTLIBS += -lbfd
-		else
-			FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty
-			has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty)
-			ifeq ($(has_bfd_iberty),y)
-				EXTLIBS += -lbfd -liberty
-			else
-				FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz
-				has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z),libz)
-				ifeq ($(has_bfd_iberty_z),y)
-					EXTLIBS += -lbfd -liberty -lz
-				else
-					FLAGS_CPLUS_DEMANGLE=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty
-					has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle)
-					ifeq ($(has_cplus_demangle),y)
-						EXTLIBS += -liberty
-						BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
-					else
-						msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
-						BASIC_CFLAGS += -DNO_DEMANGLE
-					endif
-				endif
-			endif
-		endif
-	endif
+            FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty
+            has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty)
+            ifeq ($(has_bfd_iberty),y)
+                EXTLIBS += -lbfd -liberty
+            else
+                FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz
+                has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z),libz)
+                ifeq ($(has_bfd_iberty_z),y)
+                    EXTLIBS += -lbfd -liberty -lz
+                else
+                    FLAGS_CPLUS_DEMANGLE=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty
+                    has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle)
+                    ifeq ($(has_cplus_demangle),y)
+                        EXTLIBS += -liberty
+                        BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
+                    endif
+                    $(error No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling or unset CONFIG_DEMANGLE)
+                endif
+            endif
+        endif
+    endif
 endif
 
 ifeq ($(NO_PERF_REGS),0)
diff --git a/tools/perf/Pconfig b/tools/perf/Pconfig
index d6e067e..dc0fc36 100644
--- a/tools/perf/Pconfig
+++ b/tools/perf/Pconfig
@@ -26,6 +26,10 @@ config LIBUNWIND
     bool "Enable support for libunwind"
     depends on HAVE_CFI_UNWIND_SUPPORT && LIBELF
 
+ config DEMANGLE
+    bool "Enable support for demangle"
+    depends on LIBELF
+
 config LIBPERL
     bool "Enable support for perl scripting engine"
 
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index b62ca37..cd284dc 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -12,6 +12,7 @@
 #include <byteswap.h>
 #include <libgen.h>
 #include "build-id.h"
+#include <linux/kconfig.h>
 
 #ifdef LIBELF_SUPPORT
 #include <libelf.h>
@@ -29,7 +30,7 @@ static inline char *bfd_demangle(void __maybe_unused *v, const char *c, int i)
 	return cplus_demangle(c, i);
 }
 #else
-#ifdef NO_DEMANGLE
+#ifndef CONFIG_DEMANGLE
 static inline char *bfd_demangle(void __maybe_unused *v,
 				 const char __maybe_unused *c,
 				 int __maybe_unused i)
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 11/23] perf: make dwarf support based on CONFIG_DWARF
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (9 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 10/23] perf: make demangle support based on CONFIG_DEMANGLE David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  3:54 ` [PATCH 12/23] perf: add BIONIC config option David Ahern
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile                 |   22 ++++++++++++----------
 tools/perf/Pconfig                  |    4 ++++
 tools/perf/arch/arm/Makefile        |    2 +-
 tools/perf/arch/powerpc/Makefile    |    2 +-
 tools/perf/arch/s390/Makefile       |    2 +-
 tools/perf/arch/sh/Makefile         |    2 +-
 tools/perf/arch/sparc/Makefile      |    2 +-
 tools/perf/arch/x86/Makefile        |    2 +-
 tools/perf/config/feature-tests.mak |    2 +-
 9 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 65283e6..d2707ee 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -30,8 +30,6 @@ include config/utilities.mak
 #
 # Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
 #
-# Define NO_DWARF if you do not want debug-info analysis feature at all.
-#
 # Define WERROR=0 to disable treating any warnings as errors.
 #
 # Define NO_BACKTRACE if you do not want stack backtrace debug feature
@@ -562,13 +560,17 @@ ifdef CONFIG_LIBELF
 	endif
 
     # libelf supported - what about dwarf?
-	FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
-	ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y)
-		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
-	endif
+    ifdef CONFIG_DWARF
+        FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+        ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y)
+            $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138.ables dwarf support.)
+            $(error Please install new elfutils-devel/libdw-dev or disable CONFIG_DWARF);
+        endif
+    endif
 else
-    NO_DWARF := 1
+    ifdef CONFIG_DWARF
+        $(error CONFIG_DWARF depends on LIBELF)
+    endif
     ifdef CONFIG_DEMANGLE
         $(error CONFIG_DEMANGLE depends on LIBELF)
     endif
@@ -612,7 +614,7 @@ ifdef CONFIG_LIBELF
 	    BASIC_CFLAGS += -DLIBELF_MMAP
     endif
 
-    ifndef NO_DWARF
+    ifdef CONFIG_DWARF
         ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
 	        msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
         else
@@ -622,7 +624,7 @@ ifdef CONFIG_LIBELF
             LIB_OBJS += $(OUTPUT)util/probe-finder.o
             LIB_OBJS += $(OUTPUT)util/dwarf-aux.o
         endif # PERF_HAVE_DWARF_REGS
-    endif # NO_DWARF
+    endif
 
 else
     EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
diff --git a/tools/perf/Pconfig b/tools/perf/Pconfig
index dc0fc36..f744b7b 100644
--- a/tools/perf/Pconfig
+++ b/tools/perf/Pconfig
@@ -26,6 +26,10 @@ config LIBUNWIND
     bool "Enable support for libunwind"
     depends on HAVE_CFI_UNWIND_SUPPORT && LIBELF
 
+config DWARF
+    bool "Enable support for dwarf"
+    depends on LIBELF
+
  config DEMANGLE
     bool "Enable support for demangle"
     depends on LIBELF
diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile
index 15130b5..6d630e3 100644
--- a/tools/perf/arch/arm/Makefile
+++ b/tools/perf/arch/arm/Makefile
@@ -1,4 +1,4 @@
-ifndef NO_DWARF
+ifdef CONFIG_DWARF
 PERF_HAVE_DWARF_REGS := 1
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile
index 744e629..d01408e 100644
--- a/tools/perf/arch/powerpc/Makefile
+++ b/tools/perf/arch/powerpc/Makefile
@@ -1,4 +1,4 @@
-ifndef NO_DWARF
+ifdef CONFIG_DWARF
 PERF_HAVE_DWARF_REGS := 1
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile
index 15130b5..6d630e3 100644
--- a/tools/perf/arch/s390/Makefile
+++ b/tools/perf/arch/s390/Makefile
@@ -1,4 +1,4 @@
-ifndef NO_DWARF
+ifdef CONFIG_DWARF
 PERF_HAVE_DWARF_REGS := 1
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
diff --git a/tools/perf/arch/sh/Makefile b/tools/perf/arch/sh/Makefile
index 15130b5..6d630e3 100644
--- a/tools/perf/arch/sh/Makefile
+++ b/tools/perf/arch/sh/Makefile
@@ -1,4 +1,4 @@
-ifndef NO_DWARF
+ifdef CONFIG_DWARF
 PERF_HAVE_DWARF_REGS := 1
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
diff --git a/tools/perf/arch/sparc/Makefile b/tools/perf/arch/sparc/Makefile
index 15130b5..6d630e3 100644
--- a/tools/perf/arch/sparc/Makefile
+++ b/tools/perf/arch/sparc/Makefile
@@ -1,4 +1,4 @@
-ifndef NO_DWARF
+ifdef CONFIG_DWARF
 PERF_HAVE_DWARF_REGS := 1
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
index 3a6dc3d..8d18b74 100644
--- a/tools/perf/arch/x86/Makefile
+++ b/tools/perf/arch/x86/Makefile
@@ -1,4 +1,4 @@
-ifndef NO_DWARF
+ifdef CONFIG_DWARF
 PERF_HAVE_DWARF_REGS := 1
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
index b0c28b2..7873e6d 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -6,7 +6,7 @@ int main(void)
 }
 endef
 
-ifndef NO_DWARF
+ifdef CONFIG_DWARF
 define SOURCE_DWARF
 #include <dwarf.h>
 #include <elfutils/libdw.h>
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 12/23] perf: add BIONIC config option
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (10 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 11/23] perf: make dwarf support based on CONFIG_DWARF David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  3:54 ` [PATCH 13/23] perf: make numa support based on CONFIG_LIBNUMA David Ahern
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Sets the LIBC option and is independent of LIBELF.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile |    6 ++++--
 tools/perf/Pconfig  |    7 ++++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index d2707ee..969bdd3 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -206,8 +206,10 @@ BASIC_CFLAGS = \
 
 BASIC_LDFLAGS =
 
-ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
-	BIONIC := 1
+ifdef CONFIG_BIONIC
+    ifneq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
+        $(error No anddroid api-level.h. Unset CONFIG_BIONIC to continue)
+    endif
 	EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
 	EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
 	BASIC_CFLAGS += -I.
diff --git a/tools/perf/Pconfig b/tools/perf/Pconfig
index f744b7b..bec1ac6 100644
--- a/tools/perf/Pconfig
+++ b/tools/perf/Pconfig
@@ -15,12 +15,17 @@ config NEWT
 config GTK2
     bool "Enable GTK-based UI"
 
+config BIONIC
+    bool "Enable support for Bionic (e.g., Android platform)"
+    default n
+    select LIBC
+
 config LIBC
     bool "Development support for libc is available - glibc or bionic"
 
 config LIBELF
     bool "Enable support for libelf"
-    depends on LIBC
+    depends on !BIONIC && LIBC
 
 config LIBUNWIND
     bool "Enable support for libunwind"
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 13/23] perf: make numa support based on CONFIG_LIBNUMA
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (11 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 12/23] perf: add BIONIC config option David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  3:54 ` [PATCH 14/23] perf: make backtrace support based on CONFIG_BACKTRACE David Ahern
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        |   18 +++++++-----------
 tools/perf/Pconfig         |    5 +++++
 tools/perf/builtin-bench.c |    5 +++--
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 969bdd3..3ada6e7 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -33,8 +33,6 @@ include config/utilities.mak
 # Define WERROR=0 to disable treating any warnings as errors.
 #
 # Define NO_BACKTRACE if you do not want stack backtrace debug feature
-#
-# Define NO_LIBNUMA if you do not want numa perf benchmark
 
 $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
 	@$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
@@ -837,15 +835,13 @@ ifndef NO_BACKTRACE
        endif
 endif
 
-ifndef NO_LIBNUMA
-	FLAGS_LIBNUMA = $(ALL_CFLAGS) $(ALL_LDFLAGS) -lnuma
-	ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y)
-		msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev);
-	else
-		BASIC_CFLAGS += -DLIBNUMA_SUPPORT
-		BUILTIN_OBJS += $(OUTPUT)bench/numa.o
-		EXTLIBS += -lnuma
-	endif
+ifdef CONFIG_LIBNUMA
+    FLAGS_LIBNUMA = $(ALL_CFLAGS) $(ALL_LDFLAGS) -lnuma
+    ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y)
+        $(error No numa.h found. Please install numa-libs-devel or libnuma-dev or unset CONFIG_LIBNUMA)
+    endif
+    BUILTIN_OBJS += $(OUTPUT)bench/numa.o
+    EXTLIBS += -lnuma
 endif
 
 ifdef ASCIIDOC8
diff --git a/tools/perf/Pconfig b/tools/perf/Pconfig
index bec1ac6..c4e20cc 100644
--- a/tools/perf/Pconfig
+++ b/tools/perf/Pconfig
@@ -44,3 +44,8 @@ config LIBPERL
 
 config LIBPYTHON
     bool "Enable support for python scripting engine"
+
+config LIBNUMA
+    bool "Enable support for libnuma"
+    help
+        Used for 'perf bench numa mem' benchmark
diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c
index 77298bf..176a57d 100644
--- a/tools/perf/builtin-bench.c
+++ b/tools/perf/builtin-bench.c
@@ -21,6 +21,7 @@
 #include "util/parse-options.h"
 #include "builtin.h"
 #include "bench/bench.h"
+#include <linux/kconfig.h>
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -35,7 +36,7 @@ struct bench_suite {
 /* sentinel: easy for help */
 #define suite_all { "all", "Test all benchmark suites", NULL }
 
-#ifdef LIBNUMA_SUPPORT
+#ifdef CONFIG_LIBNUMA
 static struct bench_suite numa_suites[] = {
 	{ "mem",
 	  "Benchmark for NUMA workloads",
@@ -80,7 +81,7 @@ struct bench_subsys {
 };
 
 static struct bench_subsys subsystems[] = {
-#ifdef LIBNUMA_SUPPORT
+#ifdef CONFIG_LIBNUMA
 	{ "numa",
 	  "NUMA scheduling and MM behavior",
 	  numa_suites },
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 14/23] perf: make backtrace support based on CONFIG_BACKTRACE
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (12 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 13/23] perf: make numa support based on CONFIG_LIBNUMA David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  3:54 ` [PATCH 15/23] perf: make libaudit support based on CONFIG_LIBAUDIT David Ahern
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile                 |   10 ++++------
 tools/perf/Pconfig                  |    3 +++
 tools/perf/config/feature-tests.mak |    2 +-
 tools/perf/util/util.c              |    5 +++--
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 3ada6e7..0baa19b 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -31,8 +31,6 @@ include config/utilities.mak
 # Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
 #
 # Define WERROR=0 to disable treating any warnings as errors.
-#
-# Define NO_BACKTRACE if you do not want stack backtrace debug feature
 
 $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
 	@$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
@@ -829,10 +827,10 @@ ifndef NO_ON_EXIT
 	endif
 endif
 
-ifndef NO_BACKTRACE
-       ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DBACKTRACE_SUPPORT),y)
-               BASIC_CFLAGS += -DBACKTRACE_SUPPORT
-       endif
+ifdef CONFIG_BACKTRACE
+    ifneq ($(call try-cc,$(SOURCE_BACKTRACE),,-DBACKTRACE_SUPPORT),y)
+        $(error backtrace not supported. Unset CONFIG_BACKTRACE)
+   endif
 endif
 
 ifdef CONFIG_LIBNUMA
diff --git a/tools/perf/Pconfig b/tools/perf/Pconfig
index c4e20cc..b03881c 100644
--- a/tools/perf/Pconfig
+++ b/tools/perf/Pconfig
@@ -49,3 +49,6 @@ config LIBNUMA
     bool "Enable support for libnuma"
     help
         Used for 'perf bench numa mem' benchmark
+
+config BACKTRACE
+    bool "Enable support for stack backtrace debugging"
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
index 7873e6d..1d16481 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -192,7 +192,7 @@ int main(void)
 endef
 endif
 
-ifndef NO_BACKTRACE
+ifdef CONFIG_BACKTRACE
 define SOURCE_BACKTRACE
 #include <execinfo.h>
 #include <stdio.h>
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 805d1f5..fa2916d 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -1,7 +1,8 @@
 #include "../perf.h"
 #include "util.h"
 #include <sys/mman.h>
-#ifdef BACKTRACE_SUPPORT
+#include <linux/kconfig.h>
+#ifdef CONFIG_BACKTRACE
 #include <execinfo.h>
 #endif
 #include <stdio.h>
@@ -202,7 +203,7 @@ int hex2u64(const char *ptr, u64 *long_val)
 }
 
 /* Obtain a backtrace and print it to stdout. */
-#ifdef BACKTRACE_SUPPORT
+#ifdef CONFIG_BACKTRACE
 void dump_stack(void)
 {
 	void *array[16];
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 15/23] perf: make libaudit support based on CONFIG_LIBAUDIT
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (13 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 14/23] perf: make backtrace support based on CONFIG_BACKTRACE David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  3:54 ` [PATCH 16/23] perf: consolidate CONFIG_LIBUNWIND checks in Makefile David Ahern
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile                 |   16 +++++++---------
 tools/perf/Pconfig                  |    5 +++++
 tools/perf/config/feature-tests.mak |    2 +-
 tools/perf/perf.c                   |    3 ++-
 4 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 0baa19b..62c10b8 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -644,15 +644,13 @@ ifdef CONFIG_LIBUNWIND
 	LIB_OBJS += $(OUTPUT)util/unwind.o
 endif
 
-ifndef NO_LIBAUDIT
-	FLAGS_LIBAUDIT = $(ALL_CFLAGS) $(ALL_LDFLAGS) -laudit
-	ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y)
-		msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
-	else
-		BASIC_CFLAGS += -DLIBAUDIT_SUPPORT
-		BUILTIN_OBJS += $(OUTPUT)builtin-trace.o
-		EXTLIBS += -laudit
-	endif
+ifdef CONFIG_LIBAUDIT
+    FLAGS_LIBAUDIT = $(ALL_CFLAGS) $(ALL_LDFLAGS) -laudit
+    ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y)
+        $(error No libaudit.h found, please install audit-libs-devel or libaudit-dev or disable CONFIG_LIBAUDIT)
+    endif
+    BUILTIN_OBJS += $(OUTPUT)builtin-trace.o
+    EXTLIBS += -laudit
 endif
 
 ifdef CONFIG_NEWT
diff --git a/tools/perf/Pconfig b/tools/perf/Pconfig
index b03881c..4cfccf3 100644
--- a/tools/perf/Pconfig
+++ b/tools/perf/Pconfig
@@ -45,6 +45,11 @@ config LIBPERL
 config LIBPYTHON
     bool "Enable support for python scripting engine"
 
+config LIBAUDIT
+    bool "Enable support for libaudit"
+    help
+        Used for perf trace tool.
+
 config LIBNUMA
     bool "Enable support for libnuma"
     help
diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak
index 1d16481..6e3ba0f 100644
--- a/tools/perf/config/feature-tests.mak
+++ b/tools/perf/config/feature-tests.mak
@@ -206,7 +206,7 @@ int main(void)
 endef
 endif
 
-ifndef NO_LIBAUDIT
+ifdef CONFIG_LIBAUDIT
 define SOURCE_LIBAUDIT
 #include <libaudit.h>
 
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 095b882..f7fcf78 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -14,6 +14,7 @@
 #include "util/run-command.h"
 #include "util/parse-events.h"
 #include "util/debugfs.h"
+#include <linux/kconfig.h>
 #include <pthread.h>
 
 const char perf_usage_string[] =
@@ -56,7 +57,7 @@ static struct cmd_struct commands[] = {
 	{ "lock",	cmd_lock,	0 },
 	{ "kvm",	cmd_kvm,	0 },
 	{ "test",	cmd_test,	0 },
-#ifdef LIBAUDIT_SUPPORT
+#ifdef CONFIG_LIBAUDIT
 	{ "trace",	cmd_trace,	0 },
 #endif
 	{ "inject",	cmd_inject,	0 },
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 16/23] perf: consolidate CONFIG_LIBUNWIND checks in Makefile
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (14 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 15/23] perf: make libaudit support based on CONFIG_LIBAUDIT David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  3:54 ` [PATCH 17/23] perf: remove LIBUNWIND_SUPPORT in favor of CONFIG_LIBUNWIND David Ahern
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

code move only

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile |   38 +++++++++++++++++---------------------
 1 file changed, 17 insertions(+), 21 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 62c10b8..a606eb1 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -577,27 +577,6 @@ else
     endif
 endif
 
-# There's only x86 (both 32 and 64) support for CFI unwind so far
-ifneq ($(ARCH),x86)
-ifdef CONFIG_LIBUNWIND
-	$(error CONFIG_LIBUNWIND only supported for x86 architecture)
-endif
-endif
-
-ifdef CONFIG_LIBUNWIND
-# for linking with debug library, run like:
-# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
-ifdef LIBUNWIND_DIR
-	LIBUNWIND_CFLAGS  := -I$(LIBUNWIND_DIR)/include
-	LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib
-endif
-
-FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
-ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y)
-    $(error No libunwind found. Please install libunwind-dev[el] >= 0.99 or disable CONFIG_LIBUNWIND)
-endif # Libunwind support
-endif
-
 -include arch/$(ARCH)/Makefile
 
 ifneq ($(OUTPUT),)
@@ -637,6 +616,23 @@ else
 endif
 
 ifdef CONFIG_LIBUNWIND
+    # There's only x86 (both 32 and 64) support for CFI unwind so far
+    ifneq ($(ARCH),x86)
+	    $(error CONFIG_LIBUNWIND only supported for x86 architecture)
+    endif
+
+    # for linking with debug library, run like:
+    # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
+    ifdef LIBUNWIND_DIR
+	    LIBUNWIND_CFLAGS  := -I$(LIBUNWIND_DIR)/include
+	    LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib
+    endif
+
+    FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
+    ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y)
+        $(error No libunwind found. Please install libunwind-dev[el] >= 0.99 or disable CONFIG_LIBUNWIND)
+    endif
+
 	BASIC_CFLAGS += -DLIBUNWIND_SUPPORT
 	EXTLIBS += $(LIBUNWIND_LIBS)
 	BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS)
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 17/23] perf: remove LIBUNWIND_SUPPORT in favor of CONFIG_LIBUNWIND
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (15 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 16/23] perf: consolidate CONFIG_LIBUNWIND checks in Makefile David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  3:54 ` [PATCH 18/23] perf: deprecate LIBELF_SUPPORT in favor of CONFIG_LIBELF David Ahern
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile         |    1 -
 tools/perf/builtin-record.c |   11 ++++++-----
 tools/perf/util/unwind.h    |    5 +++--
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index a606eb1..cc44818 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -633,7 +633,6 @@ ifdef CONFIG_LIBUNWIND
         $(error No libunwind found. Please install libunwind-dev[el] >= 0.99 or disable CONFIG_LIBUNWIND)
     endif
 
-	BASIC_CFLAGS += -DLIBUNWIND_SUPPORT
 	EXTLIBS += $(LIBUNWIND_LIBS)
 	BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS)
 	BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index f1a939e..276a6e0 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -26,6 +26,7 @@
 #include "util/symbol.h"
 #include "util/cpumap.h"
 #include "util/thread_map.h"
+#include <linux/kconfig.h>
 
 #include <unistd.h>
 #include <sched.h>
@@ -742,7 +743,7 @@ error:
 	return ret;
 }
 
-#ifdef LIBUNWIND_SUPPORT
+#ifdef CONFIG_LIBUNWIND
 static int get_stack_size(char *str, unsigned long *_size)
 {
 	char *endptr;
@@ -768,7 +769,7 @@ static int get_stack_size(char *str, unsigned long *_size)
 	       max_size, str);
 	return -1;
 }
-#endif /* LIBUNWIND_SUPPORT */
+#endif /* CONFIG_LIBUNWIND */
 
 int record_parse_callchain_opt(const struct option *opt,
 			       const char *arg, int unset)
@@ -806,7 +807,7 @@ int record_parse_callchain_opt(const struct option *opt,
 				       "needed for -g fp\n");
 			break;
 
-#ifdef LIBUNWIND_SUPPORT
+#ifdef CONFIG_LIBUNWIND
 		/* Dwarf style */
 		} else if (!strncmp(name, "dwarf", sizeof("dwarf"))) {
 			const unsigned long default_stack_dump_size = 8192;
@@ -826,7 +827,7 @@ int record_parse_callchain_opt(const struct option *opt,
 			if (!ret)
 				pr_debug("callchain: stack dump size %d\n",
 					 opts->stack_dump_size);
-#endif /* LIBUNWIND_SUPPORT */
+#endif /* CONFIG_LIBUNWIND */
 		} else {
 			pr_err("callchain: Unknown -g option "
 			       "value: %s\n", arg);
@@ -875,7 +876,7 @@ static struct perf_record record = {
 
 #define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: "
 
-#ifdef LIBUNWIND_SUPPORT
+#ifdef CONFIG_LIBUNWIND
 const char record_callchain_help[] = CALLCHAIN_HELP "[fp] dwarf";
 #else
 const char record_callchain_help[] = CALLCHAIN_HELP "[fp]";
diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h
index cb6bc50..9890981 100644
--- a/tools/perf/util/unwind.h
+++ b/tools/perf/util/unwind.h
@@ -4,6 +4,7 @@
 #include "types.h"
 #include "event.h"
 #include "symbol.h"
+#include <linux/kconfig.h>
 
 struct unwind_entry {
 	struct map	*map;
@@ -13,7 +14,7 @@ struct unwind_entry {
 
 typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);
 
-#ifdef LIBUNWIND_SUPPORT
+#ifdef CONFIG_LIBUNWIND
 int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
 			struct machine *machine,
 			struct thread *thread,
@@ -31,5 +32,5 @@ unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
 {
 	return 0;
 }
-#endif /* LIBUNWIND_SUPPORT */
+#endif /* CONFIG_LIBUNWIND */
 #endif /* __UNWIND_H */
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 18/23] perf: deprecate LIBELF_SUPPORT in favor of CONFIG_LIBELF
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (16 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 17/23] perf: remove LIBUNWIND_SUPPORT in favor of CONFIG_LIBUNWIND David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  3:54 ` [PATCH 19/23] perf: deprecate DWARF_SUPPORT in favor of CONFIG_DWARF David Ahern
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile                 |    2 --
 tools/perf/builtin-inject.c         |    3 ++-
 tools/perf/perf.c                   |    2 +-
 tools/perf/util/generate-cmdlist.sh |    4 ++--
 tools/perf/util/map.c               |    3 ++-
 tools/perf/util/symbol.h            |    4 ++--
 6 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index cc44818..f9847db 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -584,8 +584,6 @@ ifneq ($(OUTPUT),)
 endif
 
 ifdef CONFIG_LIBELF
-    BASIC_CFLAGS += -DLIBELF_SUPPORT
-
     FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
     ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
 	    BASIC_CFLAGS += -DLIBELF_MMAP
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 84ad6ab..92e8012 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -17,6 +17,7 @@
 #include "util/build-id.h"
 
 #include "util/parse-options.h"
+#include <linux/kconfig.h>
 
 #include <linux/list.h>
 
@@ -229,7 +230,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool,
 				 * account this as unresolved.
 				 */
 			} else {
-#ifdef LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
 				pr_warning("no symbols found in %s, maybe "
 					   "install a debug package?\n",
 					   al.map->dso->long_name);
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index f7fcf78..0919ee1 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -50,7 +50,7 @@ static struct cmd_struct commands[] = {
 	{ "version",	cmd_version,	0 },
 	{ "script",	cmd_script,	0 },
 	{ "sched",	cmd_sched,	0 },
-#ifdef LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
 	{ "probe",	cmd_probe,	0 },
 #endif
 	{ "kmem",	cmd_kmem,	0 },
diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh
index 3ac3803..8c039f6 100755
--- a/tools/perf/util/generate-cmdlist.sh
+++ b/tools/perf/util/generate-cmdlist.sh
@@ -22,7 +22,7 @@ do
      }' "Documentation/perf-$cmd.txt"
 done
 
-echo "#ifdef LIBELF_SUPPORT"
+echo "#ifdef CONFIG_LIBELF"
 sed -n -e 's/^perf-\([^ 	]*\)[ 	].* full.*/\1/p' command-list.txt |
 sort |
 while read cmd
@@ -35,5 +35,5 @@ do
 	    p
      }' "Documentation/perf-$cmd.txt"
 done
-echo "#endif /* LIBELF_SUPPORT */"
+echo "#endif /* CONFIG_LIBELF */"
 echo "};"
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 6fcb9de..80f351f 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -11,6 +11,7 @@
 #include "strlist.h"
 #include "vdso.h"
 #include "build-id.h"
+#include <linux/kconfig.h>
 #include <linux/string.h>
 
 const char *map_type__name[MAP__NR_TYPES] = {
@@ -165,7 +166,7 @@ int map__load(struct map *map, symbol_filter_t filter)
 		pr_warning(", continuing without symbols\n");
 		return -1;
 	} else if (nr == 0) {
-#ifdef LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
 		const size_t len = strlen(name);
 		const size_t real_len = len - sizeof(DSO__DELETED);
 
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index cd284dc..3875d40 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -14,7 +14,7 @@
 #include "build-id.h"
 #include <linux/kconfig.h>
 
-#ifdef LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
 #include <libelf.h>
 #include <gelf.h>
 #endif
@@ -172,7 +172,7 @@ struct symsrc {
 	int fd;
 	enum dso_binary_type type;
 
-#ifdef LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
 	Elf *elf;
 	GElf_Ehdr ehdr;
 
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 19/23] perf: deprecate DWARF_SUPPORT in favor of CONFIG_DWARF
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (17 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 18/23] perf: deprecate LIBELF_SUPPORT in favor of CONFIG_LIBELF David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  3:54 ` [PATCH 20/23] perf: consolidate CONFIG_LIBELF checks in Makefile David Ahern
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile                  |    2 +-
 tools/perf/builtin-probe.c           |   15 ++++++++-------
 tools/perf/util/include/dwarf-regs.h |    4 +++-
 tools/perf/util/probe-event.c        |    5 +++--
 tools/perf/util/probe-finder.h       |    5 +++--
 5 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index f9847db..e76fa2f 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -593,7 +593,7 @@ ifdef CONFIG_LIBELF
         ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
 	        msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
         else
-            BASIC_CFLAGS := -DDWARF_SUPPORT $(LIBDW_CFLAGS) $(BASIC_CFLAGS)
+            BASIC_CFLAGS := $(LIBDW_CFLAGS) $(BASIC_CFLAGS)
             BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS)
             EXTLIBS += -lelf -ldw
             LIB_OBJS += $(OUTPUT)util/probe-finder.o
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index de38a03..c86faf0 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -41,6 +41,7 @@
 #include "util/parse-options.h"
 #include "util/probe-finder.h"
 #include "util/probe-event.h"
+#include <linux/kconfig.h>
 
 #define DEFAULT_VAR_FILTER "!__k???tab_* & !__crc_*"
 #define DEFAULT_FUNC_FILTER "!_*"
@@ -173,7 +174,7 @@ static int opt_set_target(const struct option *opt, const char *str,
 	if  (str && !params.target) {
 		if (!strcmp(opt->long_name, "exec"))
 			params.uprobes = true;
-#ifdef DWARF_SUPPORT
+#ifdef CONFIG_DWARF
 		else if (!strcmp(opt->long_name, "module"))
 			params.uprobes = false;
 #endif
@@ -187,7 +188,7 @@ static int opt_set_target(const struct option *opt, const char *str,
 	return ret;
 }
 
-#ifdef DWARF_SUPPORT
+#ifdef CONFIG_DWARF
 static int opt_show_lines(const struct option *opt __maybe_unused,
 			  const char *str, int unset __maybe_unused)
 {
@@ -257,7 +258,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
 		"perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]",
 		"perf probe [<options>] --del '[GROUP:]EVENT' ...",
 		"perf probe --list",
-#ifdef DWARF_SUPPORT
+#ifdef CONFIG_DWARF
 		"perf probe [<options>] --line 'LINEDESC'",
 		"perf probe [<options>] --vars 'PROBEPOINT'",
 #endif
@@ -271,7 +272,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
 	OPT_CALLBACK('d', "del", NULL, "[GROUP:]EVENT", "delete a probe event.",
 		opt_del_probe_event),
 	OPT_CALLBACK('a', "add", NULL,
-#ifdef DWARF_SUPPORT
+#ifdef CONFIG_DWARF
 		"[EVENT=]FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT"
 		" [[NAME=]ARG ...]",
 #else
@@ -283,7 +284,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
 		"\t\tFUNC:\tFunction name\n"
 		"\t\tOFF:\tOffset from function entry (in byte)\n"
 		"\t\t%return:\tPut the probe at function return\n"
-#ifdef DWARF_SUPPORT
+#ifdef CONFIG_DWARF
 		"\t\tSRC:\tSource code path\n"
 		"\t\tRL:\tRelative line number from function entry.\n"
 		"\t\tAL:\tAbsolute line number in file.\n"
@@ -296,7 +297,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
 		opt_add_probe_event),
 	OPT_BOOLEAN('f', "force", &params.force_add, "forcibly add events"
 		    " with existing name"),
-#ifdef DWARF_SUPPORT
+#ifdef CONFIG_DWARF
 	OPT_CALLBACK('L', "line", NULL,
 		     "FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]",
 		     "Show source code lines.", opt_show_lines),
@@ -408,7 +409,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
 		return ret;
 	}
 
-#ifdef DWARF_SUPPORT
+#ifdef CONFIG_DWARF
 	if (params.show_lines && !params.uprobes) {
 		if (params.mod_events) {
 			pr_err("  Error: Don't use --line with"
diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h
index cf6727e..f77a851 100644
--- a/tools/perf/util/include/dwarf-regs.h
+++ b/tools/perf/util/include/dwarf-regs.h
@@ -1,7 +1,9 @@
 #ifndef _PERF_DWARF_REGS_H_
 #define _PERF_DWARF_REGS_H_
 
-#ifdef DWARF_SUPPORT
+#include <linux/kconfig.h>
+
+#ifdef CONFIG_DWARF
 const char *get_arch_regstr(unsigned int n);
 #endif
 
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 49a256e..1aed7a6 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -45,6 +45,7 @@
 #include "probe-event.h"
 #include "probe-finder.h"
 #include "session.h"
+#include <linux/kconfig.h>
 
 #define MAX_CMDLEN 256
 #define MAX_PROBE_ARGS 128
@@ -201,7 +202,7 @@ static int convert_to_perf_probe_point(struct probe_trace_point *tp,
 	return 0;
 }
 
-#ifdef DWARF_SUPPORT
+#ifdef CONFIG_DWARF
 /* Open new debuginfo of given module */
 static struct debuginfo *open_debuginfo(const char *module)
 {
@@ -630,7 +631,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
 	return ret;
 }
 
-#else	/* !DWARF_SUPPORT */
+#else	/* !CONFIG_DWARF */
 
 static int kprobe_convert_to_perf_probe(struct probe_trace_point *tp,
 					struct perf_probe_point *pp)
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index 17e94d0..5e4621e 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -4,6 +4,7 @@
 #include <stdbool.h>
 #include "util.h"
 #include "probe-event.h"
+#include <linux/kconfig.h>
 
 #define MAX_PROBE_BUFFER	1024
 #define MAX_PROBES		 128
@@ -14,7 +15,7 @@ static inline int is_c_varname(const char *name)
 	return isalpha(name[0]) || name[0] == '_';
 }
 
-#ifdef DWARF_SUPPORT
+#ifdef CONFIG_DWARF
 
 #include "dwarf-aux.h"
 
@@ -102,6 +103,6 @@ struct line_finder {
 	int			found;
 };
 
-#endif /* DWARF_SUPPORT */
+#endif /* CONFIG_DWARF */
 
 #endif /*_PROBE_FINDER_H */
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 20/23] perf: consolidate CONFIG_LIBELF checks in Makefile
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (18 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 19/23] perf: deprecate DWARF_SUPPORT in favor of CONFIG_DWARF David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  9:37   ` Paul Bolle
  2013-04-02  3:54 ` [PATCH 21/23] perf: consolidate CONFIG_DWARF " David Ahern
                   ` (2 subsequent siblings)
  22 siblings, 1 reply; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile |   34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index e76fa2f..a3a62611 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -530,6 +530,12 @@ PERFLIBS = $(LIB_FILE) $(LIBTRACEEVENT)
 ifneq ($(MAKECMDGOALS),clean)
 ifneq ($(MAKECMDGOALS),tags)
 
+-include arch/$(ARCH)/Makefile
+
+ifneq ($(OUTPUT),)
+	BASIC_CFLAGS += -I$(OUTPUT)
+endif
+
 # We choose to avoid "if .. else if .. else .. endif endif"
 # because maintaining the nesting to match is a pain.  If
 # we had "elif" things would have been much nicer...
@@ -565,25 +571,7 @@ ifdef CONFIG_LIBELF
             $(error Please install new elfutils-devel/libdw-dev or disable CONFIG_DWARF);
         endif
     endif
-else
-    ifdef CONFIG_DWARF
-        $(error CONFIG_DWARF depends on LIBELF)
-    endif
-    ifdef CONFIG_DEMANGLE
-        $(error CONFIG_DEMANGLE depends on LIBELF)
-    endif
-    ifdef CONFIG_LIBUNWIND
-        $(error CONFIG_LIBUNWIND depends on LIBELF)
-    endif
-endif
 
--include arch/$(ARCH)/Makefile
-
-ifneq ($(OUTPUT),)
-	BASIC_CFLAGS += -I$(OUTPUT)
-endif
-
-ifdef CONFIG_LIBELF
     FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
     ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
 	    BASIC_CFLAGS += -DLIBELF_MMAP
@@ -602,6 +590,16 @@ ifdef CONFIG_LIBELF
     endif
 
 else
+    ifdef CONFIG_DWARF
+        $(error CONFIG_DWARF depends on LIBELF)
+    endif
+    ifdef CONFIG_DEMANGLE
+        $(error CONFIG_DEMANGLE depends on LIBELF)
+    endif
+    ifdef CONFIG_LIBUNWIND
+        $(error CONFIG_LIBUNWIND depends on LIBELF)
+    endif
+
     EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
 
     # Remove ELF/DWARF dependent codes
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 21/23] perf: consolidate CONFIG_DWARF checks in Makefile
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (19 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 20/23] perf: consolidate CONFIG_LIBELF checks in Makefile David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  3:54 ` [PATCH 22/23] perf: only add elf to EXTLIBS if CONFIG_LIBELF is set David Ahern
  2013-04-02  3:54 ` [PATCH 23/23] perf: only add elf-based object files " David Ahern
  22 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index a3a62611..5037856 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -563,6 +563,11 @@ ifdef CONFIG_LIBELF
 		LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
 	endif
 
+    FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+    ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
+	    BASIC_CFLAGS += -DLIBELF_MMAP
+    endif
+
     # libelf supported - what about dwarf?
     ifdef CONFIG_DWARF
         FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
@@ -570,14 +575,7 @@ ifdef CONFIG_LIBELF
             $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138.ables dwarf support.)
             $(error Please install new elfutils-devel/libdw-dev or disable CONFIG_DWARF);
         endif
-    endif
 
-    FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
-    ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
-	    BASIC_CFLAGS += -DLIBELF_MMAP
-    endif
-
-    ifdef CONFIG_DWARF
         ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
 	        msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
         else
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 22/23] perf: only add elf to EXTLIBS if CONFIG_LIBELF is set
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (20 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 21/23] perf: consolidate CONFIG_DWARF " David Ahern
@ 2013-04-02  3:54 ` David Ahern
  2013-04-02  3:54 ` [PATCH 23/23] perf: only add elf-based object files " David Ahern
  22 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 5037856..5990520 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -87,7 +87,7 @@ ifdef PARSER_DEBUG
 endif
 
 CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)
-EXTLIBS = -lpthread -lrt -lelf -lm
+EXTLIBS = -lpthread -lrt -lm
 ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 ALL_LDFLAGS = $(LDFLAGS)
 STRIP ?= strip
@@ -541,6 +541,7 @@ endif
 # we had "elif" things would have been much nicer...
 
 ifdef CONFIG_LIBELF
+    EXTLIBS += -lelf
     FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
 
     # try to compile with libelf support ...
@@ -570,7 +571,7 @@ ifdef CONFIG_LIBELF
 
     # libelf supported - what about dwarf?
     ifdef CONFIG_DWARF
-        FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+        FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
         ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y)
             $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138.ables dwarf support.)
             $(error Please install new elfutils-devel/libdw-dev or disable CONFIG_DWARF);
@@ -581,7 +582,7 @@ ifdef CONFIG_LIBELF
         else
             BASIC_CFLAGS := $(LIBDW_CFLAGS) $(BASIC_CFLAGS)
             BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS)
-            EXTLIBS += -lelf -ldw
+            EXTLIBS += -ldw
             LIB_OBJS += $(OUTPUT)util/probe-finder.o
             LIB_OBJS += $(OUTPUT)util/dwarf-aux.o
         endif # PERF_HAVE_DWARF_REGS
@@ -598,8 +599,6 @@ else
         $(error CONFIG_LIBUNWIND depends on LIBELF)
     endif
 
-    EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
-
     # Remove ELF/DWARF dependent codes
     LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS))
     LIB_OBJS := $(filter-out $(OUTPUT)util/probe-event.o,$(LIB_OBJS))
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 23/23] perf: only add elf-based object files if CONFIG_LIBELF is set
  2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
                   ` (21 preceding siblings ...)
  2013-04-02  3:54 ` [PATCH 22/23] perf: only add elf to EXTLIBS if CONFIG_LIBELF is set David Ahern
@ 2013-04-02  3:54 ` David Ahern
  22 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02  3:54 UTC (permalink / raw)
  To: acme, linux-kernel
  Cc: David Ahern, Borislav Petkov, Frederic Weisbecker, Ingo Molnar,
	Jiri Olsa, Namhyung Kim, Peter Zijlstra, Stephane Eranian

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 5990520..b16a944 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -430,7 +430,6 @@ LIB_OBJS += $(OUTPUT)util/wrapper.o
 LIB_OBJS += $(OUTPUT)util/sigchain.o
 LIB_OBJS += $(OUTPUT)util/dso.o
 LIB_OBJS += $(OUTPUT)util/symbol.o
-LIB_OBJS += $(OUTPUT)util/symbol-elf.o
 LIB_OBJS += $(OUTPUT)util/color.o
 LIB_OBJS += $(OUTPUT)util/pager.o
 LIB_OBJS += $(OUTPUT)util/header.o
@@ -454,7 +453,6 @@ LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o
 LIB_OBJS += $(OUTPUT)util/svghelper.o
 LIB_OBJS += $(OUTPUT)util/sort.o
 LIB_OBJS += $(OUTPUT)util/hist.o
-LIB_OBJS += $(OUTPUT)util/probe-event.o
 LIB_OBJS += $(OUTPUT)util/util.o
 LIB_OBJS += $(OUTPUT)util/xyarray.o
 LIB_OBJS += $(OUTPUT)util/cpumap.o
@@ -515,7 +513,6 @@ BUILTIN_OBJS += $(OUTPUT)builtin-stat.o
 BUILTIN_OBJS += $(OUTPUT)builtin-timechart.o
 BUILTIN_OBJS += $(OUTPUT)builtin-top.o
 BUILTIN_OBJS += $(OUTPUT)builtin-script.o
-BUILTIN_OBJS += $(OUTPUT)builtin-probe.o
 BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o
 BUILTIN_OBJS += $(OUTPUT)builtin-lock.o
 BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o
@@ -588,6 +585,10 @@ ifdef CONFIG_LIBELF
         endif # PERF_HAVE_DWARF_REGS
     endif
 
+    LIB_OBJS += $(OUTPUT)util/symbol-elf.o
+    LIB_OBJS += $(OUTPUT)util/probe-event.o
+    BUILTIN_OBJS += $(OUTPUT)builtin-probe.o
+
 else
     ifdef CONFIG_DWARF
         $(error CONFIG_DWARF depends on LIBELF)
@@ -599,11 +600,6 @@ else
         $(error CONFIG_LIBUNWIND depends on LIBELF)
     endif
 
-    # Remove ELF/DWARF dependent codes
-    LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS))
-    LIB_OBJS := $(filter-out $(OUTPUT)util/probe-event.o,$(LIB_OBJS))
-    BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS))
-
     # Use minimal symbol handling
     LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
 endif
-- 
1.7.10.1


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH 01/23] perf: initial infrasructure for kconfig
  2013-04-02  3:54 ` [PATCH 01/23] perf: initial infrasructure for kconfig David Ahern
@ 2013-04-02  8:22   ` Paul Bolle
  2013-04-02 15:09     ` David Ahern
  0 siblings, 1 reply; 32+ messages in thread
From: Paul Bolle @ 2013-04-02  8:22 UTC (permalink / raw)
  To: David Ahern
  Cc: acme, linux-kernel, Borislav Petkov, Frederic Weisbecker,
	Ingo Molnar, Jiri Olsa, Namhyung Kim, Peter Zijlstra,
	Stephane Eranian, linux-kbuild

On Mon, 2013-04-01 at 21:54 -0600, David Ahern wrote:
> Add Pconfig file which will hold the build options.
> Update Makefile with new config files.
> 
> Signed-off-by: David Ahern <dsahern@gmail.com>
> Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Stephane Eranian <eranian@google.com>
> Cc: linux-kbuild@vger.kernel.org
> ---
>  tools/perf/Makefile |    5 +++++
>  1 file changed, 5 insertions(+)
>  create mode 100644 tools/perf/Pconfig

All current Kconfig files can be found with git ls-files "*Kconfig*".
This file won't. Why does it need to be named differently?


Paul Bolle


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 10/23] perf: make demangle support based on CONFIG_DEMANGLE
  2013-04-02  3:54 ` [PATCH 10/23] perf: make demangle support based on CONFIG_DEMANGLE David Ahern
@ 2013-04-02  9:26   ` Paul Bolle
  0 siblings, 0 replies; 32+ messages in thread
From: Paul Bolle @ 2013-04-02  9:26 UTC (permalink / raw)
  To: David Ahern
  Cc: acme, linux-kernel, Borislav Petkov, Frederic Weisbecker,
	Ingo Molnar, Jiri Olsa, Namhyung Kim, Peter Zijlstra,
	Stephane Eranian

On Mon, 2013-04-01 at 21:54 -0600, David Ahern wrote:
> diff --git a/tools/perf/Makefile b/tools/perf/Makefile
> index 5c060c8..65283e6 100644
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
>[...]
> @@ -571,7 +569,9 @@ ifdef CONFIG_LIBELF
>  	endif
>  else
>      NO_DWARF := 1
> -    NO_DEMANGLE := 1
> +    ifdef CONFIG_DEMANGLE
> +        $(error CONFIG_DEMANGLE depends on LIBELF)
> +    endif

You check for a dependency here ...

>      ifdef CONFIG_LIBUNWIND
>          $(error CONFIG_LIBUNWIND depends on LIBELF)
>      endif
>[...]
> diff --git a/tools/perf/Pconfig b/tools/perf/Pconfig
> index d6e067e..dc0fc36 100644
> --- a/tools/perf/Pconfig
> +++ b/tools/perf/Pconfig
> @@ -26,6 +26,10 @@ config LIBUNWIND
>      bool "Enable support for libunwind"
>      depends on HAVE_CFI_UNWIND_SUPPORT && LIBELF
>  
> + config DEMANGLE
> +    bool "Enable support for demangle"
> +    depends on LIBELF
> +

... that already seems to be enforced here.

>  config LIBPERL
>      bool "Enable support for perl scripting engine"
>  


Paul Bolle


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 09/23] perf: make cfi unwind support based on CONFIG_LIBUNWIND
  2013-04-02  3:54 ` [PATCH 09/23] perf: make cfi unwind support based on CONFIG_LIBUNWIND David Ahern
@ 2013-04-02  9:32   ` Paul Bolle
  2013-04-02 15:20     ` David Ahern
  0 siblings, 1 reply; 32+ messages in thread
From: Paul Bolle @ 2013-04-02  9:32 UTC (permalink / raw)
  To: David Ahern
  Cc: acme, linux-kernel, Borislav Petkov, Frederic Weisbecker,
	Ingo Molnar, Jiri Olsa, Namhyung Kim, Peter Zijlstra,
	Stephane Eranian

On Mon, 2013-04-01 at 21:54 -0600, David Ahern wrote:
> --- a/tools/perf/Pconfig
> +++ b/tools/perf/Pconfig
> @@ -1,3 +1,14 @@
> +config ARCH
> +    string
> +    option env="ARCH"

Why does this copy init/Kconfig?

> +config X86
> +    def_bool y if ARCH = "x86"
> +    select HAVE_CFI_UNWIND_SUPPORT
> +

Doesn't this clash with the same Kconfig symbol in arch/x86/Kconfig?

> +config HAVE_CFI_UNWIND_SUPPORT
> +    bool
> +
>  config NEWT
>      bool "Enable newt-based TUI"
>  


Paul Bolle


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 20/23] perf: consolidate CONFIG_LIBELF checks in Makefile
  2013-04-02  3:54 ` [PATCH 20/23] perf: consolidate CONFIG_LIBELF checks in Makefile David Ahern
@ 2013-04-02  9:37   ` Paul Bolle
  2013-04-02 15:21     ` David Ahern
  0 siblings, 1 reply; 32+ messages in thread
From: Paul Bolle @ 2013-04-02  9:37 UTC (permalink / raw)
  To: David Ahern
  Cc: acme, linux-kernel, Borislav Petkov, Frederic Weisbecker,
	Ingo Molnar, Jiri Olsa, Namhyung Kim, Peter Zijlstra,
	Stephane Eranian

On Mon, 2013-04-01 at 21:54 -0600, David Ahern wrote:
> --- a/tools/perf/Makefile
> +++ b/tools/perf/Makefile
>[...]
> @@ -602,6 +590,16 @@ ifdef CONFIG_LIBELF
>      endif
>  
>  else
> +    ifdef CONFIG_DWARF
> +        $(error CONFIG_DWARF depends on LIBELF)
> +    endif
> +    ifdef CONFIG_DEMANGLE
> +        $(error CONFIG_DEMANGLE depends on LIBELF)
> +    endif
> +    ifdef CONFIG_LIBUNWIND
> +        $(error CONFIG_LIBUNWIND depends on LIBELF)
> +    endif
> +
>      EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
>  
>      # Remove ELF/DWARF dependent codes

A quick scan of your series suggests you check here for dependencies
that are already enforced by the kconfig tools. Why is this needed?


Paul Bolle


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 01/23] perf: initial infrasructure for kconfig
  2013-04-02  8:22   ` Paul Bolle
@ 2013-04-02 15:09     ` David Ahern
  0 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02 15:09 UTC (permalink / raw)
  To: Paul Bolle
  Cc: acme, linux-kernel, Borislav Petkov, Frederic Weisbecker,
	Ingo Molnar, Jiri Olsa, Namhyung Kim, Peter Zijlstra,
	Stephane Eranian, linux-kbuild

On 4/2/13 2:22 AM, Paul Bolle wrote:
>>   tools/perf/Makefile |    5 +++++
>>   1 file changed, 5 insertions(+)
>>   create mode 100644 tools/perf/Pconfig
>
> All current Kconfig files can be found with git ls-files "*Kconfig*".
> This file won't. Why does it need to be named differently?

It does not. I will rename to Kconfig.

David

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 09/23] perf: make cfi unwind support based on CONFIG_LIBUNWIND
  2013-04-02  9:32   ` Paul Bolle
@ 2013-04-02 15:20     ` David Ahern
  2013-04-04  8:02       ` Paul Bolle
  0 siblings, 1 reply; 32+ messages in thread
From: David Ahern @ 2013-04-02 15:20 UTC (permalink / raw)
  To: Paul Bolle
  Cc: acme, linux-kernel, Borislav Petkov, Frederic Weisbecker,
	Ingo Molnar, Jiri Olsa, Namhyung Kim, Peter Zijlstra,
	Stephane Eranian

On 4/2/13 3:32 AM, Paul Bolle wrote:
> On Mon, 2013-04-01 at 21:54 -0600, David Ahern wrote:
>> --- a/tools/perf/Pconfig
>> +++ b/tools/perf/Pconfig
>> @@ -1,3 +1,14 @@
>> +config ARCH
>> +    string
>> +    option env="ARCH"
>
> Why does this copy init/Kconfig?
>
>> +config X86
>> +    def_bool y if ARCH = "x86"
>> +    select HAVE_CFI_UNWIND_SUPPORT
>> +
>
> Doesn't this clash with the same Kconfig symbol in arch/x86/Kconfig?

traditionally, perf has not required a kernel config to build it. The 
above grabs some symbols for a standalone perf config. I guess that's a 
question to be answered - should the kernel's config files should be 
used for perf (or a tools target in general).

Also, perf can be built outside of the kernel tree. Tying the build to 
the kernel config files would have an affect on that option.

Something to look at for the next version.

David

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 20/23] perf: consolidate CONFIG_LIBELF checks in Makefile
  2013-04-02  9:37   ` Paul Bolle
@ 2013-04-02 15:21     ` David Ahern
  0 siblings, 0 replies; 32+ messages in thread
From: David Ahern @ 2013-04-02 15:21 UTC (permalink / raw)
  To: Paul Bolle
  Cc: acme, linux-kernel, Borislav Petkov, Frederic Weisbecker,
	Ingo Molnar, Jiri Olsa, Namhyung Kim, Peter Zijlstra,
	Stephane Eranian

On 4/2/13 3:37 AM, Paul Bolle wrote:
> On Mon, 2013-04-01 at 21:54 -0600, David Ahern wrote:
>> --- a/tools/perf/Makefile
>> +++ b/tools/perf/Makefile
>> [...]
>> @@ -602,6 +590,16 @@ ifdef CONFIG_LIBELF
>>       endif
>>
>>   else
>> +    ifdef CONFIG_DWARF
>> +        $(error CONFIG_DWARF depends on LIBELF)
>> +    endif
>> +    ifdef CONFIG_DEMANGLE
>> +        $(error CONFIG_DEMANGLE depends on LIBELF)
>> +    endif
>> +    ifdef CONFIG_LIBUNWIND
>> +        $(error CONFIG_LIBUNWIND depends on LIBELF)
>> +    endif
>> +
>>       EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
>>
>>       # Remove ELF/DWARF dependent codes
>
> A quick scan of your series suggests you check here for dependencies
> that are already enforced by the kconfig tools. Why is this needed?

Just a side effect of the evolutionary path from where the perf build is 
today to the kconfig route. Certainly the above (and similar ones) are 
not needed in the end.

David


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 09/23] perf: make cfi unwind support based on CONFIG_LIBUNWIND
  2013-04-02 15:20     ` David Ahern
@ 2013-04-04  8:02       ` Paul Bolle
  0 siblings, 0 replies; 32+ messages in thread
From: Paul Bolle @ 2013-04-04  8:02 UTC (permalink / raw)
  To: David Ahern
  Cc: acme, linux-kernel, Borislav Petkov, Frederic Weisbecker,
	Ingo Molnar, Jiri Olsa, Namhyung Kim, Peter Zijlstra,
	Stephane Eranian

On Tue, 2013-04-02 at 09:20 -0600, David Ahern wrote:
> traditionally, perf has not required a kernel config to build it. The 
> above grabs some symbols for a standalone perf config. I guess that's a 
> question to be answered - should the kernel's config files should be 
> used for perf (or a tools target in general).

If you decide to only use the kernel kconfig tools but not the current
tree of Kconfig files I suggest to separate things clearly. So in that
case using Pconfig as a filename (as we discussed for PATCH 01/23)
actually seems to be a good idea. Likewise, in that case you might want
to prefix your macros with, say, PCONFIG_ instead of CONFIG_. (I think
the kconfig tools support that, but I haven't checked.)

> Also, perf can be built outside of the kernel tree. Tying the build to 
> the kernel config files would have an affect on that option.
> 
> Something to look at for the next version.


Paul Bolle


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2013-04-04  8:02 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-02  3:54 [PATCH 00/23] perf: integrate with kconfig and CONFIG driven features David Ahern
2013-04-02  3:54 ` [PATCH 01/23] perf: initial infrasructure for kconfig David Ahern
2013-04-02  8:22   ` Paul Bolle
2013-04-02 15:09     ` David Ahern
2013-04-02  3:54 ` [PATCH 02/23] perf: make perl support based on CONFIG_LIBPERL David Ahern
2013-04-02  3:54 ` [PATCH 03/23] perf: make python support based on CONFIG_LIBPYTHON David Ahern
2013-04-02  3:54 ` [PATCH 04/23] perf: make gtk2 support based on CONFIG_GTK2 David Ahern
2013-04-02  3:54 ` [PATCH 05/23] perf: make newt support based on CONFIG_NEWT David Ahern
2013-04-02  3:54 ` [PATCH 06/23] perf: remove NEWT_SUPPORT in favor of CONFIG_NEWT David Ahern
2013-04-02  3:54 ` [PATCH 07/23] perf: remove GTK2_SUPPORT in favor of CONFIG_GTK2 David Ahern
2013-04-02  3:54 ` [PATCH 08/23] perf: make elf support based on CONFIG_LIBELF David Ahern
2013-04-02  3:54 ` [PATCH 09/23] perf: make cfi unwind support based on CONFIG_LIBUNWIND David Ahern
2013-04-02  9:32   ` Paul Bolle
2013-04-02 15:20     ` David Ahern
2013-04-04  8:02       ` Paul Bolle
2013-04-02  3:54 ` [PATCH 10/23] perf: make demangle support based on CONFIG_DEMANGLE David Ahern
2013-04-02  9:26   ` Paul Bolle
2013-04-02  3:54 ` [PATCH 11/23] perf: make dwarf support based on CONFIG_DWARF David Ahern
2013-04-02  3:54 ` [PATCH 12/23] perf: add BIONIC config option David Ahern
2013-04-02  3:54 ` [PATCH 13/23] perf: make numa support based on CONFIG_LIBNUMA David Ahern
2013-04-02  3:54 ` [PATCH 14/23] perf: make backtrace support based on CONFIG_BACKTRACE David Ahern
2013-04-02  3:54 ` [PATCH 15/23] perf: make libaudit support based on CONFIG_LIBAUDIT David Ahern
2013-04-02  3:54 ` [PATCH 16/23] perf: consolidate CONFIG_LIBUNWIND checks in Makefile David Ahern
2013-04-02  3:54 ` [PATCH 17/23] perf: remove LIBUNWIND_SUPPORT in favor of CONFIG_LIBUNWIND David Ahern
2013-04-02  3:54 ` [PATCH 18/23] perf: deprecate LIBELF_SUPPORT in favor of CONFIG_LIBELF David Ahern
2013-04-02  3:54 ` [PATCH 19/23] perf: deprecate DWARF_SUPPORT in favor of CONFIG_DWARF David Ahern
2013-04-02  3:54 ` [PATCH 20/23] perf: consolidate CONFIG_LIBELF checks in Makefile David Ahern
2013-04-02  9:37   ` Paul Bolle
2013-04-02 15:21     ` David Ahern
2013-04-02  3:54 ` [PATCH 21/23] perf: consolidate CONFIG_DWARF " David Ahern
2013-04-02  3:54 ` [PATCH 22/23] perf: only add elf to EXTLIBS if CONFIG_LIBELF is set David Ahern
2013-04-02  3:54 ` [PATCH 23/23] perf: only add elf-based object files " David Ahern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.