Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1572157 > unrolled thread

[PATCH 0/4] Fixes for perf build and feature detection

Started byDavid Carrillo-Cisneros <davidcc@google.com>
First post2017-02-02 07:40 +0100
Last post2017-02-02 14:00 +0100
Articles 18 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/4] Fixes for perf build and feature detection David Carrillo-Cisneros <davidcc@google.com> - 2017-02-02 07:40 +0100
    [PATCH 2/4] tools lib traceevent: Robustify do_generate_dynamic_list_file David Carrillo-Cisneros <davidcc@google.com> - 2017-02-02 07:40 +0100
      Re: [PATCH 2/4] tools lib traceevent: Robustify  do_generate_dynamic_list_file Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-06 18:50 +0100
    [PATCH 4/4] tools include: Fix include path for uapi/asm-generic/mman.h David Carrillo-Cisneros <davidcc@google.com> - 2017-02-02 07:40 +0100
      Re: [PATCH 4/4] tools include: Fix include path for  uapi/asm-generic/mman.h Jiri Olsa <jolsa@redhat.com> - 2017-02-02 14:00 +0100
      Re: [PATCH 4/4] tools include: Fix include path for  uapi/asm-generic/mman.h Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-06 19:30 +0100
        Re: [PATCH 4/4] tools include: Fix include path for uapi/asm-generic/mman.h David Carrillo-Cisneros <davidcc@google.com> - 2017-02-06 21:10 +0100
    [PATCH 1/4] perf tools: pass PYTHON config to feature detection David Carrillo-Cisneros <davidcc@google.com> - 2017-02-02 07:40 +0100
      Re: [PATCH 1/4] perf tools: pass PYTHON config to feature detection Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-06 14:20 +0100
        Re: [PATCH 1/4] perf tools: pass PYTHON config to feature detection Namhyung Kim <namhyung@kernel.org> - 2017-02-06 16:30 +0100
      Re: [PATCH 1/4] perf tools: pass PYTHON config to feature detection Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-07 20:50 +0100
        Re: [PATCH 1/4] perf tools: pass PYTHON config to feature detection David Carrillo-Cisneros <davidcc@google.com> - 2017-02-08 04:20 +0100
          [PATCH v2] tools lib traceevent: Robustify do_generate_dynamic_list_file David Carrillo-Cisneros <davidcc@google.com> - 2017-02-08 06:30 +0100
            Re: [PATCH v2] tools lib traceevent: Robustify  do_generate_dynamic_list_file Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-08 13:50 +0100
              Re: [PATCH v2] tools lib traceevent: Robustify  do_generate_dynamic_list_file Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-08 14:30 +0100
                Re: [PATCH v2] tools lib traceevent: Robustify do_generate_dynamic_list_file David Carrillo-Cisneros <davidcc@google.com> - 2017-02-09 06:20 +0100
            [tip:perf/core] tools lib traceevent: Robustify  do_generate_dynamic_list_file tip-bot for David Carrillo-Cisneros <tipbot@zytor.com> - 2017-02-10 09:50 +0100
    Re: [PATCH 0/4] Fixes for perf build and feature detection Jiri Olsa <jolsa@redhat.com> - 2017-02-02 14:00 +0100

#1572157 — [PATCH 0/4] Fixes for perf build and feature detection

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2017-02-02 07:40 +0100
Subject[PATCH 0/4] Fixes for perf build and feature detection
Message-ID<t6jdL-fC-1@gated-at.bofh.it>
Fixes for minor problems with Makefiles and libs that I found while
building perf.

David Carrillo-Cisneros (4):
  perf tools: pass PYTHON config to feature detection
  tools lib traceevent: Robustify do_generate_dynamic_list_file
  tools lib feature: Do not redefine compiler configuration
  tools include: Fix include path for uapi/asm-generic/mman.h

 tools/build/feature/Makefile    |  8 ++++----
 tools/include/uapi/linux/mman.h |  2 +-
 tools/lib/traceevent/Makefile   | 13 +++++++++----
 tools/perf/Makefile.config      | 23 ++++++++++-------------
 4 files changed, 24 insertions(+), 22 deletions(-)

-- 
2.11.0.483.g087da7b7c-goog

[toc] | [next] | [standalone]


#1572158 — [PATCH 2/4] tools lib traceevent: Robustify do_generate_dynamic_list_file

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2017-02-02 07:40 +0100
Subject[PATCH 2/4] tools lib traceevent: Robustify do_generate_dynamic_list_file
Message-ID<t6jdL-fC-3@gated-at.bofh.it>
In reply to#1572157
The dynamic-list-file used to export dynamic symbols introduced in

