linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/3] perf tool: 'config3' attribute support
@ 2022-10-04 19:12 Rob Herring
  2022-10-04 19:12 ` [PATCH v4 1/3] perf: Skip and warn on unknown format 'configN' attrs Rob Herring
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Rob Herring @ 2022-10-04 19:12 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Mark Rutland, Namhyung Kim,
	Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa
  Cc: linux-kernel, linux-perf-users, Leo Yan, James Clark,
	Namhyung Kim

This series is a fix to allow unknown 'configN' attrs and then extends 
perf tool to support a new config3 attr.

The config3 support is RFC for context as the kernel side support[1] is 
not yet accepted. Patch 1 is intended for 6.1.

[1] https://lore.kernel.org/all/20220825-arm-spe-v8-7-v1-0-c75b8d92e692@kernel.org/

Signed-off-by: Rob Herring <robh@kernel.org>
---
Changes in v4:
- Fix event parsing test segfault
- Add 'config3' in event parsing tests
- Link to v3: https://lore.kernel.org/r/20220914-arm-perf-tool-spe1-2-v2-v3-0-8189fc04dcc6@kernel.org

---
Rob Herring (3):
      perf: Skip and warn on unknown format 'configN' attrs
      perf tools: Sync perf_event_attr::config3 addition
      perf: Add support for perf_event_attr::config3

 include/uapi/linux/perf_event.h       |  3 +++
 tools/include/uapi/linux/perf_event.h |  3 +++
 tools/perf/tests/parse-events.c       | 13 ++++++++++++-
 tools/perf/util/parse-events.c        |  9 +++++++++
 tools/perf/util/parse-events.h        |  1 +
 tools/perf/util/parse-events.l        |  1 +
 tools/perf/util/pmu.c                 | 20 ++++++++++++++++++++
 tools/perf/util/pmu.h                 |  3 +++
 tools/perf/util/pmu.l                 |  2 --
 tools/perf/util/pmu.y                 | 15 ++++-----------
 10 files changed, 56 insertions(+), 14 deletions(-)
---
base-commit: 1c23f9e627a7b412978b4e852793c5e3c3efc555
change-id: 20220914-arm-perf-tool-spe1-2-v2-cab789c5d598

Best regards,
-- 
Rob Herring <robh@kernel.org>

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

* [PATCH v4 1/3] perf: Skip and warn on unknown format 'configN' attrs
  2022-10-04 19:12 [PATCH v4 0/3] perf tool: 'config3' attribute support Rob Herring
@ 2022-10-04 19:12 ` Rob Herring
  2022-10-04 19:12 ` [PATCH v4 2/3] perf tools: Sync perf_event_attr::config3 addition Rob Herring
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2022-10-04 19:12 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Mark Rutland, Namhyung Kim,
	Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa
  Cc: linux-kernel, linux-perf-users, Leo Yan, James Clark,
	Namhyung Kim

If the kernel exposes a new perf_event_attr field in a format attr, perf
will return an error stating the specified PMU can't be found. For
example, a format attr with 'config3:0-63' causes an error as config3 is
unknown to perf. This causes a compatibility issue between a newer
kernel with older perf tool.

Before this change with a kernel adding 'config3' I get:

$ perf record -e arm_spe// -- true
event syntax error: 'arm_spe//'
                     \___ Cannot find PMU `arm_spe'. Missing kernel support?
Run 'perf list' for a list of valid events

 Usage: perf record [<options>] [<command>]
    or: perf record [<options>] -- <command> [<options>]

    -e, --event <event>   event selector. use 'perf list' to list
available events

After this change, I get:

$ perf record -e arm_spe// -- true
WARNING: 'arm_spe_0' format 'inv_event_filter' requires 'perf_event_attr::config3' which is not supported by this version of perf!
[ perf record: Woken up 2 times to write data ]
[ perf record: Captured and wrote 0.091 MB perf.data ]

To support unknown configN formats, rework the YACC implementation to
pass any config[0-9]+ format to perf_pmu__new_format() to handle with a
warning.

Cc: stable@vger.kernel.org
Tested-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
---
v4:
 - Skip format list check for fake pmu

v3:
 - https://lore.kernel.org/r/20220914-arm-perf-tool-spe1-2-v2-v3-0-8189fc04dcc6@kernel.org
 - Move warning from format scanning to when PMU is selected
 - Add and use PERF_PMU_FORMAT_VALUE_CONFIG_END

