Skip to contentSkip to conversation

perf: intel-pt: Add hybrid CPU compatibility test

PATCH Applied Adrian Hunter 3 participants 6 messages Nov 4, 2022 – Nov 9, 2022 perf events

lore
Share & tools
lore

Adrian Hunter

author reviewer
#0 lore raw

cover perf: intel-pt: Add hybrid CPU compatibility test

Hi

The kernel driver assumes hybrid CPUs will have Intel PT capabilities that are compatible with the boot CPU. Add a test to check that is the case.

First 2 patches are preparation.

Adrian Hunter (3):
perf: intel-pt: Rename intel-pt-pkt-decoder-test.c
perf: intel-pt: Redefine test_suite
perf: intel-pt: Add hybrid CPU compatibility test

 tools/perf/arch/x86/include/arch-tests.h           |   1 +
 tools/perf/arch/x86/tests/Build                    |   2 +-
 tools/perf/arch/x86/tests/arch-tests.c             |  15 +-
 ...intel-pt-pkt-decoder-test.c => intel-pt-test.c} | 154 +++++++++++++++++++++
 4 files changed, 169 insertions(+), 3 deletions(-)
 rename tools/perf/arch/x86/tests/{intel-pt-pkt-decoder-test.c => intel-pt-test.c} (80%)

Regards
Adrian

author reviewer
#1 lore raw

PATCH 1/3 perf: intel-pt: Rename intel-pt-pkt-decoder-test.c

In preparation for adding more Intel PT testing, rename intel-pt-pkt-decoder-test.c to intel-pt-test.c.

Subtests will later be added to intel-pt-test.c.

---
 tools/perf/arch/x86/tests/Build                                 | 2 +-
 .../x86/tests/{intel-pt-pkt-decoder-test.c => intel-pt-test.c}  | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename tools/perf/arch/x86/tests/{intel-pt-pkt-decoder-test.c => intel-pt-test.c} (100%)
tools/perf/arch/x86/tests/Build +1 -1
index 70b5bcbc15df..6f4e8636c3bf 100644
@@ -3,5 +3,5 @@ perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
 
 perf-y += arch-tests.o
 perf-y += sample-parsing.o
-perf-$(CONFIG_AUXTRACE) += insn-x86.o intel-pt-pkt-decoder-test.o
+perf-$(CONFIG_AUXTRACE) += insn-x86.o intel-pt-test.o
 perf-$(CONFIG_X86_64) += bp-modify.o
tools/perf/arch/x86/tests/intel-pt-test.c renamed from tools/perf/arch/x86/tests/intel-pt-pkt-decoder-test.c +0 -0
similarity index 100%
rename from tools/perf/arch/x86/tests/intel-pt-pkt-decoder-test.c
rename to tools/perf/arch/x86/tests/intel-pt-test.c
Signature · 1 line
2.34.1
author reviewer
#2 lore raw

PATCH 2/3 perf: intel-pt: Redefine test_suite

In reply to Adrian Hunter

In preparation for adding more Intel PT testing, redefine the test_suite to allow for adding more subtests.

---
 tools/perf/arch/x86/tests/arch-tests.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
tools/perf/arch/x86/tests/arch-tests.c +12 -2
index 04018b8aa85b..8d5e4a0831d5 100644
@@ -5,7 +5,17 @@
 
 #ifdef HAVE_AUXTRACE_SUPPORT
 DEFINE_SUITE("x86 instruction decoder - new instructions", insn_x86);
-DEFINE_SUITE("Intel PT packet decoder", intel_pt_pkt_decoder);
+
+static struct test_case intel_pt_tests[] = {
+	TEST_CASE("Intel PT packet decoder", intel_pt_pkt_decoder),
+	{ .name = NULL, }
+};
+
+struct test_suite suite__intel_pt = {
+	.desc = "Intel PT packet decoder",
+	.test_cases = intel_pt_tests,
+};
+
 #endif
 #if defined(__x86_64__)
 DEFINE_SUITE("x86 bp modify", bp_modify);
