All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] perf tool: build related fixes
@ 2020-03-06  7:11 Ian Rogers
  2020-03-06  7:11 ` [PATCH 1/3] tools: fix off-by 1 relative directory includes Ian Rogers
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Ian Rogers @ 2020-03-06  7:11 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Mathieu Poirier, Adrian Hunter, Igor Lubashev, Nick Desaulniers,
	Alexios Zavras, Greg Kroah-Hartman, Thomas Gleixner, Wei Li,
	Kan Liang, Andi Kleen, linux-kernel
  Cc: Stephane Eranian, Ian Rogers

These patches better enable a build of perf when not using the regular
Makefiles, in my case using bazel.

Ian Rogers (3):
  tools: fix off-by 1 relative directory includes
  libperf: avoid redefining _GNU_SOURCE in test
  tools/perf: build fixes for arch_errno_names.sh

 tools/include/uapi/asm/errno.h              | 14 +++++-----
 tools/lib/perf/tests/test-evlist.c          |  2 ++
 tools/perf/arch/arm64/util/arm-spe.c        | 20 +++++++-------
 tools/perf/arch/arm64/util/perf_regs.c      |  2 +-
 tools/perf/arch/powerpc/util/perf_regs.c    |  4 +--
 tools/perf/arch/x86/util/auxtrace.c         | 14 +++++-----
 tools/perf/arch/x86/util/event.c            | 12 ++++-----
 tools/perf/arch/x86/util/header.c           |  4 +--
 tools/perf/arch/x86/util/intel-bts.c        | 24 ++++++++---------
 tools/perf/arch/x86/util/intel-pt.c         | 30 ++++++++++-----------
 tools/perf/arch/x86/util/machine.c          |  6 ++---
 tools/perf/arch/x86/util/perf_regs.c        |  8 +++---
 tools/perf/arch/x86/util/pmu.c              |  6 ++---
 tools/perf/trace/beauty/arch_errno_names.sh |  4 +--
 14 files changed, 76 insertions(+), 74 deletions(-)

-- 
2.25.1.481.gfbce0eb801-goog


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

* [PATCH 1/3] tools: fix off-by 1 relative directory includes
  2020-03-06  7:11 [PATCH 0/3] perf tool: build related fixes Ian Rogers
@ 2020-03-06  7:11 ` Ian Rogers
  2020-03-06  9:33   ` Jiri Olsa
                     ` (2 more replies)
  2020-03-06  7:11 ` [PATCH 2/3] libperf: avoid redefining _GNU_SOURCE in test Ian Rogers
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 17+ messages in thread
From: Ian Rogers @ 2020-03-06  7:11 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Mathieu Poirier, Adrian Hunter, Igor Lubashev, Nick Desaulniers,
	Alexios Zavras, Greg Kroah-Hartman, Thomas Gleixner, Wei Li,
	Kan Liang, Andi Kleen, linux-kernel
  Cc: Stephane Eranian, Ian Rogers

This is currently working due to extra include paths in the build.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/include/uapi/asm/errno.h           | 14 +++++------
 tools/perf/arch/arm64/util/arm-spe.c     | 20 ++++++++--------
 tools/perf/arch/arm64/util/perf_regs.c   |  2 +-
 tools/perf/arch/powerpc/util/perf_regs.c |  4 ++--
 tools/perf/arch/x86/util/auxtrace.c      | 14 +++++------
 tools/perf/arch/x86/util/event.c         | 12 +++++-----
 tools/perf/arch/x86/util/header.c        |  4 ++--
 tools/perf/arch/x86/util/intel-bts.c     | 24 +++++++++----------
 tools/perf/arch/x86/util/intel-pt.c      | 30 ++++++++++++------------
 tools/perf/arch/x86/util/machine.c       |  6 ++---
 tools/perf/arch/x86/util/perf_regs.c     |  8 +++----
 tools/perf/arch/x86/util/pmu.c           |  6 ++---
 12 files changed, 72 insertions(+), 72 deletions(-)

diff --git a/tools/include/uapi/asm/errno.h b/tools/include/uapi/asm/errno.h
index ce3c5945a1c4..637189ec1ab9 100644
--- a/tools/include/uapi/asm/errno.h
+++ b/tools/include/uapi/asm/errno.h
@@ -1,18 +1,18 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #if defined(__i386__) || defined(__x86_64__)
-#include "../../arch/x86/include/uapi/asm/errno.h"
+#include "../../../arch/x86/include/uapi/asm/errno.h"
 #elif defined(__powerpc__)
-#include "../../arch/powerpc/include/uapi/asm/errno.h"
+#include "../../../arch/powerpc/include/uapi/asm/errno.h"
 #elif defined(__sparc__)
-#include "../../arch/sparc/include/uapi/asm/errno.h"
+#include "../../../arch/sparc/include/uapi/asm/errno.h"
 #elif defined(__alpha__)
-#include "../../arch/alpha/include/uapi/asm/errno.h"
+#include "../../../arch/alpha/include/uapi/asm/errno.h"
 #elif defined(__mips__)
-#include "../../arch/mips/include/uapi/asm/errno.h"
+#include "../../../arch/mips/include/uapi/asm/errno.h"
 #elif defined(__ia64__)
-#include "../../arch/ia64/include/uapi/asm/errno.h"
+#include "../../../arch/ia64/include/uapi/asm/errno.h"
 #elif defined(__xtensa__)
-#include "../../arch/xtensa/include/uapi/asm/errno.h"
+#include "../../../arch/xtensa/include/uapi/asm/errno.h"
 #else
 #include <asm-generic/errno.h>
 #endif
diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c
index 8d6821d9c3f6..27653be24447 100644
--- a/tools/perf/arch/arm64/util/arm-spe.c
+++ b/tools/perf/arch/arm64/util/arm-spe.c
@@ -11,17 +11,17 @@
 #include <linux/zalloc.h>
 #include <time.h>
 
-#include "../../util/cpumap.h"
-#include "../../util/event.h"
-#include "../../util/evsel.h"
-#include "../../util/evlist.h"
-#include "../../util/session.h"
+#include "../../../util/cpumap.h"
+#include "../../../util/event.h"
+#include "../../../util/evsel.h"
+#include "../../../util/evlist.h"
+#include "../../../util/session.h"
 #include <internal/lib.h> // page_size
-#include "../../util/pmu.h"
-#include "../../util/debug.h"
-#include "../../util/auxtrace.h"
-#include "../../util/record.h"
-#include "../../util/arm-spe.h"
+#include "../../../util/pmu.h"
+#include "../../../util/debug.h"
+#include "../../../util/auxtrace.h"
+#include "../../../util/record.h"
+#include "../../../util/arm-spe.h"
 
 #define KiB(x) ((x) * 1024)
 #define MiB(x) ((x) * 1024 * 1024)
diff --git a/tools/perf/arch/arm64/util/perf_regs.c b/tools/perf/arch/arm64/util/perf_regs.c
index 2864e2e3776d..2833e101a7c6 100644
--- a/tools/perf/arch/arm64/util/perf_regs.c
+++ b/tools/perf/arch/arm64/util/perf_regs.c
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
-#include "../../util/perf_regs.h"
+#include "../../../util/perf_regs.h"
 
 const struct sample_reg sample_reg_masks[] = {
 	SMPL_REG_END
diff --git a/tools/perf/arch/powerpc/util/perf_regs.c b/tools/perf/arch/powerpc/util/perf_regs.c
index e9c436eeffc9..0a5242900248 100644
--- a/tools/perf/arch/powerpc/util/perf_regs.c
+++ b/tools/perf/arch/powerpc/util/perf_regs.c
@@ -4,8 +4,8 @@
 #include <regex.h>
 #include <linux/zalloc.h>
 
-#include "../../util/perf_regs.h"
-#include "../../util/debug.h"
+#include "../../../util/perf_regs.h"
+#include "../../../util/debug.h"
 
 #include <linux/kernel.h>
 
diff --git a/tools/perf/arch/x86/util/auxtrace.c b/tools/perf/arch/x86/util/auxtrace.c
index 7abc9fd4cbec..3da506e13f49 100644
--- a/tools/perf/arch/x86/util/auxtrace.c
+++ b/tools/perf/arch/x86/util/auxtrace.c
@@ -7,13 +7,13 @@
 #include <errno.h>
 #include <stdbool.h>
 
-#include "../../util/header.h"
-#include "../../util/debug.h"
-#include "../../util/pmu.h"
-#include "../../util/auxtrace.h"
-#include "../../util/intel-pt.h"
-#include "../../util/intel-bts.h"
-#include "../../util/evlist.h"
+#include "../../../util/header.h"
+#include "../../../util/debug.h"
+#include "../../../util/pmu.h"
+#include "../../../util/auxtrace.h"
+#include "../../../util/intel-pt.h"
+#include "../../../util/intel-bts.h"
+#include "../../../util/evlist.h"
 
 static
 struct auxtrace_record *auxtrace_record__init_intel(struct evlist *evlist,
diff --git a/tools/perf/arch/x86/util/event.c b/tools/perf/arch/x86/util/event.c
index ac45015cc6ba..047dc00eafa6 100644
--- a/tools/perf/arch/x86/util/event.c
+++ b/tools/perf/arch/x86/util/event.c
@@ -3,12 +3,12 @@
 #include <linux/string.h>
 #include <linux/zalloc.h>
 
-#include "../../util/event.h"
-#include "../../util/synthetic-events.h"
-#include "../../util/machine.h"
-#include "../../util/tool.h"
-#include "../../util/map.h"
-#include "../../util/debug.h"
+#include "../../../util/event.h"
+#include "../../../util/synthetic-events.h"
+#include "../../../util/machine.h"
+#include "../../../util/tool.h"
+#include "../../../util/map.h"
+#include "../../../util/debug.h"
 
 #if defined(__x86_64__)
 
diff --git a/tools/perf/arch/x86/util/header.c b/tools/perf/arch/x86/util/header.c
index aa6deb463bf3..578c8c568ffd 100644
--- a/tools/perf/arch/x86/util/header.c
+++ b/tools/perf/arch/x86/util/header.c
@@ -7,8 +7,8 @@
 #include <string.h>
 #include <regex.h>
 
-#include "../../util/debug.h"
-#include "../../util/header.h"
+#include "../../../util/debug.h"
+#include "../../../util/header.h"
 
 static inline void
 cpuid(unsigned int op, unsigned int *a, unsigned int *b, unsigned int *c,
diff --git a/tools/perf/arch/x86/util/intel-bts.c b/tools/perf/arch/x86/util/intel-bts.c
index 26cee1052179..09f93800bffd 100644
--- a/tools/perf/arch/x86/util/intel-bts.c
+++ b/tools/perf/arch/x86/util/intel-bts.c
@@ -11,18 +11,18 @@
 #include <linux/log2.h>
 #include <linux/zalloc.h>
 
-#include "../../util/cpumap.h"
-#include "../../util/event.h"
-#include "../../util/evsel.h"
-#include "../../util/evlist.h"
-#include "../../util/mmap.h"
-#include "../../util/session.h"
-#include "../../util/pmu.h"
-#include "../../util/debug.h"
-#include "../../util/record.h"
-#include "../../util/tsc.h"
-#include "../../util/auxtrace.h"
-#include "../../util/intel-bts.h"
+#include "../../../util/cpumap.h"
+#include "../../../util/event.h"
+#include "../../../util/evsel.h"
+#include "../../../util/evlist.h"
+#include "../../../util/mmap.h"
+#include "../../../util/session.h"
+#include "../../../util/pmu.h"
+#include "../../../util/debug.h"
+#include "../../../util/record.h"
+#include "../../../util/tsc.h"
+#include "../../../util/auxtrace.h"
+#include "../../../util/intel-bts.h"
 #include <internal/lib.h> // page_size
 
 #define KiB(x) ((x) * 1024)
diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
index 7eea4fd7ce58..1643aed8c4c8 100644
--- a/tools/perf/arch/x86/util/intel-pt.c
+++ b/tools/perf/arch/x86/util/intel-pt.c
@@ -13,23 +13,23 @@
 #include <linux/zalloc.h>
 #include <cpuid.h>
 
-#include "../../util/session.h"
-#include "../../util/event.h"
-#include "../../util/evlist.h"
-#include "../../util/evsel.h"
-#include "../../util/evsel_config.h"
-#include "../../util/cpumap.h"
-#include "../../util/mmap.h"
+#include "../../../util/session.h"
+#include "../../../util/event.h"
+#include "../../../util/evlist.h"
+#include "../../../util/evsel.h"
+#include "../../../util/evsel_config.h"
+#include "../../../util/cpumap.h"
+#include "../../../util/mmap.h"
 #include <subcmd/parse-options.h>
-#include "../../util/parse-events.h"
-#include "../../util/pmu.h"
-#include "../../util/debug.h"
-#include "../../util/auxtrace.h"
-#include "../../util/record.h"
-#include "../../util/target.h"
-#include "../../util/tsc.h"
+#include "../../../util/parse-events.h"
+#include "../../../util/pmu.h"
+#include "../../../util/debug.h"
+#include "../../../util/auxtrace.h"
+#include "../../../util/record.h"
+#include "../../../util/target.h"
+#include "../../../util/tsc.h"
 #include <internal/lib.h> // page_size
-#include "../../util/intel-pt.h"
+#include "../../../util/intel-pt.h"
 
 #define KiB(x) ((x) * 1024)
 #define MiB(x) ((x) * 1024 * 1024)
diff --git a/tools/perf/arch/x86/util/machine.c b/tools/perf/arch/x86/util/machine.c
index e17e080e76f4..31679c35d493 100644
--- a/tools/perf/arch/x86/util/machine.c
+++ b/tools/perf/arch/x86/util/machine.c
@@ -5,9 +5,9 @@
 #include <stdlib.h>
 
 #include <internal/lib.h> // page_size
-#include "../../util/machine.h"
-#include "../../util/map.h"
-#include "../../util/symbol.h"
+#include "../../../util/machine.h"
+#include "../../../util/map.h"
+#include "../../../util/symbol.h"
 #include <linux/ctype.h>
 
 #include <symbol/kallsyms.h>
diff --git a/tools/perf/arch/x86/util/perf_regs.c b/tools/perf/arch/x86/util/perf_regs.c
index c218b83e063b..fca81b39b09f 100644
--- a/tools/perf/arch/x86/util/perf_regs.c
+++ b/tools/perf/arch/x86/util/perf_regs.c
@@ -5,10 +5,10 @@
 #include <linux/kernel.h>
 #include <linux/zalloc.h>
 
-#include "../../perf-sys.h"
-#include "../../util/perf_regs.h"
-#include "../../util/debug.h"
-#include "../../util/event.h"
+#include "../../../perf-sys.h"
+#include "../../../util/perf_regs.h"
+#include "../../../util/debug.h"
+#include "../../../util/event.h"
 
 const struct sample_reg sample_reg_masks[] = {
 	SMPL_REG(AX, PERF_REG_X86_AX),
diff --git a/tools/perf/arch/x86/util/pmu.c b/tools/perf/arch/x86/util/pmu.c
index e33ef5bc31c5..d48d608517fd 100644
--- a/tools/perf/arch/x86/util/pmu.c
+++ b/tools/perf/arch/x86/util/pmu.c
@@ -4,9 +4,9 @@
 #include <linux/stddef.h>
 #include <linux/perf_event.h>
 
-#include "../../util/intel-pt.h"
-#include "../../util/intel-bts.h"
-#include "../../util/pmu.h"
+#include "../../../util/intel-pt.h"
+#include "../../../util/intel-bts.h"
+#include "../../../util/pmu.h"
 
 struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused)
 {
-- 
2.25.1.481.gfbce0eb801-goog


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

* [PATCH 2/3] libperf: avoid redefining _GNU_SOURCE in test
  2020-03-06  7:11 [PATCH 0/3] perf tool: build related fixes Ian Rogers
  2020-03-06  7:11 ` [PATCH 1/3] tools: fix off-by 1 relative directory includes Ian Rogers