v2:
 - https://lore.kernel.org/all/20220909204509.2169512-1-robh@kernel.org/
 - Rework YACC code to handle configN formats in C code
 - Add a warning when an unknown configN attr is found

v1:
 - https://lore.kernel.org/all/20220901184709.2179309-1-robh@kernel.org/
---
 tools/perf/util/parse-events.c |  3 +++
 tools/perf/util/pmu.c          | 17 +++++++++++++++++
 tools/perf/util/pmu.h          |  2 ++
 tools/perf/util/pmu.l          |  2 --
 tools/perf/util/pmu.y          | 15 ++++-----------
 5 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index f05e15acd33f..e2305fca0f95 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -215,6 +215,9 @@ __add_event(struct list_head *list, int *idx,
 	struct perf_cpu_map *cpus = pmu ? perf_cpu_map__get(pmu->cpus) :
 			       cpu_list ? perf_cpu_map__new(cpu_list) : NULL;
 
+	if (pmu)
+		perf_pmu__warn_invalid_formats(pmu);
+
 	if (pmu && attr->type == PERF_TYPE_RAW)
 		perf_pmu__warn_invalid_config(pmu, attr->config, name);
 
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 89655d53117a..82455b073c2f 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -1005,6 +1005,23 @@ static struct perf_pmu *pmu_lookup(const char *lookup_name)
 	return NULL;
 }
 
+void perf_pmu__warn_invalid_formats(struct perf_pmu *pmu)
+{
+	struct perf_pmu_format *format;
+
+	/* fake pmu doesn't have format list */
+	if (pmu == &perf_pmu__fake)
+		return;
+
+	list_for_each_entry(format, &pmu->format, list)
+		if (format->value >= PERF_PMU_FORMAT_VALUE_CONFIG_END) {
+			pr_warning("WARNING: '%s' format '%s' requires 'perf_event_attr::config%d'"
+				   "which is not supported by this version of perf!\n",
+				   pmu->name, format->name, format->value);
+			return;
+		}
+}
+
 static struct perf_pmu *pmu_find(const char *name)
 {
 	struct perf_pmu *pmu;
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index a7b0f9507510..68e15c38ae71 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -17,6 +17,7 @@ enum {
 	PERF_PMU_FORMAT_VALUE_CONFIG,
 	PERF_PMU_FORMAT_VALUE_CONFIG1,
 	PERF_PMU_FORMAT_VALUE_CONFIG2,
+	PERF_PMU_FORMAT_VALUE_CONFIG_END,
 };
 
 #define PERF_PMU_FORMAT_BITS 64
@@ -139,6 +140,7 @@ int perf_pmu__caps_parse(struct perf_pmu *pmu);
 
 void perf_pmu__warn_invalid_config(struct perf_pmu *pmu, __u64 config,
 				   const char *name);
+void perf_pmu__warn_invalid_formats(struct perf_pmu *pmu);
 
 bool perf_pmu__has_hybrid(void);
 int perf_pmu__match(char *pattern, char *name, char *tok);
diff --git a/tools/perf/util/pmu.l b/tools/perf/util/pmu.l
index a15d9fbd7c0e..58b4926cfaca 100644
--- a/tools/perf/util/pmu.l
+++ b/tools/perf/util/pmu.l
@@ -27,8 +27,6 @@ num_dec         [0-9]+
 
 {num_dec}	{ return value(10); }
 config		{ return PP_CONFIG; }
-config1		{ return PP_CONFIG1; }
-config2		{ return PP_CONFIG2; }
 -		{ return '-'; }
 :		{ return ':'; }
 ,		{ return ','; }
diff --git a/tools/perf/util/pmu.y b/tools/perf/util/pmu.y
index bfd7e8509869..283efe059819 100644
--- a/tools/perf/util/pmu.y
+++ b/tools/perf/util/pmu.y
@@ -20,7 +20,7 @@ do { \
 
 %}
 
-%token PP_CONFIG PP_CONFIG1 PP_CONFIG2
+%token PP_CONFIG
 %token PP_VALUE PP_ERROR
 %type <num> PP_VALUE
 %type <bits> bit_term
@@ -47,18 +47,11 @@ PP_CONFIG ':' bits
 				      $3));
 }
 |