commit e3d09ec8126f ("tools lib traceevent: Export dynamic symbols
used by traceevent plugins")

is generated without any sort of error checking.

I experienced problems due to an old version of nm (v 0.158) that outputs
in a format distinct from the assumed by the script.

Robustify this by enforcing that the second column in the symbol output
is an "U" (Undefined) as it should be since we are calling $(NM) -u ...
and print an error message otherwise.

Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
---
 tools/lib/traceevent/Makefile | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 2616c66e10c1..1b6e146429d0 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -257,10 +257,15 @@ define do_install_plugins
 endef
 
 define do_generate_dynamic_list_file
-	(echo '{';							\
-	$(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;	\
-	echo '};';							\
-	) > $2
+	symbol_type=`$(NM) -u -D $1 | awk 'NF>1 {print $$1}' | sort -u`;\
+	if [ "$$symbol_type" == "U" ];then				\
+		(echo '{';						\
+		$(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;\
+		echo '};';						\
+		) > $2;							\
+	else								\
+		(echo Either missing one of [$1] or bad version of $(NM)) 1>&2;\
+	fi
 endef
 
 install_lib: all_cmd install_plugins
-- 
2.11.0.483.g087da7b7c-goog

[toc] | [prev] | [next] | [standalone]


#1575027 — Re: [PATCH 2/4] tools lib traceevent: Robustify do_generate_dynamic_list_file

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2017-02-06 18:50 +0100
SubjectRe: [PATCH 2/4] tools lib traceevent: Robustify do_generate_dynamic_list_file
Message-ID<t7VAl-87K-5@gated-at.bofh.it>
In reply to#1572158
Em Wed, Feb 01, 2017 at 10:38:02PM -0800, David Carrillo-Cisneros escreveu:
> The dynamic-list-file used to export dynamic symbols introduced in
> 
> commit e3d09ec8126f ("tools lib traceevent: Export dynamic symbols
> used by traceevent plugins")
> 
> is generated without any sort of error checking.
> 
> I experienced problems due to an old version of nm (v 0.158) that outputs
> in a format distinct from the assumed by the script.
> 
> Robustify this by enforcing that the second column in the symbol output
> is an "U" (Undefined) as it should be since we are calling $(NM) -u ...
> and print an error message otherwise.

Thanks, applied.

- Arnaldo
 
> Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
> ---
>  tools/lib/traceevent/Makefile | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
> index 2616c66e10c1..1b6e146429d0 100644
> --- a/tools/lib/traceevent/Makefile
> +++ b/tools/lib/traceevent/Makefile
> @@ -257,10 +257,15 @@ define do_install_plugins
>  endef
>  
>  define do_generate_dynamic_list_file
> -	(echo '{';							\
> -	$(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;	\
> -	echo '};';							\
> -	) > $2
> +	symbol_type=`$(NM) -u -D $1 | awk 'NF>1 {print $$1}' | sort -u`;\
> +	if [ "$$symbol_type" == "U" ];then				\
> +		(echo '{';						\
> +		$(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;\
> +		echo '};';						\
> +		) > $2;							\
> +	else								\
> +		(echo Either missing one of [$1] or bad version of $(NM)) 1>&2;\
> +	fi
>  endef
>  
>  install_lib: all_cmd install_plugins
> -- 
> 2.11.0.483.g087da7b7c-goog

[toc] | [prev] | [next] | [standalone]


#1572159 — [PATCH 4/4] tools include: Fix include path for uapi/asm-generic/mman.h

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2017-02-02 07:40 +0100
Subject[PATCH 4/4] tools include: Fix include path for uapi/asm-generic/mman.h
Message-ID<t6jdM-fC-9@gated-at.bofh.it>
In reply to#1572157
commit f3539c12d819 ("tools include: Add uapi mman.h for each architecture")

copied include/uapi/linux/mman.h into tools/include/uapi/linux/mman.h
but did not update the include path for uapi/asm-generic/mman.h. Fix it.

Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
---
 tools/include/uapi/linux/mman.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/include/uapi/linux/mman.h b/tools/include/uapi/linux/mman.h
index 81d8edf11789..74a19ae15cd1 100644
--- a/tools/include/uapi/linux/mman.h
+++ b/tools/include/uapi/linux/mman.h
@@ -1,7 +1,7 @@
 #ifndef _UAPI_LINUX_MMAN_H
 #define _UAPI_LINUX_MMAN_H
 
-#include <uapi/asm/mman.h>
+#include <uapi/asm-generic/mman.h>
 
 #define MREMAP_MAYMOVE	1
 #define MREMAP_FIXED	2
-- 
2.11.0.483.g087da7b7c-goog

[toc] | [prev] | [next] | [standalone]


#1572335 — Re: [PATCH 4/4] tools include: Fix include path for uapi/asm-generic/mman.h

FromJiri Olsa <jolsa@redhat.com>
Date2017-02-02 14:00 +0100
SubjectRe: [PATCH 4/4] tools include: Fix include path for uapi/asm-generic/mman.h
Message-ID<t6p9v-441-21@gated-at.bofh.it>
In reply to#1572159
On Wed, Feb 01, 2017 at 10:38:04PM -0800, David Carrillo-Cisneros wrote:
> commit f3539c12d819 ("tools include: Add uapi mman.h for each architecture")
> 
> copied include/uapi/linux/mman.h into tools/include/uapi/linux/mman.h
> but did not update the include path for uapi/asm-generic/mman.h. Fix it.
> 
> Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
> ---
>  tools/include/uapi/linux/mman.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/include/uapi/linux/mman.h b/tools/include/uapi/linux/mman.h
> index 81d8edf11789..74a19ae15cd1 100644
> --- a/tools/include/uapi/linux/mman.h
> +++ b/tools/include/uapi/linux/mman.h
> @@ -1,7 +1,7 @@
>  #ifndef _UAPI_LINUX_MMAN_H
>  #define _UAPI_LINUX_MMAN_H
>  
> -#include <uapi/asm/mman.h>
> +#include <uapi/asm-generic/mman.h>
>  
>  #define MREMAP_MAYMOVE	1
>  #define MREMAP_FIXED	2
> -- 
> 2.11.0.483.g087da7b7c-goog
> 

Arnaldo,
could you please squash in the check-headers.sh update
as well..

thanks,
jirka


---
diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
index c747bfd7f14d..87187b0b3bc0 100755
--- a/tools/perf/check-headers.sh
+++ b/tools/perf/check-headers.sh
@@ -56,4 +56,4 @@ done
 check arch/x86/lib/memcpy_64.S        -B -I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"
 check arch/x86/lib/memset_64.S        -B -I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"
 check include/uapi/asm-generic/mman.h -B -I "^#include <\(uapi/\)*asm-generic/mman-common.h>"
-check include/uapi/linux/mman.h       -B -I "^#include <\(uapi/\)*asm/mman.h>"
+check include/uapi/linux/mman.h       -B -I "^#include <\(uapi/\)*asm\(-generic\)*/mman.h>"

[toc] | [prev] | [next] | [standalone]


#1575043 — Re: [PATCH 4/4] tools include: Fix include path for uapi/asm-generic/mman.h

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2017-02-06 19:30 +0100
SubjectRe: [PATCH 4/4] tools include: Fix include path for uapi/asm-generic/mman.h
Message-ID<t7Wd3-9Q-1@gated-at.bofh.it>
In reply to#1572159
Em Wed, Feb 01, 2017 at 10:38:04PM -0800, David Carrillo-Cisneros escreveu:
> commit f3539c12d819 ("tools include: Add uapi mman.h for each architecture")
> 
> copied include/uapi/linux/mman.h into tools/include/uapi/linux/mman.h
> but did not update the include path for uapi/asm-generic/mman.h. Fix it.

What problem is this fixing?

I.e. one is supposed to include <linux/mman.h>, get the
tools/include/uapi/linux/mman.h and it in turn will include the per-arch
mman.h, say tools/arch/sparc/include/uapi/asm/mman.h, that in turn will
include uapi/asm-generic/mman-common.h after defining its diverging
bits.

Some, like the ones for the Alpha and MIPS architectures, will not even
include mman-common.h, so diverging they are.

Lots of arches, like s390, will just include uapi/asm-generic/mman.h
from its mman.h file (tools/arch/s390/include/uapi/asm/mman.h), just
like you'd do for _all_ arches in your patch below.

tools/perf/Makefile.config is the one doing:

INC_FLAGS += -I$(srctree)/tools/arch/$(ARCH)/include/

and:

[acme@jouet linux]$ ls tools/arch/*/include/uapi/asm/mman.h
tools/arch/alpha/include/uapi/asm/mman.h    tools/arch/ia64/include/uapi/asm/mman.h        tools/arch/s390/include/uapi/asm/mman.h
tools/arch/arc/include/uapi/asm/mman.h      tools/arch/m32r/include/uapi/asm/mman.h        tools/arch/score/include/uapi/asm/mman.h
tools/arch/arm64/include/uapi/asm/mman.h    tools/arch/microblaze/include/uapi/asm/mman.h  tools/arch/sh/include/uapi/asm/mman.h
tools/arch/arm/include/uapi/asm/mman.h      tools/arch/mips/include/uapi/asm/mman.h        tools/arch/sparc/include/uapi/asm/mman.h
tools/arch/frv/include/uapi/asm/mman.h      tools/arch/mn10300/include/uapi/asm/mman.h     tools/arch/tile/include/uapi/asm/mman.h
tools/arch/h8300/include/uapi/asm/mman.h    tools/arch/parisc/include/uapi/asm/mman.h      tools/arch/x86/include/uapi/asm/mman.h
tools/arch/hexagon/include/uapi/asm/mman.h  tools/arch/powerpc/include/uapi/asm/mman.h     tools/arch/xtensa/include/uapi/asm/mman.h
[acme@jouet linux]$

Am I missing something?

- Arnaldo
 
> Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
> ---
>  tools/include/uapi/linux/mman.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/include/uapi/linux/mman.h b/tools/include/uapi/linux/mman.h
> index 81d8edf11789..74a19ae15cd1 100644
> --- a/tools/include/uapi/linux/mman.h
> +++ b/tools/include/uapi/linux/mman.h
> @@ -1,7 +1,7 @@
>  #ifndef _UAPI_LINUX_MMAN_H
>  #define _UAPI_LINUX_MMAN_H
>  
> -#include <uapi/asm/mman.h>
> +#include <uapi/asm-generic/mman.h>
>  
>  #define MREMAP_MAYMOVE	1
>  #define MREMAP_FIXED	2
> -- 
> 2.11.0.483.g087da7b7c-goog

[toc] | [prev] | [next] | [standalone]


#1575101 — Re: [PATCH 4/4] tools include: Fix include path for uapi/asm-generic/mman.h

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2017-02-06 21:10 +0100
SubjectRe: [PATCH 4/4] tools include: Fix include path for uapi/asm-generic/mman.h
Message-ID<t7XLP-1eL-1@gated-at.bofh.it>
In reply to#1575043
> What problem is this fixing?
>
> I.e. one is supposed to include <linux/mman.h>, get the
> tools/include/uapi/linux/mman.h and it in turn will include the per-arch
> mman.h, say tools/arch/sparc/include/uapi/asm/mman.h, that in turn will
> include uapi/asm-generic/mman-common.h after defining its diverging
> bits.
>
> Some, like the ones for the Alpha and MIPS architectures, will not even
> include mman-common.h, so diverging they are.
>
> Lots of arches, like s390, will just include uapi/asm-generic/mman.h
> from its mman.h file (tools/arch/s390/include/uapi/asm/mman.h), just
> like you'd do for _all_ arches in your patch below.
>
> tools/perf/Makefile.config is the one doing:
>
> INC_FLAGS += -I$(srctree)/tools/arch/$(ARCH)/include/
>
> and:
>
> [acme@jouet linux]$ ls tools/arch/*/include/uapi/asm/mman.h
> tools/arch/alpha/include/uapi/asm/mman.h    tools/arch/ia64/include/uapi/asm/mman.h        tools/arch/s390/include/uapi/asm/mman.h
> tools/arch/arc/include/uapi/asm/mman.h      tools/arch/m32r/include/uapi/asm/mman.h        tools/arch/score/include/uapi/asm/mman.h
> tools/arch/arm64/include/uapi/asm/mman.h    tools/arch/microblaze/include/uapi/asm/mman.h  tools/arch/sh/include/uapi/asm/mman.h
> tools/arch/arm/include/uapi/asm/mman.h      tools/arch/mips/include/uapi/asm/mman.h        tools/arch/sparc/include/uapi/asm/mman.h
> tools/arch/frv/include/uapi/asm/mman.h      tools/arch/mn10300/include/uapi/asm/mman.h     tools/arch/tile/include/uapi/asm/mman.h
> tools/arch/h8300/include/uapi/asm/mman.h    tools/arch/parisc/include/uapi/asm/mman.h      tools/arch/x86/include/uapi/asm/mman.h
> tools/arch/hexagon/include/uapi/asm/mman.h  tools/arch/powerpc/include/uapi/asm/mman.h     tools/arch/xtensa/include/uapi/asm/mman.h
> [acme@jouet linux]$
>
> Am I missing something?
>

The original error is:

In file included from util/event.c:2:0:
...tools/include/uapi/linux/mman.h:4:27: fatal error: uapi/asm/mman.h:
No such file or directory
 #include <uapi/asm/mman.h>
                           ^
compilation terminated.

After reading your explanation, seems like the problem is caused by
util/event.c directly including uapi/linux/mman.h :

  Line 2:   #include <uapi/linux/mman.h> /* To get things like
MAP_HUGETLB even on older libc headers */

introduced in commit fbef103fad ("perf tools: Do hugetlb handling in
more systems").

Doing:

--- a/tools/include/uapi/linux/mman.h
+++ b/tools/include/uapi/linux/mman.h
@@ -1,7 +1,7 @@
 #ifndef _UAPI_LINUX_MMAN_H
 #define _UAPI_LINUX_MMAN_H

-#include <uapi/asm-generic/mman.h>
+#include <uapi/asm/mman.h>

fixes by build. I don't know if it breaks something with HugeTLB, though.

Thanks,
David

[toc] | [prev] | [next] | [standalone]


#1572160 — [PATCH 1/4] perf tools: pass PYTHON config to feature detection

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2017-02-02 07:40 +0100
Subject[PATCH 1/4] perf tools: pass PYTHON config to feature detection
Message-ID<t6jdM-fC-11@gated-at.bofh.it>
In reply to#1572157
Python's CC and link Makefile variables were not passed to feature
detection, causing feature detection to use system's Python rather than
PYTHON_CONFIG's one. This created a mismatch between the detected Python
support and the one actually used by perf when PYTHON_CONFIG is specified.

Fix it by moving Python's variable initialization to before feature
detection and pass FLAGS_PYTHON_EMBED to Python's feature detection's
build target.

Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
---
 tools/build/feature/Makefile |  2 +-
 tools/perf/Makefile.config   | 23 ++++++++++-------------
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index b564a2eea039..3dd2c600d250 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -171,7 +171,7 @@ $(OUTPUT)test-libperl.bin:
 	$(BUILD) $(FLAGS_PERL_EMBED)
 
 $(OUTPUT)test-libpython.bin:
-	$(BUILD)
+	$(BUILD) $(FLAGS_PYTHON_EMBED)
 
 $(OUTPUT)test-libpython-version.bin:
 	$(BUILD)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 03cf947755b9..41f5c41c5660 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -166,10 +166,18 @@ PYTHON2_CONFIG := \
 override PYTHON_CONFIG := \
   $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))
 
+grep-libs  = $(filter -l%,$(1))
+strip-libs  = $(filter-out -l%,$(1))
+
 PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
 
-PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
-PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
+ifdef 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)) -lutil
+  PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
+  FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
+endif
 
 FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
 FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
@@ -542,8 +550,6 @@ ifndef NO_GTK2
   endif
 endif
 
-grep-libs  = $(filter -l%,$(1))
-strip-libs = $(filter-out -l%,$(1))
 
 ifdef NO_LIBPERL
   CFLAGS += -DNO_LIBPERL
@@ -591,18 +597,9 @@ else
       $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev)
     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)) -lutil
