Re: [PATCH 31/33] perf, tools: Support generic events as pmu event names v2

2012-10-29 Thread Peter Zijlstra
On Sun, 2012-10-28 at 20:12 +0100, Andi Kleen wrote:
> 
> Note I wrote and posted all this before you posted last week, but the wheels
> of perf review grind so slowly that you overtook me.
> 
> Peter Z., to be honest all these later patches are just caused by not having
> generic TSX events/modifiers and you not liking my original approach.

He posted his patches first in June, your haswell stuff came in Sep, you
completely ignored his sysfs work, your problem.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 31/33] perf, tools: Support generic events as pmu event names v2

2012-10-29 Thread Peter Zijlstra
On Sun, 2012-10-28 at 20:12 +0100, Andi Kleen wrote:
 
 Note I wrote and posted all this before you posted last week, but the wheels
 of perf review grind so slowly that you overtook me.
 
 Peter Z., to be honest all these later patches are just caused by not having
 generic TSX events/modifiers and you not liking my original approach.

He posted his patches first in June, your haswell stuff came in Sep, you
completely ignored his sysfs work, your problem.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 31/33] perf, tools: Support generic events as pmu event names v2

2012-10-28 Thread Andi Kleen
On Sat, Oct 27, 2012 at 09:42:00PM +0200, Jiri Olsa wrote:
> On Fri, Oct 26, 2012 at 01:30:13PM -0700, Andi Kleen wrote:
> > From: Andi Kleen 
> > 
> > Extend the parser/lexer to allow generic event names like
> > "instructions" as a sysfs supplied PMU event name.
> > 
> > This resolves the problem that cpu/instructions/ gives a parse
> > error, even when the kernel supplies a "instructions" event
> > 
> > This is useful to add sysfs specified qualifiers to these
> > events, for example cpu/instructions,intx=1/ and needed
> > for the TSX events
> > 
> > Simply extend the grammar to handle this case. The lexer
> > needs minor changes to save the original string.
> 
> ops, I think you need to check recent changes:

Note I wrote and posted all this before you posted last week, but the wheels
of perf review grind so slowly that you overtook me.

Peter Z., to be honest all these later patches are just caused by not having
generic TSX events/modifiers and you not liking my original approach.

I'm now at 10+ patches for the sysfs stuff and counting and have conflicts
with parallel work by Jiri and in general it's still all somewhat hacky and
actually far more code than the original patches.

I'm very tempted to go back to the original approach with generic
events and modifiers, that was far simpler and cleaner and really
did work better, and it was a far less intrusive patchkit.

Comments?

-Andi

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 31/33] perf, tools: Support generic events as pmu event names v2

2012-10-28 Thread Andi Kleen
On Sat, Oct 27, 2012 at 09:42:00PM +0200, Jiri Olsa wrote:
 On Fri, Oct 26, 2012 at 01:30:13PM -0700, Andi Kleen wrote:
  From: Andi Kleen a...@linux.intel.com
  
  Extend the parser/lexer to allow generic event names like
  instructions as a sysfs supplied PMU event name.
  
  This resolves the problem that cpu/instructions/ gives a parse
  error, even when the kernel supplies a instructions event
  
  This is useful to add sysfs specified qualifiers to these
  events, for example cpu/instructions,intx=1/ and needed
  for the TSX events
  
  Simply extend the grammar to handle this case. The lexer
  needs minor changes to save the original string.
 
 ops, I think you need to check recent changes:

Note I wrote and posted all this before you posted last week, but the wheels
of perf review grind so slowly that you overtook me.

Peter Z., to be honest all these later patches are just caused by not having
generic TSX events/modifiers and you not liking my original approach.

I'm now at 10+ patches for the sysfs stuff and counting and have conflicts
with parallel work by Jiri and in general it's still all somewhat hacky and
actually far more code than the original patches.

I'm very tempted to go back to the original approach with generic
events and modifiers, that was far simpler and cleaner and really
did work better, and it was a far less intrusive patchkit.

Comments?

-Andi

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 31/33] perf, tools: Support generic events as pmu event names v2