-PP_CONFIG1 ':' bits
+PP_CONFIG PP_VALUE ':' bits
 {
 	ABORT_ON(perf_pmu__new_format(format, name,
-				      PERF_PMU_FORMAT_VALUE_CONFIG1,
-				      $3));
-}
-|
-PP_CONFIG2 ':' bits
-{
-	ABORT_ON(perf_pmu__new_format(format, name,
-				      PERF_PMU_FORMAT_VALUE_CONFIG2,
-				      $3));
+				      $2,
+				      $4));
 }
 
 bits:

-- 
b4 0.11.0-dev

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

* [PATCH v4 2/3] perf tools: Sync perf_event_attr::config3 addition
  2022-10-04 19:12 [PATCH v4 0/3] perf tool: 'config3' attribute support Rob Herring
  2022-10-04 19:12 ` [PATCH v4 1/3] perf: Skip and warn on unknown format 'configN' attrs Rob Herring
@ 2022-10-04 19:12 ` Rob Herring
  2022-10-14 21:51   ` Arnaldo Carvalho de Melo
  2022-10-04 19:12 ` [PATCH v4 3/3] perf: Add support for perf_event_attr::config3 Rob Herring
  2022-10-14 15:25 ` [PATCH v4 0/3] perf tool: 'config3' attribute support Arnaldo Carvalho de Melo
  3 siblings, 1 reply; 7+ messages in thread
From: Rob Herring @ 2022-10-04 19:12 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Mark Rutland, Namhyung Kim,
	Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa
  Cc: linux-kernel, linux-perf-users, Leo Yan, James Clark,
	Namhyung Kim

Arm SPEv1.2 adds another 64-bits of event filtering control. As the
existing perf_event_attr::configN fields are all used up for SPE PMU, an
additional field is needed. Add a new 'config3' field.

Signed-off-by: Rob Herring <robh@kernel.org>
---
This patch is dependent on the kernel side landing first.
---
 include/uapi/linux/perf_event.h       | 3 +++
 tools/include/uapi/linux/perf_event.h | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index 03b370062741..b53f9b958235 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -333,6 +333,7 @@ enum perf_event_read_format {
 #define PERF_ATTR_SIZE_VER5	112	/* add: aux_watermark */
 #define PERF_ATTR_SIZE_VER6	120	/* add: aux_sample_size */
 #define PERF_ATTR_SIZE_VER7	128	/* add: sig_data */
+#define PERF_ATTR_SIZE_VER8	136	/* add: config3 */
 
 /*
  * Hardware event_id to monitor via a performance monitoring event:
@@ -474,6 +475,8 @@ struct perf_event_attr {
 	 * truncated accordingly on 32 bit architectures.
 	 */
 	__u64	sig_data;
+
+	__u64	config3; /* extension of config2 */
 };
 
 /*
diff --git a/tools/include/uapi/linux/perf_event.h b/tools/include/uapi/linux/perf_event.h
index 581ed4bdc062..7fad17853310 100644
--- a/tools/include/uapi/linux/perf_event.h
+++ b/tools/include/uapi/linux/perf_event.h
@@ -333,6 +333,7 @@ enum perf_event_read_format {
 #define PERF_ATTR_SIZE_VER5	112	/* add: aux_watermark */
 #define PERF_ATTR_SIZE_VER6	120	/* add: aux_sample_size */
 #define PERF_ATTR_SIZE_VER7	128	/* add: sig_data */
+#define PERF_ATTR_SIZE_VER8	136	/* add: config3 */
 
 /*
  * Hardware event_id to monitor via a performance monitoring event:
@@ -474,6 +475,8 @@ struct perf_event_attr {
 	 * truncated accordingly on 32 bit architectures.
 	 */
 	__u64	sig_data;
+
+	__u64	config3; /* extension of config2 */
 };
 
 /*

-- 
b4 0.11.0-dev

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

* [PATCH v4 3/3] perf: Add support for perf_event_attr::config3
  2022-10-04 19:12 [PATCH v4 0/3] perf tool: 'config3' attribute support Rob Herring
  2022-10-04 19:12 ` [PATCH v4 1/3] perf: Skip and warn on unknown format 'configN' attrs Rob Herring
  2022-10-04 19:12 ` [PATCH v4 2/3] perf tools: Sync perf_event_attr::config3 addition Rob Herring
@ 2022-10-04 19:12 ` Rob Herring
  2022-10-14 15:25 ` [PATCH v4 0/3] perf tool: 'config3' attribute support Arnaldo Carvalho de Melo
  3 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2022-10-04 19:12 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Mark Rutland, Namhyung Kim,
	Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa
  Cc: linux-kernel, linux-perf-users, Leo Yan, James Clark,
	Namhyung Kim

perf_event_attr has gained a new field, config3, so add support for it
extending the existing configN support.

Signed-off-by: Rob Herring <robh@kernel.org>
---
This patch is dependent on the kernel side landing first.

v4:
 - Add config3 to event parsing tests
---
 tools/perf/tests/parse-events.c | 13 ++++++++++++-
 tools/perf/util/parse-events.c  |  6 ++++++
 tools/perf/util/parse-events.h  |  1 +
 tools/perf/util/parse-events.l  |  1 +
 tools/perf/util/pmu.c           |  3 +++
 tools/perf/util/pmu.h           |  1 +
 6 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 459afdb256a1..ddd5bdfe5723 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -444,6 +444,7 @@ static int test__checkevent_pmu(struct evlist *evlist)
 	TEST_ASSERT_VAL("wrong config",    10 == evsel->core.attr.config);
 	TEST_ASSERT_VAL("wrong config1",    1 == evsel->core.attr.config1);
 	TEST_ASSERT_VAL("wrong config2",    3 == evsel->core.attr.config2);
+	TEST_ASSERT_VAL("wrong config3",    0 == evsel->core.attr.config3);
 	/*
 	 * The period value gets configured within evlist__config,
 	 * while this test executes only parse events method.
@@ -464,6 +465,7 @@ static int test__checkevent_list(struct evlist *evlist)
 	TEST_ASSERT_VAL("wrong config", 1 == evsel->core.attr.config);
 	TEST_ASSERT_VAL("wrong config1", 0 == evsel->core.attr.config1);
 	TEST_ASSERT_VAL("wrong config2", 0 == evsel->core.attr.config2);
+	TEST_ASSERT_VAL("wrong config3", 0 == evsel->core.attr.config3);
 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
@@ -625,6 +627,15 @@ static int test__checkterms_simple(struct list_head *terms)
 	TEST_ASSERT_VAL("wrong val", term->val.num == 3);
 	TEST_ASSERT_VAL("wrong config", !strcmp(term->config, "config2"));
 
+	/* config3=4 */
+	term = list_entry(term->list.next, struct parse_events_term, list);
+	TEST_ASSERT_VAL("wrong type term",
+			term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG3);
+	TEST_ASSERT_VAL("wrong type val",
+			term->type_val == PARSE_EVENTS__TERM_TYPE_NUM);
+	TEST_ASSERT_VAL("wrong val", term->val.num == 4);
+	TEST_ASSERT_VAL("wrong config", !strcmp(term->config, "config3"));
+
 	/* umask=1*/
 	term = list_entry(term->list.next, struct parse_events_term, list);
 	TEST_ASSERT_VAL("wrong type term",
@@ -1983,7 +1994,7 @@ struct terms_test {
 
 static const struct terms_test test__terms[] = {
 	[0] = {
-		.str   = "config=10,config1,config2=3,umask=1,read,r0xead",
+		.str   = "config=10,config1,config2=3,config3=4,umask=1,read,r0xead",
 		.check = test__checkterms_simple,
 	},
 };
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index e2305fca0f95..c843434981d0 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -913,6 +913,7 @@ static const char *config_term_names[__PARSE_EVENTS__TERM_TYPE_NR] = {
 	[PARSE_EVENTS__TERM_TYPE_CONFIG]		= "config",
 	[PARSE_EVENTS__TERM_TYPE_CONFIG1]		= "config1",
 	[PARSE_EVENTS__TERM_TYPE_CONFIG2]		= "config2",
+	[PARSE_EVENTS__TERM_TYPE_CONFIG3]		= "config3",
 	[PARSE_EVENTS__TERM_TYPE_NAME]			= "name",
 	[PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD]		= "period",
 	[PARSE_EVENTS__TERM_TYPE_SAMPLE_FREQ]		= "freq",
@@ -952,6 +953,7 @@ config_term_avail(int term_type, struct parse_events_error *err)
 	case PARSE_EVENTS__TERM_TYPE_CONFIG:
 	case PARSE_EVENTS__TERM_TYPE_CONFIG1:
 	case PARSE_EVENTS__TERM_TYPE_CONFIG2:
+	case PARSE_EVENTS__TERM_TYPE_CONFIG3:
 	case PARSE_EVENTS__TERM_TYPE_NAME:
 	case PARSE_EVENTS__TERM_TYPE_METRIC_ID:
 	case PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD:
@@ -997,6 +999,10 @@ do {									   \
 		CHECK_TYPE_VAL(NUM);
 		attr->config2 = term->val.num;
 		break;
+	case PARSE_EVENTS__TERM_TYPE_CONFIG3:
+		CHECK_TYPE_VAL(NUM);
+		attr->config3 = term->val.num;
+		break;
 	case PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD:
 		CHECK_TYPE_VAL(NUM);
 		break;
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index 7e6a601d9cd0..fa9460900abf 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -59,6 +59,7 @@ enum {
 	PARSE_EVENTS__TERM_TYPE_CONFIG,
 	PARSE_EVENTS__TERM_TYPE_CONFIG1,
 	PARSE_EVENTS__TERM_TYPE_CONFIG2,
+	PARSE_EVENTS__TERM_TYPE_CONFIG3,
 	PARSE_EVENTS__TERM_TYPE_NAME,
 	PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD,
 	PARSE_EVENTS__TERM_TYPE_SAMPLE_FREQ,
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index 3a9ce96c8bce..51fe0a9fb3de 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -285,6 +285,7 @@ modifier_bp	[rwx]{1,3}
 config			{ return term(yyscanner, PARSE_EVENTS__TERM_TYPE_CONFIG); }
 config1			{ return term(yyscanner, PARSE_EVENTS__TERM_TYPE_CONFIG1); }
 config2			{ return term(yyscanner, PARSE_EVENTS__TERM_TYPE_CONFIG2); }
+config3			{ return term(yyscanner, PARSE_EVENTS__TERM_TYPE_CONFIG3); }
 name			{ return term(yyscanner, PARSE_EVENTS__TERM_TYPE_NAME); }
 period			{ return term(yyscanner, PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD); }
 freq			{ return term(yyscanner, PARSE_EVENTS__TERM_TYPE_SAMPLE_FREQ); }
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 82455b073c2f..9c0a4b9973a4 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -1278,6 +1278,9 @@ static int pmu_config_term(const char *pmu_name,
 	case PERF_PMU_FORMAT_VALUE_CONFIG2:
 		vp = &attr->config2;
 		break;
+	case PERF_PMU_FORMAT_VALUE_CONFIG3:
+		vp = &attr->config3;
+		break;
 	default:
 		return -EINVAL;
 	}
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 68e15c38ae71..2e6bd1bf304a 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -17,6 +17,7 @@ enum {
 	PERF_PMU_FORMAT_VALUE_CONFIG,
 	PERF_PMU_FORMAT_VALUE_CONFIG1,
 	PERF_PMU_FORMAT_VALUE_CONFIG2,
+	PERF_PMU_FORMAT_VALUE_CONFIG3,
 	PERF_PMU_FORMAT_VALUE_CONFIG_END,
 };
 

-- 
b4 0.11.0-dev

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

* Re: [PATCH v4 0/3] perf tool: 'config3' attribute support
  2022-10-04 19:12 [PATCH v4 0/3] perf tool: 'config3' attribute support Rob Herring
                   ` (2 preceding siblings ...)
  2022-10-04 19:12 ` [PATCH v4 3/3] perf: Add support for perf_event_attr::config3 Rob Herring
@ 2022-10-14 15:25 ` Arnaldo Carvalho de Melo
  3 siblings, 0 replies; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-10-14 15:25 UTC (permalink / raw)
  To: Rob Herring
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Namhyung Kim,
	Alexander Shishkin, Jiri Olsa, linux-kernel, linux-perf-users,
	Leo Yan, James Clark

