All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL 00/31] perf/core improvements and fixes
@ 2015-03-19 17:04 Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 01/31] perf hists browser: Simplify symbol annotation menu setup Arnaldo Carvalho de Melo
                   ` (30 more replies)
  0 siblings, 31 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Borislav Petkov, Corey Ashford, David Ahern, Don Zickus,
	Frederic Weisbecker, H . J . Lu, Jiri Olsa, Li Zefan,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra, pi3orama,
	Stephane Eranian, Wang Nan, Yunlong Song,
	Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling, more to come,

- Arnaldo

The following changes since commit 107eb964d8c04417e8bce9e9ec2ed61d9261aec6:

  Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2015-03-13 13:30:10 +0100)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo

for you to fetch changes up to 0c8c20779c5d56b93b8cb4cd30ba129a927ab437:

  perf report: Don't allow empty argument for '-t'. (2015-03-19 13:53:28 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

- Bash completion for subcommands (Yunlong Song)

- Allow annotating entries in callchains in the hists browser (top/report).
  TODO: give some visual cue to what entries in callchains have samples and thus
  can be annotated and/or allow showing the source code for functions without
  samples (Arnaldo Carvalho de Melo)

- Don't allow empty argument for '-t' in perf report, fixing segfault (Wang Nan)

Infrastructure:

- Prep work for moving the perf feature tests build system to tools/build (Jiri Olsa)

- Fix perf-read-vdsox32 not building and lib64 install dir (H.J. Lu)

- ARM64: fix building error and eh/debug frame offset cache fixes (Wang Nan)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Arnaldo Carvalho de Melo (4):
      perf hists browser: Simplify symbol annotation menu setup
      perf hists browser: Fix up some branch alignment
      perf hists: Remove hist_entry->used, not used anymore
      perf hists browser: Allow annotating entries in callchains

H.J. Lu (1):
      perf tools: Fix perf-read-vdsox32 not building and lib64 install dir

Jiri Olsa (10):
      perf build: Disable default check for libbabeltrace
      perf build: Move features build output under features directory
      perf build: Fix pthread-attr-setaffinity-np include in test-all
      perf build: Get rid of LIB_INCLUDE variable
      perf build: Rename CORE_FEATURE_TESTS to FEATURE_TESTS
      perf build: Get rid of VF_FEATURE_TESTS
      perf build: Rename display_lib into feature_display
      perf build: Rename display_vf to feature_verbose
      perf build: Rename PERF-FEATURES into FEATURE-DUMP
      perf build: Rename feature_print_var_code to print_var_code

Wang Nan (3):
      perf tools: Fix building error for arm64.
      perf callchain: Separate eh/debug frame offset cache.
      perf report: Don't allow empty argument for '-t'.

Yunlong Song (13):
      perf tools: Fix the bash completion for listing options of perf subcommand
      perf tools: Fix the bash completion for listing subsubcommands of perf subcommand
      perf tools: Provide the right bash completion for listing options of perf subcommand subsubcommand
      perf tools: Fix the bash completion for listing events of perf subcommand record|stat|top -e
      perf tools: Fix the bash completion to support listing events for --event
      perf tools: Fix the bash completion for listing subcommands of perf
      perf tools: Add the bash completion for listing subsubcommands of perf data
      perf tools: Add the bash completion for listing subsubcommands of perf help
      perf tools: Add the bash completion for listing subsubcommands of perf script
      perf tools: Add the bash completion for listing subsubcommands of perf test
      perf tools: Add the bash completion for listing subsubcommands of perf timechart
      perf tools: Add the bash completion for listing subsubcommands of perf trace
      perf tools: Avoid confusion with preloaded bash function for perf bash completion

 tools/perf/Makefile.perf                    |   3 +-
 tools/perf/builtin-data.c                   |   6 +-
 tools/perf/builtin-help.c                   |  17 ++++-
 tools/perf/builtin-report.c                 |   2 +-
 tools/perf/builtin-script.c                 |   5 +-
 tools/perf/builtin-timechart.c              |   7 +-
 tools/perf/builtin-trace.c                  |   7 +-
 tools/perf/config/Makefile                  | 111 ++++++++++++----------------
 tools/perf/config/Makefile.arch             |   2 +-
 tools/perf/config/feature-checks/Makefile   |   7 +-
 tools/perf/config/feature-checks/test-all.c |  11 ++-
 tools/perf/perf-completion.sh               |  88 +++++++++++++++++-----
 tools/perf/tests/builtin-test.c             |   5 +-
 tools/perf/tests/make                       |   2 +-
 tools/perf/ui/browsers/annotate.c           |   8 +-
 tools/perf/ui/browsers/hists.c              |  59 +++++++--------
 tools/perf/util/dso.h                       |   3 +-
 tools/perf/util/hist.c                      |   8 +-
 tools/perf/util/hist.h                      |   9 +++
 tools/perf/util/parse-options.c             |  21 +++++-
 tools/perf/util/parse-options.h             |   2 +
 tools/perf/util/sort.h                      |   1 -
 tools/perf/util/unwind-libunwind.c          |   8 +-
 23 files changed, 237 insertions(+), 155 deletions(-)

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

* [PATCH 01/31] perf hists browser: Simplify symbol annotation menu setup
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 02/31] perf hists browser: Fix up some branch alignment Arnaldo Carvalho de Melo
                   ` (29 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Borislav Petkov, David Ahern, Don Zickus, Frederic Weisbecker,
	Jiri Olsa, Namhyung Kim, Stephane Eranian

From: Arnaldo Carvalho de Melo <acme@redhat.com>

No need to repeat some tests, skip annotation instead.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-6h6igrb81u4e6rwfmx7dv47n@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 49eddeb81458..f69371b7f49b 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1612,19 +1612,22 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 		if (!sort__has_sym)
 			goto add_exit_option;
 
+		if (browser->selection == NULL)
+			goto skip_annotation;
+
 		if (sort__mode == SORT_MODE__BRANCH) {
 			bi = browser->he_selection->branch_info;
-			if (browser->selection != NULL &&
-			    bi &&
-			    bi->from.sym != NULL &&
+
+			if (bi == NULL)
+				goto skip_annotation;
+
+			if (bi->from.sym != NULL &&
 			    !bi->from.map->dso->annotate_warned &&
 				asprintf(&options[nr_options], "Annotate %s",
 					 bi->from.sym->name) > 0)
 				annotate_f = nr_options++;
 
-			if (browser->selection != NULL &&
-			    bi &&
-			    bi->to.sym != NULL &&
+			if (bi->to.sym != NULL &&
 			    !bi->to.map->dso->annotate_warned &&
 			    (bi->to.sym != bi->from.sym ||
 			     bi->to.map->dso != bi->from.map->dso) &&
@@ -1632,8 +1635,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 					 bi->to.sym->name) > 0)
 				annotate_t = nr_options++;
 		} else {
-			if (browser->selection != NULL &&
-			    browser->selection->sym != NULL &&
+			if (browser->selection->sym != NULL &&
 			    !browser->selection->map->dso->annotate_warned) {
 				struct annotation *notes;
 
@@ -1645,7 +1647,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 					annotate = nr_options++;
 			}
 		}
-
+skip_annotation:
 		if (thread != NULL &&
 		    asprintf(&options[nr_options], "Zoom %s %s(%d) thread",
 			     (browser->hists->thread_filter ? "out of" : "into"),
-- 
1.9.3


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

* [PATCH 02/31] perf hists browser: Fix up some branch alignment
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 01/31] perf hists browser: Simplify symbol annotation menu setup Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 03/31] perf hists: Remove hist_entry->used, not used anymore Arnaldo Carvalho de Melo
                   ` (28 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Borislav Petkov, David Ahern, Don Zickus, Frederic Weisbecker,
	Jiri Olsa, Namhyung Kim, Stephane Eranian

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Those asprintf return checks should be aligned with the other
conditionals, fix it.

Also add {} blocks to further clarify.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
echo Link: http://lkml.kernel.org/n/tip-`ranpwd -l 24`@git.kernel.org
Link: http://lkml.kernel.org/n/tip-nqgs07jfphbkw67wja870d3r@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index f69371b7f49b..ebd9d3afe2d6 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1623,17 +1623,17 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 
 			if (bi->from.sym != NULL &&
 			    !bi->from.map->dso->annotate_warned &&
-				asprintf(&options[nr_options], "Annotate %s",
-					 bi->from.sym->name) > 0)
+			    asprintf(&options[nr_options], "Annotate %s", bi->from.sym->name) > 0) {
 				annotate_f = nr_options++;
+			}
 
 			if (bi->to.sym != NULL &&
 			    !bi->to.map->dso->annotate_warned &&
 			    (bi->to.sym != bi->from.sym ||
 			     bi->to.map->dso != bi->from.map->dso) &&
-				asprintf(&options[nr_options], "Annotate %s",
-					 bi->to.sym->name) > 0)
+			    asprintf(&options[nr_options], "Annotate %s", bi->to.sym->name) > 0) {
 				annotate_t = nr_options++;
+			}
 		} else {
 			if (browser->selection->sym != NULL &&
 			    !browser->selection->map->dso->annotate_warned) {
@@ -1643,8 +1643,9 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 
 				if (notes->src &&
 				    asprintf(&options[nr_options], "Annotate %s",
-						 browser->selection->sym->name) > 0)
+						 browser->selection->sym->name) > 0) {
 					annotate = nr_options++;
+				}
 			}
 		}
 skip_annotation:
-- 
1.9.3


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

* [PATCH 03/31] perf hists: Remove hist_entry->used, not used anymore
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 01/31] perf hists browser: Simplify symbol annotation menu setup Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 02/31] perf hists browser: Fix up some branch alignment Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 04/31] perf hists browser: Allow annotating entries in callchains Arnaldo Carvalho de Melo
                   ` (27 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Borislav Petkov, David Ahern, Don Zickus, Frederic Weisbecker,
	Jiri Olsa, Namhyung Kim, Stephane Eranian

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Since hist_entry__delete() nowadays doesn't actually frees anything that
may be in use by the annotation code.

Eventually we will solve this for good by reference counting struct
symbol.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-uldtgljymtrkns0knpiso5op@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 5 -----
 tools/perf/util/hist.c         | 8 +-------
 tools/perf/util/sort.h         | 1 -
 3 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index ebd9d3afe2d6..c37e70ae0b20 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1731,12 +1731,7 @@ do_annotate:
 			if (!notes->src)
 				continue;
 
-			/*
-			 * Don't let this be freed, say, by hists__decay_entry.
-			 */
-			he->used = true;
 			err = hist_entry__tui_annotate(he, evsel, hbt);
-			he->used = false;
 			/*
 			 * offer option to annotate the other branch source or target
 			 * (if they exists) when returning from annotate
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index d9a6d35eda17..cc22b9158b93 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -263,15 +263,9 @@ void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel)
 	while (next) {
 		n = rb_entry(next, struct hist_entry, rb_node);
 		next = rb_next(&n->rb_node);
-		/*
-		 * We may be annotating this, for instance, so keep it here in
-		 * case some it gets new samples, we'll eventually free it when
-		 * the user stops browsing and it agains gets fully decayed.
-		 */
 		if (((zap_user && n->level == '.') ||
 		     (zap_kernel && n->level != '.') ||
-		     hists__decay_entry(hists, n)) &&
-		    !n->used) {
+		     hists__decay_entry(hists, n))) {
 			hists__delete_entry(hists, n);
 		}
 	}
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index c03e4ff8beff..9c01b83eebca 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -102,7 +102,6 @@ struct hist_entry {
 
 	bool			init_have_children;
 	char			level;
-	bool			used;
 	u8			filtered;
 	char			*srcline;
 	struct symbol		*parent;
-- 
1.9.3


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

* [PATCH 04/31] perf hists browser: Allow annotating entries in callchains
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (2 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 03/31] perf hists: Remove hist_entry->used, not used anymore Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 05/31] perf tools: Fix building error for arm64 Arnaldo Carvalho de Melo
                   ` (26 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Borislav Petkov, David Ahern, Don Zickus, Frederic Weisbecker,
	Jiri Olsa, Namhyung Kim

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Instead of annotating just the top level hist_entry, allow instead
annotating a map_symbol, i.e. the top level hist_entry or one of the
callchains for which there were samples.

Suggested-by: Stephane Eranian <eranian@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/n/tip-k1zxj5564je9jei4yd15ouwn@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/annotate.c |  8 +++++++-
 tools/perf/ui/browsers/hists.c    | 23 ++++++++++-------------
 tools/perf/util/hist.h            |  9 +++++++++
 3 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index 9d32e3c0cfee..e5250eb2dd57 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -829,10 +829,16 @@ out:
 	return key;
 }
 
+int map_symbol__tui_annotate(struct map_symbol *ms, struct perf_evsel *evsel,
+			     struct hist_browser_timer *hbt)
+{
+	return symbol__tui_annotate(ms->sym, ms->map, evsel, hbt);
+}
+
 int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel,
 			     struct hist_browser_timer *hbt)
 {
-	return symbol__tui_annotate(he->ms.sym, he->ms.map, evsel, hbt);
+	return map_symbol__tui_annotate(&he->ms, evsel, hbt);
 }
 
 static void annotate_browser__mark_jump_targets(struct annotate_browser *browser,
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index c37e70ae0b20..cd7350aeb8e7 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1704,6 +1704,7 @@ retry_popup_menu:
 		if (choice == annotate || choice == annotate_t || choice == annotate_f) {
 			struct hist_entry *he;
 			struct annotation *notes;
+			struct map_symbol ms;
 			int err;
 do_annotate:
 			if (!objdump_path && perf_session_env__lookup_objdump(env))
@@ -1713,25 +1714,21 @@ do_annotate:
 			if (he == NULL)
 				continue;
 
-			/*
-			 * we stash the branch_info symbol + map into the
-			 * the ms so we don't have to rewrite all the annotation
-			 * code to use branch_info.
-			 * in branch mode, the ms struct is not used
-			 */
 			if (choice == annotate_f) {
-				he->ms.sym = he->branch_info->from.sym;
-				he->ms.map = he->branch_info->from.map;
-			}  else if (choice == annotate_t) {
-				he->ms.sym = he->branch_info->to.sym;
-				he->ms.map = he->branch_info->to.map;
+				ms.map = he->branch_info->from.map;
+				ms.sym = he->branch_info->from.sym;
+			} else if (choice == annotate_t) {
+				ms.map = he->branch_info->to.map;
+				ms.sym = he->branch_info->to.sym;
+			} else {
+				ms = *browser->selection;
 			}
 
-			notes = symbol__annotation(he->ms.sym);
+			notes = symbol__annotation(ms.sym);
 			if (!notes->src)
 				continue;
 
-			err = hist_entry__tui_annotate(he, evsel, hbt);
+			err = map_symbol__tui_annotate(&ms, evsel, hbt);
 			/*
 			 * offer option to annotate the other branch source or target
 			 * (if they exists) when returning from annotate
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index e988c9fcd1bc..9f31b89a527a 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -303,6 +303,9 @@ struct hist_browser_timer {
 
 #ifdef HAVE_SLANG_SUPPORT
 #include "../ui/keysyms.h"
+int map_symbol__tui_annotate(struct map_symbol *ms, struct perf_evsel *evsel,
+			     struct hist_browser_timer *hbt);
+
 int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel,
 			     struct hist_browser_timer *hbt);
 
@@ -321,6 +324,12 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist __maybe_unused,
 {
 	return 0;
 }
+static inline int map_symbol__tui_annotate(struct map_symbol *ms __maybe_unused,
+					   struct perf_evsel *evsel __maybe_unused,
+					   struct hist_browser_timer *hbt __maybe_unused)
+{
+	return 0;
+}
 
 static inline int hist_entry__tui_annotate(struct hist_entry *he __maybe_unused,
 					   struct perf_evsel *evsel __maybe_unused,
-- 
1.9.3


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

* [PATCH 05/31] perf tools: Fix building error for arm64.
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (3 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 04/31] perf hists browser: Allow annotating entries in callchains Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 06/31] perf build: Disable default check for libbabeltrace Arnaldo Carvalho de Melo
                   ` (25 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Wang Nan, Jiri Olsa, Zefan Li, Arnaldo Carvalho de Melo

From: Wang Nan <wangnan0@huawei.com>

Commit b11db6581beaccef8ae9a388ae96074aa5cc144f ("perf tools: Fix build
error on ARCH=i386/x86_64/sparc64") uses sed on ARCH, which triggers a
bug in sequence of sed expression, where 's/arm.*/arm/' will replace
'arm64' to 'arm', causes arm64 building failure.

This patch prevent 'arm64' to be mached for 'arm.*' case.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Link: http://lkml.kernel.org/r/1426598987-75245-1-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/config/Makefile.arch | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/config/Makefile.arch b/tools/perf/config/Makefile.arch
index e9720571341d..e11fbd6fae78 100644
--- a/tools/perf/config/Makefile.arch
+++ b/tools/perf/config/Makefile.arch
@@ -4,7 +4,7 @@ endif
 
 ARCH := $(shell echo $(ARCH) | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
                                   -e s/sun4u/sparc/ -e s/sparc64/sparc/ \
-                                  -e s/arm.*/arm/ -e s/sa110/arm/ \
+                                  -e /arm64/!s/arm.*/arm/ -e s/sa110/arm/ \
                                   -e s/s390x/s390/ -e s/parisc64/parisc/ \
                                   -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
                                   -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
-- 
1.9.3


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

* [PATCH 06/31] perf build: Disable default check for libbabeltrace
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (4 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 05/31] perf tools: Fix building error for arm64 Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 07/31] perf build: Move features build output under features directory Arnaldo Carvalho de Melo
                   ` (24 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Corey Ashford, David Ahern,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Remove libbabeltrace check from default features set, because the
requested version is not released yet in most distributions. We'll
enable later.

Calling libbabeltrace check manually via feature_check before
$(feature-libbabeltrace) is used.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <david.ahern@oracle.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-5n7mr6ugcwdbxk0n1z8uukaa@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/config/Makefile                  | 11 +++++------
 tools/perf/config/feature-checks/Makefile   |  2 +-
 tools/perf/config/feature-checks/test-all.c |  9 ++++++++-
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index bd097187724b..b799649ab0e7 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -227,7 +227,6 @@ CORE_FEATURE_TESTS =			\
 	stackprotector-all		\
 	timerfd				\
 	libdw-dwarf-unwind		\
-	libbabeltrace			\
 	zlib
 
 LIB_FEATURE_TESTS =			\
@@ -243,7 +242,6 @@ LIB_FEATURE_TESTS =			\
 	libslang			\
 	libunwind			\
 	libdw-dwarf-unwind		\
-	libbabeltrace			\
 	zlib
 
 VF_FEATURE_TESTS =			\
@@ -705,14 +703,15 @@ else
 endif
 
 ifndef NO_LIBBABELTRACE
-  ifeq ($(feature-libbabeltrace), 0)
-    msg := $(warning No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev);
-    NO_LIBBABELTRACE := 1
-  else
+  $(call feature_check,libbabeltrace)
+  ifeq ($(feature-libbabeltrace), 1)
     CFLAGS += -DHAVE_LIBBABELTRACE_SUPPORT $(LIBBABELTRACE_CFLAGS)
     LDFLAGS += $(LIBBABELTRACE_LDFLAGS)
     EXTLIBS += -lbabeltrace-ctf
     $(call detected,CONFIG_LIBBABELTRACE)
+  else
+    msg := $(warning No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev);
+    NO_LIBBABELTRACE := 1
   endif
 endif
 
diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile
index 8fe067864957..b6e2e312ba54 100644
--- a/tools/perf/config/feature-checks/Makefile
+++ b/tools/perf/config/feature-checks/Makefile
@@ -44,7 +44,7 @@ BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(
 ###############################
 
 test-all.bin:
-	$(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -laudit -I/usr/include/slang -lslang $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -lbabeltrace
+	$(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -laudit -I/usr/include/slang -lslang $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz
 
 test-hello.bin:
 	$(BUILD)
diff --git a/tools/perf/config/feature-checks/test-all.c b/tools/perf/config/feature-checks/test-all.c
index 1ffc3da5ca10..06f5c8a67cb2 100644
--- a/tools/perf/config/feature-checks/test-all.c
+++ b/tools/perf/config/feature-checks/test-all.c
@@ -101,9 +101,17 @@
 # include "test-pthread_attr_setaffinity_np.c"
 #undef main
 
+# if 0
+/*
+ * Disable libbabeltrace check for test-all, because the requested
+ * library version is not released yet in most distributions. Will
+ * reenable later.
+ */
+
 #define main main_test_libbabeltrace
 # include "test-libbabeltrace.c"
 #undef main
+#endif
 
 int main(int argc, char *argv[])
 {
@@ -130,7 +138,6 @@ int main(int argc, char *argv[])
 	main_test_sync_compare_and_swap(argc, argv);
 	main_test_zlib();
 	main_test_pthread_attr_setaffinity_np();
-	main_test_libbabeltrace();
 
 	return 0;
 }
-- 
1.9.3


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

* [PATCH 07/31] perf build: Move features build output under features directory
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (5 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 06/31] perf build: Disable default check for libbabeltrace Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 08/31] perf build: Fix pthread-attr-setaffinity-np include in test-all Arnaldo Carvalho de Melo
                   ` (23 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Corey Ashford, David Ahern,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Following commit introduced features build dump:
  443a70541c56 perf tools: Output feature detection's gcc output to a file

Moving them into to have code more compact and renaming build dump
files. For each feature 'test-X' new file 'test-X.make.output' is
created and contains the build out.  It's created in the same directory
as the feature itself.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <david.ahern@oracle.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-dk6svnhcephrzgz4mfpcmtm7@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile.perf                  | 1 -
 tools/perf/config/Makefile                | 2 +-
 tools/perf/config/feature-checks/Makefile | 5 +++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 933d70345f87..ec4c063ed9f3 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -529,7 +529,6 @@ clean: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean config-clean
 	$(Q)$(RM) .config-detected
 	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32
 	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-FEATURES $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
-	$(call QUIET_CLEAN, feature-detect) $(RM) $(OUTPUT)config/feature-checks/.make-*.output
 	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
 	$(python-clean)
 
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index b799649ab0e7..45f61253ccce 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -184,7 +184,7 @@ endif
 
 feature_check = $(eval $(feature_check_code))
 define feature_check_code
-  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C config/feature-checks test-$1.bin > $(OUTPUT)config/feature-checks/.make-$(1).output 2>&1 && echo 1 || echo 0)
+  feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C config/feature-checks test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0)
 endef
 
 feature_set = $(eval $(feature_set_code))
diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile
index b6e2e312ba54..0d694a94cda2 100644
--- a/tools/perf/config/feature-checks/Makefile
+++ b/tools/perf/config/feature-checks/Makefile
@@ -39,7 +39,8 @@ PKG_CONFIG := $(CROSS_COMPILE)pkg-config
 
 all: $(FILES)
 
-BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
+__BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
+  BUILD = $(__BUILD) > $(OUTPUT)$(@:.bin=.make.output) 2>&1
 
 ###############################
 
@@ -156,4 +157,4 @@ test-zlib.bin:
 ###############################
 
 clean:
-	rm -f $(FILES) *.d
+	rm -f $(FILES) *.d $(FILES:.bin=.make.output)
-- 
1.9.3


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

* [PATCH 08/31] perf build: Fix pthread-attr-setaffinity-np include in test-all
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (6 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 07/31] perf build: Move features build output under features directory Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 09/31] perf build: Get rid of LIB_INCLUDE variable Arnaldo Carvalho de Melo
                   ` (22 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Corey Ashford, David Ahern,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

The test-all fails to build due to type in pthread-attr-setaffinity-np
include.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <david.ahern@oracle.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-awn2658267slejnebyrlns86@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/config/feature-checks/test-all.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/config/feature-checks/test-all.c b/tools/perf/config/feature-checks/test-all.c
index 06f5c8a67cb2..a61c20456705 100644
--- a/tools/perf/config/feature-checks/test-all.c
+++ b/tools/perf/config/feature-checks/test-all.c
@@ -98,7 +98,7 @@
 #undef main
 
 #define main main_test_pthread_attr_setaffinity_np
-# include "test-pthread_attr_setaffinity_np.c"
+# include "test-pthread-attr-setaffinity-np.c"
 #undef main
 
 # if 0
-- 
1.9.3


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

* [PATCH 09/31] perf build: Get rid of LIB_INCLUDE variable
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (7 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 08/31] perf build: Fix pthread-attr-setaffinity-np include in test-all Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 10/31] perf build: Rename CORE_FEATURE_TESTS to FEATURE_TESTS Arnaldo Carvalho de Melo
                   ` (21 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Corey Ashford, David Ahern,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

It has no use, so we can directly use the value for CFLAGS.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <david.ahern@oracle.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-ywyr5v962s32daq5hpgfkjap@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/config/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 45f61253ccce..467106bc5fab 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -15,7 +15,6 @@ $(shell echo -n > .config-detected)
 detected     = $(shell echo "$(1)=y"       >> .config-detected)
 detected_var = $(shell echo "$(1)=$($(1))" >> .config-detected)
 
-LIB_INCLUDE := $(srctree)/tools/lib/
 CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
 
 include $(src-perf)/config/Makefile.arch
@@ -320,7 +319,7 @@ endif
 
 CFLAGS += -I$(src-perf)/util
 CFLAGS += -I$(src-perf)
-CFLAGS += -I$(LIB_INCLUDE)
+CFLAGS += -I$(srctree)/tools/lib/
 
 CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 
-- 
1.9.3


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

* [PATCH 10/31] perf build: Rename CORE_FEATURE_TESTS to FEATURE_TESTS
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (8 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 09/31] perf build: Get rid of LIB_INCLUDE variable Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 11/31] perf build: Get rid of VF_FEATURE_TESTS Arnaldo Carvalho de Melo
                   ` (20 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Corey Ashford, David Ahern,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Preparing for feature checks separation, moving related stuff under
'FEATURE*' namespace.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <david.ahern@oracle.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-iobj4f9gygcakrk2v5u61159@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/config/Makefile | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 467106bc5fab..507350566e7f 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -203,7 +203,7 @@ endef
 #   the rule that uses them - an example for that is the 'bionic'
 #   feature check. ]
 #
-CORE_FEATURE_TESTS =			\
+FEATURE_TESTS =			\
 	backtrace			\
 	dwarf				\
 	fortify-source			\
@@ -262,7 +262,7 @@ VF_FEATURE_TESTS =			\
 	compile-32			\
 	compile-x32
 
-# Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features.
+# Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features.
 # If in the future we need per-feature checks/flags for features not
 # mentioned in this list we need to refactor this ;-).
 set_test_all_flags = $(eval $(set_test_all_flags_code))
@@ -271,7 +271,7 @@ define set_test_all_flags_code
   FEATURE_CHECK_LDFLAGS-all += $(FEATURE_CHECK_LDFLAGS-$(1))
 endef
 
-$(foreach feat,$(CORE_FEATURE_TESTS),$(call set_test_all_flags,$(feat)))
+$(foreach feat,$(FEATURE_TESTS),$(call set_test_all_flags,$(feat)))
 
 #
 # Special fast-path for the 'all features are available' case:
@@ -286,10 +286,10 @@ ifeq ($(feature-all), 1)
   #
   # test-all.c passed - just set all the core feature flags to 1:
   #
-  $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat)))
+  $(foreach feat,$(FEATURE_TESTS),$(call feature_set,$(feat)))
 else
-  $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(addsuffix .bin,$(CORE_FEATURE_TESTS)) >/dev/null 2>&1)
-  $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat)))
+  $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(addsuffix .bin,$(FEATURE_TESTS)) >/dev/null 2>&1)
+  $(foreach feat,$(FEATURE_TESTS),$(call feature_check,$(feat)))
 endif
 
 ifeq ($(feature-stackprotector-all), 1)
-- 
1.9.3


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

* [PATCH 11/31] perf build: Get rid of VF_FEATURE_TESTS
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (9 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 10/31] perf build: Rename CORE_FEATURE_TESTS to FEATURE_TESTS Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 12/31] perf build: Rename display_lib into feature_display Arnaldo Carvalho de Melo
                   ` (19 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Corey Ashford, David Ahern,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

It only contains (FEATURE_TESTS - FEATURE_DISPLAY) tests to display the
rest of the checks on 'make VF=1'. But we can actually compute this
list, which is less confusing.

Also renaming LIB_FEATURE_TESTS into FEATURE_DISPLAY, so it reflects
what this variable actually does - display its tests status to user.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <david.ahern@oracle.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-gs160y03hpmx5ezpcr4gunxc@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/config/Makefile | 32 +++++++-------------------------
 1 file changed, 7 insertions(+), 25 deletions(-)

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 507350566e7f..198609e1d696 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -228,7 +228,7 @@ FEATURE_TESTS =			\
 	libdw-dwarf-unwind		\
 	zlib
 
-LIB_FEATURE_TESTS =			\
+FEATURE_DISPLAY =			\
 	dwarf				\
 	glibc				\
 	gtk2				\
@@ -243,25 +243,6 @@ LIB_FEATURE_TESTS =			\
 	libdw-dwarf-unwind		\
 	zlib
 
-VF_FEATURE_TESTS =			\
-	backtrace			\
-	fortify-source			\
-	sync-compare-and-swap		\
-	gtk2-infobar			\
-	libelf-getphdrnum		\
-	libelf-mmap			\
-	libpython-version		\
-	pthread-attr-setaffinity-np	\
-	stackprotector-all		\
-	timerfd				\
-	libunwind-debug-frame		\
-	bionic				\
-	liberty				\
-	liberty-z			\
-	cplus-demangle			\
-	compile-32			\
-	compile-x32
-
 # Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features.
 # If in the future we need per-feature checks/flags for features not
 # mentioned in this list we need to refactor this ;-).
@@ -805,7 +786,7 @@ define feature_print_text_code
     MSG = $(shell printf '...%30s: %s' $(1) $(2))
 endef
 
-PERF_FEATURES := $(foreach feat,$(LIB_FEATURE_TESTS),feature-$(feat)($(feature-$(feat))))
+PERF_FEATURES := $(foreach feat,$(FEATURE_DISPLAY),feature-$(feat)($(feature-$(feat))))
 PERF_FEATURES_FILE := $(shell touch $(OUTPUT)PERF-FEATURES; cat $(OUTPUT)PERF-FEATURES)
 
 ifeq ($(dwarf-post-unwind),1)
@@ -816,7 +797,7 @@ endif
 # output. It's set if:
 # - detected features differes from stored features from
 #   last build (in PERF-FEATURES file)
-# - one of the $(LIB_FEATURE_TESTS) is not detected
+# - one of the $(FEATURE_DISPLAY) is not detected
 # - VF is enabled
 
 ifneq ("$(PERF_FEATURES)","$(PERF_FEATURES_FILE)")
@@ -831,7 +812,7 @@ define feature_check_code
   endif
 endef
 
-$(foreach feat,$(LIB_FEATURE_TESTS),$(call feature_check,$(feat)))
+$(foreach feat,$(FEATURE_DISPLAY),$(call feature_check,$(feat)))
 
 ifeq ($(VF),1)
   display_lib := 1
@@ -841,7 +822,7 @@ endif
 ifeq ($(display_lib),1)
   $(info )
   $(info Auto-detecting system features:)
-  $(foreach feat,$(LIB_FEATURE_TESTS),$(call feature_print_status,$(feat),))
+  $(foreach feat,$(FEATURE_DISPLAY),$(call feature_print_status,$(feat),))
 
   ifeq ($(dwarf-post-unwind),1)
     $(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text))
@@ -849,7 +830,8 @@ ifeq ($(display_lib),1)
 endif
 
 ifeq ($(display_vf),1)
-  $(foreach feat,$(VF_FEATURE_TESTS),$(call feature_print_status,$(feat),))
+  TMP := $(filter-out $(FEATURE_DISPLAY),$(FEATURE_TESTS))
+  $(foreach feat,$(TMP),$(call feature_print_status,$(feat),))
   $(info )
   $(call feature_print_var,prefix)
   $(call feature_print_var,bindir)
-- 
1.9.3


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

* [PATCH 12/31] perf build: Rename display_lib into feature_display
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (10 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 11/31] perf build: Get rid of VF_FEATURE_TESTS Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 13/31] perf build: Rename display_vf to feature_verbose Arnaldo Carvalho de Melo
                   ` (18 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Corey Ashford, David Ahern,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Preparing for feature checks separation, moving related stuff under
'feature*' namespace.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <david.ahern@oracle.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-t72o4nwx81owjv14y43b2wpf@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/config/Makefile | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 198609e1d696..f80fc7ec8036 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -793,7 +793,7 @@ ifeq ($(dwarf-post-unwind),1)
   PERF_FEATURES += dwarf-post-unwind($(dwarf-post-unwind-text))
 endif
 
-# The $(display_lib) controls the default detection message
+# The $(feature_display) controls the default detection message
 # output. It's set if:
 # - detected features differes from stored features from
 #   last build (in PERF-FEATURES file)
@@ -802,24 +802,24 @@ endif
 
 ifneq ("$(PERF_FEATURES)","$(PERF_FEATURES_FILE)")
   $(shell echo "$(PERF_FEATURES)" > $(OUTPUT)PERF-FEATURES)
-  display_lib := 1
+  feature_display := 1
 endif
 
 feature_check = $(eval $(feature_check_code))
 define feature_check_code
   ifneq ($(feature-$(1)), 1)
-    display_lib := 1
+    feature_display := 1
   endif
 endef
 
 $(foreach feat,$(FEATURE_DISPLAY),$(call feature_check,$(feat)))
 
 ifeq ($(VF),1)
-  display_lib := 1
+  feature_display := 1
   display_vf := 1
 endif
 
-ifeq ($(display_lib),1)
+ifeq ($(feature_display),1)
   $(info )
   $(info Auto-detecting system features:)
   $(foreach feat,$(FEATURE_DISPLAY),$(call feature_print_status,$(feat),))
@@ -841,7 +841,7 @@ ifeq ($(display_vf),1)
   $(call feature_print_var,LIBDW_DIR)
 endif
 
-ifeq ($(display_lib),1)
+ifeq ($(feature_display),1)
   $(info )
 endif
 
-- 
1.9.3


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

* [PATCH 13/31] perf build: Rename display_vf to feature_verbose
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (11 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 12/31] perf build: Rename display_lib into feature_display Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 14/31] perf build: Rename PERF-FEATURES into FEATURE-DUMP Arnaldo Carvalho de Melo
                   ` (17 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Corey Ashford, David Ahern,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Preparing for feature checks separation, moving related
stuff under 'feature*' namespace.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <david.ahern@oracle.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-ciaflab01mf0ljmfb9xr4p41@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/config/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index f80fc7ec8036..370ad509422b 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -816,7 +816,7 @@ $(foreach feat,$(FEATURE_DISPLAY),$(call feature_check,$(feat)))
 
 ifeq ($(VF),1)
   feature_display := 1
-  display_vf := 1
+  feature_verbose := 1
 endif
 
 ifeq ($(feature_display),1)
@@ -829,7 +829,7 @@ ifeq ($(feature_display),1)
   endif
 endif
 
-ifeq ($(display_vf),1)
+ifeq ($(feature_verbose),1)
   TMP := $(filter-out $(FEATURE_DISPLAY),$(FEATURE_TESTS))
   $(foreach feat,$(TMP),$(call feature_print_status,$(feat),))
   $(info )
-- 
1.9.3


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

* [PATCH 14/31] perf build: Rename PERF-FEATURES into FEATURE-DUMP
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (12 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 13/31] perf build: Rename display_vf to feature_verbose Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-22 10:19   ` Ingo Molnar
  2015-03-19 17:04 ` [PATCH 15/31] perf build: Rename feature_print_var_code to print_var_code Arnaldo Carvalho de Melo
                   ` (16 subsequent siblings)
  30 siblings, 1 reply; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Corey Ashford, David Ahern,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Preparing for feature checks separation, moving related stuff under
'FEATURE*' namespace.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <david.ahern@oracle.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-v9oo22ra70rrk1dy495a7bjc@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile.perf   |  2 +-
 tools/perf/config/Makefile | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index ec4c063ed9f3..e323eab10694 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -528,7 +528,7 @@ clean: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean config-clean
 	$(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
 	$(Q)$(RM) .config-detected
 	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32
-	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-FEATURES $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
+	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
 	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
 	$(python-clean)
 
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 370ad509422b..b98ab77ca179 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -786,22 +786,22 @@ define feature_print_text_code
     MSG = $(shell printf '...%30s: %s' $(1) $(2))
 endef
 
-PERF_FEATURES := $(foreach feat,$(FEATURE_DISPLAY),feature-$(feat)($(feature-$(feat))))
-PERF_FEATURES_FILE := $(shell touch $(OUTPUT)PERF-FEATURES; cat $(OUTPUT)PERF-FEATURES)
+FEATURE_DUMP := $(foreach feat,$(FEATURE_DISPLAY),feature-$(feat)($(feature-$(feat))))
+FEATURE_DUMP_FILE := $(shell touch $(OUTPUT)FEATURE-DUMP; cat $(OUTPUT)FEATURE-DUMP)
 
 ifeq ($(dwarf-post-unwind),1)
-  PERF_FEATURES += dwarf-post-unwind($(dwarf-post-unwind-text))
+  FEATURE_DUMP += dwarf-post-unwind($(dwarf-post-unwind-text))
 endif
 
 # The $(feature_display) controls the default detection message
 # output. It's set if:
 # - detected features differes from stored features from
-#   last build (in PERF-FEATURES file)
+#   last build (in FEATURE-DUMP file)
 # - one of the $(FEATURE_DISPLAY) is not detected
 # - VF is enabled
 
-ifneq ("$(PERF_FEATURES)","$(PERF_FEATURES_FILE)")
-  $(shell echo "$(PERF_FEATURES)" > $(OUTPUT)PERF-FEATURES)
+ifneq ("$(FEATURE_DUMP)","$(FEATURE_DUMP_FILE)")
+  $(shell echo "$(FEATURE_DUMP)" > $(OUTPUT)FEATURE-DUMP)
   feature_display := 1
 endif
 
-- 
1.9.3


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

* [PATCH 15/31] perf build: Rename feature_print_var_code to print_var_code
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (13 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 14/31] perf build: Rename PERF-FEATURES into FEATURE-DUMP Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 17/31] perf tools: Fix the bash completion for listing options of perf subcommand Arnaldo Carvalho de Melo
                   ` (15 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Corey Ashford, David Ahern,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

As it has nothing to do with features and won't be moved
into tools/build.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <david.ahern@oracle.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/n/tip-6qgf37nss4wwjatgj5i4ng0o@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/config/Makefile | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index b98ab77ca179..489d33305b16 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -776,8 +776,8 @@ define feature_print_status_code
   endif
 endef
 
-feature_print_var = $(eval $(feature_print_var_code)) $(info $(MSG))
-define feature_print_var_code
+print_var = $(eval $(print_var_code)) $(info $(MSG))
+define print_var_code
     MSG = $(shell printf '...%30s: %s' $(1) $($(1)))
 endef
 
@@ -827,21 +827,22 @@ ifeq ($(feature_display),1)
   ifeq ($(dwarf-post-unwind),1)
     $(call feature_print_text,"DWARF post unwind library", $(dwarf-post-unwind-text))
   endif
+
+  ifneq ($(feature_verbose),1)
+    $(info )
+  endif
 endif
 
 ifeq ($(feature_verbose),1)
   TMP := $(filter-out $(FEATURE_DISPLAY),$(FEATURE_TESTS))
   $(foreach feat,$(TMP),$(call feature_print_status,$(feat),))
   $(info )
-  $(call feature_print_var,prefix)
-  $(call feature_print_var,bindir)
-  $(call feature_print_var,libdir)
-  $(call feature_print_var,sysconfdir)
-  $(call feature_print_var,LIBUNWIND_DIR)
-  $(call feature_print_var,LIBDW_DIR)
-endif
-
-ifeq ($(feature_display),1)
+  $(call print_var,prefix)
+  $(call print_var,bindir)
+  $(call print_var,libdir)
+  $(call print_var,sysconfdir)
+  $(call print_var,LIBUNWIND_DIR)
+  $(call print_var,LIBDW_DIR)
   $(info )
 endif
 
-- 
1.9.3


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

* [PATCH 17/31] perf tools: Fix the bash completion for listing options of perf subcommand
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (14 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 15/31] perf build: Rename feature_print_var_code to print_var_code Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 18/31] perf tools: Fix the bash completion for listing subsubcommands " Arnaldo Carvalho de Melo
                   ` (14 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Yunlong Song, Paul Mackerras, Peter Zijlstra,
	Wang Nan, Arnaldo Carvalho de Melo

From: Yunlong Song <yunlong.song@huawei.com>

The bash completion does not support listing options for 'perf
kvm|kmem|mem|lock|sched --<TAB>', where 'kvm|kmem|mem|lock|sched' are
all subcommands of perf.

Example:

Before this patch:

 $ perf kvm --<TAB>
 $

As shown above, the options of perf kvm does not come out.

After this patch:

 $ perf kvm --<TAB>
 --alloc    --caller   --input    --line     --raw-ip   --sort
 --verbose

As shown above, the options of perf kvm can come out now.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1426685758-25488-2-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/perf-completion.sh | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index c2595e9bd69b..4822ed38e23e 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -119,15 +119,18 @@ __perf_main ()
 	elif [[ $prev == "-e" && "${words[1]}" == @(record|stat|top) ]]; then
 		evts=$($cmd list --raw-dump)
 		__perfcomp_colon "$evts" "$cur"
-	# List subcommands for perf commands
-	elif [[ $prev == @(kvm|kmem|mem|lock|sched) ]]; then
-		subcmds=$($cmd $prev --list-cmds)
-		__perfcomp_colon "$subcmds" "$cur"
-	# List long option names
-	elif [[ $cur == --* ]];  then
-		subcmd=${words[1]}
-		opts=$($cmd $subcmd --list-opts)
-		__perfcomp "$opts" "$cur"
+	else
+		# List subcommands for perf commands
+		if [[ $prev == @(kvm|kmem|mem|lock|sched) ]]; then
+			subcmds=$($cmd $prev --list-cmds)
+			__perfcomp_colon "$subcmds" "$cur"
+		fi
+		# List long option names
+		if [[ $cur == --* ]];  then
+			subcmd=${words[1]}
+			opts=$($cmd $subcmd --list-opts)
+			__perfcomp "$opts" "$cur"
+		fi
 	fi
 }
 
-- 
1.9.3


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

* [PATCH 18/31] perf tools: Fix the bash completion for listing subsubcommands of perf subcommand
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (15 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 17/31] perf tools: Fix the bash completion for listing options of perf subcommand Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 19/31] perf tools: Provide the right bash completion for listing options of perf subcommand subsubcommand Arnaldo Carvalho de Melo
                   ` (13 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Yunlong Song, Peter Zijlstra, Paul Mackerras,
	Wang Nan, Arnaldo Carvalho de Melo

From: Yunlong Song <yunlong.song@huawei.com>

The bash completion does not support listing subsubcommands for 'perf
kvm|kmem|mem|lock|sched --<long option> <TAB>', where 'kvm|kmem|mem|
lock|sched' are all subcommands of perf.

Example:

Before this patch:

 $ perf kvm --verbose <TAB>
 $

As shown above, the subsubcommands of perf kvm does not come out.

After this patch:

 $ perf kvm --verbose <TAB>
 buildid-list  diff          record        report        stat
 top

As shown above, the subsubcommands of perf kvm can come out now.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1426685758-25488-3-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/perf-completion.sh | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 4822ed38e23e..bbb61d0b79cd 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -100,6 +100,23 @@ __perfcomp_colon ()
 	__ltrim_colon_completions $cur
 }
 
+__perf_prev_skip_opts ()
+{
+	local i cmd_ cmds_
+
+	let i=cword-1
+	cmds_=$($cmd --list-cmds)
+	prev_skip_opts=()
+	while [ $i -ge 0 ]; do
+		for cmd_ in $cmds_; do
+			if [[ ${words[i]} == $cmd_ ]]; then
+				prev_skip_opts=${words[i]}
+				return
+			fi
+		done
+		((i--))
+	done
+}
 __perf_main ()
 {
 	local cmd
@@ -107,6 +124,8 @@ __perf_main ()
 	cmd=${words[0]}
 	COMPREPLY=()
 
+	# Skip options backward and find the last perf command
+	__perf_prev_skip_opts
 	# List perf subcommands or long options
 	if [ $cword -eq 1 ]; then
 		if [[ $cur == --* ]]; then
@@ -121,8 +140,8 @@ __perf_main ()
 		__perfcomp_colon "$evts" "$cur"
 	else
 		# List subcommands for perf commands
-		if [[ $prev == @(kvm|kmem|mem|lock|sched) ]]; then
-			subcmds=$($cmd $prev --list-cmds)
+		if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched) ]]; then
+			subcmds=$($cmd $prev_skip_opts --list-cmds)
 			__perfcomp_colon "$subcmds" "$cur"
 		fi
 		# List long option names