2012-10-27 Thread Jiri Olsa
On Fri, Oct 26, 2012 at 01:30:13PM -0700, Andi Kleen wrote:
> From: Andi Kleen 
> 
> Extend the parser/lexer to allow generic event names like
> "instructions" as a sysfs supplied PMU event name.
> 
> This resolves the problem that cpu/instructions/ gives a parse
> error, even when the kernel supplies a "instructions" event
> 
> This is useful to add sysfs specified qualifiers to these
> events, for example cpu/instructions,intx=1/ and needed
> for the TSX events
> 
> Simply extend the grammar to handle this case. The lexer
> needs minor changes to save the original string.

ops, I think you need to check recent changes:

3f3a206 perf test: Add automated tests for pmu sysfs translated events
1d33d6d perf tools: Add support to specify hw event as PMU event term
3fded96 perf tools: Fix PMU object alias initialization
20550a4 perf/x86: Add hardware events translations for Intel P6 cpus
0bf79d4 perf/x86: Add hardware events translations for AMD cpus
43c032f perf/x86: Add hardware events translations for Intel cpus
8300daa perf/x86: Filter out undefined events from sysfs events attribute
a474739 perf/x86: Make hardware event translations available in sysfs

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 31/33] perf, tools: Support generic events as pmu event names v2

2012-10-27 Thread Jiri Olsa
On Fri, Oct 26, 2012 at 01:30:13PM -0700, Andi Kleen wrote:
 From: Andi Kleen a...@linux.intel.com
 
 Extend the parser/lexer to allow generic event names like
 instructions as a sysfs supplied PMU event name.
 
 This resolves the problem that cpu/instructions/ gives a parse
 error, even when the kernel supplies a instructions event
 
 This is useful to add sysfs specified qualifiers to these
 events, for example cpu/instructions,intx=1/ and needed
 for the TSX events
 
 Simply extend the grammar to handle this case. The lexer
 needs minor changes to save the original string.

ops, I think you need to check recent changes:

3f3a206 perf test: Add automated tests for pmu sysfs translated events
1d33d6d perf tools: Add support to specify hw event as PMU event term
3fded96 perf tools: Fix PMU object alias initialization
20550a4 perf/x86: Add hardware events translations for Intel P6 cpus
0bf79d4 perf/x86: Add hardware events translations for AMD cpus
43c032f perf/x86: Add hardware events translations for Intel cpus
8300daa perf/x86: Filter out undefined events from sysfs events attribute
a474739 perf/x86: Make hardware event translations available in sysfs

jirka
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 31/33] perf, tools: Support generic events as pmu event names v2

2012-10-26 Thread Andi Kleen
From: Andi Kleen 

Extend the parser/lexer to allow generic event names like
"instructions" as a sysfs supplied PMU event name.

This resolves the problem that cpu/instructions/ gives a parse
error, even when the kernel supplies a "instructions" event

This is useful to add sysfs specified qualifiers to these
events, for example cpu/instructions,intx=1/ and needed
for the TSX events

Simply extend the grammar to handle this case. The lexer
needs minor changes to save the original string.