Em Tue, Oct 04, 2022 at 02:12:34PM -0500, Rob Herring escreveu:
> This series is a fix to allow unknown 'configN' attrs and then extends 
> perf tool to support a new config3 attr.
> 
> The config3 support is RFC for context as the kernel side support[1] is 
> not yet accepted. Patch 1 is intended for 6.1.
> 
> [1] https://lore.kernel.org/all/20220825-arm-spe-v8-7-v1-0-c75b8d92e692@kernel.org/
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> Changes in v4:
> - Fix event parsing test segfault
> - Add 'config3' in event parsing tests
> - Link to v3: https://lore.kernel.org/r/20220914-arm-perf-tool-spe1-2-v2-v3-0-8189fc04dcc6@kernel.org

Thanks, applied.

- Arnaldo

 
> ---
> Rob Herring (3):
>       perf: Skip and warn on unknown format 'configN' attrs
>       perf tools: Sync perf_event_attr::config3 addition
>       perf: Add support for perf_event_attr::config3
> 
>  include/uapi/linux/perf_event.h       |  3 +++
>  tools/include/uapi/linux/perf_event.h |  3 +++
>  tools/perf/tests/parse-events.c       | 13 ++++++++++++-
>  tools/perf/util/parse-events.c        |  9 +++++++++
>  tools/perf/util/parse-events.h        |  1 +
>  tools/perf/util/parse-events.l        |  1 +
>  tools/perf/util/pmu.c                 | 20 ++++++++++++++++++++
>  tools/perf/util/pmu.h                 |  3 +++
>  tools/perf/util/pmu.l                 |  2 --
>  tools/perf/util/pmu.y                 | 15 ++++-----------
>  10 files changed, 56 insertions(+), 14 deletions(-)
> ---
> base-commit: 1c23f9e627a7b412978b4e852793c5e3c3efc555
> change-id: 20220914-arm-perf-tool-spe1-2-v2-cab789c5d598
> 
> Best regards,
> -- 
> Rob Herring <robh@kernel.org>