@ 2020-03-06  7:11 ` Ian Rogers
  2020-03-06 11:38   ` Arnaldo Carvalho de Melo
  2020-03-06  7:11 ` [PATCH 3/3] tools/perf: build fixes for arch_errno_names.sh Ian Rogers
  2020-03-06  9:35 ` [PATCH 0/3] perf tool: build related fixes Jiri Olsa
  3 siblings, 1 reply; 17+ messages in thread
From: Ian Rogers @ 2020-03-06  7:11 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Mathieu Poirier, Adrian Hunter, Igor Lubashev, Nick Desaulniers,
	Alexios Zavras, Greg Kroah-Hartman, Thomas Gleixner, Wei Li,
	Kan Liang, Andi Kleen, linux-kernel
  Cc: Stephane Eranian, Ian Rogers

_GNU_SOURCE needs to be globally defined to pick up features like
asprintf. Add a guard against redefinition in this test.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/lib/perf/tests/test-evlist.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/lib/perf/tests/test-evlist.c b/tools/lib/perf/tests/test-evlist.c
index 6d8ebe0c2504..5a5ff104b668 100644
--- a/tools/lib/perf/tests/test-evlist.c
+++ b/tools/lib/perf/tests/test-evlist.c
@@ -1,5 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE // needed for sched.h to get sched_[gs]etaffinity and CPU_(ZERO,SET)
+#endif
 #include <sched.h>
 #include <stdio.h>
 #include <stdarg.h>
-- 
2.25.1.481.gfbce0eb801-goog


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

* [PATCH 3/3] tools/perf: build fixes for arch_errno_names.sh
  2020-03-06  7:11 [PATCH 0/3] perf tool: build related fixes Ian Rogers
  2020-03-06  7:11 ` [PATCH 1/3] tools: fix off-by 1 relative directory includes Ian Rogers
  2020-03-06  7:11 ` [PATCH 2/3] libperf: avoid redefining _GNU_SOURCE in test Ian Rogers
@ 2020-03-06  7:11 ` Ian Rogers
  2020-03-06 11:40   ` Arnaldo Carvalho de Melo
  2020-05-14 15:04   ` Arnaldo Carvalho de Melo
  2020-03-06  9:35 ` [PATCH 0/3] perf tool: build related fixes Jiri Olsa
  3 siblings, 2 replies; 17+ messages in thread
From: Ian Rogers @ 2020-03-06  7:11 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Mathieu Poirier, Adrian Hunter, Igor Lubashev, Nick Desaulniers,
	Alexios Zavras, Greg Kroah-Hartman, Thomas Gleixner, Wei Li,
	Kan Liang, Andi Kleen, linux-kernel
  Cc: Stephane Eranian, Ian Rogers

Allow the CC compiler to accept a CFLAGS environment variable.
Make the architecture test directory agree with the code comment.
This doesn't change the code generated but makes it easier to integrate
running the shell script in build systems like bazel.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/trace/beauty/arch_errno_names.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/trace/beauty/arch_errno_names.sh b/tools/perf/trace/beauty/arch_errno_names.sh
index 22c9fc900c84..9f9ea45cddc4 100755
--- a/tools/perf/trace/beauty/arch_errno_names.sh
+++ b/tools/perf/trace/beauty/arch_errno_names.sh
@@ -57,7 +57,7 @@ process_arch()
 	local arch="$1"
 	local asm_errno=$(asm_errno_file "$arch")
 
-	$gcc $include_path -E -dM -x c $asm_errno \
+	$gcc $CFLAGS $include_path -E -dM -x c $asm_errno \
 		|grep -hE '^#define[[:blank:]]+(E[^[:blank:]]+)[[:blank:]]+([[:digit:]]+).*' \
 		|awk '{ print $2","$3; }' \
 		|sort -t, -k2 -nu \
@@ -91,7 +91,7 @@ EoHEADER
 # in tools/perf/arch
 archlist=""
 for arch in $(find $toolsdir/arch -maxdepth 1 -mindepth 1 -type d -printf "%f\n" | grep -v x86 | sort); do
-	test -d arch/$arch && archlist="$archlist $arch"
+	test -d $toolsdir/perf/arch/$arch && archlist="$archlist $arch"
 done
 
 for arch in x86 $archlist generic; do
-- 
2.25.1.481.gfbce0eb801-goog


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

