perf test case 6 dumps core on s390 without PMU
Using Linux 6.5.0rc3 perf test case 6 dumps core on an s390 without configured PMU (this can happen depending on customer machine configuration).
In this configuration several perf test cases fail:
# ./perf test 2>&1 | grep FAIL 6.1: Test event parsing : FAILED! 10.3: Parsing of PMU event table metrics : FAILED! 10.4: Parsing of PMU event table metrics with fake PMUs : FAILED! 28: Use a dummy software event to keep tracking : FAILED! 35: Track with sched_switch : FAILED! 66: Parse and process metrics : FAILED! #
Even worse the test case 6 dumps core:
# ./perf test -F 6 6: Parse event definition strings : 6.1: Test event parsing : Segmentation fault (core dumped) #
The root cause for these failures and core dump is a missing
PMU, as can be seen by the debug output:
...
Event test failure: test 57 'instructions:uep'
running test 58 '{cycles,cache-misses,branch-misses}:e'
No PMU found for 'cycles' <-- Here no PMU is found, because there is none!
FAILED tests/parse-events.c:1516 wrong number of entries
Event test failure: test 58 '{cycles,cache-misses,branch-misses}:e'Here no PMU is found, because there is none!
....
running test 59 'cycles/name=name/'
No PMU found for 'name'
Segmentation fault (core dumped)
Here the root cause in in function test__term_equal_term() variable evsel->name is NULL:
# gdb ./perf
....
Breakpoint 1, test__term_equal_term (evlist=0x1542c00) at\
tests/parse-events.c:1688
(gdb) p evsel->name
$3 = 0x3fff7fe3dc0 ""
(gdb) n
691 TEST_ASSERT_VAL("wrong type", evsel->core.attr.type == PERF_TYPE_HARDWARE);
(gdb) n
1692 TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES));
(gdb) n
1693 TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "name") == 0);
(gdb) nProgram received signal SIGSEGV, Segmentation fault.
I could fix this by checking for NULL pointer, but I have the feeling that there is more to it. However I do not fully understand the latest rework on the event handling.
The other test cases listed above fail due to the same root cause, no PMU found.
Please advise. What should all these test return when a system does not have any PMU defined at all?
Thanks a lot.
Signature · 5 lines
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany -- Vorsitzender des Aufsichtsrats: Gregor Pillen Geschäftsführung: David Faller Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
Quoted 14 lines · Thomas Richter
Using Linux 6.5.0rc3 perf test case 6 dumps core on an s390 without configured PMU (this can happen depending on customer machine configuration).
In this configuration several perf test cases fail:
# ./perf test 2>&1 | grep FAIL 6.1: Test event parsing : FAILED! 10.3: Parsing of PMU event table metrics : FAILED! 10.4: Parsing of PMU event table metrics with fake PMUs : FAILED! 28: Use a dummy software event to keep tracking : FAILED! 35: Track with sched_switch : FAILED! 66: Parse and process metrics : FAILED! #
Quoted 7 lines
Even worse the test case 6 dumps core:
# ./perf test -F 6 6: Parse event definition strings : 6.1: Test event parsing : Segmentation fault (core dumped) #
Thanks for reporting this!
Quoted 38 lines
The root cause for these failures and core dump is a missing
PMU, as can be seen by the debug output:
...
Event test failure: test 57 'instructions:uep'
running test 58 '{cycles,cache-misses,branch-misses}:e'
No PMU found for 'cycles' <-- Here no PMU is found, because there is none!FAILED tests/parse-events.c:1516 wrong number of entries Event test failure: test 58 '{cycles,cache-misses,branch-misses}:e'Here no PMU is found, because there is none!
....
running test 59 'cycles/name=name/'
No PMU found for 'name'
Segmentation fault (core dumped)Here the root cause in in function
test__term_equal_term()variableevsel->nameis NULL:# gdb ./perf .... Breakpoint 1, test__term_equal_term (evlist=0x1542c00) at\ tests/parse-events.c:1688 (gdb) p evsel->name $3 = 0x3fff7fe3dc0 "" (gdb) n 691 TEST_ASSERT_VAL("wrong type", evsel->core.attr.type == PERF_TYPE_HARDWARE); (gdb) n 1692 TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES)); (gdb) n 1693 TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "name") == 0); (gdb) nProgram received signal SIGSEGV, Segmentation fault.
I could fix this by checking for NULL pointer, but I have the feeling that there is more to it. However I do not fully understand the latest rework on the event handling.
Quoted 5 lines
The other test cases listed above fail due to the same root cause, no PMU found.
Please advise. What should all these test return when a system does not have any PMU defined at all?
So I was writing a response then figured out I've already fixed this but it looks like the patch hasn't been taken yet:
https://lore.kernel.org/lkml/[email protected]/
Arnaldo, could you take a look?
Thanks,
Ian
Quoted 8 lines
Thanks a lot.
--
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany --
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
Thomas Richter
Tested-byQuoted 69 lines · Ian Rogers
Quoted 14 lines · Thomas Richter
Using Linux 6.5.0rc3 perf test case 6 dumps core on an s390 without configured PMU (this can happen depending on customer machine configuration).
In this configuration several perf test cases fail:
# ./perf test 2>&1 | grep FAIL 6.1: Test event parsing : FAILED! 10.3: Parsing of PMU event table metrics : FAILED! 10.4: Parsing of PMU event table metrics with fake PMUs : FAILED! 28: Use a dummy software event to keep tracking : FAILED! 35: Track with sched_switch : FAILED! 66: Parse and process metrics : FAILED! #Quoted 7 lines
Even worse the test case 6 dumps core:
# ./perf test -F 6 6: Parse event definition strings : 6.1: Test event parsing : Segmentation fault (core dumped) #Thanks for reporting this!
Quoted 38 lines
The root cause for these failures and core dump is a missing
PMU, as can be seen by the debug output:
...
Event test failure: test 57 'instructions:uep'
running test 58 '{cycles,cache-misses,branch-misses}:e'
No PMU found for 'cycles' <-- Here no PMU is found, because there is none!FAILED tests/parse-events.c:1516 wrong number of entries Event test failure: test 58 '{cycles,cache-misses,branch-misses}:e'Here no PMU is found, because there is none!
....
running test 59 'cycles/name=name/'
No PMU found for 'name'
Segmentation fault (core dumped)Here the root cause in in function
test__term_equal_term()variableevsel->nameis NULL:# gdb ./perf .... Breakpoint 1, test__term_equal_term (evlist=0x1542c00) at\ tests/parse-events.c:1688 (gdb) p evsel->name $3 = 0x3fff7fe3dc0 "" (gdb) n 691 TEST_ASSERT_VAL("wrong type", evsel->core.attr.type == PERF_TYPE_HARDWARE); (gdb) n 1692 TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES)); (gdb) n 1693 TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "name") == 0); (gdb) nProgram received signal SIGSEGV, Segmentation fault.
I could fix this by checking for NULL pointer, but I have the feeling that there is more to it. However I do not fully understand the latest rework on the event handling.
Quoted 5 lines
The other test cases listed above fail due to the same root cause, no PMU found.
Please advise. What should all these test return when a system does not have any PMU defined at all?
Quoted 9 lines
So I was writing a response then figured out I've already fixed this but it looks like the patch hasn't been taken yet:
https://lore.kernel.org/lkml/[email protected]/Arnaldo, could you take a look?
Thanks,
Ian
Ian,
thanks a lot. I applied both patches you mentioned above and the test cases work fine.
You have my
Quoted 7 lines
Quoted 7 lines
--
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany --
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
Signature · 5 lines
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany -- Vorsitzender des Aufsichtsrats: Gregor Pillen Geschäftsführung: David Faller Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
Arnaldo Carvalho de Melo
AppliedEm Mon, Jul 31, 2023 at 11:42:31AM +0200, Thomas Richter escreveu:
Quoted 80 lines · Ian Rogers
Quoted 69 lines · Thomas Richter
Quoted 14 lines
Using Linux 6.5.0rc3 perf test case 6 dumps core on an s390 without configured PMU (this can happen depending on customer machine configuration).
In this configuration several perf test cases fail:
# ./perf test 2>&1 | grep FAIL 6.1: Test event parsing : FAILED! 10.3: Parsing of PMU event table metrics : FAILED! 10.4: Parsing of PMU event table metrics with fake PMUs : FAILED! 28: Use a dummy software event to keep tracking : FAILED! 35: Track with sched_switch : FAILED! 66: Parse and process metrics : FAILED! #Quoted 7 lines
Even worse the test case 6 dumps core:
# ./perf test -F 6 6: Parse event definition strings : 6.1: Test event parsing : Segmentation fault (core dumped) #Thanks for reporting this!
Quoted 38 lines
The root cause for these failures and core dump is a missing
PMU, as can be seen by the debug output:
...
Event test failure: test 57 'instructions:uep'
running test 58 '{cycles,cache-misses,branch-misses}:e'
No PMU found for 'cycles' <-- Here no PMU is found, because there is none!FAILED tests/parse-events.c:1516 wrong number of entries Event test failure: test 58 '{cycles,cache-misses,branch-misses}:e'Here no PMU is found, because there is none!
....
running test 59 'cycles/name=name/'
No PMU found for 'name'
Segmentation fault (core dumped)Here the root cause in in function
test__term_equal_term()variableevsel->nameis NULL:# gdb ./perf .... Breakpoint 1, test__term_equal_term (evlist=0x1542c00) at\ tests/parse-events.c:1688 (gdb) p evsel->name $3 = 0x3fff7fe3dc0 "" (gdb) n 691 TEST_ASSERT_VAL("wrong type", evsel->core.attr.type == PERF_TYPE_HARDWARE); (gdb) n 1692 TEST_ASSERT_VAL("wrong config", test_config(evsel, PERF_COUNT_HW_CPU_CYCLES)); (gdb) n 1693 TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "name") == 0); (gdb) nProgram received signal SIGSEGV, Segmentation fault.
I could fix this by checking for NULL pointer, but I have the feeling that there is more to it. However I do not fully understand the latest rework on the event handling.
Quoted 5 lines
The other test cases listed above fail due to the same root cause, no PMU found.
Please advise. What should all these test return when a system does not have any PMU defined at all?
Quoted 9 lines
So I was writing a response then figured out I've already fixed this but it looks like the patch hasn't been taken yet:
https://lore.kernel.org/lkml/[email protected]/Arnaldo, could you take a look?
Thanks,
Ian
Quoted 6 lines
Ian,
thanks a lot. I applied both patches you mentioned above and the test cases work fine.
You have myTested-by Thomas Richter <[email protected]>
Thanks, applied.
- Arnaldo