-- 

- Arnaldo

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

* Re: [PATCH v4 2/3] perf tools: Sync perf_event_attr::config3 addition
  2022-10-04 19:12 ` [PATCH v4 2/3] perf tools: Sync perf_event_attr::config3 addition Rob Herring
@ 2022-10-14 21:51   ` Arnaldo Carvalho de Melo
  2022-10-14 22:05     ` Rob Herring
  0 siblings, 1 reply; 7+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-10-14 21:51 UTC (permalink / raw)
  To: Rob Herring
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Namhyung Kim,
	Alexander Shishkin, Jiri Olsa, linux-kernel, linux-perf-users,
	Leo Yan, James Clark

Em Tue, Oct 04, 2022 at 02:12:36PM -0500, Rob Herring escreveu:
> Arm SPEv1.2 adds another 64-bits of event filtering control. As the
> existing perf_event_attr::configN fields are all used up for SPE PMU, an
> additional field is needed. Add a new 'config3' field.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> This patch is dependent on the kernel side landing first.
> ---
>  include/uapi/linux/perf_event.h       | 3 +++
>  tools/include/uapi/linux/perf_event.h | 3 +++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
> index 03b370062741..b53f9b958235 100644
> --- a/include/uapi/linux/perf_event.h
> +++ b/include/uapi/linux/perf_event.h
> @@ -333,6 +333,7 @@ enum perf_event_read_format {
>  #define PERF_ATTR_SIZE_VER5	112	/* add: aux_watermark */
>  #define PERF_ATTR_SIZE_VER6	120	/* add: aux_sample_size */
>  #define PERF_ATTR_SIZE_VER7	128	/* add: sig_data */
> +#define PERF_ATTR_SIZE_VER8	136	/* add: config3 */
>  
>  /*
>   * Hardware event_id to monitor via a performance monitoring event:
> @@ -474,6 +475,8 @@ struct perf_event_attr {
>  	 * truncated accordingly on 32 bit architectures.
>  	 */
>  	__u64	sig_data;
> +
> +	__u64	config3; /* extension of config2 */
>  };
>  
>  /*


I'm removing the above part, as this is for the kernel, not for tooling.

Was this part submitted upstream? I couldn't find, so far, where it was
submitted, can you please clarify?

- Arnaldo

> diff --git a/tools/include/uapi/linux/perf_event.h b/tools/include/uapi/linux/perf_event.h
> index 581ed4bdc062..7fad17853310 100644
> --- a/tools/include/uapi/linux/perf_event.h
> +++ b/tools/include/uapi/linux/perf_event.h
> @@ -333,6 +333,7 @@ enum perf_event_read_format {
>  #define PERF_ATTR_SIZE_VER5	112	/* add: aux_watermark */
>  #define PERF_ATTR_SIZE_VER6	120	/* add: aux_sample_size */
>  #define PERF_ATTR_SIZE_VER7	128	/* add: sig_data */
> +#define PERF_ATTR_SIZE_VER8	136	/* add: config3 */
>  
>  /*
>   * Hardware event_id to monitor via a performance monitoring event:
> @@ -474,6 +475,8 @@ struct perf_event_attr {
>  	 * truncated accordingly on 32 bit architectures.
>  	 */
>  	__u64	sig_data;
> +
> +	__u64	config3; /* extension of config2 */
>  };
>  
>  /*
> 
> -- 
> b4 0.11.0-dev

-- 

- Arnaldo

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

* Re: [PATCH v4 2/3] perf tools: Sync perf_event_attr::config3 addition
  2022-10-14 21:51   ` Arnaldo Carvalho de Melo