-      PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
-      FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
-
       ifneq ($(feature-libpython), 1)
         $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
       else
-
         ifneq ($(feature-libpython-version), 1)
           $(warning Python 3 is not yet supported; please set)
           $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
-- 
2.11.0.483.g087da7b7c-goog

[toc] | [prev] | [next] | [standalone]


#1574669 — Re: [PATCH 1/4] perf tools: pass PYTHON config to feature detection

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2017-02-06 14:20 +0100
SubjectRe: [PATCH 1/4] perf tools: pass PYTHON config to feature detection
Message-ID<t7Rn3-5po-7@gated-at.bofh.it>
In reply to#1572160
Em Wed, Feb 01, 2017 at 10:38:01PM -0800, David Carrillo-Cisneros escreveu:
> Python's CC and link Makefile variables were not passed to feature
> detection, causing feature detection to use system's Python rather than
> PYTHON_CONFIG's one. This created a mismatch between the detected Python
> support and the one actually used by perf when PYTHON_CONFIG is specified.
> 
> Fix it by moving Python's variable initialization to before feature
> detection and pass FLAGS_PYTHON_EMBED to Python's feature detection's
> build target.

Hi Namhyung, Thomas, since this was last touched in the cset below, can you
please check this if possible and provide Acked-by tags?

Thanks,