-- 
1.9.3


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

* [PATCH 19/31] perf tools: Provide the right bash completion for listing options of perf subcommand subsubcommand
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (16 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 18/31] perf tools: Fix the bash completion for listing subsubcommands " Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 20/31] perf tools: Fix the bash completion for listing events of perf subcommand record|stat|top -e Arnaldo Carvalho de Melo
                   ` (12 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Yunlong Song, Paul Mackerras, Peter Zijlstra,
	Wang Nan, Arnaldo Carvalho de Melo

From: Yunlong Song <yunlong.song@huawei.com>

The bash completion gives wrong options for 'perf kvm|kmem|mem|lock|
sched subsubcommand --<TAB>', where 'kvm|kmem|mem|lock|sched' are all
subcommands of perf and 'subsubcommand' is a subcommand of 'kvm|kmem|mem
|lock|sched'. In fact, the result incorrectly lists the bash completion
of 'perf subcommand' rather than 'perf subcommand subsubcommand'.

Example:

Before this patch:

 $ perf kvm record --<TAB>
 --guest          --guestkallsyms  --guestmodules   --guestmount
 --guestvmlinux   --host           --input          --output
 --verbose

As shown above, the result is the options of kvm rather than record.

After this patch:

 $ perf kvm record --<TAB>
 --all-cpus          --cgroup            --delay             --group
 --no-buildid        --output            --quiet             --stat
 --uid
 --branch-any        --count             --event             --intr-regs
 --no-buildid-cache  --period            --raw-samples       --tid
 --verbose
 --branch-filter     --cpu               --filter            --mmap-pages
 --no-inherit        --per-thread        --realtime          --timestamp
 --weight
 --call-graph        --data              --freq
 --no-buffering      --no-samples        --pid
 --running-time      --transaction

As shown above, the result is exactly the options of record as we wished.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1426685758-25488-4-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/perf-completion.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index bbb61d0b79cd..01ce841f155b 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -105,9 +105,12 @@ __perf_prev_skip_opts ()
 	local i cmd_ cmds_
 
 	let i=cword-1
-	cmds_=$($cmd --list-cmds)
+	cmds_=$($cmd $1 --list-cmds)
 	prev_skip_opts=()
 	while [ $i -ge 0 ]; do
+		if [[ ${words[i]} == $1 ]]; then
+			return
+		fi
 		for cmd_ in $cmds_; do
 			if [[ ${words[i]} == $cmd_ ]]; then
 				prev_skip_opts=${words[i]}
@@ -146,7 +149,9 @@ __perf_main ()
 		fi
 		# List long option names
 		if [[ $cur == --* ]];  then
-			subcmd=${words[1]}
+			subcmd=$prev_skip_opts
+			__perf_prev_skip_opts $subcmd
+			subcmd=$subcmd" "$prev_skip_opts
 			opts=$($cmd $subcmd --list-opts)
 			__perfcomp "$opts" "$cur"
 		fi
-- 
1.9.3


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

* [PATCH 20/31] perf tools: Fix the bash completion for listing events of perf subcommand record|stat|top -e
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (17 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 19/31] perf tools: Provide the right bash completion for listing options of perf subcommand subsubcommand Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 21/31] perf tools: Fix the bash completion to support listing events for --event Arnaldo Carvalho de Melo
                   ` (11 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Yunlong Song, Paul Mackerras, Peter Zijlstra,
	Wang Nan, Arnaldo Carvalho de Melo

From: Yunlong Song <yunlong.song@huawei.com>

The bash completion does not support listing events for 'perf kvm|kmem|
mem|lock|sched record|stat|top -e <TAB>', where 'kvm|kmem|mem|lock|sched'
are all subcommands of perf.

Example:

Before this patch:

 $ perf kvm record -e <TAB>
 $

As shown above, the events of record does not come out.

After this patch:

 $ perf kvm record -e <TAB>
 alignment-faults                   cpu/instructions/
 L1-dcache-prefetch-misses          node-prefetches
 uncore_rbox_0/qpi0_idle_filt/
 branch-instructions                cpu/mem-loads/
 L1-dcache-store-misses             node-prefetch-misses
 uncore_rbox_0/qpi1_date_response/
 branch-load-misses                 cpu-migrations
 L1-dcache-stores                   node-store-misses
 uncore_rbox_0/qpi1_filt_send/
 branch-loads                       dTLB-load-misses
 L1-icache-load-misses              node-stores
 uncore_rbox_0/qpi1_idle_filt/
 ...

As shown above, the events of record can come out now.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1426685758-25488-5-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/perf-completion.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 01ce841f155b..4b58ac2ae578 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -138,7 +138,7 @@ __perf_main ()
 		fi
 		__perfcomp "$cmds" "$cur"
 	# List possible events for -e option
-	elif [[ $prev == "-e" && "${words[1]}" == @(record|stat|top) ]]; then
+	elif [[ $prev == "-e" && $prev_skip_opts == @(record|stat|top) ]]; then
 		evts=$($cmd list --raw-dump)
 		__perfcomp_colon "$evts" "$cur"
 	else
-- 
1.9.3


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

* [PATCH 21/31] perf tools: Fix the bash completion to support listing events for --event
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (18 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 20/31] perf tools: Fix the bash completion for listing events of perf subcommand record|stat|top -e Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 22/31] perf tools: Fix the bash completion for listing subcommands of perf Arnaldo Carvalho de Melo
                   ` (10 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Yunlong Song, Paul Mackerras, Peter Zijlstra,
	Wang Nan, Arnaldo Carvalho de Melo

From: Yunlong Song <yunlong.song@huawei.com>

The bash completion only supports -e rather than --event, so fix it.

Example:

Before this patch:

 $ perf record --event <TAB>
 $

As shown above, the events of record does not come out.

After this patch:

 $ perf record --event <TAB>
 lignment-faults                   cpu/instructions/
 L1-dcache-prefetch-misses          node-prefetches
 uncore_rbox_0/qpi0_idle_filt/
 branch-instructions                cpu/mem-loads/
 L1-dcache-store-misses             node-prefetch-misses
 uncore_rbox_0/qpi1_date_response/
 branch-load-misses                 cpu-migrations
 L1-dcache-stores                   node-store-misses
 uncore_rbox_0/qpi1_filt_send/
 branch-loads                       dTLB-load-misses
 L1-icache-load-misses              node-stores
 uncore_rbox_0/qpi1_idle_filt/
 ...

As shown above, the events of record can come out now.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1426685758-25488-6-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/perf-completion.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 4b58ac2ae578..3e25d3ea17f9 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -137,8 +137,8 @@ __perf_main ()
 			cmds=$($cmd --list-cmds)
 		fi
 		__perfcomp "$cmds" "$cur"
-	# List possible events for -e option
-	elif [[ $prev == "-e" && $prev_skip_opts == @(record|stat|top) ]]; then
+	# List possible events for -e and --event option
+	elif [[ $prev == @("-e"|"--event") && $prev_skip_opts == @(record|stat|top) ]]; then
 		evts=$($cmd list --raw-dump)
 		__perfcomp_colon "$evts" "$cur"
 	else
-- 
1.9.3


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

* [PATCH 22/31] perf tools: Fix the bash completion for listing subcommands of perf
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (19 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 21/31] perf tools: Fix the bash completion to support listing events for --event Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:04 ` [PATCH 23/31] perf tools: Add the bash completion for listing subsubcommands of perf data Arnaldo Carvalho de Melo
                   ` (9 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Yunlong Song, Paul Mackerras, Peter Zijlstra,
	Wang Nan, Arnaldo Carvalho de Melo

From: Yunlong Song <yunlong.song@huawei.com>

The bash completion does not support listing subcommands for 'perf
--<long option> <TAB>'.

Example:

Before this patch:

 $ perf --debug <TAB>
 $

As shown above, the subcommands of perf does not come out.

After this patch:

 $ perf --debug <TAB>
 annotate       buildid-cache  data           evlist         inject
 kvm            lock           probe          report         script
 test           top            version
 bench          buildid-list   diff           help           kmem
 list           mem            record         sched          stat
 timechart      trace

As shown above, the subcommands of perf can come out now.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1426685758-25488-7-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/perf-completion.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 3e25d3ea17f9..7b98ae48f0bf 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -130,7 +130,7 @@ __perf_main ()
 	# Skip options backward and find the last perf command
 	__perf_prev_skip_opts
 	# List perf subcommands or long options
-	if [ $cword -eq 1 ]; then
+	if [ -z $prev_skip_opts ]; then
 		if [[ $cur == --* ]]; then
 			cmds=$($cmd --list-opts)
 		else
-- 
1.9.3


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

* [PATCH 23/31] perf tools: Add the bash completion for listing subsubcommands of perf data
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (20 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 22/31] perf tools: Fix the bash completion for listing subcommands of perf Arnaldo Carvalho de Melo
@ 2015-03-19 17:04 ` Arnaldo Carvalho de Melo
  2015-03-19 17:05 ` [PATCH 24/31] perf tools: Add the bash completion for listing subsubcommands of perf help Arnaldo Carvalho de Melo
                   ` (8 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Yunlong Song, Paul Mackerras, Peter Zijlstra,
	Wang Nan, Arnaldo Carvalho de Melo

From: Yunlong Song <yunlong.song@huawei.com>

The bash completion does not support listing subsubcommands for 'perf
data <TAB>', so fix it.

Example:

Before this patch:

 $ perf data <TAB>
 $

As shown above, the subsubcommands of perf data does not come out.

After this patch:

 $ perf data <TAB>
 convert

As shown above, the subsubcommands of perf data can come out now.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1426685758-25488-8-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-data.c     | 6 ++++--
 tools/perf/perf-completion.sh | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-data.c b/tools/perf/builtin-data.c
index 155cf75b8199..709152a7b408 100644
--- a/tools/perf/builtin-data.c
+++ b/tools/perf/builtin-data.c
@@ -22,7 +22,9 @@ static const struct option data_options[] = {
 	OPT_END()
 };
 
-static const char * const data_usage[] = {
+static const char * const data_subcommands[] = { "convert", NULL };
+
+static const char *data_usage[] = {
 	"perf data [<common options>] <command> [<options>]",
 	NULL
 };
@@ -98,7 +100,7 @@ int cmd_data(int argc, const char **argv, const char *prefix)
 	if (argc < 2)
 		goto usage;
 
-	argc = parse_options(argc, argv, data_options, data_usage,
+	argc = parse_options_subcommand(argc, argv, data_options, data_subcommands, data_usage,
 			     PARSE_OPT_STOP_AT_NON_OPTION);
 	if (argc < 1)
 		goto usage;
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 7b98ae48f0bf..535ff72babc7 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -143,7 +143,7 @@ __perf_main ()
 		__perfcomp_colon "$evts" "$cur"
 	else
 		# List subcommands for perf commands
-		if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched) ]]; then
+		if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched|data) ]]; then
 			subcmds=$($cmd $prev_skip_opts --list-cmds)
 			__perfcomp_colon "$subcmds" "$cur"
 		fi
