All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] perf: Support event alias in form foo-bar-baz
@ 2022-01-17 15:10 John Garry
  2022-01-17 15:10 ` [PATCH 1/3] perf parse-events: " John Garry
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: John Garry @ 2022-01-17 15:10 UTC (permalink / raw)
  To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
	namhyung, irogers, kjain
  Cc: linux-perf-users, linux-kernel, linuxarm, liuqi115, zhangshaokun,
	John Garry

Currently event aliases in the form foo-bar-baz are not supported.

The HiSilicon D06 platform has uncore event aliases in that form, and
using those aliases fail:

$ ./perf list sdir-home-migrate 
  
List of pre-defined events (to be used in -e): 
  
uncore hha:
  sdir-home-migrate 
 [Unit: hisi_sccl,hha]  

$ sudo ./perf stat -e sdir-home-migrate  
event syntax error: 'sdir-home-migrate'  
                        \___ parser error  
Run 'perf list' for a list of valid events  
  
 Usage: perf stat [<options>] [<command>]
  
 -e, --event <event>event selector. use 'perf list' to list available events

This series added support for such an event alias form.

I am no expert on l+y, so any and all review here would be appreciated,
especially the last patch which is marked as RFC (for that same reason).

The series is based on acme perf/core @ 9bce13ea88f8.

John Garry (3):
  perf parse-events: Support event alias in form foo-bar-baz
  perf test: Add pmu-events test for aliases with hyphens
  perf test: Add parse-events test for aliases with hyphens

 .../arch/test/test_soc/cpu/uncore.json        | 16 +++++
 tools/perf/tests/parse-events.c               | 49 ++++++++++++++
 tools/perf/tests/pmu-events.c                 | 32 +++++++++
 tools/perf/util/parse-events.c                | 67 ++++++++++++++++---
 tools/perf/util/parse-events.h                |  1 +
 tools/perf/util/parse-events.l                |  2 +
 tools/perf/util/parse-events.y                | 17 ++++-
 7 files changed, 171 insertions(+), 13 deletions(-)

-- 
2.26.2


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

* [PATCH 1/3] perf parse-events: Support event alias in form foo-bar-baz
  2022-01-17 15:10 [PATCH 0/3] perf: Support event alias in form foo-bar-baz John Garry
@ 2022-01-17 15:10 ` John Garry
  2022-01-17 15:10 ` [PATCH 2/3] perf test: Add pmu-events test for aliases with hyphens John Garry
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: John Garry @ 2022-01-17 15:10 UTC (permalink / raw)
  To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
	namhyung, irogers, kjain
  Cc: linux-perf-users, linux-kernel, linuxarm, liuqi115, zhangshaokun,
	John Garry

Event aliasing for events whose name in the form foo-bar-baz is not
supported, while foo-bar, foo_bar_baz, and other combinations are, i.e.
two hyphens are not supported.

The HiSilicon D06 platform has events in such form:

$ ./perf list sdir-home-migrate 
  
List of pre-defined events (to be used in -e): 
  
uncore hha:
  sdir-home-migrate 
 [Unit: hisi_sccl,hha]  

$ sudo ./perf stat -e sdir-home-migrate  
event syntax error: 'sdir-home-migrate'  
                        \___ parser error  
Run 'perf list' for a list of valid events  
  
 Usage: perf stat [<options>] [<command>]
  
 -e, --event <event>event selector. use 'perf list' to list available events

To support, add an extra PMU event symbol type for "baz", and add a new
rule in the bison file.

Signed-off-by: John Garry <john.garry@huawei.com>
---
 tools/perf/util/parse-events.c | 25 +++++++++++++++++++++++--
 tools/perf/util/parse-events.h |  1 +
 tools/perf/util/parse-events.l |  2 ++
 tools/perf/util/parse-events.y | 17 +++++++++++++++--
 4 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index acf20ce98ce9..879f606e07e6 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -2098,8 +2098,17 @@ static void perf_pmu__parse_init(void)
 	pmu = NULL;
 	while ((pmu = perf_pmu__scan(pmu)) != NULL) {
 		list_for_each_entry(alias, &pmu->aliases, list) {
-			if (strchr(alias->name, '-'))
+			char *tmp = strchr(alias->name, '-');
+
+			if (tmp) {
+				char *tmp2 = NULL;
+
+				tmp2 = strchr(tmp + 1, '-');
 				len++;
+				if (tmp2)
+					len++;
+			}
+
 			len++;
 		}
 	}
@@ -2119,8 +2128,20 @@ static void perf_pmu__parse_init(void)
 		list_for_each_entry(alias, &pmu->aliases, list) {
 			struct perf_pmu_event_symbol *p = perf_pmu_events_list + len;
 			char *tmp = strchr(alias->name, '-');
+			char *tmp2 = NULL;
 
-			if (tmp != NULL) {
+			if (tmp)
+				tmp2 = strchr(tmp + 1, '-');
+			if (tmp2) {
+				SET_SYMBOL(strndup(alias->name, tmp - alias->name),
+						PMU_EVENT_SYMBOL_PREFIX);
+				p++;
+				tmp++;
+				SET_SYMBOL(strndup(tmp, tmp2 - tmp), PMU_EVENT_SYMBOL_SUFFIX);
+				p++;
+				SET_SYMBOL(strdup(++tmp2), PMU_EVENT_SYMBOL_SUFFIX2);
+				len += 3;
+			} else if (tmp) {
 				SET_SYMBOL(strndup(alias->name, tmp - alias->name),
 						PMU_EVENT_SYMBOL_PREFIX);
 				p++;
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index c7fc93f54577..a38b8b160e80 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -53,6 +53,7 @@ enum perf_pmu_event_symbol_type {
 	PMU_EVENT_SYMBOL,		/* normal style PMU event */
 	PMU_EVENT_SYMBOL_PREFIX,	/* prefix of pre-suf style event */
 	PMU_EVENT_SYMBOL_SUFFIX,	/* suffix of pre-suf style event */
+	PMU_EVENT_SYMBOL_SUFFIX2,	/* suffix of pre-suf2 style event */
 };
 
 struct perf_pmu_event_symbol {
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index 4efe9872c667..5b6e4b5249cf 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -149,6 +149,8 @@ static int pmu_str_check(yyscan_t scanner, struct parse_events_state *parse_stat
 			return PE_PMU_EVENT_PRE;
 		case PMU_EVENT_SYMBOL_SUFFIX:
 			return PE_PMU_EVENT_SUF;
+		case PMU_EVENT_SYMBOL_SUFFIX2:
+			return PE_PMU_EVENT_SUF2;
 		case PMU_EVENT_SYMBOL:
 			return parse_state->fake_pmu
 				? PE_PMU_EVENT_FAKE : PE_KERNEL_PMU_EVENT;
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 174158982fae..be8c51770051 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -69,7 +69,7 @@ static void inc_group_count(struct list_head *list,
 %token PE_NAME_CACHE_TYPE PE_NAME_CACHE_OP_RESULT
 %token PE_PREFIX_MEM PE_PREFIX_RAW PE_PREFIX_GROUP
 %token PE_ERROR
-%token PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT PE_PMU_EVENT_FAKE
+%token PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_PMU_EVENT_SUF2 PE_KERNEL_PMU_EVENT PE_PMU_EVENT_FAKE
 %token PE_ARRAY_ALL PE_ARRAY_RANGE
 %token PE_DRV_CFG_TERM
 %type <num> PE_VALUE
@@ -87,7 +87,7 @@ static void inc_group_count(struct list_head *list,
 %type <str> PE_MODIFIER_EVENT
 %type <str> PE_MODIFIER_BP
 %type <str> PE_EVENT_NAME
-%type <str> PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT PE_PMU_EVENT_FAKE
+%type <str> PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_PMU_EVENT_SUF2 PE_KERNEL_PMU_EVENT PE_PMU_EVENT_FAKE
 %type <str> PE_DRV_CFG_TERM
 %type <str> event_pmu_name
 %destructor { free ($$); } <str>
@@ -372,6 +372,19 @@ PE_KERNEL_PMU_EVENT opt_pmu_config
 	$$ = list;
 }
 |
+PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF '-' PE_PMU_EVENT_SUF2 sep_dc
+{
+	struct list_head *list;
+	char pmu_name[128];
+	snprintf(pmu_name, sizeof(pmu_name), "%s-%s-%s", $1, $3, $5);
+	free($1);
+	free($3);
+	free($5);
+	if (parse_events_multi_pmu_add(_parse_state, pmu_name, NULL, &list) < 0)
+		YYABORT;
+	$$ = list;
+}
+|
 PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc
 {
 	struct list_head *list;
-- 
2.26.2


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

* [PATCH 2/3] perf test: Add pmu-events test for aliases with hyphens
  2022-01-17 15:10 [PATCH 0/3] perf: Support event alias in form foo-bar-baz John Garry
  2022-01-17 15:10 ` [PATCH 1/3] perf parse-events: " John Garry