* Re: [PATCH 1/3] tools: fix off-by 1 relative directory includes
  2020-03-06  7:11 ` [PATCH 1/3] tools: fix off-by 1 relative directory includes Ian Rogers
@ 2020-03-06  9:33   ` Jiri Olsa
  2020-03-06 16:47     ` Ian Rogers
  2020-03-06 11:41   ` Arnaldo Carvalho de Melo
  2020-03-07  7:36   ` [tip: perf/urgent] tools: Fix " tip-bot2 for Ian Rogers
  2 siblings, 1 reply; 17+ messages in thread
From: Jiri Olsa @ 2020-03-06  9:33 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Namhyung Kim, Mathieu Poirier,
	Adrian Hunter, Igor Lubashev, Nick Desaulniers, Alexios Zavras,
	Greg Kroah-Hartman, Thomas Gleixner, Wei Li, Kan Liang,
	Andi Kleen, linux-kernel, Stephane Eranian

On Thu, Mar 05, 2020 at 11:11:08PM -0800, Ian Rogers wrote:
> This is currently working due to extra include paths in the build.

if you're fixing this, why not remove that extra include path then?

jirka


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

* Re: [PATCH 0/3] perf tool: build related fixes
  2020-03-06  7:11 [PATCH 0/3] perf tool: build related fixes Ian Rogers
                   ` (2 preceding siblings ...)
  2020-03-06  7:11 ` [PATCH 3/3] tools/perf: build fixes for arch_errno_names.sh Ian Rogers
@ 2020-03-06  9:35 ` Jiri Olsa
  3 siblings, 0 replies; 17+ messages in thread
From: Jiri Olsa @ 2020-03-06  9:35 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Namhyung Kim, Mathieu Poirier,
	Adrian Hunter, Igor Lubashev, Nick Desaulniers, Alexios Zavras,
	Greg Kroah-Hartman, Thomas Gleixner, Wei Li, Kan Liang,
	Andi Kleen, linux-kernel, Stephane Eranian

On Thu, Mar 05, 2020 at 11:11:07PM -0800, Ian Rogers wrote:
> These patches better enable a build of perf when not using the regular
> Makefiles, in my case using bazel.
> 
> Ian Rogers (3):
>   tools: fix off-by 1 relative directory includes
>   libperf: avoid redefining _GNU_SOURCE in test
>   tools/perf: build fixes for arch_errno_names.sh

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

thanks,
jirka

> 
>  tools/include/uapi/asm/errno.h              | 14 +++++-----
>  tools/lib/perf/tests/test-evlist.c          |  2 ++
>  tools/perf/arch/arm64/util/arm-spe.c        | 20 +++++++-------
>  tools/perf/arch/arm64/util/perf_regs.c      |  2 +-
>  tools/perf/arch/powerpc/util/perf_regs.c    |  4 +--
>  tools/perf/arch/x86/util/auxtrace.c         | 14 +++++-----
>  tools/perf/arch/x86/util/event.c            | 12 ++++-----
>  tools/perf/arch/x86/util/header.c           |  4 +--
>  tools/perf/arch/x86/util/intel-bts.c        | 24 ++++++++---------
>  tools/perf/arch/x86/util/intel-pt.c         | 30 ++++++++++-----------
>  tools/perf/arch/x86/util/machine.c          |  6 ++---
>  tools/perf/arch/x86/util/perf_regs.c        |  8 +++---
>  tools/perf/arch/x86/util/pmu.c              |  6 ++---
>  tools/perf/trace/beauty/arch_errno_names.sh |  4 +--
>  14 files changed, 76 insertions(+), 74 deletions(-)
> 
> -- 
> 2.25.1.481.gfbce0eb801-goog
> 


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

* Re: [PATCH 2/3] libperf: avoid redefining _GNU_SOURCE in test
  2020-03-06  7:11 ` [PATCH 2/3] libperf: avoid redefining _GNU_SOURCE in test Ian Rogers
@ 2020-03-06 11:38   ` Arnaldo Carvalho de Melo
  2020-03-06 17:54     ` Ian Rogers
  0 siblings, 1 reply; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-03-06 11:38 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Mathieu Poirier, Adrian Hunter,
	Igor Lubashev, Nick Desaulniers, Alexios Zavras,
	Greg Kroah-Hartman, Thomas Gleixner, Wei Li, Kan Liang,
	Andi Kleen, linux-kernel, Stephane Eranian

Em Thu, Mar 05, 2020 at 11:11:09PM -0800, Ian Rogers escreveu:
> _GNU_SOURCE needs to be globally defined to pick up features like
> asprintf. Add a guard against redefinition in this test.

Humm, so you're completely sure that the Makefiles that drive the build
of this file don't set _GNU_SOURCE? I.e. some explanation in the cset
log message about that would help in processing the patch,

- Arnaldo
 
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/lib/perf/tests/test-evlist.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/lib/perf/tests/test-evlist.c b/tools/lib/perf/tests/test-evlist.c
> index 6d8ebe0c2504..5a5ff104b668 100644
> --- a/tools/lib/perf/tests/test-evlist.c
> +++ b/tools/lib/perf/tests/test-evlist.c
> @@ -1,5 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0
> +#ifndef _GNU_SOURCE
>  #define _GNU_SOURCE // needed for sched.h to get sched_[gs]etaffinity and CPU_(ZERO,SET)
> +#endif
>  #include <sched.h>
>  #include <stdio.h>
>  #include <stdarg.h>
> -- 
> 2.25.1.481.gfbce0eb801-goog
> 

-- 

- Arnaldo

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

* Re: [PATCH 3/3] tools/perf: build fixes for arch_errno_names.sh
  2020-03-06  7:11 ` [PATCH 3/3] tools/perf: build fixes for arch_errno_names.sh Ian Rogers