-- 
1.9.3


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

* [PATCH 24/31] perf tools: Add the bash completion for listing subsubcommands of perf help
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (21 preceding siblings ...)
  2015-03-19 17:04 ` [PATCH 23/31] perf tools: Add the bash completion for listing subsubcommands of perf data Arnaldo Carvalho de Melo
@ 2015-03-19 17:05 ` Arnaldo Carvalho de Melo
  2015-03-19 17:05 ` [PATCH 25/31] perf tools: Add the bash completion for listing subsubcommands of perf script Arnaldo Carvalho de Melo
                   ` (7 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:05 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Yunlong Song, Paul Mackerras, Peter Zijlstra,
	Wang Nan, Arnaldo Carvalho de Melo

From: Yunlong Song <yunlong.song@huawei.com>

The bash completion does not support listing subsubcommands for 'perf
help <TAB>', so fix it.

Example:

Before this patch:

 $ perf help <TAB>
 $

As shown above, the subsubcommands of perf help does not come out.

After this patch:

 $ perf help <TAB>
 annotate       buildid-cache  data           evlist         inject
 kvm            lock           probe          report         script
 test           top
 bench          buildid-list   diff           help           kmem
 list           mem            record         sched          stat
 timechart      trace

As shown above, the subsubcommands of perf help can come out now.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1426685758-25488-9-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-help.c     | 17 ++++++++++++++---
 tools/perf/perf-completion.sh |  2 +-
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index 25d20628212e..36486eade1ef 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -437,7 +437,18 @@ int cmd_help(int argc, const char **argv, const char *prefix __maybe_unused)
 			HELP_FORMAT_INFO),
 	OPT_END(),
 	};