@ 2022-01-17 15:10 ` John Garry
  2022-01-17 15:10 ` [PATCH 3/3] perf test: Add parse-events " John Garry
  2022-01-17 16:21 ` [PATCH 0/3] perf: Support event alias in form foo-bar-baz Ian Rogers
  3 siblings, 0 replies; 6+ messages in thread
From: John Garry @ 2022-01-17 15:10 UTC (permalink / raw)
  To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
	namhyung, irogers, kjain
  Cc: linux-perf-users, linux-kernel, linuxarm, liuqi115, zhangshaokun,
	John Garry

Add a test for aliases with hyphens in the name to ensure that the
pmu-events tables are as expects. There should be no reason why these sort
of aliases would be treated differently, but no harm in checking.

Signed-off-by: John Garry <john.garry@huawei.com>
---
 .../arch/test/test_soc/cpu/uncore.json        | 16 ++++++++++
 tools/perf/tests/pmu-events.c                 | 32 +++++++++++++++++++
 2 files changed, 48 insertions(+)

diff --git a/tools/perf/pmu-events/arch/test/test_soc/cpu/uncore.json b/tools/perf/pmu-events/arch/test/test_soc/cpu/uncore.json
index 73089c682f80..41bac1c6a008 100644
--- a/tools/perf/pmu-events/arch/test/test_soc/cpu/uncore.json
+++ b/tools/perf/pmu-events/arch/test/test_soc/cpu/uncore.json
@@ -18,6 +18,22 @@
 	    "Invert": "0",
 	    "EdgeDetect": "0"
   },
+  {
+	    "Unit": "CBO",
+	    "EventCode": "0xE0",
+	    "UMask": "0x00",
+	    "EventName": "event-hyphen",
+	    "BriefDescription": "UNC_CBO_HYPHEN",
+	    "PublicDescription": "UNC_CBO_HYPHEN"
+  },
+  {
+	    "Unit": "CBO",
+	    "EventCode": "0xC0",
+	    "UMask": "0x00",
+	    "EventName": "event-two-hyph",
+	    "BriefDescription": "UNC_CBO_TWO_HYPH",
+	    "PublicDescription": "UNC_CBO_TWO_HYPH"
+  },
   {
 	    "EventCode": "0x7",
 	    "EventName": "uncore_hisi_l3c.rd_hit_cpipe",
diff --git a/tools/perf/tests/pmu-events.c b/tools/perf/tests/pmu-events.c
index df1c9a3cc05b..1c695fb5a79c 100644
--- a/tools/perf/tests/pmu-events.c
+++ b/tools/perf/tests/pmu-events.c
@@ -143,6 +143,34 @@ static const struct perf_pmu_test_event unc_cbo_xsnp_response_miss_eviction = {
 	.matching_pmu = "uncore_cbox_0",
 };
 
+static const struct perf_pmu_test_event uncore_hyphen = {
+	.event = {
+		.name = "event-hyphen",
+		.event = "umask=0x00,event=0xe0",
+		.desc = "Unit: uncore_cbox UNC_CBO_HYPHEN",
+		.topic = "uncore",
+		.long_desc = "UNC_CBO_HYPHEN",
+		.pmu = "uncore_cbox",
+	},
+	.alias_str = "umask=0,event=0xe0",
+	.alias_long_desc = "UNC_CBO_HYPHEN",
+	.matching_pmu = "uncore_cbox_0",
+};
+
+static const struct perf_pmu_test_event uncore_two_hyph = {
+	.event = {
+		.name = "event-two-hyph",
+		.event = "umask=0x00,event=0xc0",
+		.desc = "Unit: uncore_cbox UNC_CBO_TWO_HYPH",
+		.topic = "uncore",
+		.long_desc = "UNC_CBO_TWO_HYPH",
+		.pmu = "uncore_cbox",
+	},
+	.alias_str = "umask=0,event=0xc0",
+	.alias_long_desc = "UNC_CBO_TWO_HYPH",
+	.matching_pmu = "uncore_cbox_0",
+};
+
 static const struct perf_pmu_test_event uncore_hisi_l3c_rd_hit_cpipe = {
 	.event = {
 		.name = "uncore_hisi_l3c.rd_hit_cpipe",
@@ -188,6 +216,8 @@ static const struct perf_pmu_test_event uncore_imc_cache_hits = {
 static const struct perf_pmu_test_event *uncore_events[] = {
 	&uncore_hisi_ddrc_flux_wcmd,
 	&unc_cbo_xsnp_response_miss_eviction,
+	&uncore_hyphen,
+	&uncore_two_hyph,
 	&uncore_hisi_l3c_rd_hit_cpipe,
 	&uncore_imc_free_running_cache_miss,
 	&uncore_imc_cache_hits,
@@ -654,6 +684,8 @@ static struct perf_pmu_test_pmu test_pmus[] = {
 		},
 		.aliases = {
 			&unc_cbo_xsnp_response_miss_eviction,
+			&uncore_hyphen,
+			&uncore_two_hyph,
 		},
 	},
 	{
-- 
2.26.2


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

* [PATCH 3/3] perf test: Add parse-events test for aliases with hyphens
  2022-01-17 15:10 [PATCH 0/3] perf: Support event alias in form foo-bar-baz John Garry
  2022-01-17 15:10 ` [PATCH 1/3] perf parse-events: " John Garry
  2022-01-17 15:10 ` [PATCH 2/3] perf test: Add pmu-events test for aliases with hyphens John Garry
@ 2022-01-17 15:10 ` John Garry
  2022-01-17 16:21 ` [PATCH 0/3] perf: Support event alias in form foo-bar-baz Ian Rogers
  3 siblings, 0 replies; 6+ messages in thread
From: John Garry @ 2022-01-17 15:10 UTC (permalink / raw)
  To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
	namhyung, irogers, kjain
  Cc: linux-perf-users, linux-kernel, linuxarm, liuqi115, zhangshaokun,
	John Garry

Add a test which allows us to test parsing an event alias with hyphens.

Since these events typically do not exist on most host systems, add the
alias to the fake pmu.

Function perf_pmu__test_parse_init() has terms added to match known test
aliases.

Signed-off-by: John Garry <john.garry@huawei.com>
---
 tools/perf/tests/parse-events.c | 49 +++++++++++++++++++++++++++++++++
 tools/perf/util/parse-events.c  | 42 ++++++++++++++++++++++------
 2 files changed, 82 insertions(+), 9 deletions(-)

diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index a508f1dbcb2a..e71efadb24f5 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -2069,6 +2069,31 @@ static int test_event(struct evlist_test *e)
 	return ret;
 }
 
+static int test_event_fake_pmu(const char *str)
+{
+	struct parse_events_error err;
+	struct evlist *evlist;
+	int ret;
+
+	evlist = evlist__new();
+	if (!evlist)
+		return -ENOMEM;
+
+	parse_events_error__init(&err);
+	perf_pmu__test_parse_init();
+	ret = __parse_events(evlist, str, &err, &perf_pmu__fake);
+	if (ret) {
+		pr_debug("failed to parse event '%s', err %d, str '%s'\n",
+			 str, ret, err.str);
+		parse_events_error__print(&err, str);
+	}
+
+	parse_events_error__exit(&err);
+	evlist__delete(evlist);
+
+	return ret;
+}
+
 static int test_events(struct evlist_test *events, unsigned cnt)
 {
 	int ret1, ret2 = 0;
@@ -2276,6 +2301,26 @@ static int test_pmu_events_alias(char *event, char *alias)
 	return test_event(&e);
 }
 
+static int test_pmu_events_alias2(void)
+{
+	static const char events[][30] = {
+			"event-hyphen",
+			"event-two-hyph",
+	};
+	unsigned long i;
+	int ret = 0;
+
+	for (i = 0; i < ARRAY_SIZE(events); i++) {
+		ret = test_event_fake_pmu(&events[i][0]);
+		if (ret) {
+			pr_err("check_parse_fake %s failed\n", &events[i][0]);
+			break;
+		}
+	}
+
+	return ret;
+}
+
 static int test__parse_events(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
 {
 	int ret1, ret2 = 0;
@@ -2313,6 +2358,10 @@ do {							\
 			return ret;
 	}
 
+	ret1 = test_pmu_events_alias2();
+	if (!ret2)
+		ret2 = ret1;
+
 	ret1 = test_terms(test__terms, ARRAY_SIZE(test__terms));
 	if (!ret2)
 		ret2 = ret1;
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 879f606e07e6..9739b05b999e 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1697,6 +1697,15 @@ int parse_events_multi_pmu_add(struct parse_events_state *parse_state,
 			}
 		}
 	}
+
+	if (parse_state->fake_pmu) {
+		if (!parse_events_add_pmu(parse_state, list, str, head,
+					  true, true)) {
+			pr_debug("%s -> %s/%s/\n", str, "fake_pmu", str);
+			ok++;
+		}
+	}
+
 out_err:
 	if (ok)
 		*listp = list;
@@ -2168,23 +2177,38 @@ static void perf_pmu__parse_init(void)
  */
 int perf_pmu__test_parse_init(void)
 {
-	struct perf_pmu_event_symbol *list;
+	struct perf_pmu_event_symbol *list, *tmp, symbols[] = {
+		{(char *)"read", PMU_EVENT_SYMBOL},
+		{(char *)"event", PMU_EVENT_SYMBOL_PREFIX},
+		{(char *)"two", PMU_EVENT_SYMBOL_SUFFIX},
+		{(char *)"hyphen", PMU_EVENT_SYMBOL_SUFFIX},
+		{(char *)"hyph", PMU_EVENT_SYMBOL_SUFFIX2},
+	};
+	unsigned long i, j;
 
-	list = malloc(sizeof(*list) * 1);
+	tmp = list = malloc(sizeof(*list) * ARRAY_SIZE(symbols));
 	if (!list)
 		return -ENOMEM;
 
-	list->type   = PMU_EVENT_SYMBOL;
-	list->symbol = strdup("read");
-
-	if (!list->symbol) {
-		free(list);
-		return -ENOMEM;
+	for (i = 0; i < ARRAY_SIZE(symbols); i++, tmp++) {
+		tmp->type = symbols[i].type;
+		tmp->symbol = strdup(symbols[i].symbol);
+		if (!list->symbol)
+			goto err_free;
 	}
 
 	perf_pmu_events_list = list;
-	perf_pmu_events_list_num = 1;
+	perf_pmu_events_list_num = ARRAY_SIZE(symbols);
+
+	qsort(perf_pmu_events_list, ARRAY_SIZE(symbols),
+	      sizeof(struct perf_pmu_event_symbol), comp_pmu);
 	return 0;
+
+err_free:
+	for (j = 0, tmp = list; j < i; j++, tmp++)
+		free(tmp->symbol);
+	free(list);
+	return -ENOMEM;
 }
 
 enum perf_pmu_event_symbol_type
-- 
2.26.2


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

* Re: [PATCH 0/3] perf: Support event alias in form foo-bar-baz
  2022-01-17 15:10 [PATCH 0/3] perf: Support event alias in form foo-bar-baz John Garry
                   ` (2 preceding siblings ...)
  2022-01-17 15:10 ` [PATCH 3/3] perf test: Add parse-events " John Garry
@ 2022-01-17 16:21 ` Ian Rogers
  2022-01-22 20:22   ` Arnaldo Carvalho de Melo
  3 siblings, 1 reply; 6+ messages in thread
From: Ian Rogers @ 2022-01-17 16:21 UTC (permalink / raw)
  To: John Garry
  Cc: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
	namhyung, kjain, linux-perf-users, linux-kernel, linuxarm,
	liuqi115, zhangshaokun

On Mon, Jan 17, 2022 at 7:15 AM John Garry <john.garry@huawei.com> wrote:
>
> Currently event aliases in the form foo-bar-baz are not supported.
>
> The HiSilicon D06 platform has uncore event aliases in that form, and
> using those aliases fail:
>
> $ ./perf list sdir-home-migrate
>
> List of pre-defined events (to be used in -e):
>
> uncore hha:
>   sdir-home-migrate
>  [Unit: hisi_sccl,hha]
>
> $ sudo ./perf stat -e sdir-home-migrate
> event syntax error: 'sdir-home-migrate'
>                         \___ parser error
> Run 'perf list' for a list of valid events
>
>  Usage: perf stat [<options>] [<command>]
>
>  -e, --event <event>event selector. use 'perf list' to list available events
>
> This series added support for such an event alias form.
>
> I am no expert on l+y, so any and all review here would be appreciated,
> especially the last patch which is marked as RFC (for that same reason).
>
> The series is based on acme perf/core @ 9bce13ea88f8.
>
> John Garry (3):
>   perf parse-events: Support event alias in form foo-bar-baz
>   perf test: Add pmu-events test for aliases with hyphens
>   perf test: Add parse-events test for aliases with hyphens

The whole set:

Acked-by: Ian Rogers <irogers@google.com>

The additional code is no worse than the existing code. The testing is
a great addition!

Thanks,
Ian

>  .../arch/test/test_soc/cpu/uncore.json        | 16 +++++
>  tools/perf/tests/parse-events.c               | 49 ++++++++++++++
>  tools/perf/tests/pmu-events.c                 | 32 +++++++++
>  tools/perf/util/parse-events.c                | 67 ++++++++++++++++---
>  tools/perf/util/parse-events.h                |  1 +
>  tools/perf/util/parse-events.l                |  2 +
>  tools/perf/util/parse-events.y                | 17 ++++-
>  7 files changed, 171 insertions(+), 13 deletions(-)
>
> --
> 2.26.2
>

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

* Re: [PATCH 0/3] perf: Support event alias in form foo-bar-baz
  2022-01-17 16:21 ` [PATCH 0/3] perf: Support event alias in form foo-bar-baz Ian Rogers