@ 2020-03-06 11:40   ` Arnaldo Carvalho de Melo
  2020-04-29 19:16     ` Ian Rogers
  2020-05-14 15:04   ` Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-03-06 11:40 UTC (permalink / raw)
  To: Hendrik Brueckner, Thomas Richter
  Cc: Ian Rogers, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim, Mathieu Poirier,
	Adrian Hunter, Igor Lubashev, Nick Desaulniers, Alexios Zavras,
	Greg Kroah-Hartman, Thomas Gleixner, Wei Li, Kan Liang,
	Andi Kleen, linux-kernel, Stephane Eranian

Em Thu, Mar 05, 2020 at 11:11:10PM -0800, Ian Rogers escreveu:
> Allow the CC compiler to accept a CFLAGS environment variable.
> Make the architecture test directory agree with the code comment.
> This doesn't change the code generated but makes it easier to integrate
> running the shell script in build systems like bazel.

Hendrik and Thomas, can you please take a look at this and provide a
Reviewed-by tag?

Thanks,

- Arnaldo
 
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/trace/beauty/arch_errno_names.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/trace/beauty/arch_errno_names.sh b/tools/perf/trace/beauty/arch_errno_names.sh
> index 22c9fc900c84..9f9ea45cddc4 100755
> --- a/tools/perf/trace/beauty/arch_errno_names.sh
> +++ b/tools/perf/trace/beauty/arch_errno_names.sh
> @@ -57,7 +57,7 @@ process_arch()
>  	local arch="$1"
>  	local asm_errno=$(asm_errno_file "$arch")
>  
> -	$gcc $include_path -E -dM -x c $asm_errno \
> +	$gcc $CFLAGS $include_path -E -dM -x c $asm_errno \
>  		|grep -hE '^#define[[:blank:]]+(E[^[:blank:]]+)[[:blank:]]+([[:digit:]]+).*' \
>  		|awk '{ print $2","$3; }' \
>  		|sort -t, -k2 -nu \
> @@ -91,7 +91,7 @@ EoHEADER
>  # in tools/perf/arch
>  archlist=""
>  for arch in $(find $toolsdir/arch -maxdepth 1 -mindepth 1 -type d -printf "%f\n" | grep -v x86 | sort); do
> -	test -d arch/$arch && archlist="$archlist $arch"
> +	test -d $toolsdir/perf/arch/$arch && archlist="$archlist $arch"
>  done
>  
>  for arch in x86 $archlist generic; do
> -- 
> 2.25.1.481.gfbce0eb801-goog
> 

-- 

- Arnaldo

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

* Re: [PATCH 1/3] tools: fix off-by 1 relative directory includes
  2020-03-06  7:11 ` [PATCH 1/3] tools: fix off-by 1 relative directory includes Ian Rogers
  2020-03-06  9:33   ` Jiri Olsa
@ 2020-03-06 11:41   ` Arnaldo Carvalho de Melo
  2020-03-07  7:36   ` [tip: perf/urgent] tools: Fix " tip-bot2 for Ian Rogers
  2 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-03-06 11:41 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Mathieu Poirier, Adrian Hunter,
	Igor Lubashev, Nick Desaulniers, Alexios Zavras,
	Greg Kroah-Hartman, Thomas Gleixner, Wei Li, Kan Liang,
	Andi Kleen, linux-kernel, Stephane Eranian

Em Thu, Mar 05, 2020 at 11:11:08PM -0800, Ian Rogers escreveu:
> This is currently working due to extra include paths in the build.

Thanks, applied and added this to the cset commit log:

    Committer testing:
    
      $ cd tools/include/uapi/asm/
    
    Before this patch:
    
      $ ls -la ../../arch/x86/include/uapi/asm/errno.h
      ls: cannot access '../../arch/x86/include/uapi/asm/errno.h': No such file or directory
      $
    
    After this patch;
    
      $ ls -la ../../../arch/x86/include/uapi/asm/errno.h
      -rw-rw-r--. 1 acme acme 31 Feb 20 12:42 ../../../arch/x86/include/uapi/asm/errno.h
      $
    
    Check that that is still under tools/, i.e. hasn't escaped into the main
    kernel sources:
    
      $ cd ../../../arch/x86/include/uapi/asm/
      $ pwd
      /home/acme/git/perf/tools/arch/x86/include/uapi/asm
      $
    
    Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>

 
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/include/uapi/asm/errno.h           | 14 +++++------
>  tools/perf/arch/arm64/util/arm-spe.c     | 20 ++++++++--------
>  tools/perf/arch/arm64/util/perf_regs.c   |  2 +-
>  tools/perf/arch/powerpc/util/perf_regs.c |  4 ++--
>  tools/perf/arch/x86/util/auxtrace.c      | 14 +++++------
>  tools/perf/arch/x86/util/event.c         | 12 +++++-----
>  tools/perf/arch/x86/util/header.c        |  4 ++--
>  tools/perf/arch/x86/util/intel-bts.c     | 24 +++++++++----------
>  tools/perf/arch/x86/util/intel-pt.c      | 30 ++++++++++++------------
>  tools/perf/arch/x86/util/machine.c       |  6 ++---
>  tools/perf/arch/x86/util/perf_regs.c     |  8 +++----
>  tools/perf/arch/x86/util/pmu.c           |  6 ++---
>  12 files changed, 72 insertions(+), 72 deletions(-)
> 
> diff --git a/tools/include/uapi/asm/errno.h b/tools/include/uapi/asm/errno.h
> index ce3c5945a1c4..637189ec1ab9 100644
> --- a/tools/include/uapi/asm/errno.h
> +++ b/tools/include/uapi/asm/errno.h
> @@ -1,18 +1,18 @@
>  /* SPDX-License-Identifier: GPL-2.0 */
>  #if defined(__i386__) || defined(__x86_64__)
> -#include "../../arch/x86/include/uapi/asm/errno.h"
> +#include "../../../arch/x86/include/uapi/asm/errno.h"
>  #elif defined(__powerpc__)
> -#include "../../arch/powerpc/include/uapi/asm/errno.h"
> +#include "../../../arch/powerpc/include/uapi/asm/errno.h"
>  #elif defined(__sparc__)
> -#include "../../arch/sparc/include/uapi/asm/errno.h"
> +#include "../../../arch/sparc/include/uapi/asm/errno.h"
>  #elif defined(__alpha__)
> -#include "../../arch/alpha/include/uapi/asm/errno.h"
> +#include "../../../arch/alpha/include/uapi/asm/errno.h"
>  #elif defined(__mips__)
> -#include "../../arch/mips/include/uapi/asm/errno.h"
> +#include "../../../arch/mips/include/uapi/asm/errno.h"
>  #elif defined(__ia64__)
> -#include "../../arch/ia64/include/uapi/asm/errno.h"
> +#include "../../../arch/ia64/include/uapi/asm/errno.h"
>  #elif defined(__xtensa__)
> -#include "../../arch/xtensa/include/uapi/asm/errno.h"
> +#include "../../../arch/xtensa/include/uapi/asm/errno.h"
>  #else
>  #include <asm-generic/errno.h>
>  #endif
> diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c
> index 8d6821d9c3f6..27653be24447 100644
> --- a/tools/perf/arch/arm64/util/arm-spe.c
> +++ b/tools/perf/arch/arm64/util/arm-spe.c
> @@ -11,17 +11,17 @@
>  #include <linux/zalloc.h>
>  #include <time.h>
>  
> -#include "../../util/cpumap.h"
> -#include "../../util/event.h"
> -#include "../../util/evsel.h"
> -#include "../../util/evlist.h"
> -#include "../../util/session.h"
> +#include "../../../util/cpumap.h"
> +#include "../../../util/event.h"
> +#include "../../../util/evsel.h"
> +#include "../../../util/evlist.h"
> +#include "../../../util/session.h"
>  #include <internal/lib.h> // page_size
> -#include "../../util/pmu.h"
> -#include "../../util/debug.h"
> -#include "../../util/auxtrace.h"
> -#include "../../util/record.h"
> -#include "../../util/arm-spe.h"
> +#include "../../../util/pmu.h"
> +#include "../../../util/debug.h"
> +#include "../../../util/auxtrace.h"
> +#include "../../../util/record.h"
> +#include "../../../util/arm-spe.h"
>  
>  #define KiB(x) ((x) * 1024)
>  #define MiB(x) ((x) * 1024 * 1024)
> diff --git a/tools/perf/arch/arm64/util/perf_regs.c b/tools/perf/arch/arm64/util/perf_regs.c
> index 2864e2e3776d..2833e101a7c6 100644
> --- a/tools/perf/arch/arm64/util/perf_regs.c
> +++ b/tools/perf/arch/arm64/util/perf_regs.c
> @@ -1,5 +1,5 @@
>  // SPDX-License-Identifier: GPL-2.0
> -#include "../../util/perf_regs.h"
> +#include "../../../util/perf_regs.h"
>  
>  const struct sample_reg sample_reg_masks[] = {
>  	SMPL_REG_END
> diff --git a/tools/perf/arch/powerpc/util/perf_regs.c b/tools/perf/arch/powerpc/util/perf_regs.c
> index e9c436eeffc9..0a5242900248 100644
> --- a/tools/perf/arch/powerpc/util/perf_regs.c
> +++ b/tools/perf/arch/powerpc/util/perf_regs.c
> @@ -4,8 +4,8 @@
>  #include <regex.h>
>  #include <linux/zalloc.h>
>  
> -#include "../../util/perf_regs.h"
> -#include "../../util/debug.h"
> +#include "../../../util/perf_regs.h"
> +#include "../../../util/debug.h"
>  
>  #include <linux/kernel.h>
>  
> diff --git a/tools/perf/arch/x86/util/auxtrace.c b/tools/perf/arch/x86/util/auxtrace.c
> index 7abc9fd4cbec..3da506e13f49 100644
> --- a/tools/perf/arch/x86/util/auxtrace.c
> +++ b/tools/perf/arch/x86/util/auxtrace.c
> @@ -7,13 +7,13 @@
>  #include <errno.h>
>  #include <stdbool.h>
>  
> -#include "../../util/header.h"
> -#include "../../util/debug.h"
> -#include "../../util/pmu.h"
> -#include "../../util/auxtrace.h"
> -#include "../../util/intel-pt.h"
> -#include "../../util/intel-bts.h"
> -#include "../../util/evlist.h"
> +#include "../../../util/header.h"
> +#include "../../../util/debug.h"
> +#include "../../../util/pmu.h"
> +#include "../../../util/auxtrace.h"
> +#include "../../../util/intel-pt.h"
> +#include "../../../util/intel-bts.h"
> +#include "../../../util/evlist.h"
>  
>  static
>  struct auxtrace_record *auxtrace_record__init_intel(struct evlist *evlist,
> diff --git a/tools/perf/arch/x86/util/event.c b/tools/perf/arch/x86/util/event.c
> index ac45015cc6ba..047dc00eafa6 100644
> --- a/tools/perf/arch/x86/util/event.c
> +++ b/tools/perf/arch/x86/util/event.c
> @@ -3,12 +3,12 @@
>  #include <linux/string.h>
>  #include <linux/zalloc.h>
>  
> -#include "../../util/event.h"
> -#include "../../util/synthetic-events.h"
> -#include "../../util/machine.h"
> -#include "../../util/tool.h"
> -#include "../../util/map.h"
> -#include "../../util/debug.h"
> +#include "../../../util/event.h"
> +#include "../../../util/synthetic-events.h"
> +#include "../../../util/machine.h"
> +#include "../../../util/tool.h"
> +#include "../../../util/map.h"
> +#include "../../../util/debug.h"
>  
>  #if defined(__x86_64__)
>  
> diff --git a/tools/perf/arch/x86/util/header.c b/tools/perf/arch/x86/util/header.c
> index aa6deb463bf3..578c8c568ffd 100644
> --- a/tools/perf/arch/x86/util/header.c
> +++ b/tools/perf/arch/x86/util/header.c
> @@ -7,8 +7,8 @@
>  #include <string.h>
>  #include <regex.h>
>  
> -#include "../../util/debug.h"
> -#include "../../util/header.h"
> +#include "../../../util/debug.h"
> +#include "../../../util/header.h"
>  
>  static inline void
>  cpuid(unsigned int op, unsigned int *a, unsigned int *b, unsigned int *c,
> diff --git a/tools/perf/arch/x86/util/intel-bts.c b/tools/perf/arch/x86/util/intel-bts.c
> index 26cee1052179..09f93800bffd 100644
> --- a/tools/perf/arch/x86/util/intel-bts.c
> +++ b/tools/perf/arch/x86/util/intel-bts.c
> @@ -11,18 +11,18 @@
>  #include <linux/log2.h>
>  #include <linux/zalloc.h>
>  
> -#include "../../util/cpumap.h"
> -#include "../../util/event.h"
> -#include "../../util/evsel.h"
> -#include "../../util/evlist.h"
> -#include "../../util/mmap.h"
> -#include "../../util/session.h"
> -#include "../../util/pmu.h"
> -#include "../../util/debug.h"
> -#include "../../util/record.h"
> -#include "../../util/tsc.h"
> -#include "../../util/auxtrace.h"
> -#include "../../util/intel-bts.h"
> +#include "../../../util/cpumap.h"
> +#include "../../../util/event.h"
> +#include "../../../util/evsel.h"
> +#include "../../../util/evlist.h"
> +#include "../../../util/mmap.h"
> +#include "../../../util/session.h"
> +#include "../../../util/pmu.h"
> +#include "../../../util/debug.h"
> +#include "../../../util/record.h"
> +#include "../../../util/tsc.h"
> +#include "../../../util/auxtrace.h"
> +#include "../../../util/intel-bts.h"
>  #include <internal/lib.h> // page_size
>  
>  #define KiB(x) ((x) * 1024)
> diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
> index 7eea4fd7ce58..1643aed8c4c8 100644
> --- a/tools/perf/arch/x86/util/intel-pt.c
> +++ b/tools/perf/arch/x86/util/intel-pt.c
> @@ -13,23 +13,23 @@
>  #include <linux/zalloc.h>
>  #include <cpuid.h>
>  
> -#include "../../util/session.h"
> -#include "../../util/event.h"
> -#include "../../util/evlist.h"
> -#include "../../util/evsel.h"
> -#include "../../util/evsel_config.h"
> -#include "../../util/cpumap.h"
> -#include "../../util/mmap.h"
> +#include "../../../util/session.h"
> +#include "../../../util/event.h"
> +#include "../../../util/evlist.h"
> +#include "../../../util/evsel.h"
> +#include "../../../util/evsel_config.h"
> +#include "../../../util/cpumap.h"
> +#include "../../../util/mmap.h"
>  #include <subcmd/parse-options.h>
> -#include "../../util/parse-events.h"
> -#include "../../util/pmu.h"
> -#include "../../util/debug.h"
> -#include "../../util/auxtrace.h"
> -#include "../../util/record.h"
> -#include "../../util/target.h"
> -#include "../../util/tsc.h"
> +#include "../../../util/parse-events.h"
> +#include "../../../util/pmu.h"
> +#include "../../../util/debug.h"
> +#include "../../../util/auxtrace.h"
> +#include "../../../util/record.h"
> +#include "../../../util/target.h"
> +#include "../../../util/tsc.h"
>  #include <internal/lib.h> // page_size
> -#include "../../util/intel-pt.h"
> +#include "../../../util/intel-pt.h"
>  
>  #define KiB(x) ((x) * 1024)
>  #define MiB(x) ((x) * 1024 * 1024)
> diff --git a/tools/perf/arch/x86/util/machine.c b/tools/perf/arch/x86/util/machine.c
> index e17e080e76f4..31679c35d493 100644
> --- a/tools/perf/arch/x86/util/machine.c
> +++ b/tools/perf/arch/x86/util/machine.c
> @@ -5,9 +5,9 @@
>  #include <stdlib.h>
>  
>  #include <internal/lib.h> // page_size
> -#include "../../util/machine.h"
> -#include "../../util/map.h"
> -#include "../../util/symbol.h"
> +#include "../../../util/machine.h"
> +#include "../../../util/map.h"
> +#include "../../../util/symbol.h"
>  #include <linux/ctype.h>
>  
>  #include <symbol/kallsyms.h>
> diff --git a/tools/perf/arch/x86/util/perf_regs.c b/tools/perf/arch/x86/util/perf_regs.c
> index c218b83e063b..fca81b39b09f 100644
> --- a/tools/perf/arch/x86/util/perf_regs.c
> +++ b/tools/perf/arch/x86/util/perf_regs.c
> @@ -5,10 +5,10 @@
>  #include <linux/kernel.h>
>  #include <linux/zalloc.h>
>  
> -#include "../../perf-sys.h"
> -#include "../../util/perf_regs.h"
> -#include "../../util/debug.h"
> -#include "../../util/event.h"
> +#include "../../../perf-sys.h"
> +#include "../../../util/perf_regs.h"
> +#include "../../../util/debug.h"
> +#include "../../../util/event.h"
>  
>  const struct sample_reg sample_reg_masks[] = {
>  	SMPL_REG(AX, PERF_REG_X86_AX),
> diff --git a/tools/perf/arch/x86/util/pmu.c b/tools/perf/arch/x86/util/pmu.c
> index e33ef5bc31c5..d48d608517fd 100644
> --- a/tools/perf/arch/x86/util/pmu.c
> +++ b/tools/perf/arch/x86/util/pmu.c
> @@ -4,9 +4,9 @@
>  #include <linux/stddef.h>
>  #include <linux/perf_event.h>
>  
> -#include "../../util/intel-pt.h"
> -#include "../../util/intel-bts.h"
> -#include "../../util/pmu.h"
> +#include "../../../util/intel-pt.h"
> +#include "../../../util/intel-bts.h"
> +#include "../../../util/pmu.h"
>  
>  struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused)
>  {
> -- 
> 2.25.1.481.gfbce0eb801-goog
> 

-- 

- Arnaldo

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

* Re: [PATCH 1/3] tools: fix off-by 1 relative directory includes
  2020-03-06  9:33   ` Jiri Olsa