-	const char * const builtin_help_usage[] = {
+	const char * const builtin_help_subcommands[] = {
+		"buildid-cache", "buildid-list", "diff", "evlist", "help", "list",
+		"record", "report", "bench", "stat", "timechart", "top", "annotate",
+		"script", "sched", "kmem", "lock", "kvm", "test", "inject", "mem", "data",
+#ifdef HAVE_LIBELF_SUPPORT
+		"probe",
+#endif
+#ifdef HAVE_LIBAUDIT_SUPPORT
+		"trace",
+#endif
+	NULL };
+	const char *builtin_help_usage[] = {
 		"perf help [--all] [--man|--web|--info] [command]",
 		NULL
 	};
@@ -448,8 +459,8 @@ int cmd_help(int argc, const char **argv, const char *prefix __maybe_unused)
 
 	perf_config(perf_help_config, &help_format);
 
-	argc = parse_options(argc, argv, builtin_help_options,
-			builtin_help_usage, 0);
+	argc = parse_options_subcommand(argc, argv, builtin_help_options,
+			builtin_help_subcommands, builtin_help_usage, 0);
 
 	if (show_all) {
 		printf("\n usage: %s\n\n", perf_usage_string);
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 535ff72babc7..dbca6a66f401 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -143,7 +143,7 @@ __perf_main ()
 		__perfcomp_colon "$evts" "$cur"
 	else
 		# List subcommands for perf commands
-		if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched|data) ]]; then
+		if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched|data|help) ]]; then
 			subcmds=$($cmd $prev_skip_opts --list-cmds)
 			__perfcomp_colon "$subcmds" "$cur"
 		fi
