Skip to contentSkip to conversation

perf test: Fix sample-parsing fails on non-x86 platforms

PATCH Applied [email protected] 2 participants 3 messages Mar 3, 2021 perf events

lore
Share & tools
lore
#1 lore raw

PATCH 2/2 perf test: Support the ins_lat check in the X86 specific test

In reply to [email protected]

From: Kan Liang <[email protected]>

The ins_lat of PERF_SAMPLE_WEIGHT_STRUCT stands for the instruction latency, which is only available for X86. Add a X86 specific test for the ins_lat and PERF_SAMPLE_WEIGHT_STRUCT type.

The test__x86_sample_parsing() uses the same way as the test__sample_parsing() to verify a sample type. Since the ins_lat and PERF_SAMPLE_WEIGHT_STRUCT are the only X86 specific sample type for now, the test__x86_sample_parsing() only verify the PERF_SAMPLE_WEIGHT_STRUCT type. Other sample types are still verified in the generic test.

$perf test 77 -v
77: x86 Sample parsing :
--- start ---
test child forked, pid 102370
test child finished with 0
---- end ----
x86 Sample parsing: Ok

---
 tools/perf/arch/x86/include/arch-tests.h   |   1 +
 tools/perf/arch/x86/tests/Build            |   1 +
 tools/perf/arch/x86/tests/arch-tests.c     |   4 +
 tools/perf/arch/x86/tests/sample-parsing.c | 121 +++++++++++++++++++++++++++++
 4 files changed, 127 insertions(+)
 create mode 100644 tools/perf/arch/x86/tests/sample-parsing.c
tools/perf/arch/x86/include/arch-tests.h +1 -0
index 6a54b94..0e20f3d 100644
@@ -10,6 +10,7 @@ int test__rdpmc(struct test *test __maybe_unused, int subtest);
 int test__insn_x86(struct test *test __maybe_unused, int subtest);
 int test__intel_pt_pkt_decoder(struct test *test, int subtest);
 int test__bp_modify(struct test *test, int subtest);
+int test__x86_sample_parsing(struct test *test, int subtest);
 
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
 struct thread;
tools/perf/arch/x86/tests/Build +1 -0
index 36d4f24..28d7933 100644
@@ -3,5 +3,6 @@ perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
 
 perf-y += arch-tests.o
 perf-y += rdpmc.o
+perf-y += sample-parsing.o
 perf-$(CONFIG_AUXTRACE) += insn-x86.o intel-pt-pkt-decoder-test.o
 perf-$(CONFIG_X86_64) += bp-modify.o
tools/perf/arch/x86/tests/arch-tests.c +4 -0
index bc25d72..71aa673 100644
@@ -31,6 +31,10 @@ struct test arch_tests[] = {
 	},
 #endif
 	{
+		.desc = "x86 Sample parsing",
+		.func = test__x86_sample_parsing,
+	},
+	{
 		.func = NULL,
 	},
 
tools/perf/arch/x86/tests/sample-parsing.c new file +121 -0

121 lines not on this page · raw message

Signature · 1 line
2.7.4
#0 lore raw

PATCH 1/2 perf test: Fix sample-parsing fails on non-x86 platforms

From: Kan Liang <[email protected]>

Executing perf test 27 fails on s390:
[root@t35lp46 perf]# ./perf test -Fv 27
27: Sample parsing
--- start ---
---- end ----
Sample parsing: FAILED!
[root@t35lp46 perf]#

The commit fbefe9c2f87f ("perf tools: Support arch specific PERF_SAMPLE_WEIGHT_STRUCT processing") changes the ins_lat to a model-specific variable only for X86, but perf test still verify the variable in the generic test.

Remove the ins_lat check in the generic test. The following patch will add it in the X86 specific test.

Fixes fbefe9c2f87f ("perf tools: Support arch specific PERF_SAMPLE_WEIGHT_STRUCT processing")
---
 tools/perf/tests/sample-parsing.c | 4 ----
 1 file changed, 4 deletions(-)
tools/perf/tests/sample-parsing.c +0 -4
index 0dbe3aa..8fd8a4e 100644
@@ -129,9 +129,6 @@ static bool samples_same(const struct perf_sample *s1,
 	if (type & PERF_SAMPLE_WEIGHT)
 		COMP(weight);
 
-	if (type & PERF_SAMPLE_WEIGHT_STRUCT)
-		COMP(ins_lat);
-
 	if (type & PERF_SAMPLE_DATA_SRC)
 		COMP(data_src);
 
@@ -245,7 +242,6 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format)
 		.cgroup		= 114,
 		.data_page_size = 115,
 		.code_page_size = 116,
-		.ins_lat        = 117,
 		.aux_sample	= {
 			.size	= sizeof(aux_data),
 			.data	= (void *)aux_data,
Signature · 1 line
2.7.4
maintainer Applied
#2 lore raw

Em Wed, Mar 03, 2021 at 08:01:24AM -0800, [email protected] escreveu:

Quoted 10 lines

From: Kan Liang <[email protected]>

Executing perf test 27 fails on s390:
[root@t35lp46 perf]# ./perf test -Fv 27
27: Sample parsing
--- start ---
---- end ----
Sample parsing: FAILED!
[root@t35lp46 perf]#

Quoted 7 lines

The commit fbefe9c2f87f ("perf tools: Support arch specific PERF_SAMPLE_WEIGHT_STRUCT processing") changes the ins_lat to a model-specific variable only for X86, but perf test still verify the variable in the generic test.

Remove the ins_lat check in the generic test. The following patch will add it in the X86 specific test.

Thanks, applied both patches.

- Arnaldo

Quoted 33 lines
Fixes fbefe9c2f87f ("perf tools: Support arch specific PERF_SAMPLE_WEIGHT_STRUCT processing")
---
 tools/perf/tests/sample-parsing.c | 4 ----
 1 file changed, 4 deletions(-)
tools/perf/tests/sample-parsing.c +0 -4
index 0dbe3aa..8fd8a4e 100644
@@ -129,9 +129,6 @@ static bool samples_same(const struct perf_sample *s1,
 	if (type & PERF_SAMPLE_WEIGHT)
 		COMP(weight);
 
-	if (type & PERF_SAMPLE_WEIGHT_STRUCT)
-		COMP(ins_lat);
-
 	if (type & PERF_SAMPLE_DATA_SRC)
 		COMP(data_src);
 
@@ -245,7 +242,6 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format)
 		.cgroup		= 114,
 		.data_page_size = 115,
 		.code_page_size = 116,
-		.ins_lat        = 117,
 		.aux_sample	= {
 			.size	= sizeof(aux_data),
 			.data	= (void *)aux_data,
Signature · 1 line
2.7.4
Signature · 1 line
- Arnaldo