@ 2020-03-06 16:47     ` Ian Rogers
  2020-03-06 20:13       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 17+ messages in thread
From: Ian Rogers @ 2020-03-06 16:47 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Namhyung Kim, Mathieu Poirier,
	Adrian Hunter, Igor Lubashev, Nick Desaulniers, Alexios Zavras,
	Greg Kroah-Hartman, Thomas Gleixner, Wei Li, Kan Liang,
	Andi Kleen, LKML, Stephane Eranian

On Fri, Mar 6, 2020 at 1:34 AM Jiri Olsa <jolsa@redhat.com> wrote:
>
> On Thu, Mar 05, 2020 at 11:11:08PM -0800, Ian Rogers wrote:
> > This is currently working due to extra include paths in the build.
>
> if you're fixing this, why not remove that extra include path then?

TL;DR it is complicated, but the include paths are all currently
necessary I believe and doing this way is necessary due to how header
files may be copied out of the kernel.

The current build uses multiple -Is to ensure the correct version of a
file is included, for example there are 27 files called bitops.h and
29 called bitsperlong.h. In
Google we're using libraries and bazel build files:
https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library
and there's no way to say if you depend on this library then you need
this include path. We've tried to make perf this way but having tied
ourselves in knots we decided instead to emulate the include path
behaviour by rewriting includes when we import code using copybara:
https://github.com/google/copybara
We are able when doing this to prioritize the include paths we rewrite
so that a local directory version of a header is preferred over say
one in tools/lib/perf and perhaps tools/perf. Having full include
paths isn't really an option upstream as the same header file may be
copied into a libc project that has a different directory layout.
As we have absolute include paths at the time of building we need
relative include paths to be correct. Upstream -Is allow the build to
find the file but it is a bit of a quirk of the C preprocessor, so
fixing these off-by 1s feels like value add both for us and upstream.
For upstream to do anything different I think is going to be a
significant rewrite of how the Makefile build works and I'm not sure
what the result would look like.

Thanks!
Ian

> jirka
>

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

* Re: [PATCH 2/3] libperf: avoid redefining _GNU_SOURCE in test
  2020-03-06 11:38   ` Arnaldo Carvalho de Melo
@ 2020-03-06 17:54     ` Ian Rogers
  0 siblings, 0 replies; 17+ messages in thread
From: Ian Rogers @ 2020-03-06 17:54 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Mathieu Poirier, Adrian Hunter,
	Igor Lubashev, Nick Desaulniers, Alexios Zavras,
	Greg Kroah-Hartman, Thomas Gleixner, Wei Li, Kan Liang,
	Andi Kleen, LKML, Stephane Eranian

On Fri, Mar 6, 2020 at 3:38 AM Arnaldo Carvalho de Melo
<arnaldo.melo@gmail.com> wrote:
>
> Em Thu, Mar 05, 2020 at 11:11:09PM -0800, Ian Rogers escreveu:
> > _GNU_SOURCE needs to be globally defined to pick up features like
> > asprintf. Add a guard against redefinition in this test.
>
> Humm, so you're completely sure that the Makefiles that drive the build
> of this file don't set _GNU_SOURCE? I.e. some explanation in the cset
> log message about that would help in processing the patch,

The convention on _GNU_SOURCE isn't very clear. For our builds we set
_GNU_SOURCE globally hence needing this patch. This patch won't
interfere with a Makefile setting. Here is some of the inconsistency:

tools/perf: sets _GNU_SOURCE:
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/tree/tools/perf/Makefile.config#n309

tools/lib/perf: doesn't set _GNU_SOURCE <-- I'm inconsistent in
setting _GNU_SOURCE when building files here
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/tree/tools/lib/perf/Makefile

tools/lib/subcmd: sets _GNU_SOURCE
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/tree/tools/lib/subcmd/Makefile#n43

Some #defines of _GNU_SOURCE are already guarded to avoid redefinition:
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/tree/tools/lib/bpf/libbpf.c#n13

Some code explicitly undefines _GNU_SOURCE:
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/tree/tools/lib/str_error_r.c#n2

I don't think this patch hurts, I'm not sure it adds value. I think
there's a wider cleanup necessary here but I'm not sure what that
would look like.

Thanks,
Ian

> - Arnaldo
>
> > Signed-off-by: Ian Rogers <irogers@google.com>
> > ---
> >  tools/lib/perf/tests/test-evlist.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/tools/lib/perf/tests/test-evlist.c b/tools/lib/perf/tests/test-evlist.c
> > index 6d8ebe0c2504..5a5ff104b668 100644
> > --- a/tools/lib/perf/tests/test-evlist.c
> > +++ b/tools/lib/perf/tests/test-evlist.c
> > @@ -1,5 +1,7 @@
> >  // SPDX-License-Identifier: GPL-2.0
> > +#ifndef _GNU_SOURCE
> >  #define _GNU_SOURCE // needed for sched.h to get sched_[gs]etaffinity and CPU_(ZERO,SET)
> > +#endif
> >  #include <sched.h>
> >  #include <stdio.h>
> >  #include <stdarg.h>
> > --
> > 2.25.1.481.gfbce0eb801-goog
> >
>
> --
>
> - Arnaldo

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

* Re: [PATCH 1/3] tools: fix off-by 1 relative directory includes
  2020-03-06 16:47     ` Ian Rogers
@ 2020-03-06 20:13       ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-03-06 20:13 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Jiri Olsa, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Namhyung Kim, Mathieu Poirier, Adrian Hunter,
	Igor Lubashev, Nick Desaulniers, Alexios Zavras,
	Greg Kroah-Hartman, Thomas Gleixner, Wei Li, Kan Liang,
	Andi Kleen, LKML, Stephane Eranian

Em Fri, Mar 06, 2020 at 08:47:51AM -0800, Ian Rogers escreveu:
> On Fri, Mar 6, 2020 at 1:34 AM Jiri Olsa <jolsa@redhat.com> wrote:
> >
> > On Thu, Mar 05, 2020 at 11:11:08PM -0800, Ian Rogers wrote:
> > > This is currently working due to extra include paths in the build.
> >
> > if you're fixing this, why not remove that extra include path then?
> 
> TL;DR it is complicated, but the include paths are all currently
> necessary I believe and doing this way is necessary due to how header
> files may be copied out of the kernel.

TL;DR response: yeah, lets make incremental fixes to this, like applying
this patch :)

- Arnaldo
 
> The current build uses multiple -Is to ensure the correct version of a
> file is included, for example there are 27 files called bitops.h and
> 29 called bitsperlong.h. In
> Google we're using libraries and bazel build files:
> https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library
> and there's no way to say if you depend on this library then you need
> this include path. We've tried to make perf this way but having tied
> ourselves in knots we decided instead to emulate the include path
> behaviour by rewriting includes when we import code using copybara:
> https://github.com/google/copybara
> We are able when doing this to prioritize the include paths we rewrite
> so that a local directory version of a header is preferred over say
> one in tools/lib/perf and perhaps tools/perf. Having full include
> paths isn't really an option upstream as the same header file may be
> copied into a libc project that has a different directory layout.
> As we have absolute include paths at the time of building we need
> relative include paths to be correct. Upstream -Is allow the build to
> find the file but it is a bit of a quirk of the C preprocessor, so
> fixing these off-by 1s feels like value add both for us and upstream.
> For upstream to do anything different I think is going to be a
> significant rewrite of how the Makefile build works and I'm not sure
> what the result would look like.
> 
> Thanks!
> Ian
> 
> > jirka
> >

-- 

- Arnaldo

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