-- 
1.9.3


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

* [PATCH 25/31] perf tools: Add the bash completion for listing subsubcommands of perf script
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (22 preceding siblings ...)
  2015-03-19 17:05 ` [PATCH 24/31] perf tools: Add the bash completion for listing subsubcommands of perf help Arnaldo Carvalho de Melo
@ 2015-03-19 17:05 ` Arnaldo Carvalho de Melo
  2015-03-19 17:05 ` [PATCH 26/31] perf tools: Add the bash completion for listing subsubcommands of perf test Arnaldo Carvalho de Melo
                   ` (6 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:05 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Yunlong Song, Paul Mackerras, Peter Zijlstra,
	Wang Nan, Arnaldo Carvalho de Melo

From: Yunlong Song <yunlong.song@huawei.com>

The bash completion does not support listing subsubcommands for 'perf
script <TAB>', so fix it.

Example:

Before this patch:

 $ perf script <TAB>
 $

As shown above, the subsubcommands of perf script does not come out.

After this patch:

 $ perf script <TAB>
 record  report

As shown above, the subsubcommands of perf script can come out now.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1426685758-25488-10-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-script.c   | 5 +++--
 tools/perf/perf-completion.sh | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index c7e6750923ef..f2a348b57b8f 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1572,7 +1572,8 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
 		    "Show the mmap events"),
 	OPT_END()
 	};
-	const char * const script_usage[] = {
+	const char * const script_subcommands[] = { "record", "report", NULL };
+	const char *script_usage[] = {
 		"perf script [<options>]",
 		"perf script [<options>] record <script> [<record-options>] <command>",
 		"perf script [<options>] report <script> [script-args]",
@@ -1586,7 +1587,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
 
 	setup_scripting();
 
-	argc = parse_options(argc, argv, options, script_usage,
+	argc = parse_options_subcommand(argc, argv, options, script_subcommands, script_usage,
 			     PARSE_OPT_STOP_AT_NON_OPTION);
 
 	file.path = input_name;
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index dbca6a66f401..8739a1345017 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -143,7 +143,7 @@ __perf_main ()
 		__perfcomp_colon "$evts" "$cur"
 	else
 		# List subcommands for perf commands
-		if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched|data|help) ]]; then
+		if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched|data|help|script) ]]; then
 			subcmds=$($cmd $prev_skip_opts --list-cmds)
 			__perfcomp_colon "$subcmds" "$cur"
 		fi
-- 
1.9.3


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

* [PATCH 26/31] perf tools: Add the bash completion for listing subsubcommands of perf test
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (23 preceding siblings ...)
  2015-03-19 17:05 ` [PATCH 25/31] perf tools: Add the bash completion for listing subsubcommands of perf script Arnaldo Carvalho de Melo
@ 2015-03-19 17:05 ` Arnaldo Carvalho de Melo
  2015-03-19 17:05 ` [PATCH 27/31] perf tools: Add the bash completion for listing subsubcommands of perf timechart Arnaldo Carvalho de Melo
                   ` (5 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:05 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Yunlong Song, Paul Mackerras, Peter Zijlstra,
	Wang Nan, Arnaldo Carvalho de Melo

From: Yunlong Song <yunlong.song@huawei.com>

The bash completion does not support listing subsubcommands for 'perf
test <TAB>', so fix it.

Example:

Before this patch:

 $ perf test <TAB>
 $

As shown above, the subsubcommands of perf test does not come out.

After this patch:

 $ perf test <TAB>
 list

As shown above, the subsubcommands of perf test can come out now.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1426685758-25488-11-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/perf-completion.sh   | 2 +-
 tools/perf/tests/builtin-test.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 8739a1345017..35f43fd7a38b 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -143,7 +143,7 @@ __perf_main ()
 		__perfcomp_colon "$evts" "$cur"
 	else
 		# List subcommands for perf commands
-		if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched|data|help|script) ]]; then
+		if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched|data|help|script|test) ]]; then
 			subcmds=$($cmd $prev_skip_opts --list-cmds)
 			__perfcomp_colon "$subcmds" "$cur"
 		fi
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 4b7d9ab0f049..ed8e05c6839a 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -291,7 +291,7 @@ static int perf_test__list(int argc, const char **argv)
 
 int cmd_test(int argc, const char **argv, const char *prefix __maybe_unused)
 {
-	const char * const test_usage[] = {
+	const char *test_usage[] = {
 	"perf test [<options>] [{list <test-name-fragment>|[<test-name-fragments>|<test-numbers>]}]",
 	NULL,
 	};
@@ -302,13 +302,14 @@ int cmd_test(int argc, const char **argv, const char *prefix __maybe_unused)
 		    "be more verbose (show symbol address, etc)"),
 	OPT_END()
 	};