@ 2022-01-22 20:22   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-01-22 20:22 UTC (permalink / raw)
  To: Ian Rogers
  Cc: John Garry, peterz, mingo, mark.rutland, alexander.shishkin,
	jolsa, namhyung, kjain, linux-perf-users, linux-kernel, linuxarm,
	liuqi115, zhangshaokun

Em Mon, Jan 17, 2022 at 08:21:42AM -0800, Ian Rogers escreveu:
> On Mon, Jan 17, 2022 at 7:15 AM John Garry <john.garry@huawei.com> wrote:
> >
> > Currently event aliases in the form foo-bar-baz are not supported.
> >
> > The HiSilicon D06 platform has uncore event aliases in that form, and
> > using those aliases fail:
> >
> > $ ./perf list sdir-home-migrate
> >
> > List of pre-defined events (to be used in -e):
> >
> > uncore hha:
> >   sdir-home-migrate
> >  [Unit: hisi_sccl,hha]
> >
> > $ sudo ./perf stat -e sdir-home-migrate
> > event syntax error: 'sdir-home-migrate'
> >                         \___ parser error
> > Run 'perf list' for a list of valid events
> >
> >  Usage: perf stat [<options>] [<command>]
> >
> >  -e, --event <event>event selector. use 'perf list' to list available events
> >
> > This series added support for such an event alias form.
> >
> > I am no expert on l+y, so any and all review here would be appreciated,
> > especially the last patch which is marked as RFC (for that same reason).
> >
> > The series is based on acme perf/core @ 9bce13ea88f8.
> >
> > John Garry (3):
> >   perf parse-events: Support event alias in form foo-bar-baz
> >   perf test: Add pmu-events test for aliases with hyphens
> >   perf test: Add parse-events test for aliases with hyphens
> 
> The whole set:
> 
> Acked-by: Ian Rogers <irogers@google.com>
> 
> The additional code is no worse than the existing code. The testing is
> a great addition!