* [tip: perf/urgent] tools: Fix off-by 1 relative directory includes
  2020-03-06  7:11 ` [PATCH 1/3] tools: fix off-by 1 relative directory includes Ian Rogers
  2020-03-06  9:33   ` Jiri Olsa
  2020-03-06 11:41   ` Arnaldo Carvalho de Melo
@ 2020-03-07  7:36   ` tip-bot2 for Ian Rogers
  2 siblings, 0 replies; 17+ messages in thread
From: tip-bot2 for Ian Rogers @ 2020-03-07  7:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Ian Rogers, Arnaldo Carvalho de Melo, Jiri Olsa, Adrian Hunter,
	Alexander Shishkin, Alexios Zavras, Andi Kleen,
	Greg Kroah-Hartman, Igor Lubashev, Kan Liang, Mark Rutland,
	Mathieu Poirier, Namhyung Kim, Nick Desaulniers, Peter Zijlstra,
	Stephane Eranian, Thomas Gleixner, Wei Li, x86, LKML

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID:     441b62acd9c809e87bab45ad1d82b1b3b77cb4f0
Gitweb:        https://git.kernel.org/tip/441b62acd9c809e87bab45ad1d82b1b3b77cb4f0
Author:        Ian Rogers <irogers@google.com>
AuthorDate:    Thu, 05 Mar 2020 23:11:08 -08:00
Committer:     Arnaldo Carvalho de Melo <acme@redhat.com>
CommitterDate: Fri, 06 Mar 2020 08:36:46 -03:00

tools: Fix off-by 1 relative directory includes

This is currently working due to extra include paths in the build.

Committer testing:

  $ cd tools/include/uapi/asm/

Before this patch:

  $ ls -la ../../arch/x86/include/uapi/asm/errno.h
  ls: cannot access '../../arch/x86/include/uapi/asm/errno.h': No such file or directory
  $

After this patch;

  $ ls -la ../../../arch/x86/include/uapi/asm/errno.h
  -rw-rw-r--. 1 acme acme 31 Feb 20 12:42 ../../../arch/x86/include/uapi/asm/errno.h
  $

Check that that is still under tools/, i.e. hasn't escaped into the main
kernel sources:

  $ cd ../../../arch/x86/include/uapi/asm/
  $ pwd
  /home/acme/git/perf/tools/arch/x86/include/uapi/asm
  $

Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexios Zavras <alexios.zavras@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Igor Lubashev <ilubashe@akamai.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wei Li <liwei391@huawei.com>
Link: http://lore.kernel.org/lkml/20200306071110.130202-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/include/uapi/asm/errno.h           | 14 +++++------
 tools/perf/arch/arm64/util/arm-spe.c     | 20 +++++++--------
 tools/perf/arch/arm64/util/perf_regs.c   |  2 +-
 tools/perf/arch/powerpc/util/perf_regs.c |  4 +--
 tools/perf/arch/x86/util/auxtrace.c      | 14 +++++------
 tools/perf/arch/x86/util/event.c         | 12 ++++-----
 tools/perf/arch/x86/util/header.c        |  4 +--
 tools/perf/arch/x86/util/intel-bts.c     | 24 +++++++++---------
 tools/perf/arch/x86/util/intel-pt.c      | 30 +++++++++++------------
 tools/perf/arch/x86/util/machine.c       |  6 ++---
 tools/perf/arch/x86/util/perf_regs.c     |  8 +++---
 tools/perf/arch/x86/util/pmu.c           |  6 ++---
 12 files changed, 72 insertions(+), 72 deletions(-)

diff --git a/tools/include/uapi/asm/errno.h b/tools/include/uapi/asm/errno.h
index ce3c594..637189e 100644
--- a/tools/include/uapi/asm/errno.h
+++ b/tools/include/uapi/asm/errno.h
@@ -1,18 +1,18 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #if defined(__i386__) || defined(__x86_64__)
-#include "../../arch/x86/include/uapi/asm/errno.h"
+#include "../../../arch/x86/include/uapi/asm/errno.h"
 #elif defined(__powerpc__)
-#include "../../arch/powerpc/include/uapi/asm/errno.h"
+#include "../../../arch/powerpc/include/uapi/asm/errno.h"
 #elif defined(__sparc__)
-#include "../../arch/sparc/include/uapi/asm/errno.h"
+#include "../../../arch/sparc/include/uapi/asm/errno.h"
 #elif defined(__alpha__)
-#include "../../arch/alpha/include/uapi/asm/errno.h"
+#include "../../../arch/alpha/include/uapi/asm/errno.h"
 #elif defined(__mips__)
-#include "../../arch/mips/include/uapi/asm/errno.h"
+#include "../../../arch/mips/include/uapi/asm/errno.h"
 #elif defined(__ia64__)
-#include "../../arch/ia64/include/uapi/asm/errno.h"
+#include "../../../arch/ia64/include/uapi/asm/errno.h"
 #elif defined(__xtensa__)
-#include "../../arch/xtensa/include/uapi/asm/errno.h"
+#include "../../../arch/xtensa/include/uapi/asm/errno.h"
 #else
 #include <asm-generic/errno.h>
 #endif
diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c
index 8d6821d..27653be 100644
--- a/tools/perf/arch/arm64/util/arm-spe.c
+++ b/tools/perf/arch/arm64/util/arm-spe.c
@@ -11,17 +11,17 @@
 #include <linux/zalloc.h>
 #include <time.h>
 
-#include "../../util/cpumap.h"
-#include "../../util/event.h"
-#include "../../util/evsel.h"
-#include "../../util/evlist.h"
-#include "../../util/session.h"
+#include "../../../util/cpumap.h"
+#include "../../../util/event.h"
+#include "../../../util/evsel.h"
+#include "../../../util/evlist.h"
+#include "../../../util/session.h"
 #include <internal/lib.h> // page_size
-#include "../../util/pmu.h"
-#include "../../util/debug.h"
-#include "../../util/auxtrace.h"
-#include "../../util/record.h"
-#include "../../util/arm-spe.h"
+#include "../../../util/pmu.h"
+#include "../../../util/debug.h"
+#include "../../../util/auxtrace.h"
+#include "../../../util/record.h"
+#include "../../../util/arm-spe.h"
 
 #define KiB(x) ((x) * 1024)
 #define MiB(x) ((x) * 1024 * 1024)