v2: Remove bogus returns in grammar.
Signed-off-by: Andi Kleen 
---
 tools/perf/util/parse-events.l |3 ++-
 tools/perf/util/parse-events.y |   27 +++
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index c2e5142..dd3a901 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -55,7 +55,8 @@ static int sym(yyscan_t scanner, int type, int config)
 {
YYSTYPE *yylval = parse_events_get_lval(scanner);
 
-   yylval->num = (type << 16) + config;
+   yylval->namenum.num = (type << 16) + config;
+   yylval->namenum.name = strdup(parse_events_get_text(scanner));
return type == PERF_TYPE_HARDWARE ? PE_VALUE_SYM_HW : PE_VALUE_SYM_SW;
 }
 
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index cd88209..25f0123 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -34,8 +34,8 @@ do { \
 %token PE_PREFIX_MEM PE_PREFIX_RAW PE_PREFIX_GROUP
 %token PE_ERROR
 %type  PE_VALUE
-%type  PE_VALUE_SYM_HW
-%type  PE_VALUE_SYM_SW
+%type  PE_VALUE_SYM_HW
+%type  PE_VALUE_SYM_SW
 %type  PE_RAW
 %type  PE_TERM
 %type  PE_NAME
@@ -65,6 +65,7 @@ do { \
 
 %union
 {
+   struct { char *name; u64 num; } namenum;
char *str;
u64 num;
struct list_head *head;
@@ -195,9 +196,9 @@ PE_NAME '/' event_config '/'
 }
 
 value_sym:
-PE_VALUE_SYM_HW
+PE_VALUE_SYM_HW{ free($1.name); $$ = $1.num; }
 |
-PE_VALUE_SYM_SW
+PE_VALUE_SYM_SW{ free($1.name); $$ = $1.num; }
 
 event_legacy_symbol:
 value_sym '/' event_config '/'
@@ -361,6 +362,24 @@ PE_NAME
$$ = term;
 }
 |
+PE_VALUE_SYM_HW
+{
+   struct parse_events__term *term;
+
+   ABORT_ON(parse_events__term_num(, PARSE_EVENTS__TERM_TYPE_USER,
+   $1.name, 1));
+   $$ = term;
+}
+|
+PE_VALUE_SYM_SW
+{
+   struct parse_events__term *term;
+
+   ABORT_ON(parse_events__term_num(, PARSE_EVENTS__TERM_TYPE_USER,
+   $1.name, 1));
+   $$ = term;
+}
+|
 PE_TERM '=' PE_NAME
 {
struct parse_events__term *term;
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 31/33] perf, tools: Support generic events as pmu event names v2

2012-10-26 Thread Andi Kleen
From: Andi Kleen a...@linux.intel.com

Extend the parser/lexer to allow generic event names like
instructions as a sysfs supplied PMU event name.

This resolves the problem that cpu/instructions/ gives a parse
error, even when the kernel supplies a instructions event

This is useful to add sysfs specified qualifiers to these
events, for example cpu/instructions,intx=1/ and needed
for the TSX events

Simply extend the grammar to handle this case. The lexer
needs minor changes to save the original string.

v2: Remove bogus returns in grammar.
Signed-off-by: Andi Kleen a...@linux.intel.com
---
 tools/perf/util/parse-events.l |3 ++-
 tools/perf/util/parse-events.y |   27 +++
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index c2e5142..dd3a901 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -55,7 +55,8 @@ static int sym(yyscan_t scanner, int type, int config)
 {
YYSTYPE *yylval = parse_events_get_lval(scanner);
 
-   yylval-num = (type  16) + config;
+   yylval-namenum.num = (type  16) + config;
+   yylval-namenum.name = strdup(parse_events_get_text(scanner));
return type == PERF_TYPE_HARDWARE ? PE_VALUE_SYM_HW : PE_VALUE_SYM_SW;
 }
 
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index cd88209..25f0123 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -34,8 +34,8 @@ do { \
 %token PE_PREFIX_MEM PE_PREFIX_RAW PE_PREFIX_GROUP
 %token PE_ERROR
 %type num PE_VALUE
-%type num PE_VALUE_SYM_HW
-%type num PE_VALUE_SYM_SW
+%type namenum PE_VALUE_SYM_HW
+%type namenum PE_VALUE_SYM_SW
 %type num PE_RAW
 %type num PE_TERM
 %type str PE_NAME
@@ -65,6 +65,7 @@ do { \
 
 %union
 {
+   struct { char *name; u64 num; } namenum;
char *str;
u64 num;
struct list_head *head;
@@ -195,9 +196,9 @@ PE_NAME '/' event_config '/'
 }
 
 value_sym:
-PE_VALUE_SYM_HW
+PE_VALUE_SYM_HW{ free($1.name); $$ = $1.num; }
 |
-PE_VALUE_SYM_SW
+PE_VALUE_SYM_SW{ free($1.name); $$ = $1.num; }
 
 event_legacy_symbol:
 value_sym '/' event_config '/'
@@ -361,6 +362,24 @@ PE_NAME
$$ = term;
 }
 |
+PE_VALUE_SYM_HW
+{
+   struct parse_events__term *term;
+
+   ABORT_ON(parse_events__term_num(term, PARSE_EVENTS__TERM_TYPE_USER,
+   $1.name, 1));
+   $$ = term;
+}
+|
+PE_VALUE_SYM_SW
+{
+   struct parse_events__term *term;
+
+   ABORT_ON(parse_events__term_num(term, PARSE_EVENTS__TERM_TYPE_USER,
+   $1.name, 1));
+   $$ = term;
+}
+|
 PE_TERM '=' PE_NAME
 {
struct parse_events__term *term;
-- 
1.7.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/