linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFCv2 0/8] perf tools: Add non-architectural event aliases
@ 2013-01-26 20:04 Jiri Olsa
  2013-01-26 20:04 ` [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token Jiri Olsa
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Jiri Olsa @ 2013-01-26 20:04 UTC (permalink / raw)
  To: linux-kernel

hi,
adding support to use non-architectural events in perf via name,
to be able to use them like:

$ perf stat -e 'cpu/IDQ.ALL_DSB_CYCLES/' ...
$ perf stat -e 'cpu/L2_STORE_LOCK_RQSTS.MISS/' ...
...

The perf list command displays current non-arch. events available:

$ perf list
...
  cpu/AGU_BYPASS_CANCEL.COUNT/                       [Kernel PMU event]
  cpu/ARITH.FPU_DIV/                                 [Kernel PMU event]
  cpu/ARITH.FPU_DIV_ACTIVE/                          [Kernel PMU event]
  cpu/BACLEARS.ANY/                                  [Kernel PMU event]
...

This version is dependent on precise changes:
http://marc.info/?l=linux-kernel&m=135922143117888&w=2

First version of this RFC is here:
http://marc.info/?l=linux-kernel&m=135575146128720&w=2

This version provides support for non-architectural events
aliasses being defined in sigle files, like for SandyBridge:

$ cat arch/x86/events/intel/snb | head -5
name=AGU_BYPASS_CANCEL.COUNT,event=0xb6,umask=0x1
name=ARITH.FPU_DIV_ACTIVE,event=0x14,umask=0x1
name=ARITH.FPU_DIV,event=0x14,umask=0x10401
name=BACLEARS.ANY,event=0xe6,umask=0x1f
...

So far this is still under testing and only SandyBridge and IvyBridge
events were added. I have no problem to add the rest of the archs.
when the shape of this is agreed.

Available also at:
  git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/linux.git
  perf/nonarch9

any comments are welcome,
jirka


---
Andi Kleen (1):
      perf tools: List kernel supplied event aliases in perf list v2

Jiri Olsa (7):
      perf tools: Add '.' as part of the event 'name' token
      perf tools: Change perf_pmu__new_alias function interface
      perf tools: Add name term processing for alias
      perf tools: Add pmu interface to parse single file of aliases
      perf tools: Add support to include non architectural event aliases
      perf tools: Add non arch events for SandyBridge microarchitecture
      perf tools: Add non arch events for IvyBridge micro architecture

 tools/perf/Documentation/perf-list.txt |   4 +-
 tools/perf/arch/x86/Makefile           |  11 ++++
 tools/perf/arch/x86/events/intel/ivb   | 248 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/arch/x86/events/intel/snb   | 274 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/arch/x86/util/pmu.c         | 125 ++++++++++++++++++++++++++++++++++++++++++
 tools/perf/builtin-list.c              |   3 +
 tools/perf/util/parse-events.c         |  24 ++------
 tools/perf/util/parse-events.l         |   4 +-
 tools/perf/util/pmu.c                  | 158 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 tools/perf/util/pmu.h                  |   9 +++
 10 files changed, 824 insertions(+), 36 deletions(-)

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

* [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token
  2013-01-26 20:04 [RFCv2 0/8] perf tools: Add non-architectural event aliases Jiri Olsa
@ 2013-01-26 20:04 ` Jiri Olsa
  2013-01-28 20:52   ` Stephane Eranian
  2013-01-26 20:04 ` [PATCH 2/8] perf tools: Change perf_pmu__new_alias function interface Jiri Olsa
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Jiri Olsa @ 2013-01-26 20:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Andi Kleen, Stephane Eranian

Adding '.' to be recognized as valid part of the event 'name'
token. Upcoming non architectural events use '.' as part
of the name.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/util/parse-events.l | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index 32a9000..4220093 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -80,8 +80,8 @@ event		[^,{}/]+
 num_dec		[0-9]+
 num_hex		0x[a-fA-F0-9]+
 num_raw_hex	[a-fA-F0-9]+
-name		[a-zA-Z_*?][a-zA-Z0-9_*?]*
-name_minus	[a-zA-Z_*?][a-zA-Z0-9\-_*?]*
+name		[a-zA-Z_*?][a-zA-Z0-9_*?\.]*
+name_minus	[a-zA-Z_*?][a-zA-Z0-9\-_*?\.]*
 modifier_event	[ukhpGH]+
 modifier_bp	[rwx]{1,3}
 
-- 
1.7.11.7


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