+	const char * const test_subcommands[] = { "list", NULL };
 	struct intlist *skiplist = NULL;
         int ret = hists__init();
 
         if (ret < 0)
                 return ret;
 
-	argc = parse_options(argc, argv, test_options, test_usage, 0);
+	argc = parse_options_subcommand(argc, argv, test_options, test_subcommands, test_usage, 0);
 	if (argc >= 1 && !strcmp(argv[0], "list"))
 		return perf_test__list(argc, argv);
 
-- 
1.9.3


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

* [PATCH 27/31] perf tools: Add the bash completion for listing subsubcommands of perf timechart
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (24 preceding siblings ...)
  2015-03-19 17:05 ` [PATCH 26/31] perf tools: Add the bash completion for listing subsubcommands of perf test Arnaldo Carvalho de Melo
@ 2015-03-19 17:05 ` Arnaldo Carvalho de Melo
  2015-03-19 17:05 ` [PATCH 28/31] perf tools: Add the bash completion for listing subsubcommands of perf trace Arnaldo Carvalho de Melo
                   ` (4 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:05 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Yunlong Song, Paul Mackerras, Peter Zijlstra,
	Wang Nan, Arnaldo Carvalho de Melo

From: Yunlong Song <yunlong.song@huawei.com>

The bash completion does not support listing subsubcommands for 'perf
timechart <TAB>', so fix it.

Example:

Before this patch:

 $ perf timechart <TAB>
 $

As shown above, the subsubcommands of perf timechart does not come out.

After this patch:

 $ perf timechart <TAB>
 record

As shown above, the subsubcommands of perf timechart can come out now.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1426685758-25488-12-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-timechart.c | 7 ++++---
 tools/perf/perf-completion.sh  | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 51440d1fc722..494b3bbe5ea4 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -1958,7 +1958,8 @@ int cmd_timechart(int argc, const char **argv,
 		     parse_time),
 	OPT_END()
 	};
-	const char * const timechart_usage[] = {
+	const char * const timechart_subcommands[] = { "record", NULL };
+	const char *timechart_usage[] = {
 		"perf timechart [<options>] {record}",
 		NULL
 	};
@@ -1976,8 +1977,8 @@ int cmd_timechart(int argc, const char **argv,
 		"perf timechart record [<options>]",
 		NULL
 	};
-	argc = parse_options(argc, argv, timechart_options, timechart_usage,
-			PARSE_OPT_STOP_AT_NON_OPTION);
+	argc = parse_options_subcommand(argc, argv, timechart_options, timechart_subcommands,
+			timechart_usage, PARSE_OPT_STOP_AT_NON_OPTION);
 
 	if (tchart.power_only && tchart.tasks_only) {
 		pr_err("-P and -T options cannot be used at the same time.\n");
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 35f43fd7a38b..a33d2ef53ae4 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -143,7 +143,7 @@ __perf_main ()
 		__perfcomp_colon "$evts" "$cur"
 	else
 		# List subcommands for perf commands
-		if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched|data|help|script|test) ]]; then
+		if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched|data|help|script|test|timechart) ]]; then
 			subcmds=$($cmd $prev_skip_opts --list-cmds)
 			__perfcomp_colon "$subcmds" "$cur"
 		fi
-- 
1.9.3


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

* [PATCH 28/31] perf tools: Add the bash completion for listing subsubcommands of perf trace
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (25 preceding siblings ...)
  2015-03-19 17:05 ` [PATCH 27/31] perf tools: Add the bash completion for listing subsubcommands of perf timechart Arnaldo Carvalho de Melo
@ 2015-03-19 17:05 ` Arnaldo Carvalho de Melo
  2015-03-19 17:05 ` [PATCH 29/31] perf tools: Avoid confusion with preloaded bash function for perf bash completion Arnaldo Carvalho de Melo
                   ` (3 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:05 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Yunlong Song, Paul Mackerras, Peter Zijlstra,
	Wang Nan, Arnaldo Carvalho de Melo

From: Yunlong Song <yunlong.song@huawei.com>

The bash completion does not support listing subsubcommands for 'perf
trace <TAB>', so fix it.

Example:

Before this patch:

 $ perf trace <TAB>
 $

As shown above, the subsubcommands of perf trace does not come out.

After this patch:

 $ perf trace <TAB>
 record

As shown above, the subsubcommands of perf trace can come out now.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1426685758-25488-13-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-trace.c    | 7 ++++---
 tools/perf/perf-completion.sh | 9 ++++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 6969ba98ff2f..0b3b4e4984b9 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2609,7 +2609,7 @@ static void evlist__set_evsel_handler(struct perf_evlist *evlist, void *handler)
 
 int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
 {
-	const char * const trace_usage[] = {
+	const char *trace_usage[] = {
 		"perf trace [<options>] [<command>]",
 		"perf trace [<options>] -- <command> [<options>]",
 		"perf trace record [<options>] [<command>]",
@@ -2684,6 +2684,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
 	OPT_BOOLEAN(0, "syscalls", &trace.trace_syscalls, "Trace syscalls"),
 	OPT_END()
 	};
+	const char * const trace_subcommands[] = { "record", NULL };
 	int err;
 	char bf[BUFSIZ];
 
@@ -2699,8 +2700,8 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
 		goto out;
 	}
 
-	argc = parse_options(argc, argv, trace_options, trace_usage,
-			     PARSE_OPT_STOP_AT_NON_OPTION);
+	argc = parse_options_subcommand(argc, argv, trace_options, trace_subcommands,
+				 trace_usage, PARSE_OPT_STOP_AT_NON_OPTION);
 
 	if (trace.trace_pgfaults) {
 		trace.opts.sample_address = true;
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index a33d2ef53ae4..bdd40350870a 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -120,6 +120,7 @@ __perf_prev_skip_opts ()
 		((i--))
 	done
 }
+
 __perf_main ()
 {
 	local cmd
@@ -137,13 +138,15 @@ __perf_main ()
 			cmds=$($cmd --list-cmds)
 		fi
 		__perfcomp "$cmds" "$cur"
-	# List possible events for -e and --event option
-	elif [[ $prev == @("-e"|"--event") && $prev_skip_opts == @(record|stat|top) ]]; then
+	# List possible events for -e option
+	elif [[ $prev == @("-e"|"--event") &&
+		$prev_skip_opts == @(record|stat|top) ]]; then
 		evts=$($cmd list --raw-dump)
 		__perfcomp_colon "$evts" "$cur"
 	else
 		# List subcommands for perf commands
-		if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched|data|help|script|test|timechart) ]]; then
+		if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched|
+			|data|help|script|test|timechart|trace) ]]; then
 			subcmds=$($cmd $prev_skip_opts --list-cmds)
 			__perfcomp_colon "$subcmds" "$cur"
 		fi
-- 
1.9.3


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

* [PATCH 29/31] perf tools: Avoid confusion with preloaded bash function for perf bash completion
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (26 preceding siblings ...)
  2015-03-19 17:05 ` [PATCH 28/31] perf tools: Add the bash completion for listing subsubcommands of perf trace Arnaldo Carvalho de Melo
@ 2015-03-19 17:05 ` Arnaldo Carvalho de Melo
  2015-03-19 17:05 ` [PATCH 30/31] perf callchain: Separate eh/debug frame offset cache Arnaldo Carvalho de Melo
                   ` (2 subsequent siblings)
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:05 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Yunlong Song, Paul Mackerras, Peter Zijlstra,
	Wang Nan, Arnaldo Carvalho de Melo

From: Yunlong Song <yunlong.song@huawei.com>

Since some functions (e.g. '_get_comp_words_by_ref()') in perf bash
completion script are originally taken from git bash completion script,
these functions may be preloaded before perf bash completion script
runs.

In order to avoid repeating loading the same function twice, some test
constraints are used before these function definitions in the perf bash
completion script (e.g. 'type _get_comp_words_by_ref &>/dev/null ||').

The problem is that, if these functions in perf bash completion script
are changed for some reason, perf will still use the preloaded bash
functions rather than the customized functions of its own.

As a result, the perf bash completion will behave incorrectly. To get
rid of this problem, a flag can be defined to determine the proper
situation.

And to avoid overwriting the preloaded functions, the names of these
functions in perf bash completion script should be renamed to the
perf-customized ones.

Example:

Before this patch:

 $ type _get_comp_words_by_ref
 _get_comp_words_by_ref is a function
 _get_comp_words_by_ref ()
 {
     local exclude flag i OPTIND=1;
     local cur cword words=();
     local upargs=() upvars=() vcur vcword vprev vwords;
     while getopts "c:i:n:p:w:" flag "$@"; do
         case $flag in
             c)
                 vcur=$OPTARG
             ;;
             i)
                 vcword=$OPTARG
             ;;
             n)
                 exclude=$OPTARG
             ;;
             p)
                 vprev=$OPTARG
             ;;
             w)
                 vwords=$OPTARG
             ;;
         esac;
     done;
     while [[ $# -ge $OPTIND ]]; do
         case ${!OPTIND} in
             cur)
                 vcur=cur
             ;;
             prev)
                 vprev=prev
             ;;
             cword)
                 vcword=cword
             ;;
             words)
                 vwords=words
             ;;
             *)
                 echo "bash: $FUNCNAME(): \`${!OPTIND}': unknown argument" 1>&2;
                 return 1
             ;;
         esac;
         let "OPTIND += 1";
     done;
     __get_cword_at_cursor_by_ref "$exclude" words cword cur;
     [[ -n $vcur ]] && {
         upvars+=("$vcur");
         upargs+=(-v $vcur "$cur")
     };
     [[ -n $vcword ]] && {
         upvars+=("$vcword");
         upargs+=(-v $vcword "$cword")
     };
     [[ -n $vprev && $cword -ge 1 ]] && {
         upvars+=("$vprev");
         upargs+=(-v $vprev "${words[cword - 1]}")
     };
     [[ -n $vwords ]] && {
         upvars+=("$vwords");
         upargs+=(-a${#words[@]} $vwords "${words[@]}")
     };
     (( ${#upvars[@]} )) && local "${upvars[@]}" && _upvars "${upargs[@]}"
 }

As shown above, the _get_comp_words_by_ref is the preloaded function in
fact, rather than the function defined in perf-completion.sh. So if we
happen to change the function for some reason, the result will behave in
a wrong state.

After this patch:

We can set preload_get_comp_words_by_ref="false" to not use the preloaded
function. Instead, it will use the function defined in perf-completion.sh,
which is renamed as __perf_get_comp_words_by_ref to avoid overwriting
the preloaded function _get_comp_words_by_ref.

 $ type __perf_get_comp_words_by_ref
 __perf_get_comp_words_by_ref is a function
 __perf_get_comp_words_by_ref ()
 {
     local exclude cur_ words_ cword_;
     if [ "$1" = "-n" ]; then
         exclude=$2;
         shift 2;
     fi;
     __my_reassemble_comp_words_by_ref "$exclude";
     cur_=${words_[cword_]};
     while [ $# -gt 0 ]; do
         case "$1" in
             cur)
                 cur=$cur_
             ;;
             prev)
                 prev=${words_[$cword_-1]}
             ;;
             words)
                 words=("${words_[@]}")
             ;;
             cword)
                 cword=$cword_
             ;;
         esac;
         shift;
     done
 }

As shown above, the function __perf_get_comp_words_by_ref is loaded and
can work this time.

Note that we do not change the original behavior when those functions are
not preloaded before perf bash completion script runs. In this case,
although the flag is set to "true", the code will still change it to
"false" to use the function defined in perf-completion.sh.

Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1426685758-25488-14-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/perf-completion.sh | 36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index bdd40350870a..3ba80b2359cc 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -47,8 +47,16 @@ __my_reassemble_comp_words_by_ref()
 	done
 }
 