@@ -18,7 +28,7 @@ struct test_suite *arch_tests[] = {
 #endif
 #ifdef HAVE_AUXTRACE_SUPPORT
 	&suite__insn_x86,
-	&suite__intel_pt_pkt_decoder,
+	&suite__intel_pt,
 #endif
 #if defined(__x86_64__)
 	&suite__bp_modify,
Signature · 1 line
2.34.1
author reviewer
#3 lore raw

PATCH 3/3 perf: intel-pt: Add hybrid CPU compatibility test

In reply to Adrian Hunter

The kernel driver assumes hybrid CPUs will have Intel PT capabilities that are compatible with the boot CPU. Add a test to check that is the case.

---
 tools/perf/arch/x86/include/arch-tests.h  |   1 +
 tools/perf/arch/x86/tests/arch-tests.c    |   3 +-
 tools/perf/arch/x86/tests/intel-pt-test.c | 154 ++++++++++++++++++++++
 3 files changed, 157 insertions(+), 1 deletion(-)
tools/perf/arch/x86/include/arch-tests.h +1 -0
index 6a1a1b3c0827..902e9ea9b99e 100644
@@ -8,6 +8,7 @@ struct test_suite;
 int test__rdpmc(struct test_suite *test, int subtest);
 int test__insn_x86(struct test_suite *test, int subtest);
 int test__intel_pt_pkt_decoder(struct test_suite *test, int subtest);
+int test__intel_pt_hybrid_compat(struct test_suite *test, int subtest);
 int test__bp_modify(struct test_suite *test, int subtest);
 int test__x86_sample_parsing(struct test_suite *test, int subtest);
 
tools/perf/arch/x86/tests/arch-tests.c +2 -1
index 8d5e4a0831d5..aae6ea0fe52b 100644
@@ -8,11 +8,12 @@ DEFINE_SUITE("x86 instruction decoder - new instructions", insn_x86);
 
 static struct test_case intel_pt_tests[] = {
 	TEST_CASE("Intel PT packet decoder", intel_pt_pkt_decoder),
+	TEST_CASE("Intel PT hybrid CPU compatibility", intel_pt_hybrid_compat),
 	{ .name = NULL, }
 };
 
 struct test_suite suite__intel_pt = {
-	.desc = "Intel PT packet decoder",
+	.desc = "Intel PT",
 	.test_cases = intel_pt_tests,
 };
 
tools/perf/arch/x86/tests/intel-pt-test.c +154 -0

169 lines not on this page · raw message

Signature · 1 line
2.34.1
maintainer Acked-by on the v1 series
#4 lore raw
In reply to Adrian Hunter

Hi Adrian,

Quoted 7 lines · Adrian Hunter

Hi

The kernel driver assumes hybrid CPUs will have Intel PT capabilities that are compatible with the boot CPU. Add a test to check that is the case.

Quoted 7 lines

First 2 patches are preparation.

Adrian Hunter (3):
perf: intel-pt: Rename intel-pt-pkt-decoder-test.c
perf: intel-pt: Redefine test_suite
perf: intel-pt: Add hybrid CPU compatibility test

Thanks,
Namhyung

Quoted 11 lines
 tools/perf/arch/x86/include/arch-tests.h           |   1 +
 tools/perf/arch/x86/tests/Build                    |   2 +-
 tools/perf/arch/x86/tests/arch-tests.c             |  15 +-
 ...intel-pt-pkt-decoder-test.c => intel-pt-test.c} | 154 +++++++++++++++++++++
 4 files changed, 169 insertions(+), 3 deletions(-)
 rename tools/perf/arch/x86/tests/{intel-pt-pkt-decoder-test.c => intel-pt-test.c} (80%)

Regards
Adrian

maintainer Applied
#5 lore raw

Em Mon, Nov 07, 2022 at 11:32:56AM -0800, Namhyung Kim escreveu:

Quoted 13 lines

Hi Adrian,

Quoted 10 lines · Adrian Hunter

Hi

The kernel driver assumes hybrid CPUs will have Intel PT capabilities that are compatible with the boot CPU. Add a test to check that is the case.

First 2 patches are preparation.

Quoted 6 lines
Quoted 4 lines

Adrian Hunter (3):
perf: intel-pt: Rename intel-pt-pkt-decoder-test.c
perf: intel-pt: Redefine test_suite
perf: intel-pt: Add hybrid CPU compatibility test

Thanks, applied.

- Arnaldo

Quoted 14 lines

Thanks,
Namhyung

Quoted 11 lines
 tools/perf/arch/x86/include/arch-tests.h           |   1 +
 tools/perf/arch/x86/tests/Build                    |   2 +-
 tools/perf/arch/x86/tests/arch-tests.c             |  15 +-
 ...intel-pt-pkt-decoder-test.c => intel-pt-test.c} | 154 +++++++++++++++++++++
 4 files changed, 169 insertions(+), 3 deletions(-)
 rename tools/perf/arch/x86/tests/{intel-pt-pkt-decoder-test.c => intel-pt-test.c} (80%)

Regards
Adrian

Signature · 1 line
- Arnaldo