* [PATCH 2/8] perf tools: Change perf_pmu__new_alias function interface
  2013-01-26 20:04 [RFCv2 0/8] perf tools: Add non-architectural event aliases Jiri Olsa
  2013-01-26 20:04 ` [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token Jiri Olsa
@ 2013-01-26 20:04 ` Jiri Olsa
  2013-01-26 20:04 ` [PATCH 3/8] perf tools: Add name term processing for alias Jiri Olsa
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Jiri Olsa @ 2013-01-26 20:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Andi Kleen, Stephane Eranian

Changing perf_pmu__new_alias interface not to work directly with
FILE object, so it can be reused by other code paths coming in
shortly.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/util/pmu.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 4c6f9c4..f7852e9 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -95,23 +95,17 @@ static int pmu_format(char *name, struct list_head *format)
 	return 0;
 }
 
-static int perf_pmu__new_alias(struct list_head *list, char *name, FILE *file)
+static int perf_pmu__new_alias(struct list_head *list, char *name, char *data)
 {
 	struct perf_pmu_alias *alias;
-	char buf[256];
 	int ret;
 
-	ret = fread(buf, 1, sizeof(buf), file);
-	if (ret == 0)
-		return -EINVAL;
-	buf[ret] = 0;
-
 	alias = malloc(sizeof(*alias));
 	if (!alias)
 		return -ENOMEM;
 
 	INIT_LIST_HEAD(&alias->terms);
-	ret = parse_events_terms(&alias->terms, buf);
+	ret = parse_events_terms(&alias->terms, data);
 	if (ret) {
 		free(alias);
 		return ret;
@@ -137,7 +131,7 @@ static int pmu_aliases_parse(char *dir, struct list_head *head)
 		return -EINVAL;
 
 	while (!ret && (evt_ent = readdir(event_dir))) {
-		char path[PATH_MAX];
+		char path[PATH_MAX], buf[256];
 		char *name = evt_ent->d_name;
 		FILE *file;
 
@@ -150,7 +144,16 @@ static int pmu_aliases_parse(char *dir, struct list_head *head)
 		file = fopen(path, "r");
 		if (!file)
 			break;
-		ret = perf_pmu__new_alias(head, name, file);
+
+		ret = fread(buf, 1, sizeof(buf), file);
+		if (ret == 0) {
+			ret = -EINVAL;
+			break;
+		}
+
+		buf[ret] = 0;
+
+		ret = perf_pmu__new_alias(head, name, buf);
 		fclose(file);
 	}
 
-- 
1.7.11.7


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

* [PATCH 3/8] perf tools: Add name term processing for alias
  2013-01-26 20:04 [RFCv2 0/8] perf tools: Add non-architectural event aliases Jiri Olsa
  2013-01-26 20:04 ` [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token Jiri Olsa
  2013-01-26 20:04 ` [PATCH 2/8] perf tools: Change perf_pmu__new_alias function interface Jiri Olsa
@ 2013-01-26 20:04 ` Jiri Olsa
  2013-01-26 20:04 ` [PATCH 4/8] perf tools: Add pmu interface to parse single file of aliases Jiri Olsa
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Jiri Olsa @ 2013-01-26 20:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Andi Kleen, Stephane Eranian

Adding support for name term being specified within
the alias definition and gives the name for the alias.

Alias could be now defined like:
  name=BR_MISP_EXEC.ALL_BRANCHES,event=0x89,umask=0xff

It'll be handy for having single file with multiple
alias definitions.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/util/parse-events.c | 19 ++-----------------
 tools/perf/util/pmu.c          | 35 +++++++++++++++++++++++++++++++++++
 tools/perf/util/pmu.h          |  3 +++
 3 files changed, 40 insertions(+), 17 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 83362f2..0143c90 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -616,22 +616,6 @@ int parse_events_add_numeric(struct list_head **list, int *idx,
 	return add_event(list, idx, &attr, NULL);
 }
 
-static int parse_events__is_name_term(struct parse_events_term *term)
-{
-	return term->type_term == PARSE_EVENTS__TERM_TYPE_NAME;
-}
-
-static char *pmu_event_name(struct list_head *head_terms)
-{
-	struct parse_events_term *term;
-
-	list_for_each_entry(term, head_terms, list)
-		if (parse_events__is_name_term(term))
-			return term->val.str;
-
-	return NULL;
-}
-
 int parse_events_add_pmu(struct list_head **list, int *idx,
 			 char *name, struct list_head *head_config)
 {
@@ -656,7 +640,8 @@ int parse_events_add_pmu(struct list_head **list, int *idx,
 	if (perf_pmu__config(pmu, &attr, head_config))
 		return -EINVAL;
 
-	return __add_event(list, idx, &attr, pmu_event_name(head_config),
+	return __add_event(list, idx, &attr,
+			   perf_pmu__event_name(head_config, false),
 			   pmu->cpus);
 }
 
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index f7852e9..0d45ccd 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -95,6 +95,27 @@ static int pmu_format(char *name, struct list_head *format)
 	return 0;
 }
 
+static int parse_events__is_name_term(struct parse_events_term *term)
+{
+	return term->type_term == PARSE_EVENTS__TERM_TYPE_NAME;
+}
+
+char *perf_pmu__event_name(struct list_head *head_terms, bool remove)
+{
+	struct parse_events_term *term;
+
+	list_for_each_entry(term, head_terms, list)
+		if (parse_events__is_name_term(term)) {
+			if (remove) {
+				list_del(&term->list);
+				free(term);
+			}
+			return term->val.str;
+		}
+
+	return NULL;
+}
+
 static int perf_pmu__new_alias(struct list_head *list, char *name, char *data)
 {
 	struct perf_pmu_alias *alias;
@@ -111,6 +132,20 @@ static int perf_pmu__new_alias(struct list_head *list, char *name, char *data)
 		return ret;
 	}
 
+	/*
+	 * Use NAME term to get alias name. In case there's no name
+	 * at all, bail out. In case we find NAME term, remove it
+	 * not to mangle with event term name.
+	 */
+	if (!name) {
+		name = perf_pmu__event_name(&alias->terms, true);
+
+		if (!name) {
+			free(alias);
+			return -EINVAL;
+		}
+	}
+
 	alias->name = strdup(name);
 	list_add_tail(&alias->list, list);
 	return 0;
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 32fe55b..54cd809 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -3,6 +3,7 @@
 
 #include <linux/bitops.h>
 #include <linux/perf_event.h>
+#include <stdbool.h>
 
 enum {
 	PERF_PMU_FORMAT_VALUE_CONFIG,
@@ -40,5 +41,7 @@ int perf_pmu__format_parse(char *dir, struct list_head *head);
 
 struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu);
 
+char *perf_pmu__event_name(struct list_head *head_terms, bool remove);
+
 int perf_pmu__test(void);
 #endif /* __PMU_H */
-- 
1.7.11.7


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

* [PATCH 4/8] perf tools: Add pmu interface to parse single file of aliases
  2013-01-26 20:04 [RFCv2 0/8] perf tools: Add non-architectural event aliases Jiri Olsa
                   ` (2 preceding siblings ...)
  2013-01-26 20:04 ` [PATCH 3/8] perf tools: Add name term processing for alias Jiri Olsa
@ 2013-01-26 20:04 ` Jiri Olsa
  2013-01-26 20:04 ` [PATCH 5/8] perf tools: Add support to include non architectural event aliases Jiri Olsa
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Jiri Olsa @ 2013-01-26 20:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Andi Kleen, Stephane Eranian

Adding pmu_aliases_parse_multi function to parse and add
aliases from single file. The file format follows the
alias format, each line for single alias. Each line
must contains 'name' term, like:

  name=BR_MISP_EXEC.ALL_BRANCHES,event=0x89,umask=0xff
  name=BR_MISP_EXEC.COND,event=0x89,umask=0x1

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/util/pmu.c | 23 +++++++++++++++++++++++
 tools/perf/util/pmu.h |  2 ++
 2 files changed, 25 insertions(+)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 0d45ccd..68d6c86 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -146,11 +146,34 @@ static int perf_pmu__new_alias(struct list_head *list, char *name, char *data)
 		}
 	}
 
+	pr_debug3("adding alias '%s' => '%s'\n", name, data);
+
 	alias->name = strdup(name);
 	list_add_tail(&alias->list, list);
 	return 0;
 }
 
+int pmu_aliases_parse_multi(char *path, struct list_head *head)
+{
+	FILE *file;
+	char *data = NULL;
+	size_t len;
+	int ret = -EINVAL;
+
+	file = fopen(path, "r");
+	if (!file)
+		return -EINVAL;
+
+	while ((getline(&data, &len, file)) != -1) {
+		ret = perf_pmu__new_alias(head, NULL, data);
+		free(data);
+		data = NULL;
+	}
+
+	fclose(file);
+	return ret;
+}
+
 /*
  * Process all the sysfs attributes located under the directory
  * specified in 'dir' parameter.
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 54cd809..add249b 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -43,5 +43,7 @@ struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu);
 
 char *perf_pmu__event_name(struct list_head *head_terms, bool remove);
 
+int pmu_aliases_parse_multi(char *path, struct list_head *head);
+
 int perf_pmu__test(void);
 #endif /* __PMU_H */
-- 
1.7.11.7


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

* [PATCH 5/8] perf tools: Add support to include non architectural event aliases
  2013-01-26 20:04 [RFCv2 0/8] perf tools: Add non-architectural event aliases Jiri Olsa
                   ` (3 preceding siblings ...)
  2013-01-26 20:04 ` [PATCH 4/8] perf tools: Add pmu interface to parse single file of aliases Jiri Olsa
@ 2013-01-26 20:04 ` Jiri Olsa
  2013-01-26 20:04 ` [PATCH 6/8] perf tools: Add non arch events for SandyBridge microarchitecture Jiri Olsa
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Jiri Olsa @ 2013-01-26 20:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Andi Kleen, Stephane Eranian

Adding support to parse non architectural event aliases
for given cpu. These aliases will be provided as single
files parsed by pmu_aliases_parse_multi function.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/arch/x86/Makefile   |   7 +++
 tools/perf/arch/x86/util/pmu.c | 121 +++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/pmu.c          |  16 ++++--
 tools/perf/util/pmu.h          |   2 +
 4 files changed, 141 insertions(+), 5 deletions(-)
 create mode 100644 tools/perf/arch/x86/util/pmu.c

diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
index 815841c..c175f65 100644
--- a/tools/perf/arch/x86/Makefile
+++ b/tools/perf/arch/x86/Makefile
@@ -6,3 +6,10 @@ ifndef NO_LIBUNWIND
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind.o
 endif
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
+LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/pmu.o
+
+$(OUTPUT)$(OUTPUT)arch/$(ARCH)/util/pmu.o: $(OUTPUT)arch/$(ARCH)/util/pmu.c $(OUTPUT)PERF-CFLAGS
+	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
+	 '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \
+	 '-DPREFIX="$(prefix_SQ)"' \
+	 $<
diff --git a/tools/perf/arch/x86/util/pmu.c b/tools/perf/arch/x86/util/pmu.c
new file mode 100644
index 0000000..a37da52
--- /dev/null
+++ b/tools/perf/arch/x86/util/pmu.c
@@ -0,0 +1,121 @@
+
+#include <linux/compiler.h>
+#include <linux/kernel.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include "pmu.h"
+#include "util.h"
+#include "sysfs.h"
+
+static int add_aliases(struct list_head *head, char *path, const char **files)
+{
+	char file[PATH_MAX];
+	int ret = 0;
+
+	while (!ret && *files) {
+		scnprintf(file, PATH_MAX, "%s/%s", path, *files);
+		ret = pmu_aliases_parse_multi(file, head);
+		files++;
+	}
+
+	return ret;
+}
+
+#define ADD_ALIASES(...)				\
+do {							\
+	const char *__files[] = { __VA_ARGS__ , NULL };	\
+	return add_aliases(head, path, __files);	\
+} while (0)
+
+static int get_path(const char *vendor, char *path, int size)
+{
+	struct stat st;
+
+	/* try local one first */
+	scnprintf(path, size, "./arch/x86/events/%s/", vendor);
+
+	if (stat(path, &st) < 0) {
+		/* and installed later */
+		scnprintf(path, size, "%s/%s/events/x86/%s/",
+			  PREFIX, PERF_EXEC_PATH, vendor);
+
+		if (stat(path, &st) < 0)
+			return -1;
+	}
+
+	return 0;
+}
+
+static int intel_aliases(struct list_head *head, unsigned model)
+{
+	char path[PATH_MAX];
+
+	if (get_path("intel", path, PATH_MAX))
+		return -1;
+
+	switch (model) {
+	default:
+		ADD_ALIASES("");
+		break;
+	}
+
+	return 0;
+}
+
+static int cpu_specs(unsigned *vendor, unsigned *model)
+{
+	FILE *file;
+	struct stat st;
+	char path[PATH_MAX];
+	int ret = 0;
+
+	scnprintf(path, PATH_MAX, "%s/devices/system/cpu/modalias",
+		  sysfs_find_mountpoint());
+
+	if (stat(path, &st) < 0)
+		return -ENOENT;
+
+	file = fopen(path, "r");
+	if (!file)
+		return -errno;
+
+	if (2 != fscanf(file, "x86cpu:vendor:%X:family:%*X:model:%X:",
+			vendor, model))
+		ret = -1;
+
+	fclose(file);
+	return ret;
+}
+
+static int cpu_aliases(struct list_head *head)
+{
+	unsigned vendol, model;
+	int ret;
+
+	ret = cpu_specs(&vendol, &model);
+	if (ret) {
+		pr_info("failed to get cpu aliases");
+		return 0;
+	}
+
+	switch (vendol) {
+	/* Intel */
+	case 0:
+		return intel_aliases(head, model);
+	default:
+		/* unknown vendor.. plenty to cover ;-) */
+		return 0;
+	}
+
+	return 0;
+}
+
+int arch_pmu_aliases(char *name, struct list_head *head)
+{
+	if (!strcmp(name, "cpu"))
+		return cpu_aliases(head);
+
+	return 0;
+}
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 68d6c86..7c2908b 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -219,6 +219,13 @@ static int pmu_aliases_parse(char *dir, struct list_head *head)
 	return ret;
 }
 
+__attribute__((weak))
+int arch_pmu_aliases(char *name __maybe_unused,
+		     struct list_head *head __maybe_unused)
+{
+	return 0;
+}
+
 /*
  * Reading the pmu event aliases definition, which should be located at:
  * /sys/bus/event_source/devices/<dev>/events as sysfs group attributes.
@@ -236,13 +243,12 @@ static int pmu_aliases(char *name, struct list_head *head)
 	snprintf(path, PATH_MAX,
 		 "%s/bus/event_source/devices/%s/events", sysfs, name);
 
-	if (stat(path, &st) < 0)
-		return 0;	 /* no error if 'events' does not exist */
-
-	if (pmu_aliases_parse(path, head))
+	/* no error if 'events' does not exist */
+	if (!stat(path, &st) &&
+	    pmu_aliases_parse(path, head))
 		return -1;
 
-	return 0;
+	return arch_pmu_aliases(name, head);
 }
 
 static int pmu_alias_terms(struct perf_pmu_alias *alias,
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index add249b..aa049ea 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -45,5 +45,7 @@ char *perf_pmu__event_name(struct list_head *head_terms, bool remove);
 
 int pmu_aliases_parse_multi(char *path, struct list_head *head);
 
+int arch_pmu_aliases(char *name, struct list_head *head);
+
 int perf_pmu__test(void);
 #endif /* __PMU_H */
-- 
1.7.11.7


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

* [PATCH 6/8] perf tools: Add non arch events for SandyBridge microarchitecture
  2013-01-26 20:04 [RFCv2 0/8] perf tools: Add non-architectural event aliases Jiri Olsa
                   ` (4 preceding siblings ...)
  2013-01-26 20:04 ` [PATCH 5/8] perf tools: Add support to include non architectural event aliases Jiri Olsa
@ 2013-01-26 20:04 ` Jiri Olsa
  2013-01-26 20:04 ` [PATCH 7/8] perf tools: Add non arch events for IvyBridge micro architecture Jiri Olsa
  2013-01-26 20:04 ` [PATCH 8/8] perf tools: List kernel supplied event aliases in perf list v2 Jiri Olsa
  7 siblings, 0 replies; 17+ messages in thread
From: Jiri Olsa @ 2013-01-26 20:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Andi Kleen, Stephane Eranian

Adding non architectural event aliases for SandyBridge
micro architecture.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/arch/x86/Makefile         |   4 +
 tools/perf/arch/x86/events/intel/snb | 274 +++++++++++++++++++++++++++++++++++
 tools/perf/arch/x86/util/pmu.c       |   4 +-
 3 files changed, 281 insertions(+), 1 deletion(-)
 create mode 100644 tools/perf/arch/x86/events/intel/snb

diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
index c175f65..1db3f56 100644
--- a/tools/perf/arch/x86/Makefile
+++ b/tools/perf/arch/x86/Makefile
@@ -13,3 +13,7 @@ $(OUTPUT)$(OUTPUT)arch/$(ARCH)/util/pmu.o: $(OUTPUT)arch/$(ARCH)/util/pmu.c $(OU
 	 '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \
 	 '-DPREFIX="$(prefix_SQ)"' \
 	 $<
+
+install:
+	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/events/x86/intel/'
+	$(INSTALL) -m 644 arch/$(ARCH)/events/intel/* $(DESTDIR_SQ)$(perfexec_instdir_SQ)/events/x86/intel/
diff --git a/tools/perf/arch/x86/events/intel/snb b/tools/perf/arch/x86/events/intel/snb
new file mode 100644
index 0000000..8b0400a
--- /dev/null
+++ b/tools/perf/arch/x86/events/intel/snb
@@ -0,0 +1,274 @@
+name=AGU_BYPASS_CANCEL.COUNT,event=0xb6,umask=0x1
+name=ARITH.FPU_DIV_ACTIVE,event=0x14,umask=0x1
+name=ARITH.FPU_DIV,event=0x14,umask=0x10401
+name=BACLEARS.ANY,event=0xe6,umask=0x1f
+name=BR_INST_EXEC.NONTAKEN_COND,event=0x88,umask=0x41
+name=BR_INST_EXEC.TAKEN_COND,event=0x88,umask=0x81
+name=BR_INST_EXEC.NONTAKEN_DIRECT_JUMP,event=0x88,umask=0x42
+name=BR_INST_EXEC.TAKEN_DIRECT_JUMP,event=0x88,umask=0x82
+name=BR_INST_EXEC.NONTAKEN_INDIRECT_JUMP_NON_CALL_RET,event=0x88,umask=0x44
+name=BR_INST_EXEC.TAKEN_INDIRECT_JUMP_NON_CALL_RET,event=0x88,umask=0x84
+name=BR_INST_EXEC.TAKEN_RETURN_NEAR,event=0x88,umask=0x88
+name=BR_INST_EXEC.TAKEN_DIRECT_NEAR_CALL,event=0x88,umask=0x90
+name=BR_INST_EXEC.TAKEN_INDIRECT_NEAR_CALL,event=0x88,umask=0xa0
+name=BR_INST_EXEC.ALL_BRANCHES,event=0x88,umask=0xff
+name=BR_INST_EXEC.ALL_CONDITIONAL,event=0x88,umask=0xc1
+name=BR_INST_EXEC.ANY_COND,event=0x88,umask=0xc1
+name=BR_INST_EXEC.ANY_INDIRECT_JUMP_NON_CALL_RET,event=0x88,umask=0xc4
+name=BR_INST_EXEC.ANY_DIRECT_NEAR_CALL,event=0x88,umask=0xd0
+name=BR_INST_RETIRED.ALL_BRANCHES,event=0xc4,umask=0x4,precise
+name=BR_INST_RETIRED.CONDITIONAL,event=0xc4,umask=0x1,precise
+name=BR_INST_RETIRED.FAR_BRANCH,event=0xc4,umask=0x40,precise
+name=BR_INST_RETIRED.NEAR_CALL,event=0xc4,umask=0x2,precise
+name=BR_INST_RETIRED.NEAR_RETURN,event=0xc4,umask=0x8,precise
+name=BR_INST_RETIRED.NEAR_TAKEN,event=0xc4,umask=0x20,precise
+name=BR_INST_RETIRED.NOT_TAKEN,event=0xc4,umask=0x10,precise
+name=BR_MISP_EXEC.NONTAKEN_COND,event=0x89,umask=0x41
+name=BR_MISP_EXEC.TAKEN_COND,event=0x89,umask=0x81
+name=BR_MISP_EXEC.NONTAKEN_INDIRECT_JUMP_NON_CALL_RET,event=0x89,umask=0x44
+name=BR_MISP_EXEC.TAKEN_INDIRECT_JUMP_NON_CALL_RET,event=0x89,umask=0x84
+name=BR_MISP_EXEC.NONTAKEN_RETURN_NEAR,event=0x89,umask=0x48
+name=BR_MISP_EXEC.TAKEN_RETURN_NEAR,event=0x89,umask=0x88
+name=BR_MISP_EXEC.NONTAKEN_DIRECT_NEAR_CALL,event=0x89,umask=0x50
+name=BR_MISP_EXEC.TAKEN_DIRECT_NEAR_CALL,event=0x89,umask=0x90
+name=BR_MISP_EXEC.NONTAKEN_INDIRECT_NEAR_CALL,event=0x89,umask=0x60
+name=BR_MISP_EXEC.TAKEN_INDIRECT_NEAR_CALL,event=0x89,umask=0xa0
+name=BR_MISP_EXEC.ANY_COND,event=0x89,umask=0xc1
+name=BR_MISP_EXEC.ANY_RETURN_NEAR,event=0x89,umask=0xc8
+name=BR_MISP_EXEC.ANY_DIRECT_NEAR_CALL,event=0x89,umask=0xd0
+name=BR_MISP_EXEC.ANY_INDIRECT_JUMP_NON_CALL_RET,event=0x89,umask=0xc4
+name=BR_MISP_EXEC.ALL_BRANCHES,event=0x89,umask=0xff
+name=BR_MISP_RETIRED.ALL_BRANCHES,event=0xc5,umask=0x4,precise
+name=BR_MISP_RETIRED.CONDITIONAL,event=0xc5,umask=0x1,precise
+name=BR_MISP_RETIRED.NEAR_CALL,event=0xc5,umask=0x2,precise
+name=BR_MISP_RETIRED.NOT_TAKEN,event=0xc5,umask=0x10,precise
+name=BR_MISP_RETIRED.TAKEN,event=0xc5,umask=0x20,precise
+name=LOCK_CYCLES.SPLIT_LOCK_UC_LOCK_DURATION,event=0x63,umask=0x1
+name=LOCK_CYCLES.CACHE_LOCK_DURATION,event=0x63,umask=0x2
+name=CPL_CYCLES.RING0,event=0x5c,umask=0x1
+name=CPL_CYCLES.RING0_TRANS,event=0x5c,umask=0x10401
+name=CPL_CYCLES.RING123,event=0x5c,umask=0x2
+name=CPU_CLK_UNHALTED.REF_P,event=0x3c,umask=0x1
+name=CPU_CLK_UNHALTED.THREAD_P,event=0x3c,umask=0x0
+name=DSB2MITE_SWITCHES.COUNT,event=0xab,umask=0x1
+name=DSB2MITE_SWITCHES.PENALTY_CYCLES,event=0xab,umask=0x2
+name=DSB_FILL.ALL_CANCEL,event=0xac,umask=0xa
+name=DSB_FILL.EXCEED_DSB_LINES,event=0xac,umask=0x8
+name=DSB_FILL.OTHER_CANCEL,event=0xac,umask=0x2
+name=DTLB_LOAD_MISSES.MISS_CAUSES_A_WALK,event=0x8,umask=0x1
+name=DTLB_LOAD_MISSES.CAUSES_A_WALK,event=0x8,umask=0x1
+name=DTLB_LOAD_MISSES.STLB_HIT,event=0x8,umask=0x10
+name=DTLB_LOAD_MISSES.WALK_COMPLETED,event=0x8,umask=0x2
+name=DTLB_LOAD_MISSES.WALK_DURATION,event=0x8,umask=0x4
+name=DTLB_STORE_MISSES.MISS_CAUSES_A_WALK,event=0x49,umask=0x1
+name=DTLB_STORE_MISSES.CAUSES_A_WALK,event=0x49,umask=0x1
+name=DTLB_STORE_MISSES.STLB_HIT,event=0x49,umask=0x10
+name=DTLB_STORE_MISSES.WALK_COMPLETED,event=0x49,umask=0x2
+name=DTLB_STORE_MISSES.WALK_DURATION,event=0x49,umask=0x4
+name=FP_ASSIST.ANY,event=0xca,umask=0x1e
+name=FP_ASSIST.SIMD_INPUT,event=0xca,umask=0x10
+name=FP_ASSIST.SIMD_OUTPUT,event=0xca,umask=0x8
+name=FP_ASSIST.X87_INPUT,event=0xca,umask=0x4
+name=FP_ASSIST.X87_OUTPUT,event=0xca,umask=0x2
+name=FP_COMP_OPS_EXE.X87,event=0x10,umask=0x1
+name=FP_COMP_OPS_EXE.SSE_FP_PACKED_DOUBLE,event=0x10,umask=0x10
+name=FP_COMP_OPS_EXE.SSE_FP_SCALAR_SINGLE,event=0x10,umask=0x20
+name=FP_COMP_OPS_EXE.SSE_PACKED_SINGLE,event=0x10,umask=0x40
+name=FP_COMP_OPS_EXE.SSE_SCALAR_DOUBLE,event=0x10,umask=0x80
+name=HW_INTERRUPTS.RECEIVED,event=0xcb,umask=0x1
+name=HW_PRE_REQ.L1D_MISS,event=0x4e,umask=0x2
+name=ICACHE.MISSES,event=0x80,umask=0x2
+name=IDQ.EMPTY,event=0x79,umask=0x2
+name=IDQ.MITE_UOPS,event=0x79,umask=0x4
+name=IDQ.DSB_UOPS,event=0x79,umask=0x8
+name=IDQ.MS_DSB_UOPS,event=0x79,umask=0x10
+name=IDQ.MS_MITE_UOPS,event=0x79,umask=0x20
+name=IDQ.MS_UOPS,event=0x79,umask=0x30
+name=IDQ.MITE_UOPS_CYCLES,event=0x79,umask=0x10004
+name=IDQ.DSB_UOPS_CYCLES,event=0x79,umask=0x10008
+name=IDQ.MS_DSB_UOPS_CYCLES,event=0x79,umask=0x10010
+name=IDQ.MS_MITE_UOPS_CYCLES,event=0x79,umask=0x10020
+name=IDQ.MS_UOPS_CYCLES,event=0x79,umask=0x10030
+name=IDQ.ALL_DSB_UOPS,event=0x79,umask=0x18
+name=IDQ.ALL_DSB_CYCLES,event=0x79,umask=0x10018
+name=IDQ.ALL_MITE_UOPS,event=0x79,umask=0x24
+name=IDQ.ALL_MITE_CYCLES,event=0x79,umask=0x10024
+name=IDQ.ANY_UOPS,event=0x79,umask=0x3c
+name=IDQ.MS_DSB_UOPS_OCCUR,event=0x79,umask=0x10410
+name=IDQ_UOPS_NOT_DELIVERED.CORE,event=0x9c,umask=0x1
+name=ILD_STALL.LCP,event=0x87,umask=0x1
+name=ILD_STALL.IQ_FULL,event=0x87,umask=0x4
+name=INSTS_WRITTEN_TO_IQ.INSTS,event=0x17,umask=0x1
+name=INST_RETIRED.ANY_P,event=0xc0,umask=0x0
+name=INST_RETIRED.PREC_DIST,event=0xc0,umask=0x1,precise
+name=INT_MISC.RAT_STALL_CYCLES,event=0xd,umask=0x40
+name=INT_MISC.RECOVERY_CYCLES,event=0xd,umask=0x10003
+name=INT_MISC.RECOVERY_STALLS_COUNT,event=0xd,umask=0x10403
+name=ITLB.ITLB_FLUSH,event=0xae,umask=0x1
+name=ITLB.FLUSH,event=0xae,umask=0x1
+name=ITLB_MISSES.MISS_CAUSES_A_WALK,event=0x85,umask=0x1
+name=ITLB_MISSES.CAUSES_A_WALK,event=0x85,umask=0x1
+name=ITLB_MISSES.STLB_HIT,event=0x85,umask=0x10
+name=ITLB_MISSES.WALK_COMPLETED,event=0x85,umask=0x2
+name=ITLB_MISSES.WALK_DURATION,event=0x85,umask=0x4
+name=L1D.ALLOCATED_IN_M,event=0x51,umask=0x2
+name=L1D.ALL_M_REPLACEMENT,event=0x51,umask=0x8
+name=L1D.M_EVICT,event=0x51,umask=0x4
+name=L1D.REPLACEMENT,event=0x51,umask=0x1
+name=L1D_BLOCKS.BANK_CONFLICT,event=0xbf,umask=0x1
+name=L1D_BLOCKS.BANK_CONFLICT_CYCLES,event=0xbf,umask=0x5
+name=L1D_PEND_MISS.OCCURRENCES,event=0x48,umask=0x10401
+name=L1D_PEND_MISS.EDGE,event=0x48,umask=0x10401
+name=L1D_PEND_MISS.PENDING,event=0x48,umask=0x1
+name=L1D_PEND_MISS.PENDING_CYCLES,event=0x48,umask=0x10001
+name=L2_L1D_WB_RQSTS.HIT_E,event=0x28,umask=0x4
+name=L2_L1D_WB_RQSTS.HIT_M,event=0x28,umask=0x8
+name=L2_LINES_IN.ANY,event=0xf1,umask=0x7
+name=L2_LINES_IN.E,event=0xf1,umask=0x4
+name=L2_LINES_IN.I,event=0xf1,umask=0x1
+name=L2_LINES_IN.S,event=0xf1,umask=0x2
+name=L2_LINES_OUT.DEMAND_CLEAN,event=0xf2,umask=0x1
+name=L2_LINES_OUT.DEMAND_DIRTY,event=0xf2,umask=0x2
+name=L2_LINES_OUT.PREFETCH_CLEAN,event=0xf2,umask=0x4
+name=L2_LINES_OUT.PREFETCH_DIRTY,event=0xf2,umask=0x8
+name=L2_LINES_OUT.DIRTY_ANY,event=0xf2,umask=0xa
+name=L2_RQSTS.ALL_CODE_RD,event=0x24,umask=0x30
+name=L2_RQSTS.CODE_RD_HIT,event=0x24,umask=0x10
+name=L2_RQSTS.CODE_RD_MISS,event=0x24,umask=0x20
+name=L2_RQSTS.ALL_DEMAND_DATA_RD,event=0x24,umask=0x3
+name=L2_RQSTS.ALL_DEMAND_RD_HIT,event=0x24,umask=0x1
+name=L2_RQSTS.ALL_PF,event=0x24,umask=0xc0
+name=L2_RQSTS.PF_HIT,event=0x24,umask=0x40
+name=L2_RQSTS.PF_MISS,event=0x24,umask=0x80
+name=L2_RQSTS.RFO_ANY,event=0x24,umask=0xc
+name=L2_RQSTS.RFO_HITS,event=0x24,umask=0x4
+name=L2_RQSTS.RFO_MISS,event=0x24,umask=0x8
+name=L2_STORE_LOCK_RQSTS.HIT_E,event=0x27,umask=0x4
+name=L2_STORE_LOCK_RQSTS.MISS,event=0x27,umask=0x1
+name=L2_STORE_LOCK_RQSTS.HIT_M,event=0x27,umask=0x8
+name=L2_STORE_LOCK_RQSTS.ALL,event=0x27,umask=0xf
+name=L2_TRANS.ALL,event=0xf0,umask=0x80
+name=L2_TRANS.CODE_RD,event=0xf0,umask=0x4
+name=L2_TRANS.L1D_WB,event=0xf0,umask=0x10
+name=L2_TRANS.LOAD,event=0xf0,umask=0x1
+name=L2_TRANS.L2_FILL,event=0xf0,umask=0x20
+name=L2_TRANS.L2_WB,event=0xf0,umask=0x40
+name=L2_TRANS.ALL_PREFETCH,event=0xf0,umask=0x8
+name=L2_TRANS.RFO,event=0xf0,umask=0x2
+name=LD_BLOCKS.DATA_UNKNOWN,event=0x3,umask=0x1
+name=LD_BLOCKS.STORE_FORWARD,event=0x3,umask=0x2
+name=LD_BLOCKS.NO_SR,event=0x3,umask=0x8
+name=LD_BLOCKS.ALL_BLOCK,event=0x3,umask=0x10
+name=LD_BLOCKS_PARTIAL.ADDRESS_ALIAS,event=0x7,umask=0x1
+name=LD_BLOCKS_PARTIAL.ALL_STA_BLOCK,event=0x7,umask=0x8
+name=LOAD_HIT_PRE.HW_PF,event=0x4c,umask=0x2
+name=LOAD_HIT_PRE.SW_PF,event=0x4c,umask=0x1
+name=L3_LAT_CACHE.MISS,event=0x2e,umask=0x1
+name=L3_LAT_CACHE.REFERENCE,event=0x2e,umask=0x2
+name=MACHINE_CLEARS.MASKMOV,event=0xc3,umask=0x20
+name=MACHINE_CLEARS.MEMORY_ORDERING,event=0xc3,umask=0x2
+name=MACHINE_CLEARS.SMC,event=0xc3,umask=0x4
+name=MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_HIT,event=0xd2,umask=0x2,precise
+name=MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_HITM,event=0xd2,umask=0x4,precise
+name=MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_MISS,event=0xd2,umask=0x1,precise
+name=MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_NONE,event=0xd2,umask=0x8,precise
+name=MEM_LOAD_LLC_HIT_RETIRED.XSNP_HIT,event=0xd2,umask=0x2,precise
+name=MEM_LOAD_LLC_HIT_RETIRED.XSNP_HITM,event=0xd2,umask=0x4,precise
+name=MEM_LOAD_LLC_HIT_RETIRED.XSNP_MISS,event=0xd2,umask=0x1,precise
+name=MEM_LOAD_LLC_HIT_RETIRED.XSNP_NONE,event=0xd2,umask=0x8,precise
+name=MEM_LOAD_UOPS_MISC_RETIRED.LLC_MISS,event=0xd4,umask=0x2,precise
+name=MEM_LOAD_MISC_RETIRED.LLC_MISS,event=0xd4,umask=0x2,precise
+name=MEM_LOAD_UOPS_RETIRED.HIT_LFB,event=0xd1,umask=0x40,precise
+name=MEM_LOAD_UOPS_RETIRED.L1_HIT,event=0xd1,umask=0x1,precise
+name=MEM_LOAD_UOPS_RETIRED.L2_HIT,event=0xd1,umask=0x2,precise
+name=MEM_LOAD_UOPS_RETIRED.L3_HIT,event=0xd1,umask=0x4,precise
+name=MEM_LOAD_RETIRED.HIT_LFB,event=0xd1,umask=0x40,precise
+name=MEM_LOAD_RETIRED.L1_HIT,event=0xd1,umask=0x1,precise
+name=MEM_LOAD_RETIRED.L2_HIT,event=0xd1,umask=0x2,precise
+name=MEM_LOAD_RETIRED.L3_HIT,event=0xd1,umask=0x4,precise
+name=MEM_TRANS_RETIRED.LATENCY_ABOVE_THRESHOLD,event=0xcd,umask=0x1,precise
+name=MEM_TRANS_RETIRED.PRECISE_STORE,event=0xcd,umask=0x2,precise
+name=MEM_UOPS_RETIRED.ALL_LOADS,event=0xd0,umask=0x81,precise
+name=MEM_UOPS_RETIRED.ANY_LOADS,event=0xd0,umask=0x81,precise
+name=MEM_UOPS_RETIRED.ALL_STORES,event=0xd0,umask=0x82,precise
+name=MEM_UOPS_RETIRED.ANY_STORES,event=0xd0,umask=0x82,precise
+name=MEM_UOPS_RETIRED.LOCK_LOADS,event=0xd0,umask=0x21,precise
+name=MEM_UOPS_RETIRED.LOCK_STORES,event=0xd0,umask=0x22,precise
+name=MEM_UOPS_RETIRED.SPLIT_LOADS,event=0xd0,umask=0x41,precise
+name=MEM_UOPS_RETIRED.SPLIT_STORES,event=0xd0,umask=0x42,precise
+name=MEM_UOPS_RETIRED.STLB_MISS_LOADS,event=0xd0,umask=0x11,precise
+name=MEM_UOPS_RETIRED.STLB_MISS_STORES,event=0xd0,umask=0x12,precise
+name=MEM_UOP_RETIRED.ALL_LOADS,event=0xd0,umask=0x81,precise
+name=MEM_UOP_RETIRED.ANY_LOADS,event=0xd0,umask=0x81,precise
+name=MEM_UOP_RETIRED.ALL_STORES,event=0xd0,umask=0x82,precise
+name=MEM_UOP_RETIRED.ANY_STORES,event=0xd0,umask=0x82,precise
+name=MEM_UOP_RETIRED.LOCK_LOADS,event=0xd0,umask=0x21,precise
+name=MEM_UOP_RETIRED.LOCK_STORES,event=0xd0,umask=0x22,precise
+name=MEM_UOP_RETIRED.SPLIT_LOADS,event=0xd0,umask=0x41,precise
+name=MEM_UOP_RETIRED.SPLIT_STORES,event=0xd0,umask=0x42,precise
+name=MEM_UOP_RETIRED.STLB_MISS_LOADS,event=0xd0,umask=0x11,precise
+name=MEM_UOP_RETIRED.STLB_MISS_STORES,event=0xd0,umask=0x12,precise
+name=MISALIGN_MEM_REF.LOADS,event=0x5,umask=0x1
+name=MISALIGN_MEM_REF.STORES,event=0x5,umask=0x2
+name=OFFCORE_REQUESTS.ALL_DATA_RD,event=0xb0,umask=0x8
+name=OFFCORE_REQUESTS.ALL_DATA_READ,event=0xb0,umask=0x8
+name=OFFCORE_REQUESTS.DEMAND_CODE_RD,event=0xb0,umask=0x2
+name=OFFCORE_REQUESTS.DEMAND_DATA_RD,event=0xb0,umask=0x1
+name=OFFCORE_REQUESTS.DEMAND_RFO,event=0xb0,umask=0x4
+name=OFFCORE_REQUESTS_BUFFER.SQ_FULL,event=0xb2,umask=0x1
+name=OFFCORE_REQUESTS_OUTSTANDING.ALL_DATA_RD_CYCLES,event=0x60,umask=0x10008
+name=OFFCORE_REQUESTS_OUTSTANDING.DEMAND_CODE_RD_CYCLES,event=0x60,umask=0x10002
+name=OFFCORE_REQUESTS_OUTSTANDING.DEMAND_DATA_RD_CYCLES,event=0x60,umask=0x10001
+name=OFFCORE_REQUESTS_OUTSTANDING.ALL_DATA_RD,event=0x60,umask=0x8
+name=OFFCORE_REQUESTS_OUTSTANDING.DEMAND_CODE_RD,event=0x60,umask=0x2
+name=OFFCORE_REQUESTS_OUTSTANDING.DEMAND_DATA_RD,event=0x60,umask=0x1
+name=OFFCORE_REQUESTS_OUTSTANDING.DEMAND_RFO,event=0x60,umask=0x4
+name=OFFCORE_REQUESTS_OUTSTANDING.DEMAND_RFO_CYCLES,event=0x60,umask=0x10004
+name=OTHER_ASSISTS.ITLB_MISS_RETIRED,event=0xc1,umask=0x2
+name=OTHER_ASSISTS.AVX_TO_SSE,event=0xc1,umask=0x10
+name=OTHER_ASSISTS.SSE_TO_AVX,event=0xc1,umask=0x20
+name=PARTIAL_RAT_STALLS.FLAGS_MERGE_UOP,event=0x59,umask=0x20
+name=PARTIAL_RAT_STALLS.CYCLES_FLAGS_MERGE_UOP,event=0x59,umask=0x10020
+name=PARTIAL_RAT_STALLS.MUL_SINGLE_UOP,event=0x59,umask=0x80
+name=PARTIAL_RAT_STALLS.SLOW_LEA_WINDOW,event=0x59,umask=0x40
+name=RESOURCE_STALLS.ANY,event=0xa2,umask=0x1
+name=RESOURCE_STALLS.LB,event=0xa2,umask=0x2
+name=RESOURCE_STALLS.RS,event=0xa2,umask=0x4
+name=RESOURCE_STALLS.SB,event=0xa2,umask=0x8
+name=RESOURCE_STALLS.ROB,event=0xa2,umask=0x10
+name=RESOURCE_STALLS.FCSW,event=0xa2,umask=0x20
+name=RESOURCE_STALLS.MXCSR,event=0xa2,umask=0x40
+name=RESOURCE_STALLS.MEM_RS,event=0xa2,umask=0xe
+name=RESOURCE_STALLS2.ALL_FL_EMPTY,event=0x5b,umask=0xc
+name=RESOURCE_STALLS2.ALL_PRF_CONTROL,event=0x5b,umask=0xf
+name=RESOURCE_STALLS2.ANY_PRF_CONTROL,event=0x5b,umask=0xf
+name=RESOURCE_STALLS2.BOB_FULL,event=0x5b,umask=0x40
+name=RESOURCE_STALLS2.OOO_RSRC,event=0x5b,umask=0x4f
+name=ROB_MISC_EVENTS.LBR_INSERTS,event=0xcc,umask=0x20
+name=RS_EVENTS.EMPTY_CYCLES,event=0x5e,umask=0x1
+name=SIMD_FP_256.PACKED_SINGLE,event=0x11,umask=0x1
+name=SIMD_FP_256.PACKED_DOUBLE,event=0x11,umask=0x2
+name=SQ_MISC.SPLIT_LOCK,event=0xf4,umask=0x10
+name=TLB_FLUSH.DTLB_THREAD,event=0xbd,umask=0x1
+name=TLB_FLUSH.STLB_ANY,event=0xbd,umask=0x20
+name=UOPS_DISPATCHED.CORE,event=0xb1,umask=0x2
+name=UOPS_DISPATCHED.STALL_CYCLES,event=0xb1,umask=0x18001
+name=UOPS_DISPATCHED.THREAD,event=0xb1,umask=0x1
+name=UOPS_DISPATCHED_PORT.PORT_0,event=0xa1,umask=0x1
+name=UOPS_DISPATCHED_PORT.PORT_1,event=0xa1,umask=0x2
+name=UOPS_DISPATCHED_PORT.PORT_2_LD,event=0xa1,umask=0x4
+name=UOPS_DISPATCHED_PORT.PORT_2_STA,event=0xa1,umask=0x8
+name=UOPS_DISPATCHED_PORT.PORT_2,event=0xa1,umask=0xc
+name=UOPS_DISPATCHED_PORT.PORT_3_LD,event=0xa1,umask=0x10
+name=UOPS_DISPATCHED_PORT.PORT_3_STA,event=0xa1,umask=0x20
+name=UOPS_DISPATCHED_PORT.PORT_3,event=0xa1,umask=0x30
+name=UOPS_DISPATCHED_PORT.PORT_4,event=0xa1,umask=0x40
+name=UOPS_DISPATCHED_PORT.PORT_5,event=0xa1,umask=0x80
+name=UOPS_ISSUED.ANY,event=0xe,umask=0x1
+name=UOPS_ISSUED.CORE_STALL_CYCLES,event=0xe,umask=0x1a001
+name=UOPS_ISSUED.STALL_CYCLES,event=0xe,umask=0x18001
+name=UOPS_RETIRED.ALL,event=0xc2,umask=0x1,precise
+name=UOPS_RETIRED.ANY,event=0xc2,umask=0x1,precise
+name=UOPS_RETIRED.RETIRE_SLOTS,event=0xc2,umask=0x2,precise
+name=UOPS_RETIRED.STALL_CYCLES,event=0xc2,umask=0x18001,precise
+name=UOPS_RETIRED.TOTAL_CYCLES,event=0xc2,umask=0x100001,precise
diff --git a/tools/perf/arch/x86/util/pmu.c b/tools/perf/arch/x86/util/pmu.c
index a37da52..cac67d3 100644
--- a/tools/perf/arch/x86/util/pmu.c
+++ b/tools/perf/arch/x86/util/pmu.c
@@ -56,8 +56,10 @@ static int intel_aliases(struct list_head *head, unsigned model)
 		return -1;
 
 	switch (model) {
+	case 42: /* Sandy Bridge (Core i7 26xx, 25xx) */
+	case 45: /* Sandy Bridge EP */
+		ADD_ALIASES("snb");
 	default:
-		ADD_ALIASES("");
 		break;
 	}
 
-- 
1.7.11.7


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

* [PATCH 7/8] perf tools: Add non arch events for IvyBridge micro architecture
  2013-01-26 20:04 [RFCv2 0/8] perf tools: Add non-architectural event aliases Jiri Olsa
                   ` (5 preceding siblings ...)
  2013-01-26 20:04 ` [PATCH 6/8] perf tools: Add non arch events for SandyBridge microarchitecture Jiri Olsa
@ 2013-01-26 20:04 ` Jiri Olsa
  2013-01-26 20:04 ` [PATCH 8/8] perf tools: List kernel supplied event aliases in perf list v2 Jiri Olsa
  7 siblings, 0 replies; 17+ messages in thread
From: Jiri Olsa @ 2013-01-26 20:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Andi Kleen, Stephane Eranian

Adding non architectural event aliases for IvyBridge
micro architecture.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/arch/x86/events/intel/ivb | 248 +++++++++++++++++++++++++++++++++++
 tools/perf/arch/x86/util/pmu.c       |   2 +
 2 files changed, 250 insertions(+)
 create mode 100644 tools/perf/arch/x86/events/intel/ivb

diff --git a/tools/perf/arch/x86/events/intel/ivb b/tools/perf/arch/x86/events/intel/ivb
new file mode 100644
index 0000000..b07535d
--- /dev/null
+++ b/tools/perf/arch/x86/events/intel/ivb
@@ -0,0 +1,248 @@
+name=ARITH.FPU_DIV_ACTIVE,event=0x14,umask=0x1
+name=ARITH.FPU_DIV,event=0x14,umask=0x10401
+name=BACLEARS.ANY,event=0xe6,umask=0x1f
+name=BR_INST_EXEC.NONTAKEN_COND,event=0x88,umask=0x41
+name=BR_INST_EXEC.TAKEN_COND,event=0x88,umask=0x81
+name=BR_INST_EXEC.NONTAKEN_DIRECT_JUMP,event=0x88,umask=0x42
+name=BR_INST_EXEC.TAKEN_DIRECT_JUMP,event=0x88,umask=0x82
+name=BR_INST_EXEC.NONTAKEN_INDIRECT_JUMP_NON_CALL_RET,event=0x88,umask=0x44
+name=BR_INST_EXEC.TAKEN_INDIRECT_JUMP_NON_CALL_RET,event=0x88,umask=0x84
+name=BR_INST_EXEC.TAKEN_NEAR_RETURN,event=0x88,umask=0x88
+name=BR_INST_EXEC.TAKEN_DIRECT_NEAR_CALL,event=0x88,umask=0x90
+name=BR_INST_EXEC.TAKEN_INDIRECT_NEAR_CALL,event=0x88,umask=0xa0
+name=BR_INST_EXEC.ALL_BRANCHES,event=0x88,umask=0xff
+name=BR_INST_EXEC.ALL_COND,event=0x88,umask=0xc1
+name=BR_INST_EXEC.ANY_COND,event=0x88,umask=0xc1
+name=BR_INST_EXEC.ANY_INDIRECT_JUMP_NON_CALL_RET,event=0x88,umask=0xc4
+name=BR_INST_EXEC.ANY_DIRECT_NEAR_CALL,event=0x88,umask=0xd0
+name=BR_INST_RETIRED.ALL_BRANCHES,event=0xc4,umask=0x4,precise
+name=BR_INST_RETIRED.COND,event=0xc4,umask=0x1,precise
+name=BR_INST_RETIRED.FAR_BRANCH,event=0xc4,umask=0x40,precise
+name=BR_INST_RETIRED.NEAR_CALL,event=0xc4,umask=0x2,precise
+name=BR_INST_RETIRED.NEAR_RETURN,event=0xc4,umask=0x8,precise
+name=BR_INST_RETIRED.NEAR_TAKEN,event=0xc4,umask=0x20,precise
+name=BR_INST_RETIRED.NOT_TAKEN,event=0xc4,umask=0x10,precise
+name=BR_MISP_EXEC.NONTAKEN_COND,event=0x89,umask=0x41
+name=BR_MISP_EXEC.TAKEN_COND,event=0x89,umask=0x81
+name=BR_MISP_EXEC.NONTAKEN_INDIRECT_JUMP_NON_CALL_RET,event=0x89,umask=0x44
+name=BR_MISP_EXEC.TAKEN_INDIRECT_JUMP_NON_CALL_RET,event=0x89,umask=0x84
+name=BR_MISP_EXEC.NONTAKEN_NEAR_RETURN,event=0x89,umask=0x48
+name=BR_MISP_EXEC.TAKEN_NEAR_RETURN,event=0x89,umask=0x88
+name=BR_MISP_EXEC.NONTAKEN_DIRECT_NEAR_CALL,event=0x89,umask=0x50
+name=BR_MISP_EXEC.TAKEN_DIRECT_NEAR_CALL,event=0x89,umask=0x90
+name=BR_MISP_EXEC.NONTAKEN_INDIRECT_NEAR_CALL,event=0x89,umask=0x60
+name=BR_MISP_EXEC.TAKEN_INDIRECT_NEAR_CALL,event=0x89,umask=0xa0
+name=BR_MISP_EXEC.ANY_COND,event=0x89,umask=0xc1
+name=BR_MISP_EXEC.ANY_RETURN_NEAR,event=0x89,umask=0xc8
+name=BR_MISP_EXEC.ANY_DIRECT_NEAR_CALL,event=0x89,umask=0xd0
+name=BR_MISP_EXEC.ANY_INDIRECT_JUMP_NON_CALL_RET,event=0x89,umask=0xc4
+name=BR_MISP_EXEC.ALL_BRANCHES,event=0x89,umask=0xff
+name=BR_MISP_RETIRED.ALL_BRANCHES,event=0xc5,umask=0x4,precise
+name=BR_MISP_RETIRED.COND,event=0xc5,umask=0x1,precise
+name=BR_MISP_RETIRED.NEAR_CALL,event=0xc5,umask=0x2,precise
+name=BR_MISP_RETIRED.NOT_TAKEN,event=0xc5,umask=0x10,precise
+name=BR_MISP_RETIRED.TAKEN,event=0xc5,umask=0x20,precise
+name=LOCK_CYCLES.SPLIT_LOCK_UC_LOCK_DURATION,event=0x63,umask=0x1
+name=LOCK_CYCLES.CACHE_LOCK_DURATION,event=0x63,umask=0x2
+name=CPL_CYCLES.RING0,event=0x5c,umask=0x1
+name=CPL_CYCLES.RING0_TRANS,event=0x5c,umask=0x10401
+name=CPL_CYCLES.RING123,event=0x5c,umask=0x2
+name=CPU_CLK_UNHALTED.REF_P,event=0x3c,umask=0x1
+name=CPU_CLK_UNHALTED.REF_XCLK,event=0x3c,umask=0x1
+name=CPU_CLK_UNHALTED.THREAD_P,event=0x3c,umask=0x0
+name=DSB2MITE_SWITCHES.COUNT,event=0xab,umask=0x1
+name=DSB2MITE_SWITCHES.PENALTY_CYCLES,event=0xab,umask=0x2
+name=DSB_FILL.EXCEED_DSB_LINES,event=0xac,umask=0x8
+name=DTLB_LOAD_MISSES.DEMAND_LD_MISS_CAUSES_A_WALK,event=0x8,umask=0x81
+name=DTLB_LOAD_MISSES.DEMAND_LD_WALK_COMPLETED,event=0x8,umask=0x82
+name=DTLB_LOAD_MISSES.DEMAND_LD_WALK_DURATION,event=0x8,umask=0x84
+name=DTLB_STORE_MISSES.MISS_CAUSES_A_WALK,event=0x49,umask=0x1
+name=DTLB_STORE_MISSES.CAUSES_A_WALK,event=0x49,umask=0x1
+name=DTLB_STORE_MISSES.STLB_HIT,event=0x49,umask=0x10
+name=DTLB_STORE_MISSES.WALK_COMPLETED,event=0x49,umask=0x2
+name=DTLB_STORE_MISSES.WALK_DURATION,event=0x49,umask=0x4
+name=FP_ASSIST.ANY,event=0xca,umask=0x1e
+name=FP_ASSIST.SIMD_INPUT,event=0xca,umask=0x10
+name=FP_ASSIST.SIMD_OUTPUT,event=0xca,umask=0x8
+name=FP_ASSIST.X87_INPUT,event=0xca,umask=0x4
+name=FP_ASSIST.X87_OUTPUT,event=0xca,umask=0x2
+name=HW_INTERRUPTS.RECEIVED,event=0xcb,umask=0x1
+name=ICACHE.MISSES,event=0x80,umask=0x2
+name=IDQ.EMPTY,event=0x79,umask=0x2
+name=IDQ.MITE_UOPS,event=0x79,umask=0x4
+name=IDQ.DSB_UOPS,event=0x79,umask=0x8
+name=IDQ.MS_DSB_UOPS,event=0x79,umask=0x10
+name=IDQ.MS_MITE_UOPS,event=0x79,umask=0x20
+name=IDQ.MS_UOPS,event=0x79,umask=0x30
+name=IDQ.MITE_UOPS_CYCLES,event=0x79,umask=0x10004
+name=IDQ.DSB_UOPS_CYCLES,event=0x79,umask=0x10008
+name=IDQ.MS_DSB_UOPS_CYCLES,event=0x79,umask=0x10010
+name=IDQ.MS_MITE_UOPS_CYCLES,event=0x79,umask=0x10020
+name=IDQ.MS_UOPS_CYCLES,event=0x79,umask=0x10030
+name=IDQ.ALL_DSB_UOPS,event=0x79,umask=0x18
+name=IDQ.ALL_DSB_CYCLES,event=0x79,umask=0x10018
+name=IDQ.ALL_DSB_CYCLES_4_UOPS,event=0x79,umask=0x40018
+name=IDQ.ALL_MITE_UOPS,event=0x79,umask=0x24
+name=IDQ.ALL_MITE_CYCLES,event=0x79,umask=0x10024
+name=IDQ.ANY_UOPS,event=0x79,umask=0x3c
+name=IDQ.MS_DSB_UOPS_OCCUR,event=0x79,umask=0x10410
+name=IDQ_UOPS_NOT_DELIVERED.CORE,event=0x9c,umask=0x1
+name=ILD_STALL.LCP,event=0x87,umask=0x1
+name=ILD_STALL.IQ_FULL,event=0x87,umask=0x4
+name=INST_RETIRED.ANY_P,event=0xc0,umask=0x0
+name=INST_RETIRED.ALL,event=0xc0,umask=0x1,precise
+name=INST_RETIRED.PREC_DIST,event=0xc0,umask=0x1,precise
+name=ITLB.ITLB_FLUSH,event=0xae,umask=0x1
+name=ITLB.FLUSH,event=0xae,umask=0x1
+name=ITLB_MISSES.MISS_CAUSES_A_WALK,event=0x85,umask=0x1
+name=ITLB_MISSES.CAUSES_A_WALK,event=0x85,umask=0x1
+name=ITLB_MISSES.STLB_HIT,event=0x85,umask=0x10
+name=ITLB_MISSES.WALK_COMPLETED,event=0x85,umask=0x2
+name=ITLB_MISSES.WALK_DURATION,event=0x85,umask=0x4
+name=L1D.REPLACEMENT,event=0x51,umask=0x1
+name=MOVE_ELIMINATION.INT_NOT_ELIMINATED,event=0x58,umask=0x1
+name=MOVE_ELIMINATION.SIMD_NOT_ELIMINATED,event=0x58,umask=0x2
+name=MOVE_ELIMINATION.INT_ELIMINATED,event=0x58,umask=0x4
+name=MOVE_ELIMINATION.SIMD_ELIMINATED,event=0x58,umask=0x2
+name=L1D_PEND_MISS.OCCURRENCES,event=0x48,umask=0x10401
+name=L1D_PEND_MISS.EDGE,event=0x48,umask=0x10401
+name=L1D_PEND_MISS.PENDING,event=0x48,umask=0x1
+name=L1D_PEND_MISS.PENDING_CYCLES,event=0x48,umask=0x10001
+name=L2_L1D_WB_RQSTS.HIT_E,event=0x28,umask=0x4
+name=L2_L1D_WB_RQSTS.HIT_M,event=0x28,umask=0x8
+name=L2_L1D_WB_RQSTS.MISS,event=0x28,umask=0x1
+name=L2_L1D_WB_RQSTS.ALL,event=0x28,umask=0xf
+name=L2_LINES_IN.ANY,event=0xf1,umask=0x7
+name=L2_LINES_IN.ALL,event=0xf1,umask=0x7
+name=L2_LINES_IN.E,event=0xf1,umask=0x4
+name=L2_LINES_IN.I,event=0xf1,umask=0x1
+name=L2_LINES_IN.S,event=0xf1,umask=0x2
+name=L2_LINES_OUT.DEMAND_CLEAN,event=0xf2,umask=0x1
+name=L2_LINES_OUT.DEMAND_DIRTY,event=0xf2,umask=0x2
+name=L2_LINES_OUT.PREFETCH_CLEAN,event=0xf2,umask=0x4
+name=L2_LINES_OUT.PF_CLEAN,event=0xf2,umask=0x4
+name=L2_LINES_OUT.PREFETCH_DIRTY,event=0xf2,umask=0x8
+name=L2_LINES_OUT.PF_DIRTY,event=0xf2,umask=0x8
+name=L2_LINES_OUT.DIRTY_ANY,event=0xf2,umask=0xa
+name=L2_LINES_OUT.DIRTY_ALL,event=0xf2,umask=0xa
+name=L2_RQSTS.ALL_CODE_RD,event=0x24,umask=0x30
+name=L2_RQSTS.CODE_RD_HIT,event=0x24,umask=0x10
+name=L2_RQSTS.CODE_RD_MISS,event=0x24,umask=0x20
+name=L2_RQSTS.ALL_DEMAND_DATA_RD,event=0x24,umask=0x3
+name=L2_RQSTS.DEMAND_DATA_RD_HIT,event=0x24,umask=0x1
+name=L2_RQSTS.ALL_PF,event=0x24,umask=0xc0
+name=L2_RQSTS.PF_HIT,event=0x24,umask=0x40
+name=L2_RQSTS.PF_MISS,event=0x24,umask=0x80
+name=L2_RQSTS.ALL_RFO,event=0x24,umask=0xc
+name=L2_RQSTS.RFO_HIT,event=0x24,umask=0x4
+name=L2_RQSTS.RFO_MISS,event=0x24,umask=0x8
+name=L2_STORE_LOCK_RQSTS.MISS,event=0x27,umask=0x1
+name=L2_STORE_LOCK_RQSTS.HIT_M,event=0x27,umask=0x8
+name=L2_STORE_LOCK_RQSTS.ALL,event=0x27,umask=0xf
+name=L2_TRANS.ALL,event=0xf0,umask=0x80
+name=L2_TRANS.CODE_RD,event=0xf0,umask=0x4
+name=L2_TRANS.L1D_WB,event=0xf0,umask=0x10
+name=L2_TRANS.DMND_DATA_RD,event=0xf0,umask=0x1
+name=L2_TRANS.L2_FILL,event=0xf0,umask=0x20
+name=L2_TRANS.L2_WB,event=0xf0,umask=0x40
+name=L2_TRANS.ALL_PREFETCH,event=0xf0,umask=0x8
+name=L2_TRANS.ALL_PF,event=0xf0,umask=0x8
+name=L2_TRANS.RFO,event=0xf0,umask=0x2
+name=LD_BLOCKS.STORE_FORWARD,event=0x3,umask=0x2
+name=LD_BLOCKS_PARTIAL.ADDRESS_ALIAS,event=0x7,umask=0x1
+name=LOAD_HIT_PRE.HW_PF,event=0x4c,umask=0x2
+name=LOAD_HIT_PRE.SW_PF,event=0x4c,umask=0x1
+name=L3_LAT_CACHE.MISS,event=0x2e,umask=0x41
+name=L3_LAT_CACHE.REFERENCE,event=0x2e,umask=0x4f
+name=MACHINE_CLEARS.MASKMOV,event=0xc3,umask=0x20
+name=MACHINE_CLEARS.MEMORY_ORDERING,event=0xc3,umask=0x2
+name=MACHINE_CLEARS.SMC,event=0xc3,umask=0x4
+name=MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_HIT,event=0xd2,umask=0x2,precise
+name=MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_HITM,event=0xd2,umask=0x4,precise
+name=MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_MISS,event=0xd2,umask=0x1,precise
+name=MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_NONE,event=0xd2,umask=0x8,precise
+name=MEM_LOAD_LLC_HIT_RETIRED.XSNP_HIT,event=0xd2,umask=0x2,precise
+name=MEM_LOAD_LLC_HIT_RETIRED.XSNP_HITM,event=0xd2,umask=0x4,precise
+name=MEM_LOAD_LLC_HIT_RETIRED.XSNP_MISS,event=0xd2,umask=0x1,precise
+name=MEM_LOAD_LLC_HIT_RETIRED.XSNP_NONE,event=0xd2,umask=0x8,precise
+name=MEM_LOAD_UOPS_LLC_MISS_RETIRED.LOCAL_DRAM,event=0xd3,umask=0x1,precise
+name=MEM_LOAD_UOPS_RETIRED.HIT_LFB,event=0xd1,umask=0x40,precise
+name=MEM_LOAD_UOPS_RETIRED.L1_HIT,event=0xd1,umask=0x1,precise
+name=MEM_LOAD_UOPS_RETIRED.L2_HIT,event=0xd1,umask=0x2,precise
+name=MEM_LOAD_UOPS_RETIRED.L3_HIT,event=0xd1,umask=0x4,precise
+name=MEM_LOAD_RETIRED.HIT_LFB,event=0xd1,umask=0x40,precise
+name=MEM_LOAD_RETIRED.L1_HIT,event=0xd1,umask=0x1,precise
+name=MEM_LOAD_RETIRED.L2_HIT,event=0xd1,umask=0x2,precise
+name=MEM_LOAD_RETIRED.L3_HIT,event=0xd1,umask=0x4,precise
+name=MEM_TRANS_RETIRED.LATENCY_ABOVE_THRESHOLD,event=0xcd,umask=0x1,precise
+name=MEM_TRANS_RETIRED.PRECISE_STORE,event=0xcd,umask=0x2,precise
+name=MEM_UOPS_RETIRED.ALL_LOADS,event=0xd0,umask=0x81,precise
+name=MEM_UOPS_RETIRED.ANY_LOADS,event=0xd0,umask=0x81,precise
+name=MEM_UOPS_RETIRED.ALL_STORES,event=0xd0,umask=0x82,precise
+name=MEM_UOPS_RETIRED.ANY_STORES,event=0xd0,umask=0x82,precise
+name=MEM_UOPS_RETIRED.LOCK_LOADS,event=0xd0,umask=0x21,precise
+name=MEM_UOPS_RETIRED.LOCK_STORES,event=0xd0,umask=0x22,precise
+name=MEM_UOPS_RETIRED.SPLIT_LOADS,event=0xd0,umask=0x41,precise
+name=MEM_UOPS_RETIRED.SPLIT_STORES,event=0xd0,umask=0x42,precise
+name=MEM_UOPS_RETIRED.STLB_MISS_LOADS,event=0xd0,umask=0x11,precise
+name=MEM_UOPS_RETIRED.STLB_MISS_STORES,event=0xd0,umask=0x12,precise
+name=MEM_UOP_RETIRED.ALL_LOADS,event=0xd0,umask=0x81,precise
+name=MEM_UOP_RETIRED.ANY_LOADS,event=0xd0,umask=0x81,precise
+name=MEM_UOP_RETIRED.ALL_STORES,event=0xd0,umask=0x82,precise
+name=MEM_UOP_RETIRED.ANY_STORES,event=0xd0,umask=0x82,precise
+name=MEM_UOP_RETIRED.LOCK_LOADS,event=0xd0,umask=0x21,precise
+name=MEM_UOP_RETIRED.LOCK_STORES,event=0xd0,umask=0x22,precise
+name=MEM_UOP_RETIRED.SPLIT_LOADS,event=0xd0,umask=0x41,precise
+name=MEM_UOP_RETIRED.SPLIT_STORES,event=0xd0,umask=0x42,precise
+name=MEM_UOP_RETIRED.STLB_MISS_LOADS,event=0xd0,umask=0x11,precise
+name=MEM_UOP_RETIRED.STLB_MISS_STORES,event=0xd0,umask=0x12,precise
+name=MISALIGN_MEM_REF.LOADS,event=0x5,umask=0x1
+name=MISALIGN_MEM_REF.STORES,event=0x5,umask=0x2
+name=OFFCORE_REQUESTS.ALL_DATA_RD,event=0xb0,umask=0x8
+name=OFFCORE_REQUESTS.ALL_DATA_READ,event=0xb0,umask=0x8
+name=OFFCORE_REQUESTS.DEMAND_CODE_RD,event=0xb0,umask=0x2
+name=OFFCORE_REQUESTS.DEMAND_DATA_RD,event=0xb0,umask=0x1
+name=OFFCORE_REQUESTS.DEMAND_RFO,event=0xb0,umask=0x4
+name=OFFCORE_REQUESTS_OUTSTANDING.ALL_DATA_RD_CYCLES,event=0x60,umask=0x10008
+name=OFFCORE_REQUESTS_OUTSTANDING.DEMAND_CODE_RD_CYCLES,event=0x60,umask=0x10002
+name=OFFCORE_REQUESTS_OUTSTANDING.DEMAND_DATA_RD_CYCLES,event=0x60,umask=0x10001
+name=OFFCORE_REQUESTS_OUTSTANDING.ALL_DATA_RD,event=0x60,umask=0x8
+name=OFFCORE_REQUESTS_OUTSTANDING.DEMAND_CODE_RD,event=0x60,umask=0x2
+name=OFFCORE_REQUESTS_OUTSTANDING.DEMAND_DATA_RD,event=0x60,umask=0x1
+name=OFFCORE_REQUESTS_OUTSTANDING.DEMAND_RFO,event=0x60,umask=0x4
+name=OFFCORE_REQUESTS_OUTSTANDING.DEMAND_RFO_CYCLES,event=0x60,umask=0x10004
+name=OTHER_ASSISTS.ITLB_MISS_RETIRED,event=0xc1,umask=0x2
+name=OTHER_ASSISTS.AVX_TO_SSE,event=0xc1,umask=0x10
+name=OTHER_ASSISTS.SSE_TO_AVX,event=0xc1,umask=0x20
+name=OTHER_ASSISTS.AVX_STORE,event=0xc1,umask=0x8
+name=RESOURCE_STALLS.ANY,event=0xa2,umask=0x1
+name=RESOURCE_STALLS.RS,event=0xa2,umask=0x4
+name=RESOURCE_STALLS.SB,event=0xa2,umask=0x8
+name=RESOURCE_STALLS.ROB,event=0xa2,umask=0x10
+name=ROB_MISC_EVENTS.LBR_INSERTS,event=0xcc,umask=0x20
+name=RS_EVENTS.EMPTY_CYCLES,event=0x5e,umask=0x1
+name=TLB_ACCESS.LOAD_STLB_HIT,event=0x5f,umask=0x1
+name=TLB_FLUSH.DTLB_THREAD,event=0xbd,umask=0x1
+name=TLB_FLUSH.STLB_ANY,event=0xbd,umask=0x20
+name=UOPS_EXECUTED.CORE,event=0xb1,umask=0x2
+name=UOPS_DISPATCHED_PORT.PORT_0,event=0xa1,umask=0x1
+name=UOPS_DISPATCHED_PORT.PORT_1,event=0xa1,umask=0x2
+name=UOPS_DISPATCHED_PORT.PORT_2_LD,event=0xa1,umask=0x4
+name=UOPS_DISPATCHED_PORT.PORT_2_STA,event=0xa1,umask=0x8
+name=UOPS_DISPATCHED_PORT.PORT_2,event=0xa1,umask=0xc
+name=UOPS_DISPATCHED_PORT.PORT_3_LD,event=0xa1,umask=0x10
+name=UOPS_DISPATCHED_PORT.PORT_3_STA,event=0xa1,umask=0x20
+name=UOPS_DISPATCHED_PORT.PORT_3,event=0xa1,umask=0x30
+name=UOPS_DISPATCHED_PORT.PORT_4,event=0xa1,umask=0x40
+name=UOPS_DISPATCHED_PORT.PORT_5,event=0xa1,umask=0x80
+name=UOPS_ISSUED.ANY,event=0xe,umask=0x1
+name=UOPS_ISSUED.CORE_STALL_CYCLES,event=0xe,umask=0x1a001
+name=UOPS_ISSUED.STALL_CYCLES,event=0xe,umask=0x18001
+name=UOPS_ISSUED.FLAGS_MERGE,event=0xe,umask=0x10
+name=UOPS_ISSUED.SLOW_LEA,event=0xe,umask=0x20
+name=UOPS_ISSUED.SINGLE_MUL,event=0xe,umask=0x40
+name=UOPS_RETIRED.ALL,event=0xc2,umask=0x1,precise
+name=UOPS_RETIRED.ANY,event=0xc2,umask=0x1,precise
+name=UOPS_RETIRED.RETIRE_SLOTS,event=0xc2,umask=0x2,precise
+name=UOPS_RETIRED.STALL_CYCLES,event=0xc2,umask=0x18001,precise
+name=UOPS_RETIRED.TOTAL_CYCLES,event=0xc2,umask=0x100001,precise
diff --git a/tools/perf/arch/x86/util/pmu.c b/tools/perf/arch/x86/util/pmu.c
index cac67d3..d6250f4 100644
--- a/tools/perf/arch/x86/util/pmu.c
+++ b/tools/perf/arch/x86/util/pmu.c
@@ -59,6 +59,8 @@ static int intel_aliases(struct list_head *head, unsigned model)
 	case 42: /* Sandy Bridge (Core i7 26xx, 25xx) */
 	case 45: /* Sandy Bridge EP */
 		ADD_ALIASES("snb");
+	case 58: /* IvyBridge */
+		ADD_ALIASES("ivb");
 	default:
 		break;
 	}
