* [PATCH v2 1/2] perf x86 test: Update hybrid expectations
@ 2024-01-03 17:01 Ian Rogers
2024-01-03 17:01 ` [PATCH v2 2/2] perf x86 test: Add hybrid test for conflicting legacy/sysfs event Ian Rogers
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ian Rogers @ 2024-01-03 17:01 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Ian Rogers, Adrian Hunter, Kan Liang, linux-perf-users,
linux-kernel
The legacy events cpu-cycles and instructions have sysfs event
equivalents on x86 (see /sys/devices/cpu_core/events). As sysfs/JSON
events are now higher in priority than legacy events this causes the
hybrid test expectations not to be met. To fix this switch to legacy
events that don't have sysfs versions, namely cpu-cycles becomes
cycles and instructions becomes branches.
Fixes: a24d9d9dc096 ("perf parse-events: Make legacy events lower priority than sysfs/JSON")
Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Closes: https://lore.kernel.org/lkml/ZYbm5L7tw7bdpDpE@kernel.org/
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/arch/x86/tests/hybrid.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tools/perf/arch/x86/tests/hybrid.c b/tools/perf/arch/x86/tests/hybrid.c
index eb152770f148..05a5f81e8167 100644
--- a/tools/perf/arch/x86/tests/hybrid.c
+++ b/tools/perf/arch/x86/tests/hybrid.c
@@ -47,7 +47,7 @@ static int test__hybrid_hw_group_event(struct evlist *evlist)
evsel = evsel__next(evsel);
TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
TEST_ASSERT_VAL("wrong hybrid type", test_hybrid_type(evsel, PERF_TYPE_RAW));
- TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_INSTRUCTIONS));
+ TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_BRANCH_INSTRUCTIONS));
TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
return TEST_OK;
}
@@ -102,7 +102,7 @@ static int test__hybrid_group_modifier1(struct evlist *evlist)
evsel = evsel__next(evsel);
TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
TEST_ASSERT_VAL("wrong hybrid type", test_hybrid_type(evsel, PERF_TYPE_RAW));
- TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_INSTRUCTIONS));
+ TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_BRANCH_INSTRUCTIONS));
TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
@@ -171,27 +171,27 @@ struct evlist_test {
static const struct evlist_test test__hybrid_events[] = {
{
- .name = "cpu_core/cpu-cycles/",
+ .name = "cpu_core/cycles/",
.check = test__hybrid_hw_event_with_pmu,
/* 0 */
},
{
- .name = "{cpu_core/cpu-cycles/,cpu_core/instructions/}",
+ .name = "{cpu_core/cycles/,cpu_core/branches/}",
.check = test__hybrid_hw_group_event,
/* 1 */
},
{
- .name = "{cpu-clock,cpu_core/cpu-cycles/}",
+ .name = "{cpu-clock,cpu_core/cycles/}",
.check = test__hybrid_sw_hw_group_event,
/* 2 */
},
{
- .name = "{cpu_core/cpu-cycles/,cpu-clock}",
+ .name = "{cpu_core/cycles/,cpu-clock}",
.check = test__hybrid_hw_sw_group_event,
/* 3 */
},
{
- .name = "{cpu_core/cpu-cycles/k,cpu_core/instructions/u}",
+ .name = "{cpu_core/cycles/k,cpu_core/branches/u}",
.check = test__hybrid_group_modifier1,
/* 4 */
},
--
2.43.0.472.g3155946c3a-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] perf x86 test: Add hybrid test for conflicting legacy/sysfs event
2024-01-03 17:01 [PATCH v2 1/2] perf x86 test: Update hybrid expectations Ian Rogers
@ 2024-01-03 17:01 ` Ian Rogers
2024-01-03 17:44 ` [PATCH v2 1/2] perf x86 test: Update hybrid expectations Liang, Kan
2024-01-05 12:00 ` Mark Rutland
2 siblings, 0 replies; 4+ messages in thread
From: Ian Rogers @ 2024-01-03 17:01 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Ian Rogers, Adrian Hunter, Kan Liang, linux-perf-users,
linux-kernel
The cpu-cycles event is both a legacy event and declared in
/sys/devices/cpu_core/events/cpu-cycles. The cycles event is a legacy
event but with no sysfs version. Add a test that the sysfs version is
preferred to the legacy for cpu-cycles, while for cycles we use the
legacy version.
Suggested-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/arch/x86/tests/hybrid.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/tools/perf/arch/x86/tests/hybrid.c b/tools/perf/arch/x86/tests/hybrid.c
index 05a5f81e8167..40f5d17fedab 100644
--- a/tools/perf/arch/x86/tests/hybrid.c
+++ b/tools/perf/arch/x86/tests/hybrid.c
@@ -163,6 +163,24 @@ static int test__checkevent_pmu(struct evlist *evlist)
return TEST_OK;
}
+static int test__hybrid_hw_group_event_2(struct evlist *evlist)
+{
+ struct evsel *evsel, *leader;
+
+ evsel = leader = evlist__first(evlist);
+ TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
+ TEST_ASSERT_VAL("wrong hybrid type", test_hybrid_type(evsel, PERF_TYPE_RAW));
+ TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
+ TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
+
+ evsel = evsel__next(evsel);
+ TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
+ TEST_ASSERT_VAL("wrong config", evsel->core.attr.config == 0x3c);
+ TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
+ return TEST_OK;
+}
+
struct evlist_test {
const char *name;
bool (*valid)(void);
@@ -215,6 +233,11 @@ static const struct evlist_test test__hybrid_events[] = {
.check = test__hybrid_cache_event,
/* 8 */
},
+ {
+ .name = "{cpu_core/cycles/,cpu_core/cpu-cycles/}",
+ .check = test__hybrid_hw_group_event_2,
+ /* 9 */
+ },
};
static int test_event(const struct evlist_test *e)
--
2.43.0.472.g3155946c3a-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/2] perf x86 test: Update hybrid expectations
2024-01-03 17:01 [PATCH v2 1/2] perf x86 test: Update hybrid expectations Ian Rogers
2024-01-03 17:01 ` [PATCH v2 2/2] perf x86 test: Add hybrid test for conflicting legacy/sysfs event Ian Rogers
@ 2024-01-03 17:44 ` Liang, Kan
2024-01-05 12:00 ` Mark Rutland
2 siblings, 0 replies; 4+ messages in thread
From: Liang, Kan @ 2024-01-03 17:44 UTC (permalink / raw)
To: Ian Rogers, Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Adrian Hunter, linux-perf-users, linux-kernel
On 2024-01-03 12:01 p.m., Ian Rogers wrote:
> The legacy events cpu-cycles and instructions have sysfs event
> equivalents on x86 (see /sys/devices/cpu_core/events). As sysfs/JSON
> events are now higher in priority than legacy events this causes the
> hybrid test expectations not to be met. To fix this switch to legacy
> events that don't have sysfs versions, namely cpu-cycles becomes
> cycles and instructions becomes branches.
>
> Fixes: a24d9d9dc096 ("perf parse-events: Make legacy events lower priority than sysfs/JSON")
> Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
> Closes: https://lore.kernel.org/lkml/ZYbm5L7tw7bdpDpE@kernel.org/
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
Thanks Ian. For the series,
Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
Thanks,
Kan
> tools/perf/arch/x86/tests/hybrid.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/tools/perf/arch/x86/tests/hybrid.c b/tools/perf/arch/x86/tests/hybrid.c
> index eb152770f148..05a5f81e8167 100644
> --- a/tools/perf/arch/x86/tests/hybrid.c
> +++ b/tools/perf/arch/x86/tests/hybrid.c
> @@ -47,7 +47,7 @@ static int test__hybrid_hw_group_event(struct evlist *evlist)
> evsel = evsel__next(evsel);
> TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
> TEST_ASSERT_VAL("wrong hybrid type", test_hybrid_type(evsel, PERF_TYPE_RAW));
> - TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_INSTRUCTIONS));
> + TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_BRANCH_INSTRUCTIONS));
> TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
> return TEST_OK;
> }
> @@ -102,7 +102,7 @@ static int test__hybrid_group_modifier1(struct evlist *evlist)
> evsel = evsel__next(evsel);
> TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
> TEST_ASSERT_VAL("wrong hybrid type", test_hybrid_type(evsel, PERF_TYPE_RAW));
> - TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_INSTRUCTIONS));
> + TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_BRANCH_INSTRUCTIONS));
> TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
> TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
> TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
> @@ -171,27 +171,27 @@ struct evlist_test {
>
> static const struct evlist_test test__hybrid_events[] = {
> {
> - .name = "cpu_core/cpu-cycles/",
> + .name = "cpu_core/cycles/",
> .check = test__hybrid_hw_event_with_pmu,
> /* 0 */
> },
> {
> - .name = "{cpu_core/cpu-cycles/,cpu_core/instructions/}",
> + .name = "{cpu_core/cycles/,cpu_core/branches/}",
> .check = test__hybrid_hw_group_event,
> /* 1 */
> },
> {
> - .name = "{cpu-clock,cpu_core/cpu-cycles/}",
> + .name = "{cpu-clock,cpu_core/cycles/}",
> .check = test__hybrid_sw_hw_group_event,
> /* 2 */
> },
> {
> - .name = "{cpu_core/cpu-cycles/,cpu-clock}",
> + .name = "{cpu_core/cycles/,cpu-clock}",
> .check = test__hybrid_hw_sw_group_event,
> /* 3 */
> },
> {
> - .name = "{cpu_core/cpu-cycles/k,cpu_core/instructions/u}",
> + .name = "{cpu_core/cycles/k,cpu_core/branches/u}",
> .check = test__hybrid_group_modifier1,
> /* 4 */
> },
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/2] perf x86 test: Update hybrid expectations
2024-01-03 17:01 [PATCH v2 1/2] perf x86 test: Update hybrid expectations Ian Rogers
2024-01-03 17:01 ` [PATCH v2 2/2] perf x86 test: Add hybrid test for conflicting legacy/sysfs event Ian Rogers
2024-01-03 17:44 ` [PATCH v2 1/2] perf x86 test: Update hybrid expectations Liang, Kan
@ 2024-01-05 12:00 ` Mark Rutland
2 siblings, 0 replies; 4+ messages in thread
From: Mark Rutland @ 2024-01-05 12:00 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Alexander Shishkin, Jiri Olsa, Namhyung Kim, Adrian Hunter,
Kan Liang, linux-perf-users, linux-kernel
On Wed, Jan 03, 2024 at 09:01:58AM -0800, Ian Rogers wrote:
> The legacy events cpu-cycles and instructions have sysfs event
> equivalents on x86 (see /sys/devices/cpu_core/events). As sysfs/JSON
> events are now higher in priority than legacy events this causes the
> hybrid test expectations not to be met. To fix this switch to legacy
> events that don't have sysfs versions, namely cpu-cycles becomes
> cycles and instructions becomes branches.
>
> Fixes: a24d9d9dc096 ("perf parse-events: Make legacy events lower priority than sysfs/JSON")
> Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
> Closes: https://lore.kernel.org/lkml/ZYbm5L7tw7bdpDpE@kernel.org/
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> tools/perf/arch/x86/tests/hybrid.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
For both patches:
Acked-by: Mark Rutland <mark.rutland@arm.com>
Mark.
>
> diff --git a/tools/perf/arch/x86/tests/hybrid.c b/tools/perf/arch/x86/tests/hybrid.c
> index eb152770f148..05a5f81e8167 100644
> --- a/tools/perf/arch/x86/tests/hybrid.c
> +++ b/tools/perf/arch/x86/tests/hybrid.c
> @@ -47,7 +47,7 @@ static int test__hybrid_hw_group_event(struct evlist *evlist)
> evsel = evsel__next(evsel);
> TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
> TEST_ASSERT_VAL("wrong hybrid type", test_hybrid_type(evsel, PERF_TYPE_RAW));
> - TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_INSTRUCTIONS));
> + TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_BRANCH_INSTRUCTIONS));
> TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
> return TEST_OK;
> }
> @@ -102,7 +102,7 @@ static int test__hybrid_group_modifier1(struct evlist *evlist)
> evsel = evsel__next(evsel);
> TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
> TEST_ASSERT_VAL("wrong hybrid type", test_hybrid_type(evsel, PERF_TYPE_RAW));
> - TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_INSTRUCTIONS));
> + TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_BRANCH_INSTRUCTIONS));
> TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
> TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
> TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
> @@ -171,27 +171,27 @@ struct evlist_test {
>
> static const struct evlist_test test__hybrid_events[] = {
> {
> - .name = "cpu_core/cpu-cycles/",
> + .name = "cpu_core/cycles/",
> .check = test__hybrid_hw_event_with_pmu,
> /* 0 */
> },
> {
> - .name = "{cpu_core/cpu-cycles/,cpu_core/instructions/}",
> + .name = "{cpu_core/cycles/,cpu_core/branches/}",
> .check = test__hybrid_hw_group_event,
> /* 1 */
> },
> {
> - .name = "{cpu-clock,cpu_core/cpu-cycles/}",
> + .name = "{cpu-clock,cpu_core/cycles/}",
> .check = test__hybrid_sw_hw_group_event,
> /* 2 */
> },
> {
> - .name = "{cpu_core/cpu-cycles/,cpu-clock}",
> + .name = "{cpu_core/cycles/,cpu-clock}",
> .check = test__hybrid_hw_sw_group_event,
> /* 3 */
> },
> {
> - .name = "{cpu_core/cpu-cycles/k,cpu_core/instructions/u}",
> + .name = "{cpu_core/cycles/k,cpu_core/branches/u}",
> .check = test__hybrid_group_modifier1,
> /* 4 */
> },
> --
> 2.43.0.472.g3155946c3a-goog
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-05 12:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-03 17:01 [PATCH v2 1/2] perf x86 test: Update hybrid expectations Ian Rogers
2024-01-03 17:01 ` [PATCH v2 2/2] perf x86 test: Add hybrid test for conflicting legacy/sysfs event Ian Rogers
2024-01-03 17:44 ` [PATCH v2 1/2] perf x86 test: Update hybrid expectations Liang, Kan
2024-01-05 12:00 ` Mark Rutland
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).