Indeed, thanks a lot!

Thanks, applied.

- Arnaldo

 
> Thanks,
> Ian
> 
> >  .../arch/test/test_soc/cpu/uncore.json        | 16 +++++
> >  tools/perf/tests/parse-events.c               | 49 ++++++++++++++
> >  tools/perf/tests/pmu-events.c                 | 32 +++++++++
> >  tools/perf/util/parse-events.c                | 67 ++++++++++++++++---
> >  tools/perf/util/parse-events.h                |  1 +
> >  tools/perf/util/parse-events.l                |  2 +
> >  tools/perf/util/parse-events.y                | 17 ++++-
> >  7 files changed, 171 insertions(+), 13 deletions(-)
> >
> > --
> > 2.26.2
> >

-- 

- Arnaldo

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

end of thread, other threads:[~2022-01-22 20:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17 15:10 [PATCH 0/3] perf: Support event alias in form foo-bar-baz John Garry
2022-01-17 15:10 ` [PATCH 1/3] perf parse-events: " John Garry
2022-01-17 15:10 ` [PATCH 2/3] perf test: Add pmu-events test for aliases with hyphens John Garry
2022-01-17 15:10 ` [PATCH 3/3] perf test: Add parse-events " John Garry
2022-01-17 16:21 ` [PATCH 0/3] perf: Support event alias in form foo-bar-baz Ian Rogers
2022-01-22 20:22   ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.