-- 
1.7.11.7


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

* [PATCH 8/8] perf tools: List kernel supplied event aliases in perf list v2
  2013-01-26 20:04 [RFCv2 0/8] perf tools: Add non-architectural event aliases Jiri Olsa
                   ` (6 preceding siblings ...)
  2013-01-26 20:04 ` [PATCH 7/8] perf tools: Add non arch events for IvyBridge micro architecture Jiri Olsa
@ 2013-01-26 20:04 ` Jiri Olsa
  7 siblings, 0 replies; 17+ messages in thread
From: Jiri Olsa @ 2013-01-26 20:04 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Andi Kleen, Stephane Eranian

From: Andi Kleen <ak@linux.intel.com>

List the kernel supplied pmu event aliases in perf list

It's better when the users can actually see them.

v2: Fix pattern matching
Signed-off-by: Andi Kleen <ak@linux.intel.com>
[ removed 'OR' alternative syntax from display & changed subject ]
[ rebased to latest perf tool changes ]
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Documentation/perf-list.txt |  4 ++-
 tools/perf/builtin-list.c              |  3 ++
 tools/perf/util/parse-events.c         |  5 ++-
 tools/perf/util/pmu.c                  | 61 ++++++++++++++++++++++++++++++++++
 tools/perf/util/pmu.h                  |  2 ++
 5 files changed, 73 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt
index d1e39dc..826f3d6 100644
--- a/tools/perf/Documentation/perf-list.txt
+++ b/tools/perf/Documentation/perf-list.txt
@@ -8,7 +8,7 @@ perf-list - List all symbolic event types
 SYNOPSIS
 --------
 [verse]
-'perf list' [hw|sw|cache|tracepoint|event_glob]
+'perf list' [hw|sw|cache|tracepoint|pmu|event_glob]
 
 DESCRIPTION
 -----------
@@ -104,6 +104,8 @@ To limit the list use:
   'subsys_glob:event_glob' to filter by tracepoint subsystems such as sched,
   block, etc.
 
+. 'pmu' to print the kernel supplied PMU events.
+
 . If none of the above is matched, it will apply the supplied glob to all
   events, printing the ones that match.
 
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
index 1948ece..e79f423 100644
--- a/tools/perf/builtin-list.c
+++ b/tools/perf/builtin-list.c
@@ -13,6 +13,7 @@
 
 #include "util/parse-events.h"
 #include "util/cache.h"
+#include "util/pmu.h"
 
 int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
 {
@@ -37,6 +38,8 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
 			else if (strcmp(argv[i], "cache") == 0 ||
 				 strcmp(argv[i], "hwcache") == 0)
 				print_hwcache_events(NULL, false);
+			else if (strcmp(argv[i], "pmu") == 0)
+				print_pmu_events(NULL, false);
 			else if (strcmp(argv[i], "--raw-dump") == 0)
 				print_events(NULL, true);
 			else {
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 0143c90..d7ebe10 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1088,6 +1088,8 @@ int print_hwcache_events(const char *event_glob, bool name_only)
 		}
 	}
 
+	if (printed)
+		printf("\n");
 	return printed;
 }
 
@@ -1142,11 +1144,12 @@ void print_events(const char *event_glob, bool name_only)
 
 	print_hwcache_events(event_glob, name_only);
 
+	print_pmu_events(event_glob, name_only);
+
 	if (event_glob != NULL)
 		return;
 
 	if (!name_only) {
-		printf("\n");
 		printf("  %-50s [%s]\n",
 		       "rNNN",
 		       event_type_descriptors[PERF_TYPE_RAW]);
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 7c2908b..51f4342 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -631,3 +631,64 @@ void perf_pmu__set_format(unsigned long *bits, long from, long to)
 	for (b = from; b <= to; b++)
 		set_bit(b, bits);
 }
+
+static char *format_alias(char *buf, int len, struct perf_pmu *pmu,
+			  struct perf_pmu_alias *alias)
+{
+	snprintf(buf, len, "%s/%s/", pmu->name, alias->name);
+	return buf;
+}
+
+static int cmp_string(const void *a, const void *b)
+{
+	const char * const *as = a;
+	const char * const *bs = b;
+	return strcmp(*as, *bs);
+}
+
+void print_pmu_events(const char *event_glob, bool name_only)
+{
+	struct perf_pmu *pmu;
+	struct perf_pmu_alias *alias;
+	char buf[1024];
+	int printed = 0;
+	int len, j;
+	char **aliases;
+
+	pmu = NULL;
+	len = 0;
+	while ((pmu = perf_pmu__scan(pmu)) != NULL)
+		list_for_each_entry (alias, &pmu->aliases, list)
+			len++;
+	aliases = malloc(sizeof(char *) * len);
+	if (!aliases)
+		return;
+	pmu = NULL;
+	j = 0;
+	while ((pmu = perf_pmu__scan(pmu)) != NULL)
+		list_for_each_entry (alias, &pmu->aliases, list) {
+			char *name = format_alias(buf, sizeof buf, pmu, alias);
+			bool is_cpu = !strcmp(pmu->name, "cpu");
+
+			if (event_glob != NULL &&
+			    !(strglobmatch(name, event_glob) ||
+			      (!is_cpu && strglobmatch(alias->name, event_glob))))
+				continue;
+			aliases[j] = strdup(name);
+			j++;
+		}
+	len = j;
+	qsort(aliases, len, sizeof(char *), cmp_string);
+	for (j = 0; j < len; j++) {
+		if (name_only) {
+			printf("%s ", aliases[j]);
+			continue;
+		}
+		printf("  %-50s [Kernel PMU event]\n", aliases[j]);
+		free(aliases[j]);
+		printed++;
+	}
+	if (printed)
+		printf("\n");
+	free(aliases);
+}
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index aa049ea..eaaf9c60 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -47,5 +47,7 @@ int pmu_aliases_parse_multi(char *path, struct list_head *head);
 
 int arch_pmu_aliases(char *name, struct list_head *head);
 
+void print_pmu_events(const char *event_glob, bool name_only);
+
 int perf_pmu__test(void);
 #endif /* __PMU_H */
-- 
1.7.11.7


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

* Re: [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token
  2013-01-26 20:04 ` [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token Jiri Olsa
@ 2013-01-28 20:52   ` Stephane Eranian
  2013-01-28 21:32     ` Stephane Eranian
  0 siblings, 1 reply; 17+ messages in thread
From: Stephane Eranian @ 2013-01-28 20:52 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: LKML, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Andi Kleen

Jiri,

I don't see part 0/8 of this series. Did you send it to me too?

I have some comments about it. I don't see why create something from scratch
when I have been developing a library (libpfm4) that takes care of that and that
is already used by many tool developers. That library can be linked with perf
and provide full symbolic events + all the modifiers. The library is portable
and supports all existing archs. It can also be used by self-monitoring apps.


You're introducing yet another event table to maintain. And believe me this is
a lot of work to maintain this.

I don't understand why not use this existing library.


On Sat, Jan 26, 2013 at 9:04 PM, Jiri Olsa <jolsa@redhat.com> wrote:
> Adding '.' to be recognized as valid part of the event 'name'
> token. Upcoming non architectural events use '.' as part
> of the name.
>
> Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Andi Kleen <ak@linux.intel.com>
> Cc: Stephane Eranian <eranian@google.com>
> ---
>  tools/perf/util/parse-events.l | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
> index 32a9000..4220093 100644
> --- a/tools/perf/util/parse-events.l
> +++ b/tools/perf/util/parse-events.l
> @@ -80,8 +80,8 @@ event         [^,{}/]+
>  num_dec                [0-9]+
>  num_hex                0x[a-fA-F0-9]+
>  num_raw_hex    [a-fA-F0-9]+
> -name           [a-zA-Z_*?][a-zA-Z0-9_*?]*
> -name_minus     [a-zA-Z_*?][a-zA-Z0-9\-_*?]*
> +name           [a-zA-Z_*?][a-zA-Z0-9_*?\.]*
> +name_minus     [a-zA-Z_*?][a-zA-Z0-9\-_*?\.]*
>  modifier_event [ukhpGH]+
>  modifier_bp    [rwx]{1,3}
>
> --
> 1.7.11.7
>

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

* Re: [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token
  2013-01-28 20:52   ` Stephane Eranian
@ 2013-01-28 21:32     ` Stephane Eranian
  2013-01-29  8:03       ` Ingo Molnar
  2013-05-03 18:56       ` Peter Zijlstra
  0 siblings, 2 replies; 17+ messages in thread
From: Stephane Eranian @ 2013-01-28 21:32 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: LKML, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Andi Kleen

On Mon, Jan 28, 2013 at 9:52 PM, Stephane Eranian <eranian@google.com> wrote:
> Jiri,
>
> I don't see part 0/8 of this series. Did you send it to me too?
>
> I have some comments about it. I don't see why create something from scratch
> when I have been developing a library (libpfm4) that takes care of that and that
> is already used by many tool developers. That library can be linked with perf
> and provide full symbolic events + all the modifiers. The library is portable
> and supports all existing archs. It can also be used by self-monitoring apps.
>
>
> You're introducing yet another event table to maintain. And believe me this is
> a lot of work to maintain this.
>
> I don't understand why not use this existing library.
>
I meant to add that I think it would be more productive if we (you and I) were
to work on the library to extend it with external text-based event tables that
could be used by perf either directly or thru the libpfm4 interface.


>
> On Sat, Jan 26, 2013 at 9:04 PM, Jiri Olsa <jolsa@redhat.com> wrote:
>> Adding '.' to be recognized as valid part of the event 'name'
>> token. Upcoming non architectural events use '.' as part
>> of the name.
>>
>> Signed-off-by: Jiri Olsa <jolsa@redhat.com>
>> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
>> Cc: Frederic Weisbecker <fweisbec@gmail.com>
>> Cc: Ingo Molnar <mingo@elte.hu>
>> Cc: Namhyung Kim <namhyung@kernel.org>
>> Cc: Paul Mackerras <paulus@samba.org>
>> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
>> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
>> Cc: Andi Kleen <ak@linux.intel.com>
>> Cc: Stephane Eranian <eranian@google.com>
>> ---
>>  tools/perf/util/parse-events.l | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
>> index 32a9000..4220093 100644
>> --- a/tools/perf/util/parse-events.l
>> +++ b/tools/perf/util/parse-events.l
>> @@ -80,8 +80,8 @@ event         [^,{}/]+
>>  num_dec                [0-9]+
>>  num_hex                0x[a-fA-F0-9]+
>>  num_raw_hex    [a-fA-F0-9]+
>> -name           [a-zA-Z_*?][a-zA-Z0-9_*?]*
>> -name_minus     [a-zA-Z_*?][a-zA-Z0-9\-_*?]*
>> +name           [a-zA-Z_*?][a-zA-Z0-9_*?\.]*
>> +name_minus     [a-zA-Z_*?][a-zA-Z0-9\-_*?\.]*
>>  modifier_event [ukhpGH]+
>>  modifier_bp    [rwx]{1,3}
>>
>> --
>> 1.7.11.7
>>

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

* Re: [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token
  2013-01-28 21:32     ` Stephane Eranian
@ 2013-01-29  8:03       ` Ingo Molnar
  2013-01-29 10:53         ` Jiri Olsa
  2013-02-03 20:37         ` Stephane Eranian
  2013-05-03 18:56       ` Peter Zijlstra
  1 sibling, 2 replies; 17+ messages in thread
From: Ingo Molnar @ 2013-01-29  8:03 UTC (permalink / raw)
  To: Stephane Eranian
  Cc: Jiri Olsa, LKML, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Andi Kleen


* Stephane Eranian <eranian@google.com> wrote:

> On Mon, Jan 28, 2013 at 9:52 PM, Stephane Eranian <eranian@google.com> wrote:
> > Jiri,
> >
> > I don't see part 0/8 of this series. Did you send it to me too?
> >
> > I have some comments about it. I don't see why create something from scratch
> > when I have been developing a library (libpfm4) that takes care of that and that
> > is already used by many tool developers. That library can be linked with perf
> > and provide full symbolic events + all the modifiers. The library is portable
> > and supports all existing archs. It can also be used by self-monitoring apps.
> >
> >
> > You're introducing yet another event table to maintain. And believe me this is
> > a lot of work to maintain this.
> >
> > I don't understand why not use this existing library.
> >
>
> I meant to add that I think it would be more productive if we 
> (you and I) were to work on the library to extend it with 
> external text-based event tables that could be used by perf 
> either directly or thru the libpfm4 interface.

perf is intentionally external file free and does not 
(fundamentally) depend on external libraries either,
other than core system libraries.

There are several advantages to that:

 - there is no version skew and no design/maintenance friction

 - 'upgrading' perf between similar boxes is as simple as
   copying the perf binary

 - it's self-sufficient

 - there's no real advantage of external text files versus
   internal text files (i.e. text tables within the source 
   code), while there are several disadvantages

So as long as Jiri is happy to maintain these tables I think 
it's a superior solution (even if the tables start out 
incomplete), from the perf project's perspective.

Thanks,

	Ingo

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

* Re: [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token
  2013-01-29  8:03       ` Ingo Molnar
@ 2013-01-29 10:53         ` Jiri Olsa
  2013-02-03 20:37         ` Stephane Eranian
  1 sibling, 0 replies; 17+ messages in thread
From: Jiri Olsa @ 2013-01-29 10:53 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Stephane Eranian, LKML, Corey Ashford, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Andi Kleen

On Tue, Jan 29, 2013 at 09:03:05AM +0100, Ingo Molnar wrote:
> 
> * Stephane Eranian <eranian@google.com> wrote:
> 
> > On Mon, Jan 28, 2013 at 9:52 PM, Stephane Eranian <eranian@google.com> wrote:
> > > Jiri,
> > >
> > > I don't see part 0/8 of this series. Did you send it to me too?

oops, it went to lkml only, here it is:
http://marc.info/?l=linux-kernel&m=135923067520675&w=2

> > >
> > > I have some comments about it. I don't see why create something from scratch
> > > when I have been developing a library (libpfm4) that takes care of that and that
> > > is already used by many tool developers. That library can be linked with perf
> > > and provide full symbolic events + all the modifiers. The library is portable
> > > and supports all existing archs. It can also be used by self-monitoring apps.
> > >
> > >
> > > You're introducing yet another event table to maintain. And believe me this is
> > > a lot of work to maintain this.
> > >
> > > I don't understand why not use this existing library.
> > >
> >
> > I meant to add that I think it would be more productive if we 
> > (you and I) were to work on the library to extend it with 
> > external text-based event tables that could be used by perf 
> > either directly or thru the libpfm4 interface.
> 
> perf is intentionally external file free and does not 
> (fundamentally) depend on external libraries either,
> other than core system libraries.
> 
> There are several advantages to that:
> 
>  - there is no version skew and no design/maintenance friction
> 
>  - 'upgrading' perf between similar boxes is as simple as
>    copying the perf binary
> 
>  - it's self-sufficient
> 
>  - there's no real advantage of external text files versus
>    internal text files (i.e. text tables within the source 
>    code), while there are several disadvantages

When you say 'internal'.. do you mean like inside binary internal?

Currently this file gets installed with perf and is loaded in run
time based on the detected architecture.

> 
> So as long as Jiri is happy to maintain these tables I think 
> it's a superior solution (even if the tables start out 
> incomplete), from the perf project's perspective.

Actually what I did here was that I wrote a tool that sucked
and get all the events from libpfm4 in the alias perf format.

It took some libpfm4 changes as well, so I did not post the
tool source. But given that libpfm4 is not going in perf, this
might be answer.. having tool to keep us in sync with libpfm4
and run it once in a while.. ;-)

jirka

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

* Re: [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token
  2013-01-29  8:03       ` Ingo Molnar
  2013-01-29 10:53         ` Jiri Olsa
@ 2013-02-03 20:37         ` Stephane Eranian
  2013-02-04  7:30           ` Jiri Olsa
  1 sibling, 1 reply; 17+ messages in thread
From: Stephane Eranian @ 2013-02-03 20:37 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, LKML, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Andi Kleen

On Tue, Jan 29, 2013 at 9:03 AM, Ingo Molnar <mingo@kernel.org> wrote:
>
> * Stephane Eranian <eranian@google.com> wrote:
>
>> On Mon, Jan 28, 2013 at 9:52 PM, Stephane Eranian <eranian@google.com> wrote:
>> > Jiri,
>> >
>> > I don't see part 0/8 of this series. Did you send it to me too?
>> >
>> > I have some comments about it. I don't see why create something from scratch
>> > when I have been developing a library (libpfm4) that takes care of that and that
>> > is already used by many tool developers. That library can be linked with perf
>> > and provide full symbolic events + all the modifiers. The library is portable
>> > and supports all existing archs. It can also be used by self-monitoring apps.
>> >
>> >
>> > You're introducing yet another event table to maintain. And believe me this is
>> > a lot of work to maintain this.
>> >
>> > I don't understand why not use this existing library.
>> >
>>
>> I meant to add that I think it would be more productive if we
>> (you and I) were to work on the library to extend it with
>> external text-based event tables that could be used by perf
>> either directly or thru the libpfm4 interface.
>
> perf is intentionally external file free and does not
> (fundamentally) depend on external libraries either,
> other than core system libraries.
>
Perf does use external files, otherwise there would not be
a need for what's in libexec.

As far as I know, perf is constantly adding dependencies
to other libraries. For instance, nowadays, it does not compile
if you don't have libnuma, libdw, and the likes. libpfm4 is similar
in nature.

The goal of the library is to provide access to event table in a
portable manner for tools and self-monitoring programs (on which they
are many). Users don't have to have to change event names, event
modifier syntax when they go from one tool to another. Or even
when they switch from one OS to another. That's what libpfm4
provides and the scope goes beyond the perf tool.



> There are several advantages to that:
>
>  - there is no version skew and no design/maintenance friction
>
There is rarely an version problem with event tables.

>  - 'upgrading' perf between similar boxes is as simple as
>    copying the perf binary
>
Not quite.

>  - it's self-sufficient
>
>  - there's no real advantage of external text files versus
>    internal text files (i.e. text tables within the source
>    code), while there are several disadvantages
>
libpfm4 currently has the tables internally hardcoded.

> So as long as Jiri is happy to maintain these tables I think
> it's a superior solution (even if the tables start out
> incomplete), from the perf project's perspective.
>
Adding the option for users to link with libpfm4 was no big
deal in my mind. You are opposed to that. That's your
choice. I don't buy your arguments for this patch series
and will continue to provide a patch to link perf and libpfm4
for users who are interested.

I would have appreciated some discussion on this instead, once
again, work was done behind closed door and thrown at my face.
The worst being that as far I can see in the patches, no proper
credits to libpfm4 contributors is even given for providing the raw
information that allowed you to  build your event tables without too
much sweat! Building electronic event tables from vendor specs is
a lot harder than it seems, but you may not know this.

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

* Re: [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token
  2013-02-03 20:37         ` Stephane Eranian
@ 2013-02-04  7:30           ` Jiri Olsa
  0 siblings, 0 replies; 17+ messages in thread
From: Jiri Olsa @ 2013-02-04  7:30 UTC (permalink / raw)
  To: Stephane Eranian
  Cc: Ingo Molnar, LKML, Corey Ashford, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Andi Kleen

On Sun, Feb 03, 2013 at 09:37:16PM +0100, Stephane Eranian wrote:
> On Tue, Jan 29, 2013 at 9:03 AM, Ingo Molnar <mingo@kernel.org> wrote:
> >
> > * Stephane Eranian <eranian@google.com> wrote:
> >
> >> On Mon, Jan 28, 2013 at 9:52 PM, Stephane Eranian <eranian@google.com> wrote:

SNIP

> Adding the option for users to link with libpfm4 was no big
> deal in my mind. You are opposed to that. That's your
> choice. I don't buy your arguments for this patch series
> and will continue to provide a patch to link perf and libpfm4
> for users who are interested.
> 
> I would have appreciated some discussion on this instead, once
> again, work was done behind closed door and thrown at my face.

Not sure why you think it was 'closed door'.. I needed some way to
access those events and sent RFC for it with you being on CC list.

> The worst being that as far I can see in the patches, no proper
> credits to libpfm4 contributors is even given for providing the raw
> information that allowed you to  build your event tables without too

Right, sorry for that.. I'll add it.

> much sweat! Building electronic event tables from vendor specs is
> a lot harder than it seems, but you may not know this.

jirka

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

* Re: [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token
  2013-01-28 21:32     ` Stephane Eranian
  2013-01-29  8:03       ` Ingo Molnar
@ 2013-05-03 18:56       ` Peter Zijlstra
  2013-05-04  8:10         ` Ingo Molnar
  1 sibling, 1 reply; 17+ messages in thread
From: Peter Zijlstra @ 2013-05-03 18:56 UTC (permalink / raw)
  To: Stephane Eranian
  Cc: Jiri Olsa, LKML, Corey Ashford, Frederic Weisbecker, Ingo Molnar,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Andi Kleen

> I meant to add that I think it would be more productive if we (you and I) were
> to work on the library to extend it with external text-based event tables that
> could be used by perf either directly or thru the libpfm4 interface.

That would be very useful indeed.. I think we talked about this before. Also
wasn't there some vendor support for this idea as well?

I think we want a format that is relatively simple to parse and human readable
(which excludes XML on both counts ;-).

The main objection of using libpfm4 has always been that its primarily
something else.  It also does the event listing thing, but that's only a small
part of it.

But if we can split out that part and use it in both projects that would be
best I think.

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

* Re: [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token
  2013-05-03 18:56       ` Peter Zijlstra
@ 2013-05-04  8:10         ` Ingo Molnar
  0 siblings, 0 replies; 17+ messages in thread
From: Ingo Molnar @ 2013-05-04  8:10 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Stephane Eranian, Jiri Olsa, LKML, Corey Ashford,
	Frederic Weisbecker, Ingo Molnar, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Arnaldo Carvalho de Melo, Andi Kleen


* Peter Zijlstra <peterz@infradead.org> wrote:

> > I meant to add that I think it would be more productive if we (you and I) were
> > to work on the library to extend it with external text-based event tables that
> > could be used by perf either directly or thru the libpfm4 interface.
> 
> That would be very useful indeed.. I think we talked about this before. 
> Also wasn't there some vendor support for this idea as well?
> 
> I think we want a format that is relatively simple to parse and human 
> readable (which excludes XML on both counts ;-).
> 
> The main objection of using libpfm4 has always been that its primarily 
> something else.  It also does the event listing thing, but that's only a 
> small part of it.
> 
> But if we can split out that part and use it in both projects that would 
> be best I think.

If that libpfm reference library moved to tools/lib/ like 
tools/lib/traceevents/ then that would be a nice, useful solution indeed.

Thanks,

	Ingo

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

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

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-26 20:04 [RFCv2 0/8] perf tools: Add non-architectural event aliases Jiri Olsa
2013-01-26 20:04 ` [PATCH 1/8] perf tools: Add '.' as part of the event 'name' token Jiri Olsa
2013-01-28 20:52   ` Stephane Eranian
2013-01-28 21:32     ` Stephane Eranian
2013-01-29  8:03       ` Ingo Molnar
2013-01-29 10:53         ` Jiri Olsa
2013-02-03 20:37         ` Stephane Eranian
2013-02-04  7:30           ` Jiri Olsa
2013-05-03 18:56       ` Peter Zijlstra
2013-05-04  8:10         ` Ingo Molnar
2013-01-26 20:04 ` [PATCH 2/8] perf tools: Change perf_pmu__new_alias function interface Jiri Olsa
2013-01-26 20:04 ` [PATCH 3/8] perf tools: Add name term processing for alias Jiri Olsa
2013-01-26 20:04 ` [PATCH 4/8] perf tools: Add pmu interface to parse single file of aliases Jiri Olsa
2013-01-26 20:04 ` [PATCH 5/8] perf tools: Add support to include non architectural event aliases Jiri Olsa
2013-01-26 20:04 ` [PATCH 6/8] perf tools: Add non arch events for SandyBridge microarchitecture Jiri Olsa
2013-01-26 20:04 ` [PATCH 7/8] perf tools: Add non arch events for IvyBridge micro architecture Jiri Olsa
2013-01-26 20:04 ` [PATCH 8/8] perf tools: List kernel supplied event aliases in perf list v2 Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).