@ 2022-10-14 22:05     ` Rob Herring
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2022-10-14 22:05 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Namhyung Kim,
	Alexander Shishkin, Jiri Olsa, linux-kernel, linux-perf-users,
	Leo Yan, James Clark

On Fri, Oct 14, 2022 at 4:51 PM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> Em Tue, Oct 04, 2022 at 02:12:36PM -0500, Rob Herring escreveu:
> > Arm SPEv1.2 adds another 64-bits of event filtering control. As the
> > existing perf_event_attr::configN fields are all used up for SPE PMU, an
> > additional field is needed. Add a new 'config3' field.
> >
> > Signed-off-by: Rob Herring <robh@kernel.org>
> > ---
> > This patch is dependent on the kernel side landing first.
> > ---
> >  include/uapi/linux/perf_event.h       | 3 +++
> >  tools/include/uapi/linux/perf_event.h | 3 +++
> >  2 files changed, 6 insertions(+)
> >
> > diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
> > index 03b370062741..b53f9b958235 100644
> > --- a/include/uapi/linux/perf_event.h
> > +++ b/include/uapi/linux/perf_event.h
> > @@ -333,6 +333,7 @@ enum perf_event_read_format {
> >  #define PERF_ATTR_SIZE_VER5  112     /* add: aux_watermark */
> >  #define PERF_ATTR_SIZE_VER6  120     /* add: aux_sample_size */
> >  #define PERF_ATTR_SIZE_VER7  128     /* add: sig_data */
> > +#define PERF_ATTR_SIZE_VER8  136     /* add: config3 */
> >
> >  /*
> >   * Hardware event_id to monitor via a performance monitoring event:
> > @@ -474,6 +475,8 @@ struct perf_event_attr {
> >        * truncated accordingly on 32 bit architectures.
> >        */
> >       __u64   sig_data;
> > +
> > +     __u64   config3; /* extension of config2 */
> >  };
> >
> >  /*
>
>
> I'm removing the above part, as this is for the kernel, not for tooling.

Oops, yes.

>
> Was this part submitted upstream? I couldn't find, so far, where it was
> submitted, can you please clarify?

I have to respin it after rc1. I'm waiting on patch 1 to be accepted first.

You should only take patch 1 (for 6.1/stable) as I've noted in the
patches. I sent the whole thing because Leo asked to see the whole
thing...

Rob

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

end of thread, other threads:[~2022-10-14 22:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-04 19:12 [PATCH v4 0/3] perf tool: 'config3' attribute support Rob Herring
2022-10-04 19:12 ` [PATCH v4 1/3] perf: Skip and warn on unknown format 'configN' attrs Rob Herring
2022-10-04 19:12 ` [PATCH v4 2/3] perf tools: Sync perf_event_attr::config3 addition Rob Herring
2022-10-14 21:51   ` Arnaldo Carvalho de Melo
2022-10-14 22:05     ` Rob Herring
2022-10-04 19:12 ` [PATCH v4 3/3] perf: Add support for perf_event_attr::config3 Rob Herring
2022-10-14 15:25 ` [PATCH v4 0/3] perf tool: 'config3' attribute support Arnaldo Carvalho de Melo

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).