-type _get_comp_words_by_ref &>/dev/null ||
-_get_comp_words_by_ref()
+# Define preload_get_comp_words_by_ref="false", if the function
+# __perf_get_comp_words_by_ref() is required instead.
+preload_get_comp_words_by_ref="true"
+
+if [ $preload_get_comp_words_by_ref = "true" ]; then
+	type _get_comp_words_by_ref &>/dev/null ||
+	preload_get_comp_words_by_ref="false"
+fi
+[ $preload_get_comp_words_by_ref = "true" ] ||
+__perf_get_comp_words_by_ref()
 {
 	local exclude cur_ words_ cword_
 	if [ "$1" = "-n" ]; then
@@ -76,8 +84,16 @@ _get_comp_words_by_ref()
 	done
 }
 
-type __ltrim_colon_completions &>/dev/null ||
-__ltrim_colon_completions()
+# Define preload__ltrim_colon_completions="false", if the function
+# __perf__ltrim_colon_completions() is required instead.
+preload__ltrim_colon_completions="true"
+
+if [ $preload__ltrim_colon_completions = "true" ]; then
+	type __ltrim_colon_completions &>/dev/null ||
+	preload__ltrim_colon_completions="false"
+fi
+[ $preload__ltrim_colon_completions = "true" ] ||
+__perf__ltrim_colon_completions()
 {
 	if [[ "$1" == *:* && "$COMP_WORDBREAKS" == *:* ]]; then
 		# Remove colon-word prefix from COMPREPLY items
@@ -97,7 +113,11 @@ __perfcomp ()
 __perfcomp_colon ()
 {
 	__perfcomp "$1" "$2"
-	__ltrim_colon_completions $cur
+	if [ $preload__ltrim_colon_completions = "true" ]; then
+		__ltrim_colon_completions $cur
+	else
+		__perf__ltrim_colon_completions $cur
+	fi
 }
 
 __perf_prev_skip_opts ()
@@ -226,7 +246,11 @@ type perf &>/dev/null &&
 _perf()
 {
 	local cur words cword prev
-	_get_comp_words_by_ref -n =: cur words cword prev
+	if [ $preload_get_comp_words_by_ref = "true" ]; then
+		_get_comp_words_by_ref -n =: cur words cword prev
+	else
+		__perf_get_comp_words_by_ref -n =: cur words cword prev
+	fi
 	__perf_main
 } &&
 
-- 
1.9.3


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

* [PATCH 30/31] perf callchain: Separate eh/debug frame offset cache.
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (27 preceding siblings ...)
  2015-03-19 17:05 ` [PATCH 29/31] perf tools: Avoid confusion with preloaded bash function for perf bash completion Arnaldo Carvalho de Melo
@ 2015-03-19 17:05 ` Arnaldo Carvalho de Melo
  2015-03-19 17:05 ` [PATCH 31/31] perf report: Don't allow empty argument for '-t' Arnaldo Carvalho de Melo
  2015-03-22  9:55 ` [GIT PULL 00/31] perf/core improvements and fixes Ingo Molnar
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:05 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Wang Nan, Li Zefan, Arnaldo Carvalho de Melo

From: Wang Nan <wangnan0@huawei.com>

Commit f1f13af99a90 ("perf callchain: Cache eh/debug frame offset for
dwarf unwind") introduces a cache for .debug_frame and .eh_frame_hdr.
Unfortunately, it makes them share a same cache (dso->frame_offset).
Which causes unwind failure on ARM:

   $ perf test unwind
  Test dwarf unwind: FAILED!

The reason is that, if a dso has '.debug_frame' but doesn't have
'.eh_frame_hdr' (like ARM), dso->frame_offset will be filled by offset
of '.debug_frame' during the first time calling of find_proc_info() ->
read_unwind_spec_debug_frame(), and be regarded to '.eh_frame_hdr' when
the second time calling of find_proc_info() ->
read_unwind_spec_eh_frame(), since '.eh_frame_hdr' is checked prior to
'.debug_frame'.

This patch solves the problem by creating two cache fields for
'.eh_frame_hdr' and '.debug_frame'.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Li Zefan <lizefan@huawei.com>
Link: http://lkml.kernel.org/r/55028BA0.1030701@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/dso.h              | 3 ++-
 tools/perf/util/unwind-libunwind.c | 8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index ced92841ff97..408c65f1a757 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -139,7 +139,8 @@ struct dso {
 		u32		 status_seen;
 		size_t		 file_size;
 		struct list_head open_entry;
-		u64		 frame_offset;
+		u64		 debug_frame_offset;
+		u64		 eh_frame_hdr_offset;
 	} data;
 
 	union { /* Tool specific area */
diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
index e3c40a520a25..7b09a443a280 100644
--- a/tools/perf/util/unwind-libunwind.c
+++ b/tools/perf/util/unwind-libunwind.c
@@ -266,7 +266,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine,
 				     u64 *fde_count)
 {
 	int ret = -EINVAL, fd;
-	u64 offset = dso->data.frame_offset;
+	u64 offset = dso->data.eh_frame_hdr_offset;
 
 	if (offset == 0) {
 		fd = dso__data_fd(dso, machine);
@@ -275,7 +275,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine,
 
 		/* Check the .eh_frame section for unwinding info */
 		offset = elf_section_offset(fd, ".eh_frame_hdr");
-		dso->data.frame_offset = offset;
+		dso->data.eh_frame_hdr_offset = offset;
 	}
 
 	if (offset)
@@ -291,7 +291,7 @@ static int read_unwind_spec_debug_frame(struct dso *dso,
 					struct machine *machine, u64 *offset)
 {
 	int fd;
-	u64 ofs = dso->data.frame_offset;
+	u64 ofs = dso->data.debug_frame_offset;
 
 	if (ofs == 0) {
 		fd = dso__data_fd(dso, machine);
@@ -300,7 +300,7 @@ static int read_unwind_spec_debug_frame(struct dso *dso,
 
 		/* Check the .debug_frame section for unwinding info */
 		ofs = elf_section_offset(fd, ".debug_frame");
-		dso->data.frame_offset = ofs;
+		dso->data.debug_frame_offset = ofs;
 	}
 
 	*offset = ofs;
-- 
1.9.3


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

* [PATCH 31/31] perf report: Don't allow empty argument for '-t'.
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (28 preceding siblings ...)
  2015-03-19 17:05 ` [PATCH 30/31] perf callchain: Separate eh/debug frame offset cache Arnaldo Carvalho de Melo
@ 2015-03-19 17:05 ` Arnaldo Carvalho de Melo
  2015-03-22  9:55 ` [GIT PULL 00/31] perf/core improvements and fixes Ingo Molnar
  30 siblings, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-19 17:05 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Wang Nan, pi3orama, Jiri Olsa, Zefan Li,
	Arnaldo Carvalho de Melo

From: Wang Nan <wangnan0@huawei.com>

Without this patch, perf report cause segfault if pass "" as '-t':

  $ perf report -t ""

   # To display the perf.data header info, please use --header/--header-only options.
   #
   # Samples: 37  of event 'syscalls:sys_enter_write'
   # Event count (approx.): 37
   #
   # Children    SelfCommand   Shared Object         Symbol
   Segmentation fault

Since -t is used to add field-separator for generate table, -t "" is
actually meanless. This patch defines a new OPT_STRING_NOEMPTY() option
generator to ensure user never pass empty string to that option.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: pi3orama@163.com
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Link: http://lkml.kernel.org/r/1426251114-198991-1-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c     |  2 +-
 tools/perf/util/parse-options.c | 21 +++++++++++++++++++--
 tools/perf/util/parse-options.h |  2 ++
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 52f74e1367e9..0ae482689e3c 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -676,7 +676,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 	OPT_STRING('w', "column-widths", &symbol_conf.col_width_list_str,
 		   "width[,width...]",
 		   "don't try to adjust column width, use these fixed values"),
-	OPT_STRING('t', "field-separator", &symbol_conf.field_sep, "separator",
+	OPT_STRING_NOEMPTY('t', "field-separator", &symbol_conf.field_sep, "separator",
 		   "separator for columns, no spaces will be added between "
 		   "columns '.' is reserved."),
 	OPT_BOOLEAN('U', "hide-unresolved", &report.hide_unresolved,
diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c
index 1457d6639b60..01626be2a8eb 100644
--- a/tools/perf/util/parse-options.c
+++ b/tools/perf/util/parse-options.c
@@ -37,6 +37,7 @@ static int get_value(struct parse_opt_ctx_t *p,
 {
 	const char *s, *arg = NULL;
 	const int unset = flags & OPT_UNSET;
+	int err;
 
 	if (unset && p->opt)
 		return opterror(opt, "takes no value", flags);
@@ -114,13 +115,29 @@ static int get_value(struct parse_opt_ctx_t *p,
 		return 0;
 
 	case OPTION_STRING:
+		err = 0;
 		if (unset)
 			*(const char **)opt->value = NULL;
 		else if (opt->flags & PARSE_OPT_OPTARG && !p->opt)
 			*(const char **)opt->value = (const char *)opt->defval;
 		else
-			return get_arg(p, opt, flags, (const char **)opt->value);
-		return 0;
+			err = get_arg(p, opt, flags, (const char **)opt->value);
+
+		/* PARSE_OPT_NOEMPTY: Allow NULL but disallow empty string. */
+		if (opt->flags & PARSE_OPT_NOEMPTY) {
+			const char *val = *(const char **)opt->value;
+
+			if (!val)
+				return err;
+
+			/* Similar to unset if we are given an empty string. */
+			if (val[0] == '\0') {
+				*(const char **)opt->value = NULL;
+				return 0;
+			}
+		}
+
+		return err;
 
 	case OPTION_CALLBACK:
 		if (unset)
diff --git a/tools/perf/util/parse-options.h b/tools/perf/util/parse-options.h
index 97b153fb4999..59561fd86278 100644
--- a/tools/perf/util/parse-options.h
+++ b/tools/perf/util/parse-options.h
@@ -40,6 +40,7 @@ enum parse_opt_option_flags {
 	PARSE_OPT_LASTARG_DEFAULT = 16,
 	PARSE_OPT_DISABLED = 32,
 	PARSE_OPT_EXCLUSIVE = 64,
+	PARSE_OPT_NOEMPTY  = 128,
 };
 
 struct option;
@@ -122,6 +123,7 @@ struct option {
 #define OPT_LONG(s, l, v, h)        { .type = OPTION_LONG, .short_name = (s), .long_name = (l), .value = check_vtype(v, long *), .help = (h) }
 #define OPT_U64(s, l, v, h)         { .type = OPTION_U64, .short_name = (s), .long_name = (l), .value = check_vtype(v, u64 *), .help = (h) }
 #define OPT_STRING(s, l, v, a, h)   { .type = OPTION_STRING,  .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), (a), .help = (h) }
+#define OPT_STRING_NOEMPTY(s, l, v, a, h)   { .type = OPTION_STRING,  .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), (a), .help = (h), .flags = PARSE_OPT_NOEMPTY}
 #define OPT_DATE(s, l, v, h) \
 	{ .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), .argh = "time", .help = (h), .callback = parse_opt_approxidate_cb }
 #define OPT_CALLBACK(s, l, v, a, h, f) \
-- 
1.9.3


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

* Re: [GIT PULL 00/31] perf/core improvements and fixes
  2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (29 preceding siblings ...)
  2015-03-19 17:05 ` [PATCH 31/31] perf report: Don't allow empty argument for '-t' Arnaldo Carvalho de Melo
@ 2015-03-22  9:55 ` Ingo Molnar
  30 siblings, 0 replies; 35+ messages in thread
From: Ingo Molnar @ 2015-03-22  9:55 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Borislav Petkov, Corey Ashford,
	David Ahern, Don Zickus, Frederic Weisbecker, H . J . Lu,
	Jiri Olsa, Li Zefan, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, pi3orama, Stephane Eranian, Wang Nan,
	Yunlong Song, Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling, more to come,
> 
> - Arnaldo
> 
> The following changes since commit 107eb964d8c04417e8bce9e9ec2ed61d9261aec6:
> 
>   Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2015-03-13 13:30:10 +0100)
> 
> are available in the git repository at:
> 
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo
> 
> for you to fetch changes up to 0c8c20779c5d56b93b8cb4cd30ba129a927ab437:
> 
>   perf report: Don't allow empty argument for '-t'. (2015-03-19 13:53:28 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Bash completion for subcommands (Yunlong Song)
> 
> - Allow annotating entries in callchains in the hists browser (top/report).
>   TODO: give some visual cue to what entries in callchains have samples and thus
>   can be annotated and/or allow showing the source code for functions without
>   samples (Arnaldo Carvalho de Melo)
> 
> - Don't allow empty argument for '-t' in perf report, fixing segfault (Wang Nan)
> 
> Infrastructure:
> 
> - Prep work for moving the perf feature tests build system to tools/build (Jiri Olsa)
> 
> - Fix perf-read-vdsox32 not building and lib64 install dir (H.J. Lu)
> 
> - ARM64: fix building error and eh/debug frame offset cache fixes (Wang Nan)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (4):
>       perf hists browser: Simplify symbol annotation menu setup
>       perf hists browser: Fix up some branch alignment
>       perf hists: Remove hist_entry->used, not used anymore
>       perf hists browser: Allow annotating entries in callchains
> 
> H.J. Lu (1):
>       perf tools: Fix perf-read-vdsox32 not building and lib64 install dir
> 
> Jiri Olsa (10):
>       perf build: Disable default check for libbabeltrace
>       perf build: Move features build output under features directory
>       perf build: Fix pthread-attr-setaffinity-np include in test-all
>       perf build: Get rid of LIB_INCLUDE variable
>       perf build: Rename CORE_FEATURE_TESTS to FEATURE_TESTS
>       perf build: Get rid of VF_FEATURE_TESTS
>       perf build: Rename display_lib into feature_display
>       perf build: Rename display_vf to feature_verbose
>       perf build: Rename PERF-FEATURES into FEATURE-DUMP
>       perf build: Rename feature_print_var_code to print_var_code
> 
> Wang Nan (3):
>       perf tools: Fix building error for arm64.
>       perf callchain: Separate eh/debug frame offset cache.
>       perf report: Don't allow empty argument for '-t'.
> 
> Yunlong Song (13):
>       perf tools: Fix the bash completion for listing options of perf subcommand
>       perf tools: Fix the bash completion for listing subsubcommands of perf subcommand
>       perf tools: Provide the right bash completion for listing options of perf subcommand subsubcommand
>       perf tools: Fix the bash completion for listing events of perf subcommand record|stat|top -e
>       perf tools: Fix the bash completion to support listing events for --event
>       perf tools: Fix the bash completion for listing subcommands of perf
>       perf tools: Add the bash completion for listing subsubcommands of perf data
>       perf tools: Add the bash completion for listing subsubcommands of perf help
>       perf tools: Add the bash completion for listing subsubcommands of perf script
>       perf tools: Add the bash completion for listing subsubcommands of perf test
>       perf tools: Add the bash completion for listing subsubcommands of perf timechart
>       perf tools: Add the bash completion for listing subsubcommands of perf trace
>       perf tools: Avoid confusion with preloaded bash function for perf bash completion
> 
>  tools/perf/Makefile.perf                    |   3 +-
>  tools/perf/builtin-data.c                   |   6 +-
>  tools/perf/builtin-help.c                   |  17 ++++-
>  tools/perf/builtin-report.c                 |   2 +-
>  tools/perf/builtin-script.c                 |   5 +-
>  tools/perf/builtin-timechart.c              |   7 +-
>  tools/perf/builtin-trace.c                  |   7 +-
>  tools/perf/config/Makefile                  | 111 ++++++++++++----------------
>  tools/perf/config/Makefile.arch             |   2 +-
>  tools/perf/config/feature-checks/Makefile   |   7 +-
>  tools/perf/config/feature-checks/test-all.c |  11 ++-
>  tools/perf/perf-completion.sh               |  88 +++++++++++++++++-----
>  tools/perf/tests/builtin-test.c             |   5 +-
>  tools/perf/tests/make                       |   2 +-
>  tools/perf/ui/browsers/annotate.c           |   8 +-
>  tools/perf/ui/browsers/hists.c              |  59 +++++++--------
>  tools/perf/util/dso.h                       |   3 +-
>  tools/perf/util/hist.c                      |   8 +-
>  tools/perf/util/hist.h                      |   9 +++
>  tools/perf/util/parse-options.c             |  21 +++++-
>  tools/perf/util/parse-options.h             |   2 +
>  tools/perf/util/sort.h                      |   1 -
>  tools/perf/util/unwind-libunwind.c          |   8 +-
>  23 files changed, 237 insertions(+), 155 deletions(-)

Pulled, thanks a lot Arnaldo!

	Ingo

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

* Re: [PATCH 14/31] perf build: Rename PERF-FEATURES into FEATURE-DUMP
  2015-03-19 17:04 ` [PATCH 14/31] perf build: Rename PERF-FEATURES into FEATURE-DUMP Arnaldo Carvalho de Melo
@ 2015-03-22 10:19   ` Ingo Molnar
  2015-03-23 10:57     ` Jiri Olsa
  2015-03-23 14:13     ` Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 35+ messages in thread
From: Ingo Molnar @ 2015-03-22 10:19 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Corey Ashford, David Ahern,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> From: Jiri Olsa <jolsa@kernel.org>
> 
> Preparing for feature checks separation, moving related stuff under
> 'FEATURE*' namespace.
> 
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
> Cc: David Ahern <david.ahern@oracle.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Link: http://lkml.kernel.org/n/tip-v9oo22ra70rrk1dy495a7bjc@git.kernel.org
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

So I think the various capital letter files in $(cwd) are highly 
suboptimal:

 FEATURE-DUMP
 PERF-CFLAGS
 PERF-VERSION-FILE

I think we should standardize on something less pushy (no shouting), 
plus more standardized, more logical, more coherent names, i.e. 
something like:

   .build.features.cache
   .build.cflags
   .build.version

?

.build.features.* would be reserved to the generic feature detection 
machinery.

.build.cflags and .build.version could be used by the perf build - 
hopefully exported to tools/build/ as well in the future! :-)

That way the .gitignore could just ignore .build.* and we'd not have 
to update it much.

Btw., another small nit: could we please do a (git-)rename of 
tools/build/feature/ to tools/build/features/?

Plural is what is used typically for generic frameworks that deal with 
a set of items (features in this case) - for example we have 
tools/tests/, and tools/perf/scripts/, not tools/test/ and 
tools/perf/script/.

Thanks,

	Ingo

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

* Re: [PATCH 14/31] perf build: Rename PERF-FEATURES into FEATURE-DUMP
  2015-03-22 10:19   ` Ingo Molnar
@ 2015-03-23 10:57     ` Jiri Olsa
  2015-03-23 14:13     ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 35+ messages in thread
From: Jiri Olsa @ 2015-03-23 10:57 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Arnaldo Carvalho de Melo, linux-kernel, Jiri Olsa, Corey Ashford,
	David Ahern, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo

On Sun, Mar 22, 2015 at 11:19:33AM +0100, Ingo Molnar wrote:
> 
> * Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> 
> > From: Jiri Olsa <jolsa@kernel.org>
> > 
> > Preparing for feature checks separation, moving related stuff under
> > 'FEATURE*' namespace.
> > 
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
> > Cc: David Ahern <david.ahern@oracle.com>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Cc: Paul Mackerras <paulus@samba.org>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Link: http://lkml.kernel.org/n/tip-v9oo22ra70rrk1dy495a7bjc@git.kernel.org
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> So I think the various capital letter files in $(cwd) are highly 
> suboptimal:
> 
>  FEATURE-DUMP
>  PERF-CFLAGS
>  PERF-VERSION-FILE

we no longer have the PERF-CFLAGS file:
  db8486626246 perf build: Remove PERF-CFLAGS file

forgot to update the .gitignore file, will do

> I think we should standardize on something less pushy (no shouting), 
> plus more standardized, more logical, more coherent names, i.e. 
> something like:
> 
>    .build.features.cache
>    .build.cflags
>    .build.version
> 
> ?
> 
> .build.features.* would be reserved to the generic feature detection 
> machinery.
> 
> .build.cflags and .build.version could be used by the perf build - 
> hopefully exported to tools/build/ as well in the future! :-)

ok, noted ;-)

> That way the .gitignore could just ignore .build.* and we'd not have 
> to update it much.

agreed

> 
> Btw., another small nit: could we please do a (git-)rename of 
> tools/build/feature/ to tools/build/features/?
> 
> Plural is what is used typically for generic frameworks that deal with 
> a set of items (features in this case) - for example we have 
> tools/tests/, and tools/perf/scripts/, not tools/test/ and 
> tools/perf/script/.

ok, I'll try to address all this in the next build update

jirka

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

* Re: [PATCH 14/31] perf build: Rename PERF-FEATURES into FEATURE-DUMP
  2015-03-22 10:19   ` Ingo Molnar
  2015-03-23 10:57     ` Jiri Olsa
@ 2015-03-23 14:13     ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 35+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-23 14:13 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, Corey Ashford, David Ahern,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra

Em Sun, Mar 22, 2015 at 11:19:33AM +0100, Ingo Molnar escreveu:
> 
> * Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> 
> > From: Jiri Olsa <jolsa@kernel.org>
> > 
> > Preparing for feature checks separation, moving related stuff under
> > 'FEATURE*' namespace.
> > 
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
> > Cc: David Ahern <david.ahern@oracle.com>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Cc: Paul Mackerras <paulus@samba.org>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Link: http://lkml.kernel.org/n/tip-v9oo22ra70rrk1dy495a7bjc@git.kernel.org
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> So I think the various capital letter files in $(cwd) are highly 
> suboptimal:
> 
>  FEATURE-DUMP
>  PERF-CFLAGS
>  PERF-VERSION-FILE
> 
> I think we should standardize on something less pushy (no shouting), 
> plus more standardized, more logical, more coherent names, i.e. 
> something like:
> 
>    .build.features.cache
>    .build.cflags
>    .build.version
> 
> ?
> 
> .build.features.* would be reserved to the generic feature detection 
> machinery.
> 
> .build.cflags and .build.version could be used by the perf build - 
> hopefully exported to tools/build/ as well in the future! :-)
> 
> That way the .gitignore could just ignore .build.* and we'd not have 
> to update it much.

Agreed, Jiri?
 
> Btw., another small nit: could we please do a (git-)rename of 
> tools/build/feature/ to tools/build/features/?

> Plural is what is used typically for generic frameworks that deal with 
> a set of items (features in this case) - for example we have 
> tools/tests/, and tools/perf/scripts/, not tools/test/ and 
> tools/perf/script/.

This one is easy enough, will do in my next pull req.

- Arnaldo

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

end of thread, other threads:[~2015-03-23 14:13 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 01/31] perf hists browser: Simplify symbol annotation menu setup Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 02/31] perf hists browser: Fix up some branch alignment Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 03/31] perf hists: Remove hist_entry->used, not used anymore Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 04/31] perf hists browser: Allow annotating entries in callchains Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 05/31] perf tools: Fix building error for arm64 Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 06/31] perf build: Disable default check for libbabeltrace Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 07/31] perf build: Move features build output under features directory Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 08/31] perf build: Fix pthread-attr-setaffinity-np include in test-all Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 09/31] perf build: Get rid of LIB_INCLUDE variable Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 10/31] perf build: Rename CORE_FEATURE_TESTS to FEATURE_TESTS Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 11/31] perf build: Get rid of VF_FEATURE_TESTS Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 12/31] perf build: Rename display_lib into feature_display Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 13/31] perf build: Rename display_vf to feature_verbose Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 14/31] perf build: Rename PERF-FEATURES into FEATURE-DUMP Arnaldo Carvalho de Melo
2015-03-22 10:19   ` Ingo Molnar
2015-03-23 10:57     ` Jiri Olsa
2015-03-23 14:13     ` Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 15/31] perf build: Rename feature_print_var_code to print_var_code Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 17/31] perf tools: Fix the bash completion for listing options of perf subcommand Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 18/31] perf tools: Fix the bash completion for listing subsubcommands " Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 19/31] perf tools: Provide the right bash completion for listing options of perf subcommand subsubcommand Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 20/31] perf tools: Fix the bash completion for listing events of perf subcommand record|stat|top -e Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 21/31] perf tools: Fix the bash completion to support listing events for --event Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 22/31] perf tools: Fix the bash completion for listing subcommands of perf Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 23/31] perf tools: Add the bash completion for listing subsubcommands of perf data Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 24/31] perf tools: Add the bash completion for listing subsubcommands of perf help Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 25/31] perf tools: Add the bash completion for listing subsubcommands of perf script Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 26/31] perf tools: Add the bash completion for listing subsubcommands of perf test Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 27/31] perf tools: Add the bash completion for listing subsubcommands of perf timechart Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 28/31] perf tools: Add the bash completion for listing subsubcommands of perf trace Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 29/31] perf tools: Avoid confusion with preloaded bash function for perf bash completion Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 30/31] perf callchain: Separate eh/debug frame offset cache Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 31/31] perf report: Don't allow empty argument for '-t' Arnaldo Carvalho de Melo
2015-03-22  9:55 ` [GIT PULL 00/31] perf/core improvements and fixes Ingo Molnar

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.