commit 56c7d79e49776084b852e451bda5f59dc3bcf894
Author: Namhyung Kim <namhyung@kernel.org>
Date:   Tue Jul 29 15:57:19 2014 +0900

    perf tools: Fix make PYTHON override
    
    Thomas reported that make PYTHON=python2 is not work on some systems.  I
    can reproduce it on my ArchLinux box too.
    
    This is because it's overridden by config/feature-checks/Makefile
    regardless of PYTHON setting.  I guess it's a bug slipped into during
    the feature checking change.
    
    Actually, we don't need to check python-config in the feature-checks.
    We can just pass appropriate FEATURE_CHECK_*FLAGS.
    
    Reported-by: Thomas Ilsche <thomas.ilsche@tu-dresden.de>
    Signed-off-by: Namhyung Kim <namhyung@kernel.org>
    Tested-by: Thomas Ilsche <thomas.ilsche@tu-dresden.de>

 
> Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
> ---
>  tools/build/feature/Makefile |  2 +-
>  tools/perf/Makefile.config   | 23 ++++++++++-------------
>  2 files changed, 11 insertions(+), 14 deletions(-)
> 
> diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> index b564a2eea039..3dd2c600d250 100644
> --- a/tools/build/feature/Makefile
> +++ b/tools/build/feature/Makefile
> @@ -171,7 +171,7 @@ $(OUTPUT)test-libperl.bin:
>  	$(BUILD) $(FLAGS_PERL_EMBED)
>  
>  $(OUTPUT)test-libpython.bin:
> -	$(BUILD)
> +	$(BUILD) $(FLAGS_PYTHON_EMBED)
>  
>  $(OUTPUT)test-libpython-version.bin:
>  	$(BUILD)
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 03cf947755b9..41f5c41c5660 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -166,10 +166,18 @@ PYTHON2_CONFIG := \
>  override PYTHON_CONFIG := \
>    $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))
>  
> +grep-libs  = $(filter -l%,$(1))
> +strip-libs  = $(filter-out -l%,$(1))
> +
>  PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
>  
> -PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
> -PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
> +ifdef 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)) -lutil
> +  PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
> +  FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
> +endif
>  
>  FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
>  FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
> @@ -542,8 +550,6 @@ ifndef NO_GTK2
>    endif
>  endif
>  
> -grep-libs  = $(filter -l%,$(1))
> -strip-libs = $(filter-out -l%,$(1))
>  
>  ifdef NO_LIBPERL
>    CFLAGS += -DNO_LIBPERL
> @@ -591,18 +597,9 @@ else
>        $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev)
>      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)) -lutil
> -      PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
> -      FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
> -
>        ifneq ($(feature-libpython), 1)
>          $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
>        else
> -
>          ifneq ($(feature-libpython-version), 1)
>            $(warning Python 3 is not yet supported; please set)
>            $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
> -- 
> 2.11.0.483.g087da7b7c-goog

[toc] | [prev] | [next] | [standalone]


#1574900 — Re: [PATCH 1/4] perf tools: pass PYTHON config to feature detection

FromNamhyung Kim <namhyung@kernel.org>
Date2017-02-06 16:30 +0100
SubjectRe: [PATCH 1/4] perf tools: pass PYTHON config to feature detection
Message-ID<t7ToS-6Gk-9@gated-at.bofh.it>
In reply to#1574669
On Mon, Feb 06, 2017 at 10:19:30AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Feb 01, 2017 at 10:38:01PM -0800, David Carrillo-Cisneros escreveu:
> > Python's CC and link Makefile variables were not passed to feature
> > detection, causing feature detection to use system's Python rather than
> > PYTHON_CONFIG's one. This created a mismatch between the detected Python
> > support and the one actually used by perf when PYTHON_CONFIG is specified.
> > 
> > Fix it by moving Python's variable initialization to before feature
> > detection and pass FLAGS_PYTHON_EMBED to Python's feature detection's
> > build target.
> 
> Hi Namhyung, Thomas, since this was last touched in the cset below, can you
> please check this if possible and provide Acked-by tags?
> 
> Thanks,
> 
> commit 56c7d79e49776084b852e451bda5f59dc3bcf894
> Author: Namhyung Kim <namhyung@kernel.org>
> Date:   Tue Jul 29 15:57:19 2014 +0900
> 
>     perf tools: Fix make PYTHON override
>     
>     Thomas reported that make PYTHON=python2 is not work on some systems.  I
>     can reproduce it on my ArchLinux box too.
>     
>     This is because it's overridden by config/feature-checks/Makefile
>     regardless of PYTHON setting.  I guess it's a bug slipped into during
>     the feature checking change.
>     
>     Actually, we don't need to check python-config in the feature-checks.
>     We can just pass appropriate FEATURE_CHECK_*FLAGS.
>     
>     Reported-by: Thomas Ilsche <thomas.ilsche@tu-dresden.de>
>     Signed-off-by: Namhyung Kim <namhyung@kernel.org>
>     Tested-by: Thomas Ilsche <thomas.ilsche@tu-dresden.de>
> 
>  
> > Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
> > ---
> >  tools/build/feature/Makefile |  2 +-
> >  tools/perf/Makefile.config   | 23 ++++++++++-------------
> >  2 files changed, 11 insertions(+), 14 deletions(-)
> > 
> > diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
> > index b564a2eea039..3dd2c600d250 100644
> > --- a/tools/build/feature/Makefile
> > +++ b/tools/build/feature/Makefile
> > @@ -171,7 +171,7 @@ $(OUTPUT)test-libperl.bin:
> >  	$(BUILD) $(FLAGS_PERL_EMBED)
> >  
> >  $(OUTPUT)test-libpython.bin:
> > -	$(BUILD)
> > +	$(BUILD) $(FLAGS_PYTHON_EMBED)
> >  
> >  $(OUTPUT)test-libpython-version.bin:
> >  	$(BUILD)
> > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> > index 03cf947755b9..41f5c41c5660 100644
> > --- a/tools/perf/Makefile.config
> > +++ b/tools/perf/Makefile.config
> > @@ -166,10 +166,18 @@ PYTHON2_CONFIG := \
> >  override PYTHON_CONFIG := \
> >    $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))
> >  
> > +grep-libs  = $(filter -l%,$(1))
> > +strip-libs  = $(filter-out -l%,$(1))
> > +
> >  PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
> >  
> > -PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
> > -PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
> > +ifdef 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)) -lutil
> > +  PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
> > +  FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
> > +endif
> >  
> >  FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
> >  FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)

Hmm.. I guess these feature check flags should be passed to the above
Makefile but it seems not.

Thanks,
Namhyung


> > @@ -542,8 +550,6 @@ ifndef NO_GTK2
> >    endif
> >  endif
> >  
> > -grep-libs  = $(filter -l%,$(1))
> > -strip-libs = $(filter-out -l%,$(1))
> >  
> >  ifdef NO_LIBPERL
> >    CFLAGS += -DNO_LIBPERL
> > @@ -591,18 +597,9 @@ else
> >        $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev)
> >      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)) -lutil
> > -      PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
> > -      FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
> > -
> >        ifneq ($(feature-libpython), 1)
> >          $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
> >        else
> > -
> >          ifneq ($(feature-libpython-version), 1)
> >            $(warning Python 3 is not yet supported; please set)
> >            $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
> > -- 
> > 2.11.0.483.g087da7b7c-goog

[toc] | [prev] | [next] | [standalone]


#1575989 — Re: [PATCH 1/4] perf tools: pass PYTHON config to feature detection

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2017-02-07 20:50 +0100
SubjectRe: [PATCH 1/4] perf tools: pass PYTHON config to feature detection
Message-ID<t8jW1-74w-23@gated-at.bofh.it>
In reply to#1572160
Em Wed, Feb 01, 2017 at 10:38:01PM -0800, David Carrillo-Cisneros escreveu:
> Python's CC and link Makefile variables were not passed to feature
> detection, causing feature detection to use system's Python rather than
> PYTHON_CONFIG's one. This created a mismatch between the detected Python
> support and the one actually used by perf when PYTHON_CONFIG is specified.
> 
> Fix it by moving Python's variable initialization to before feature
> detection and pass FLAGS_PYTHON_EMBED to Python's feature detection's
> build target.