diff --git a/tools/perf/arch/arm64/util/perf_regs.c b/tools/perf/arch/arm64/util/perf_regs.c
index 2864e2e..2833e10 100644
--- a/tools/perf/arch/arm64/util/perf_regs.c
+++ b/tools/perf/arch/arm64/util/perf_regs.c
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
-#include "../../util/perf_regs.h"
+#include "../../../util/perf_regs.h"
 
 const struct sample_reg sample_reg_masks[] = {
 	SMPL_REG_END
diff --git a/tools/perf/arch/powerpc/util/perf_regs.c b/tools/perf/arch/powerpc/util/perf_regs.c
index e9c436e..0a52429 100644
--- a/tools/perf/arch/powerpc/util/perf_regs.c
+++ b/tools/perf/arch/powerpc/util/perf_regs.c
@@ -4,8 +4,8 @@
 #include <regex.h>
 #include <linux/zalloc.h>
 
-#include "../../util/perf_regs.h"
-#include "../../util/debug.h"
+#include "../../../util/perf_regs.h"
+#include "../../../util/debug.h"
 
 #include <linux/kernel.h>
 
diff --git a/tools/perf/arch/x86/util/auxtrace.c b/tools/perf/arch/x86/util/auxtrace.c
index 7abc9fd..3da506e 100644
--- a/tools/perf/arch/x86/util/auxtrace.c
+++ b/tools/perf/arch/x86/util/auxtrace.c
@@ -7,13 +7,13 @@
 #include <errno.h>
 #include <stdbool.h>
 
-#include "../../util/header.h"
-#include "../../util/debug.h"
-#include "../../util/pmu.h"
-#include "../../util/auxtrace.h"
-#include "../../util/intel-pt.h"
-#include "../../util/intel-bts.h"
-#include "../../util/evlist.h"
+#include "../../../util/header.h"
+#include "../../../util/debug.h"
+#include "../../../util/pmu.h"
+#include "../../../util/auxtrace.h"
+#include "../../../util/intel-pt.h"
+#include "../../../util/intel-bts.h"
+#include "../../../util/evlist.h"
 
 static
 struct auxtrace_record *auxtrace_record__init_intel(struct evlist *evlist,
diff --git a/tools/perf/arch/x86/util/event.c b/tools/perf/arch/x86/util/event.c
index ac45015..047dc00 100644
--- a/tools/perf/arch/x86/util/event.c
+++ b/tools/perf/arch/x86/util/event.c
@@ -3,12 +3,12 @@
 #include <linux/string.h>
 #include <linux/zalloc.h>
 
-#include "../../util/event.h"
-#include "../../util/synthetic-events.h"
-#include "../../util/machine.h"
-#include "../../util/tool.h"
-#include "../../util/map.h"
-#include "../../util/debug.h"
+#include "../../../util/event.h"
+#include "../../../util/synthetic-events.h"
+#include "../../../util/machine.h"
+#include "../../../util/tool.h"
+#include "../../../util/map.h"
+#include "../../../util/debug.h"
 
 #if defined(__x86_64__)
 
diff --git a/tools/perf/arch/x86/util/header.c b/tools/perf/arch/x86/util/header.c
index aa6deb4..578c8c5 100644
--- a/tools/perf/arch/x86/util/header.c
+++ b/tools/perf/arch/x86/util/header.c
@@ -7,8 +7,8 @@
 #include <string.h>
 #include <regex.h>
 
-#include "../../util/debug.h"
-#include "../../util/header.h"
+#include "../../../util/debug.h"
+#include "../../../util/header.h"
 
 static inline void
 cpuid(unsigned int op, unsigned int *a, unsigned int *b, unsigned int *c,
diff --git a/tools/perf/arch/x86/util/intel-bts.c b/tools/perf/arch/x86/util/intel-bts.c
index 26cee10..09f9380 100644
--- a/tools/perf/arch/x86/util/intel-bts.c
+++ b/tools/perf/arch/x86/util/intel-bts.c
@@ -11,18 +11,18 @@
 #include <linux/log2.h>
 #include <linux/zalloc.h>
 
-#include "../../util/cpumap.h"
-#include "../../util/event.h"
-#include "../../util/evsel.h"
-#include "../../util/evlist.h"
-#include "../../util/mmap.h"
-#include "../../util/session.h"
-#include "../../util/pmu.h"
-#include "../../util/debug.h"
-#include "../../util/record.h"
-#include "../../util/tsc.h"
-#include "../../util/auxtrace.h"
-#include "../../util/intel-bts.h"
+#include "../../../util/cpumap.h"
+#include "../../../util/event.h"
+#include "../../../util/evsel.h"
+#include "../../../util/evlist.h"
+#include "../../../util/mmap.h"
+#include "../../../util/session.h"
+#include "../../../util/pmu.h"
+#include "../../../util/debug.h"
+#include "../../../util/record.h"
+#include "../../../util/tsc.h"
+#include "../../../util/auxtrace.h"
+#include "../../../util/intel-bts.h"
 #include <internal/lib.h> // page_size
 
 #define KiB(x) ((x) * 1024)
diff --git a/tools/perf/arch/x86/util/intel-pt.c b/tools/perf/arch/x86/util/intel-pt.c
index 7eea4fd..1643aed 100644
--- a/tools/perf/arch/x86/util/intel-pt.c
+++ b/tools/perf/arch/x86/util/intel-pt.c
@@ -13,23 +13,23 @@
 #include <linux/zalloc.h>
 #include <cpuid.h>
 
-#include "../../util/session.h"
-#include "../../util/event.h"
-#include "../../util/evlist.h"
-#include "../../util/evsel.h"
-#include "../../util/evsel_config.h"
-#include "../../util/cpumap.h"
-#include "../../util/mmap.h"
+#include "../../../util/session.h"
+#include "../../../util/event.h"
+#include "../../../util/evlist.h"
+#include "../../../util/evsel.h"
+#include "../../../util/evsel_config.h"
+#include "../../../util/cpumap.h"
+#include "../../../util/mmap.h"
 #include <subcmd/parse-options.h>
-#include "../../util/parse-events.h"
-#include "../../util/pmu.h"
-#include "../../util/debug.h"
-#include "../../util/auxtrace.h"
-#include "../../util/record.h"
-#include "../../util/target.h"
-#include "../../util/tsc.h"
+#include "../../../util/parse-events.h"
+#include "../../../util/pmu.h"
+#include "../../../util/debug.h"
+#include "../../../util/auxtrace.h"
+#include "../../../util/record.h"
+#include "../../../util/target.h"
+#include "../../../util/tsc.h"
 #include <internal/lib.h> // page_size
-#include "../../util/intel-pt.h"
+#include "../../../util/intel-pt.h"
 
 #define KiB(x) ((x) * 1024)
 #define MiB(x) ((x) * 1024 * 1024)
diff --git a/tools/perf/arch/x86/util/machine.c b/tools/perf/arch/x86/util/machine.c
index e17e080..31679c3 100644
--- a/tools/perf/arch/x86/util/machine.c
+++ b/tools/perf/arch/x86/util/machine.c
@@ -5,9 +5,9 @@
 #include <stdlib.h>
 
 #include <internal/lib.h> // page_size
-#include "../../util/machine.h"
-#include "../../util/map.h"
-#include "../../util/symbol.h"
+#include "../../../util/machine.h"
+#include "../../../util/map.h"
+#include "../../../util/symbol.h"
 #include <linux/ctype.h>
 
 #include <symbol/kallsyms.h>
diff --git a/tools/perf/arch/x86/util/perf_regs.c b/tools/perf/arch/x86/util/perf_regs.c
index c218b83..fca81b3 100644
--- a/tools/perf/arch/x86/util/perf_regs.c
+++ b/tools/perf/arch/x86/util/perf_regs.c
@@ -5,10 +5,10 @@
 #include <linux/kernel.h>
 #include <linux/zalloc.h>
 
-#include "../../perf-sys.h"
-#include "../../util/perf_regs.h"
-#include "../../util/debug.h"
-#include "../../util/event.h"
+#include "../../../perf-sys.h"
+#include "../../../util/perf_regs.h"
+#include "../../../util/debug.h"
+#include "../../../util/event.h"
 
 const struct sample_reg sample_reg_masks[] = {
 	SMPL_REG(AX, PERF_REG_X86_AX),
diff --git a/tools/perf/arch/x86/util/pmu.c b/tools/perf/arch/x86/util/pmu.c
index e33ef5b..d48d608 100644
--- a/tools/perf/arch/x86/util/pmu.c
+++ b/tools/perf/arch/x86/util/pmu.c
@@ -4,9 +4,9 @@
 #include <linux/stddef.h>
 #include <linux/perf_event.h>
 
-#include "../../util/intel-pt.h"
-#include "../../util/intel-bts.h"
-#include "../../util/pmu.h"
+#include "../../../util/intel-pt.h"
+#include "../../../util/intel-bts.h"
+#include "../../../util/pmu.h"
 
 struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused)
 {

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

* Re: [PATCH 3/3] tools/perf: build fixes for arch_errno_names.sh
  2020-03-06 11:40   ` Arnaldo Carvalho de Melo
@ 2020-04-29 19:16     ` Ian Rogers
  0 siblings, 0 replies; 17+ messages in thread
From: Ian Rogers @ 2020-04-29 19:16 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Hendrik Brueckner, Thomas Richter
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Mathieu Poirier, Adrian Hunter,
	Igor Lubashev, Nick Desaulniers, Alexios Zavras,
	Greg Kroah-Hartman, Thomas Gleixner, Wei Li, Kan Liang,
	Andi Kleen, LKML, Stephane Eranian

On Fri, Mar 6, 2020 at 3:40 AM Arnaldo Carvalho de Melo
<arnaldo.melo@gmail.com> wrote:
>
> Em Thu, Mar 05, 2020 at 11:11:10PM -0800, Ian Rogers escreveu:
> > Allow the CC compiler to accept a CFLAGS environment variable.
> > Make the architecture test directory agree with the code comment.
> > This doesn't change the code generated but makes it easier to integrate
> > running the shell script in build systems like bazel.
>
> Hendrik and Thomas, can you please take a look at this and provide a
> Reviewed-by tag?

Ping.

> Thanks,
>
> - Arnaldo
>
> > Signed-off-by: Ian Rogers <irogers@google.com>
> > ---
> >  tools/perf/trace/beauty/arch_errno_names.sh | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/perf/trace/beauty/arch_errno_names.sh b/tools/perf/trace/beauty/arch_errno_names.sh
> > index 22c9fc900c84..9f9ea45cddc4 100755
> > --- a/tools/perf/trace/beauty/arch_errno_names.sh
> > +++ b/tools/perf/trace/beauty/arch_errno_names.sh
> > @@ -57,7 +57,7 @@ process_arch()
> >       local arch="$1"
> >       local asm_errno=$(asm_errno_file "$arch")
> >
> > -     $gcc $include_path -E -dM -x c $asm_errno \
> > +     $gcc $CFLAGS $include_path -E -dM -x c $asm_errno \
> >               |grep -hE '^#define[[:blank:]]+(E[^[:blank:]]+)[[:blank:]]+([[:digit:]]+).*' \
> >               |awk '{ print $2","$3; }' \
> >               |sort -t, -k2 -nu \
> > @@ -91,7 +91,7 @@ EoHEADER
> >  # in tools/perf/arch
> >  archlist=""
> >  for arch in $(find $toolsdir/arch -maxdepth 1 -mindepth 1 -type d -printf "%f\n" | grep -v x86 | sort); do
> > -     test -d arch/$arch && archlist="$archlist $arch"
> > +     test -d $toolsdir/perf/arch/$arch && archlist="$archlist $arch"
> >  done
> >
> >  for arch in x86 $archlist generic; do
> > --
> > 2.25.1.481.gfbce0eb801-goog
> >
>
> --
>
> - Arnaldo

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

* Re: [PATCH 3/3] tools/perf: build fixes for arch_errno_names.sh
  2020-03-06  7:11 ` [PATCH 3/3] tools/perf: build fixes for arch_errno_names.sh Ian Rogers
  2020-03-06 11:40   ` Arnaldo Carvalho de Melo
@ 2020-05-14 15:04   ` Arnaldo Carvalho de Melo
  2020-05-14 17:54     ` Ian Rogers
  1 sibling, 1 reply; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-05-14 15:04 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Mathieu Poirier, Adrian Hunter,
	Igor Lubashev, Nick Desaulniers, Alexios Zavras,
	Greg Kroah-Hartman, Thomas Gleixner, Wei Li, Kan Liang,
	Andi Kleen, linux-kernel, Stephane Eranian

Em Thu, Mar 05, 2020 at 11:11:10PM -0800, Ian Rogers escreveu:
> Allow the CC compiler to accept a CFLAGS environment variable.
> Make the architecture test directory agree with the code comment.
> This doesn't change the code generated but makes it easier to integrate
> running the shell script in build systems like bazel.

I've looked at this and split this part in a separate patch, and applied
it locally, please take a look, now looking at the other bit of the
patch.

- Arnaldo
 
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/trace/beauty/arch_errno_names.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/trace/beauty/arch_errno_names.sh b/tools/perf/trace/beauty/arch_errno_names.sh
> index 22c9fc900c84..9f9ea45cddc4 100755
> --- a/tools/perf/trace/beauty/arch_errno_names.sh
> +++ b/tools/perf/trace/beauty/arch_errno_names.sh
> @@ -91,7 +91,7 @@ EoHEADER
>  # in tools/perf/arch
>  archlist=""
>  for arch in $(find $toolsdir/arch -maxdepth 1 -mindepth 1 -type d -printf "%f\n" | grep -v x86 | sort); do
> -	test -d arch/$arch && archlist="$archlist $arch"
> +	test -d $toolsdir/perf/arch/$arch && archlist="$archlist $arch"
>  done
>  
>  for arch in x86 $archlist generic; do
> -- 
commit 1b59e3b7bfc6183d3dc9f119e1875f9607d29d96
Author: Ian Rogers <irogers@google.com>
Date:   Thu Mar 5 23:11:10 2020 -0800

    perf trace: Fix the selection for architectures to generate the errno name tables
    
    Make the architecture test directory agree with the code comment.
    
    Committer notes:
    
    This was split from a larger patch.
    
    The code was assuming the developer always worked from tools/perf/, so make sure we
    do the test -d having $toolsdir/perf/arch/$arch, to match the intent expressed in the comment,
    just above that loop.
    
    Signed-off-by: Ian Rogers <irogers@google.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Alexios Zavras <alexios.zavras@intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Igor Lubashev <ilubashe@akamai.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Nick Desaulniers <ndesaulniers@google.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Wei Li <liwei391@huawei.com>
    Link: http://lore.kernel.org/lkml/20200306071110.130202-4-irogers@google.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

diff --git a/tools/perf/trace/beauty/arch_errno_names.sh b/tools/perf/trace/beauty/arch_errno_names.sh
index 22c9fc900c84..f8c44a85650b 100755
--- a/tools/perf/trace/beauty/arch_errno_names.sh
+++ b/tools/perf/trace/beauty/arch_errno_names.sh
@@ -91,7 +91,7 @@ EoHEADER
 # in tools/perf/arch
 archlist=""
 for arch in $(find $toolsdir/arch -maxdepth 1 -mindepth 1 -type d -printf "%f\n" | grep -v x86 | sort); do
-	test -d arch/$arch && archlist="$archlist $arch"
+	test -d $toolsdir/perf/arch/$arch && archlist="$archlist $arch"
 done
 
 for arch in x86 $archlist generic; do

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

* Re: [PATCH 3/3] tools/perf: build fixes for arch_errno_names.sh
  2020-05-14 15:04   ` Arnaldo Carvalho de Melo
@ 2020-05-14 17:54     ` Ian Rogers
  2020-05-15 13:50       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 17+ messages in thread
From: Ian Rogers @ 2020-05-14 17:54 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Mathieu Poirier, Adrian Hunter,
	Igor Lubashev, Nick Desaulniers, Alexios Zavras,
	Greg Kroah-Hartman, Thomas Gleixner, Wei Li, Kan Liang,
	Andi Kleen, LKML, Stephane Eranian

On Thu, May 14, 2020 at 8:04 AM Arnaldo Carvalho de Melo
<arnaldo.melo@gmail.com> wrote:
>
> Em Thu, Mar 05, 2020 at 11:11:10PM -0800, Ian Rogers escreveu:
> > Allow the CC compiler to accept a CFLAGS environment variable.
> > Make the architecture test directory agree with the code comment.
> > This doesn't change the code generated but makes it easier to integrate
> > running the shell script in build systems like bazel.
>
> I've looked at this and split this part in a separate patch, and applied
> it locally, please take a look, now looking at the other bit of the
> patch.


This bit looks good. The CFLAGS change is something I need to deal
with a directory layout change in our build system.

Thanks,
Ian

> - Arnaldo
>
> > Signed-off-by: Ian Rogers <irogers@google.com>
> > ---
> >  tools/perf/trace/beauty/arch_errno_names.sh | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/perf/trace/beauty/arch_errno_names.sh b/tools/perf/trace/beauty/arch_errno_names.sh
> > index 22c9fc900c84..9f9ea45cddc4 100755
> > --- a/tools/perf/trace/beauty/arch_errno_names.sh
> > +++ b/tools/perf/trace/beauty/arch_errno_names.sh
> > @@ -91,7 +91,7 @@ EoHEADER
> >  # in tools/perf/arch
> >  archlist=""
> >  for arch in $(find $toolsdir/arch -maxdepth 1 -mindepth 1 -type d -printf "%f\n" | grep -v x86 | sort); do
> > -     test -d arch/$arch && archlist="$archlist $arch"
> > +     test -d $toolsdir/perf/arch/$arch && archlist="$archlist $arch"
> >  done
> >
> >  for arch in x86 $archlist generic; do
> > --
> commit 1b59e3b7bfc6183d3dc9f119e1875f9607d29d96
> Author: Ian Rogers <irogers@google.com>
> Date:   Thu Mar 5 23:11:10 2020 -0800
>
>     perf trace: Fix the selection for architectures to generate the errno name tables
>
>     Make the architecture test directory agree with the code comment.
>
>     Committer notes:
>
>     This was split from a larger patch.
>
>     The code was assuming the developer always worked from tools/perf/, so make sure we
>     do the test -d having $toolsdir/perf/arch/$arch, to match the intent expressed in the comment,
>     just above that loop.
>
>     Signed-off-by: Ian Rogers <irogers@google.com>
>     Cc: Adrian Hunter <adrian.hunter@intel.com>
>     Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
>     Cc: Alexios Zavras <alexios.zavras@intel.com>
>     Cc: Andi Kleen <ak@linux.intel.com>
>     Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>     Cc: Igor Lubashev <ilubashe@akamai.com>
>     Cc: Jiri Olsa <jolsa@redhat.com>
>     Cc: Kan Liang <kan.liang@linux.intel.com>
>     Cc: Mark Rutland <mark.rutland@arm.com>
>     Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
>     Cc: Namhyung Kim <namhyung@kernel.org>
>     Cc: Nick Desaulniers <ndesaulniers@google.com>
>     Cc: Peter Zijlstra <peterz@infradead.org>
>     Cc: Stephane Eranian <eranian@google.com>
>     Cc: Thomas Gleixner <tglx@linutronix.de>
>     Cc: Wei Li <liwei391@huawei.com>
>     Link: http://lore.kernel.org/lkml/20200306071110.130202-4-irogers@google.com
>     Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> diff --git a/tools/perf/trace/beauty/arch_errno_names.sh b/tools/perf/trace/beauty/arch_errno_names.sh
> index 22c9fc900c84..f8c44a85650b 100755
> --- a/tools/perf/trace/beauty/arch_errno_names.sh
> +++ b/tools/perf/trace/beauty/arch_errno_names.sh
> @@ -91,7 +91,7 @@ EoHEADER
>  # in tools/perf/arch
>  archlist=""
>  for arch in $(find $toolsdir/arch -maxdepth 1 -mindepth 1 -type d -printf "%f\n" | grep -v x86 | sort); do
> -       test -d arch/$arch && archlist="$archlist $arch"
> +       test -d $toolsdir/perf/arch/$arch && archlist="$archlist $arch"
>  done
>
>  for arch in x86 $archlist generic; do

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

* Re: [PATCH 3/3] tools/perf: build fixes for arch_errno_names.sh
  2020-05-14 17:54     ` Ian Rogers
@ 2020-05-15 13:50       ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-05-15 13:50 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Mathieu Poirier, Adrian Hunter, Igor Lubashev, Nick Desaulniers,
	Alexios Zavras, Greg Kroah-Hartman, Thomas Gleixner, Wei Li,
	Kan Liang, Andi Kleen, LKML, Stephane Eranian

Em Thu, May 14, 2020 at 10:54:49AM -0700, Ian Rogers escreveu:
> On Thu, May 14, 2020 at 8:04 AM Arnaldo Carvalho de Melo
> <arnaldo.melo@gmail.com> wrote:
> >
> > Em Thu, Mar 05, 2020 at 11:11:10PM -0800, Ian Rogers escreveu:
> > > Allow the CC compiler to accept a CFLAGS environment variable.
> > > Make the architecture test directory agree with the code comment.
> > > This doesn't change the code generated but makes it easier to integrate
> > > running the shell script in build systems like bazel.
> >
> > I've looked at this and split this part in a separate patch, and applied
> > it locally, please take a look, now looking at the other bit of the
> > patch.
> 
> 
> This bit looks good. The CFLAGS change is something I need to deal
> with a directory layout change in our build system.

I added that one as well, as a separate patch, this one:

commit 6e136ceba23c087b1e1b846914e425706d492a3a
Author: Ian Rogers <irogers@google.com>
Date:   Thu Mar 5 23:11:10 2020 -0800

    perf beauty: Allow the CC used in the arch errno names script to acccept CFLAGS
    
    Allow the CC compiler to accept a CFLAGS environment variable.  This
    doesn't change the code generated but makes it easier to integrate
    running the shell script in build systems like bazel.
    
    Signed-off-by: Ian Rogers <irogers@google.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Alexios Zavras <alexios.zavras@intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Igor Lubashev <ilubashe@akamai.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Nick Desaulniers <ndesaulniers@google.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Wei Li <liwei391@huawei.com>
    Link: http://lore.kernel.org/lkml/20200306071110.130202-4-irogers@google.com
    [ split from a larger patch ]
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

diff --git a/tools/perf/trace/beauty/arch_errno_names.sh b/tools/perf/trace/beauty/arch_errno_names.sh
index f8c44a85650b..9f9ea45cddc4 100755
--- a/tools/perf/trace/beauty/arch_errno_names.sh
+++ b/tools/perf/trace/beauty/arch_errno_names.sh
@@ -57,7 +57,7 @@ process_arch()
 	local arch="$1"
 	local asm_errno=$(asm_errno_file "$arch")
 
-	$gcc $include_path -E -dM -x c $asm_errno \
+	$gcc $CFLAGS $include_path -E -dM -x c $asm_errno \
 		|grep -hE '^#define[[:blank:]]+(E[^[:blank:]]+)[[:blank:]]+([[:digit:]]+).*' \
 		|awk '{ print $2","$3; }' \
 		|sort -t, -k2 -nu \

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

end of thread, other threads:[~2020-05-15 13:57 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-06  7:11 [PATCH 0/3] perf tool: build related fixes Ian Rogers
2020-03-06  7:11 ` [PATCH 1/3] tools: fix off-by 1 relative directory includes Ian Rogers
2020-03-06  9:33   ` Jiri Olsa
2020-03-06 16:47     ` Ian Rogers
2020-03-06 20:13       ` Arnaldo Carvalho de Melo
2020-03-06 11:41   ` Arnaldo Carvalho de Melo
2020-03-07  7:36   ` [tip: perf/urgent] tools: Fix " tip-bot2 for Ian Rogers
2020-03-06  7:11 ` [PATCH 2/3] libperf: avoid redefining _GNU_SOURCE in test Ian Rogers
2020-03-06 11:38   ` Arnaldo Carvalho de Melo
2020-03-06 17:54     ` Ian Rogers
2020-03-06  7:11 ` [PATCH 3/3] tools/perf: build fixes for arch_errno_names.sh Ian Rogers
2020-03-06 11:40   ` Arnaldo Carvalho de Melo
2020-04-29 19:16     ` Ian Rogers
2020-05-14 15:04   ` Arnaldo Carvalho de Melo
2020-05-14 17:54     ` Ian Rogers
2020-05-15 13:50       ` Arnaldo Carvalho de Melo
2020-03-06  9:35 ` [PATCH 0/3] perf tool: build related fixes Jiri Olsa

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.