So, all builds on Ubuntu with the devel files for perf end up with:

ubuntu:12.04.5, 14.04.4, 16.04, 16.10 (cross builds, native ones)

  GEN      /tmp/build/perf/libtraceevent-dynamic-list
/bin/sh: 1: [: U: unexpected operator
Either missing one of [ /tmp/build/perf/plugin_jbd2.so /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so /tmp/build/perf/plugin_cfg80211.so] or bad version of nm

Details:

perfbuilder@341e71da5019:/git/linux$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="16.10 (Yakkety Yak)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.10"
VERSION_ID="16.10"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="http://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=yakkety
UBUNTU_CODENAME=yakkety
perfbuilder@341e71da5019:/git/linux$ ls -la /tmp/build/perf/plugin_jbd2.so /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so /tmp/build/perf/plugin_cfg80211.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 13576 Feb  7 19:38 /tmp/build/perf/plugin_cfg80211.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 20256 Feb  7 19:38 /tmp/build/perf/plugin_function.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 13680 Feb  7 19:38 /tmp/build/perf/plugin_hrtimer.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 13760 Feb  7 19:38 /tmp/build/perf/plugin_jbd2.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 13976 Feb  7 19:38 /tmp/build/perf/plugin_kmem.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 28680 Feb  7 19:38 /tmp/build/perf/plugin_kvm.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 14248 Feb  7 19:38 /tmp/build/perf/plugin_mac80211.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 18800 Feb  7 19:38 /tmp/build/perf/plugin_sched_switch.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 20136 Feb  7 19:38 /tmp/build/perf/plugin_scsi.so
-rwxr-xr-x. 1 perfbuilder perfbuilder 14504 Feb  7 19:38 /tmp/build/perf/plugin_xen.so
perfbuilder@341e71da5019:/git/linux$

perfbuilder@341e71da5019:/git/linux$ file=/tmp/build/perf/plugin_jbd2.so ; nm -u -D $file | awk 'NF>1 {print $$file}' | sort -u 
                 U pevent_register_print_function
                 U pevent_unregister_print_function
                 U trace_seq_printf
perfbuilder@341e71da5019:/git/linux$


Now running with "make V=1 ...".

make -C /git/linux/tools/lib/traceevent/ plugin_dir= O=/tmp/build/perf/ /tmp/build/perf/libtraceevent-dynamic-list
symbol_type=`nm -u -D  /tmp/build/perf/plugin_jbd2.so /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so /tmp/build/perf/plugin_cfg80211.so | awk 'NF>1 {print $1}' | sort -u`; if [ "$symbol_type" == "U" ];then (echo '{'; nm -u -D  /tmp/build/perf/plugin_jbd2.so /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so /tmp/build/perf/plugin_cfg80211.so | awk 'NF>1 {print "\t"$2";"}' | sort -u; echo '};'; ) >  /tmp/build/perf/libtraceevent-dynamic-list; else (echo Either missing one of [ /tmp/build/perf/plugin_jbd2.so /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so /tmp/build/perf/plugin_cfg80211.so] or bad version of nm) 1>&2; fi
/bin/sh: 1: [: U: unexpected operator
Either missing one of [ /tmp/build/perf/plugin_jbd2.so /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so /tmp/build/perf/plugin_cfg80211.so] or bad version of nm

The output below looks like the same as on fedora25, where this seems to work:

perfbuilder@341e71da5019:/git/linux$ nm -u -D  /tmp/build/perf/plugin_jbd2.so /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so /tmp/build/perf/plugin_cfg80211.so

/tmp/build/perf/plugin_jbd2.so:
                 U pevent_register_print_function
                 U pevent_unregister_print_function
                 U trace_seq_printf

/tmp/build/perf/plugin_hrtimer.so:
                 U pevent_print_func_field
                 U pevent_print_num_field
                 U pevent_register_event_handler
                 U pevent_unregister_event_handler
                 U trace_seq_printf

/tmp/build/perf/plugin_kmem.so:
                 U __stack_chk_fail
                 U pevent_find_field
                 U pevent_find_function
                 U pevent_find_function_address
                 U pevent_read_number_field
                 U pevent_register_event_handler
                 U pevent_unregister_event_handler
                 U trace_seq_printf

/tmp/build/perf/plugin_kvm.so:
                 U __stack_chk_fail
                 U pevent_get_field_raw
                 U pevent_get_field_val
                 U pevent_print_num_field
                 U pevent_register_event_handler
                 U pevent_register_print_function
                 U pevent_unregister_event_handler
                 U pevent_unregister_print_function
                 U sprintf
                 U trace_seq_printf

/tmp/build/perf/plugin_mac80211.so:
                 U __stack_chk_fail
                 U pevent_find_field
                 U pevent_print_num_field
                 U pevent_read_number_field
                 U pevent_register_event_handler
                 U pevent_unregister_event_handler
                 U strncmp
                 U trace_seq_printf
                 U trace_seq_putc

/tmp/build/perf/plugin_sched_switch.so:
                 U __stack_chk_fail
                 U pevent_find_any_field
                 U pevent_get_field_val
                 U pevent_register_comm
                 U pevent_register_event_handler
                 U pevent_unregister_event_handler
                 U trace_seq_printf
                 U trace_seq_putc
                 U trace_seq_puts
                 U trace_seq_terminate

/tmp/build/perf/plugin_function.so:
                 U __stack_chk_fail
                 U free
                 U memset
                 U pevent_find_function
                 U pevent_get_field_val
                 U pevent_register_event_handler
                 U pevent_unregister_event_handler
                 U realloc
                 U strcmp
                 U strdup
                 U trace_seq_printf
                 U trace_seq_putc
                 U traceevent_plugin_add_options
                 U traceevent_plugin_remove_options
                 U warning

/tmp/build/perf/plugin_xen.so:
                 U pevent_register_print_function
                 U pevent_unregister_print_function
                 U trace_seq_printf

/tmp/build/perf/plugin_scsi.so:
                 U pevent_register_print_function
                 U pevent_unregister_print_function
                 U trace_seq_printf
                 U trace_seq_putc

/tmp/build/perf/plugin_cfg80211.so:
                 U pevent_register_print_function
                 U pevent_unregister_print_function
perfbuilder@341e71da5019:/git/linux$

I've run out of time this afternoon to look at this, will continue later or tomorrow,
unless, preferrably, that you find this problem first :-)

- Arnaldo

[toc] | [prev] | [next] | [standalone]


#1576259 — Re: [PATCH 1/4] perf tools: pass PYTHON config to feature detection

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2017-02-08 04:20 +0100
SubjectRe: [PATCH 1/4] perf tools: pass PYTHON config to feature detection
Message-ID<t8qXw-3aG-13@gated-at.bofh.it>
In reply to#1575989
On Tue, Feb 7, 2017 at 11:47 AM, Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
> Em Wed, Feb 01, 2017 at 10:38:01PM -0800, David Carrillo-Cisneros escreveu:
>> Python's CC and link Makefile variables were not passed to feature
>> detection, causing feature detection to use system's Python rather than
>> PYTHON_CONFIG's one. This created a mismatch between the detected Python
>> support and the one actually used by perf when PYTHON_CONFIG is specified.
>>
>> Fix it by moving Python's variable initialization to before feature
>> detection and pass FLAGS_PYTHON_EMBED to Python's feature detection's
>> build target.
>
> So, all builds on Ubuntu with the devel files for perf end up with:
>
> ubuntu:12.04.5, 14.04.4, 16.04, 16.10 (cross builds, native ones)
>
>   GEN      /tmp/build/perf/libtraceevent-dynamic-list
> /bin/sh: 1: [: U: unexpected operator
> Either missing one of [ /tmp/build/perf/plugin_jbd2.so /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so /tmp/build/perf/plugin_cfg80211.so] or bad version of nm
>
> Details:
>
> perfbuilder@341e71da5019:/git/linux$ cat /etc/os-release
> NAME="Ubuntu"
> VERSION="16.10 (Yakkety Yak)"
> ID=ubuntu
> ID_LIKE=debian
> PRETTY_NAME="Ubuntu 16.10"
> VERSION_ID="16.10"
> HOME_URL="http://www.ubuntu.com/"
> SUPPORT_URL="http://help.ubuntu.com/"
> BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
> PRIVACY_POLICY_URL="http://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
> VERSION_CODENAME=yakkety
> UBUNTU_CODENAME=yakkety
> perfbuilder@341e71da5019:/git/linux$ ls -la /tmp/build/perf/plugin_jbd2.so /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so /tmp/build/perf/plugin_cfg80211.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 13576 Feb  7 19:38 /tmp/build/perf/plugin_cfg80211.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 20256 Feb  7 19:38 /tmp/build/perf/plugin_function.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 13680 Feb  7 19:38 /tmp/build/perf/plugin_hrtimer.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 13760 Feb  7 19:38 /tmp/build/perf/plugin_jbd2.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 13976 Feb  7 19:38 /tmp/build/perf/plugin_kmem.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 28680 Feb  7 19:38 /tmp/build/perf/plugin_kvm.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 14248 Feb  7 19:38 /tmp/build/perf/plugin_mac80211.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 18800 Feb  7 19:38 /tmp/build/perf/plugin_sched_switch.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 20136 Feb  7 19:38 /tmp/build/perf/plugin_scsi.so
> -rwxr-xr-x. 1 perfbuilder perfbuilder 14504 Feb  7 19:38 /tmp/build/perf/plugin_xen.so
> perfbuilder@341e71da5019:/git/linux$
>
> perfbuilder@341e71da5019:/git/linux$ file=/tmp/build/perf/plugin_jbd2.so ; nm -u -D $file | awk 'NF>1 {print $$file}' | sort -u
>                  U pevent_register_print_function
>                  U pevent_unregister_print_function
>                  U trace_seq_printf
> perfbuilder@341e71da5019:/git/linux$
>
>

Thanks for testing it.

I found that some *.so files in Ubuntu have the "w" value in nm's
otput symbol type. From man nm:

           "W"
           "w" The symbol is a weak symbol that has not been
specifically tagged as a weak object symbol.  When a
               weak defined symbol is linked with a normal defined
symbol, the normal defined symbol is used with
               no error.  When a weak undefined symbol is linked and
the symbol is not defined, the value of the
               symbol is determined in a system-specific manner
without error.  On some systems, uppercase
               indicates that a default value has been specified.


I'll send an updated patch that expects and includes undefined weak symbols.

Thanks,
David

[toc] | [prev] | [next] | [standalone]


#1576280 — [PATCH v2] tools lib traceevent: Robustify do_generate_dynamic_list_file

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2017-02-08 06:30 +0100
Subject[PATCH v2] tools lib traceevent: Robustify do_generate_dynamic_list_file
Message-ID<t8sZk-4sy-1@gated-at.bofh.it>
In reply to#1576259
v2: Accept "W" and "w" symbol options.

The dynamic-list-file used to export dynamic symbols introduced in

commit e3d09ec8126f ("tools lib traceevent: Export dynamic symbols
used by traceevent plugins")

is generated without any sort of error checking.

I experienced problems due to an old version of nm (v 0.158) that outputs
in a format distinct from the assumed by the script.

Robustify the built of dynamic symbol list  by enforcing that the second
column of $(NM) -u <files> is either "U" (Undefined), "W" or "w" (undefined
weak), which are the possible outputs from non-ancient $(NM) versions.
Print an error if format is unexpected.

Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
---
 tools/lib/traceevent/Makefile | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 2616c66e10c1..a7046ec01a5b 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -257,10 +257,16 @@ define do_install_plugins
 endef
 
 define do_generate_dynamic_list_file
-	(echo '{';							\
-	$(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;	\
-	echo '};';							\
-	) > $2
+	symbol_type=`$(NM) -u -D $1 | awk 'NF>1 {print $$1}' | \
+	xargs echo "U W w" | tr ' ' '\n' | sort -u | xargs echo`;\
+	if [ "$$symbol_type" == "U W w" ];then				\
+		(echo '{';						\
+		$(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;\
+		echo '};';						\
+		) > $2;							\
+	else								\
+		(echo Either missing one of [$1] or bad version of $(NM)) 1>&2;\
+	fi
 endef
 
 install_lib: all_cmd install_plugins
-- 
2.11.0.483.g087da7b7c-goog

[toc] | [prev] | [next] | [standalone]


#1576518 — Re: [PATCH v2] tools lib traceevent: Robustify do_generate_dynamic_list_file

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2017-02-08 13:50 +0100
SubjectRe: [PATCH v2] tools lib traceevent: Robustify do_generate_dynamic_list_file
Message-ID<t8zR8-oe-21@gated-at.bofh.it>
In reply to#1576280
Em Tue, Feb 07, 2017 at 09:28:40PM -0800, David Carrillo-Cisneros escreveu:
> v2: Accept "W" and "w" symbol options.
> 
> The dynamic-list-file used to export dynamic symbols introduced in
> 
> commit e3d09ec8126f ("tools lib traceevent: Export dynamic symbols
> used by traceevent plugins")
> 
> is generated without any sort of error checking.
> 
> I experienced problems due to an old version of nm (v 0.158) that outputs
> in a format distinct from the assumed by the script.
> 
> Robustify the built of dynamic symbol list  by enforcing that the second
> column of $(NM) -u <files> is either "U" (Undefined), "W" or "w" (undefined
> weak), which are the possible outputs from non-ancient $(NM) versions.
> Print an error if format is unexpected.

The problem persists, now with a slightly different message, including
your latest effort at weak symbols, that looked unrelated at first:

  GEN      /tmp/build/perf/pmu-events/pmu-events.c
/bin/sh: 1: [: U W w: unexpected operator
Either missing one of [ /tmp/build/perf/plugin_jbd2.so /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so /tmp/build/perf/plugin_cfg80211.so] or bad version of nm
  CC       /tmp/build/perf/ui/gtk/hists.o

  CC       /tmp/build/perf/util/symbol.o
/usr/bin/ld: cannot open linker script file /tmp/build/perf/libtraceevent-dynamic-list: No such file or directory
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
cp: cannot stat '/tmp/build/perf/python_ext_build/lib/perf.so': No such file or directory
Makefile.perf:381: recipe for target '/tmp/build/perf/python/perf.so' failed
make[2]: *** [/tmp/build/perf/python/perf.so] Error 1
make[2]: *** Waiting for unfinished jobs....
  CC       /tmp/build/perf/arch/common.o

perfbuilder@341e71da5019:/git/linux$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="16.10 (Yakkety Yak)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.10"
VERSION_ID="16.10"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="http://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=yakkety
UBUNTU_CODENAME=yakkety
perfbuilder@341e71da5019:/git/linux$ apt-cache show binutils
Package: binutils
Priority: optional
Section: devel
Installed-Size: 13828
Maintainer: Ubuntu Core developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Matthias Klose <doko@debian.org>
Architecture: amd64
Version: 2.27-8ubuntu2
Replaces: binutils-gold (<< 2.20.51.20100415), binutils-mingw-w64-i686 (<< 2.23.52.20130612-1+3), binutils-mingw-w64-x86-64 (<< 2.23.52.20130612-1+3)
Provides: binutils-gold, elf-binutils
Depends: libc6 (>= 2.14), zlib1g (>= 1:1.2.0)
Suggests: binutils-doc (>= 2.27-8ubuntu2)
Conflicts: binutils-gold (<< 2.20.51.20100415), binutils-mingw-w64-i686 (<< 2.23.52.20130612-1+3), binutils-mingw-w64-x86-64 (<< 2.23.52.20130612-1+3), binutils-multiarch (<< 2.27-8), elf-binutils, gas, modutils (<< 2.4.19-1)
Breaks: binutils-mingw-w64-i686 (<< 2.23.52.20130612-1+3), binutils-mingw-w64-x86-64 (<< 2.23.52.20130612-1+3), hardening-wrapper (<< 2.8+nmu3)
Filename: pool/main/b/binutils/binutils_2.27-8ubuntu2_amd64.deb
Size: 2416388
MD5sum: c90cc5eef9d5bf00d1de0f1c8cf98a06
SHA1: 9b7a3cb2b140f0d6903888724efe93427382fdb0
SHA256: b7bbbadfebc615e74bf2d332a581f059a453038685548919d6db230b9732febd
Description: GNU assembler, linker and binary utilities
Description-md5: fde49b4cfeaad346a6e094f973da28d7
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Build-Essential: yes
Origin: Ubuntu
Supported: 9m
Task: ubuntu-desktop, ubuntu-usb, kubuntu-desktop, kubuntu-full, edubuntu-desktop, edubuntu-usb, xubuntu-core, xubuntu-desktop, mythbuntu-frontend, mythbuntu-desktop, mythbuntu-backend-slave, mythbuntu-backend-master, mythbuntu-backend-master, ubuntustudio-desktop-core, ubuntustudio-desktop, ubuntu-gnome-desktop, ubuntu-touch, ubuntukylin-desktop, ubuntu-mate-core, ubuntu-mate-desktop

perfbuilder@341e71da5019:/git/linux$
 
> Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
> ---
>  tools/lib/traceevent/Makefile | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
> index 2616c66e10c1..a7046ec01a5b 100644
> --- a/tools/lib/traceevent/Makefile
> +++ b/tools/lib/traceevent/Makefile
> @@ -257,10 +257,16 @@ define do_install_plugins
>  endef
>  
>  define do_generate_dynamic_list_file
> -	(echo '{';							\
> -	$(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;	\
> -	echo '};';							\
> -	) > $2
> +	symbol_type=`$(NM) -u -D $1 | awk 'NF>1 {print $$1}' | \
> +	xargs echo "U W w" | tr ' ' '\n' | sort -u | xargs echo`;\
> +	if [ "$$symbol_type" == "U W w" ];then				\
> +		(echo '{';						\
> +		$(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;\
> +		echo '};';						\
> +		) > $2;							\
> +	else								\
> +		(echo Either missing one of [$1] or bad version of $(NM)) 1>&2;\
> +	fi
>  endef
>  
>  install_lib: all_cmd install_plugins
> -- 
> 2.11.0.483.g087da7b7c-goog

[toc] | [prev] | [next] | [standalone]


#1576577 — Re: [PATCH v2] tools lib traceevent: Robustify do_generate_dynamic_list_file

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2017-02-08 14:30 +0100
SubjectRe: [PATCH v2] tools lib traceevent: Robustify do_generate_dynamic_list_file
Message-ID<t8AtQ-Rq-15@gated-at.bofh.it>
In reply to#1576518
Em Wed, Feb 08, 2017 at 09:44:50AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Feb 07, 2017 at 09:28:40PM -0800, David Carrillo-Cisneros escreveu:
> > v2: Accept "W" and "w" symbol options.
> > 
> > The dynamic-list-file used to export dynamic symbols introduced in
> > 
> > commit e3d09ec8126f ("tools lib traceevent: Export dynamic symbols
> > used by traceevent plugins")
> > 
> > is generated without any sort of error checking.
> > 
> > I experienced problems due to an old version of nm (v 0.158) that outputs
> > in a format distinct from the assumed by the script.
> > 
> > Robustify the built of dynamic symbol list  by enforcing that the second
> > column of $(NM) -u <files> is either "U" (Undefined), "W" or "w" (undefined
> > weak), which are the possible outputs from non-ancient $(NM) versions.
> > Print an error if format is unexpected.
> 
> The problem persists, now with a slightly different message, including
> your latest effort at weak symbols, that looked unrelated at first:
> 
>   GEN      /tmp/build/perf/pmu-events/pmu-events.c
> /bin/sh: 1: [: U W w: unexpected operator
> Either missing one of [ /tmp/build/perf/plugin_jbd2.so /tmp/build/perf/plugin_hrtimer.so /tmp/build/perf/plugin_kmem.so /tmp/build/perf/plugin_kvm.so /tmp/build/perf/plugin_mac80211.so /tmp/build/perf/plugin_sched_switch.so /tmp/build/perf/plugin_function.so /tmp/build/perf/plugin_xen.so /tmp/build/perf/plugin_scsi.so /tmp/build/perf/plugin_cfg80211.so] or bad version of nm
>   CC       /tmp/build/perf/ui/gtk/hists.o

So, after I applied this patch:

---------------------
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index a7046ec01a5b..47076b15eebe 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -259,7 +259,7 @@ endef
 define do_generate_dynamic_list_file
 	symbol_type=`$(NM) -u -D $1 | awk 'NF>1 {print $$1}' | \
 	xargs echo "U W w" | tr ' ' '\n' | sort -u | xargs echo`;\
-	if [ "$$symbol_type" == "U W w" ];then				\
+	if [ "$$symbol_type" = "U W w" ];then				\
 		(echo '{';						\
 		$(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;\
 		echo '};';						\
---------------------

It works.

Look at the file produced by that:

In Ubuntu 16.10:

perfbuilder@341e71da5019:/git/linux$ cat /tmp/build/perf/libtraceevent-dynamic-list
{
	__stack_chk_fail;
	free;
	memset;
	pevent_find_any_field;
	pevent_find_field;
	pevent_find_function;
	pevent_find_function_address;
	pevent_get_field_raw;
	pevent_get_field_val;
	pevent_print_func_field;
	pevent_print_num_field;
	pevent_read_number_field;
	pevent_register_comm;
	pevent_register_event_handler;
	pevent_register_print_function;
	pevent_unregister_event_handler;
	pevent_unregister_print_function;
	realloc;
	sprintf;
	strcmp;
	strdup;
	strncmp;
	trace_seq_printf;
	trace_seq_putc;
	trace_seq_puts;
	trace_seq_terminate;
	traceevent_plugin_add_options;
	traceevent_plugin_remove_options;
	warning;
};
perfbuilder@341e71da5019:/git/linux$

And in fedora 25, with or without this patch, i.e. with = or ==:

[acme@jouet linux]$ cat /tmp/build/perf/libtraceevent-dynamic-list
{
	free;
	memset;
	pevent_find_any_field;
	pevent_find_field;
	pevent_find_function;
	pevent_find_function_address;
	pevent_get_field_raw;
	pevent_get_field_val;
	pevent_print_func_field;
	pevent_print_num_field;
	pevent_read_number_field;
	pevent_register_comm;
	pevent_register_event_handler;
	pevent_register_print_function;
	pevent_unregister_event_handler;
	pevent_unregister_print_function;
	realloc;
	sprintf;
	strcmp;
	strdup;
	strncmp;
	trace_seq_printf;
	trace_seq_putc;
	trace_seq_puts;
	trace_seq_terminate;
	traceevent_plugin_add_options;
	traceevent_plugin_remove_options;
	warning;
};
[acme@jouet linux]$ 

Then try to find the '==' operator on 'man test'. Albeit command line tests,
outside the Makefile shows it works, it is not documented there, just "STRING =
STRING". Some subtlety:

Fedora 25:

[acme@jouet linux]$ symbol_type="U W w"
[acme@jouet linux]$ [ "$symbol_type" == "U W w" ] && echo matches
matches
[acme@jouet linux]$ [ "$symbol_type" == "U W w A" ] && echo matches
[acme@jouet linux]$ [ "$symbol_type" = "U W w" ] && echo matches
matches
[acme@jouet linux]$ [ "$symbol_type" = "U W w A" ] && echo matches
[acme@jouet linux]$

[acme@jouet linux]$ rpm -qf /bin/\[ 
coreutils-8.25-15.fc25.x86_64
[acme@jouet linux]$ rpm -q bash
bash-4.3.43-4.fc25.x86_64

Ubuntu 16.10:

perfbuilder@341e71da5019:/git/linux$ echo $symbol_type
U W w
perfbuilder@341e71da5019:/git/linux$ [ "$symbol_type" == "U W w" ] && echo matches
matches
perfbuilder@341e71da5019:/git/linux$ [ "$symbol_type" == "U W w AA" ] && echo matches
perfbuilder@341e71da5019:/git/linux$ [ "$symbol_type" = "U W w" ] && echo matches
matches
perfbuilder@341e71da5019:/git/linux$ [ "$symbol_type" = "U W w AA" ] && echo matches
perfbuilder@341e71da5019:/git/linux$ 

perfbuilder@341e71da5019:/git/linux$ ls -la /bin/\[
ls: cannot access '/bin/[': No such file or directory
perfbuilder@341e71da5019:/git/linux$ ls -la /bin/[
ls: cannot access '/bin/[': No such file or directory
perfbuilder@341e71da5019:/git/linux$
perfbuilder@341e71da5019:/git/linux$ dpkg -l | grep coreutils
ii  coreutils                          8.25-2ubuntu2                  amd64        GNU core utilities
perfbuilder@341e71da5019:/git/linux$ dpkg -l | grep bash
ii  bash                               4.3-15ubuntu1                  amd64        GNU Bourne Again SHell


bash has some shell opts to control some aspects of compatibility with string
comparisions that could have some default different from ubuntu and fedora,
I couldn't find one that looked related, sigh.

Anyway, the difference in the order of the symbol types is related to locales, which
are fixed in the Makefiles to avoid those problems, so in both Fedora and Ubuntu
that symbol_type evaluates to "U W w" and the file is generated as intended.

So I'm just replacing == with = and running a new set of container based distro tests.

- Arnaldo

[toc] | [prev] | [next] | [standalone]


#1577312 — Re: [PATCH v2] tools lib traceevent: Robustify do_generate_dynamic_list_file

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2017-02-09 06:20 +0100
SubjectRe: [PATCH v2] tools lib traceevent: Robustify do_generate_dynamic_list_file
Message-ID<t8Pjb-1Kt-1@gated-at.bofh.it>
In reply to#1576577
> bash has some shell opts to control some aspects of compatibility with string
> comparisions that could have some default different from ubuntu and fedora,
> I couldn't find one that looked related, sigh.

The joys of batch scripting...

>
> Anyway, the difference in the order of the symbol types is related to locales, which
> are fixed in the Makefiles to avoid those problems, so in both Fedora and Ubuntu
> that symbol_type evaluates to "U W w" and the file is generated as intended.
>
> So I'm just replacing == with = and running a new set of container based distro tests.
>

"=" works fine in my build. Thanks for looking into this. Next time I
will pay attention to bash portability.

Thanks,
David

[toc] | [prev] | [next] | [standalone]


#1578293 — [tip:perf/core] tools lib traceevent: Robustify do_generate_dynamic_list_file

Fromtip-bot for David Carrillo-Cisneros <tipbot@zytor.com>
Date2017-02-10 09:50 +0100
Subject[tip:perf/core] tools lib traceevent: Robustify do_generate_dynamic_list_file
Message-ID<t9f3Z-140-27@gated-at.bofh.it>
In reply to#1576280
Commit-ID:  6467753d613993f30965d4e0717f7304eb933ef7
Gitweb:     http://git.kernel.org/tip/6467753d613993f30965d4e0717f7304eb933ef7
Author:     David Carrillo-Cisneros <davidcc@google.com>
AuthorDate: Tue, 7 Feb 2017 21:28:40 -0800
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 8 Feb 2017 10:27:45 -0300

tools lib traceevent: Robustify do_generate_dynamic_list_file

The dynamic-list-file used to export dynamic symbols introduced in

commit e3d09ec8126f ("tools lib traceevent: Export dynamic symbols
used by traceevent plugins")

is generated without any sort of error checking.

I experienced problems due to an old version of nm (v 0.158) that outputs
in a format distinct from the assumed by the script.

Robustify the built of dynamic symbol list  by enforcing that the second
column of $(NM) -u <files> is either "U" (Undefined), "W" or "w" (undefined
weak), which are the possible outputs from non-ancient $(NM) versions.
Print an error if format is unexpected.

v2: Accept "W" and "w" symbol options.

Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Michal Marek <mmarek@suse.com>
Cc: Paul Turner <pjt@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20170208052840.112182-1-davidcc@google.com
[ Use STRING1 = STRING1 instead of == to make this work on Ubuntu systems ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/Makefile | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 2616c66..47076b1 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -257,10 +257,16 @@ define do_install_plugins
 endef
 
 define do_generate_dynamic_list_file
-	(echo '{';							\
-	$(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;	\
-	echo '};';							\
-	) > $2
+	symbol_type=`$(NM) -u -D $1 | awk 'NF>1 {print $$1}' | \
+	xargs echo "U W w" | tr ' ' '\n' | sort -u | xargs echo`;\
+	if [ "$$symbol_type" = "U W w" ];then				\
+		(echo '{';						\
+		$(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;\
+		echo '};';						\
+		) > $2;							\
+	else								\
+		(echo Either missing one of [$1] or bad version of $(NM)) 1>&2;\
+	fi
 endef
 
 install_lib: all_cmd install_plugins

[toc] | [prev] | [next] | [standalone]


#1572340

FromJiri Olsa <jolsa@redhat.com>
Date2017-02-02 14:00 +0100
Message-ID<t6p9w-441-33@gated-at.bofh.it>
In reply to#1572157
On Wed, Feb 01, 2017 at 10:38:00PM -0800, David Carrillo-Cisneros wrote:
> Fixes for minor problems with Makefiles and libs that I found while
> building perf.
> 
> David Carrillo-Cisneros (4):
>   perf tools: pass PYTHON config to feature detection
>   tools lib traceevent: Robustify do_generate_dynamic_list_file
>   tools lib feature: Do not redefine compiler configuration
>   tools include: Fix include path for uapi/asm-generic/mman.h

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web