selftests/powerpc: Purge extra count_pmc() calls of ebb selftests
PATCH 1/1 selftests/powerpc: Purge extra count_pmc() calls of ebb selftests
An extra count on ebb_state.stats.pmc_count[PMC_INDEX(pmc)] is being per- formed when count_pmc() is used to reset PMCs on a few selftests. This extra pmc_count can occasionally invalidate results, such as the ones from cycles_test shown hereafter. The ebb_check_count() failed with an above the upper limit error due to the extra value on ebb_state.stats.pmc_count.
Furthermore, this extra count is also indicated by extra PMC1 trace_log on the output of the cycle test (as well as on pmc56_overflow_test):
==========
...
[21]: counter = 8
[22]: register SPRN_MMCR0 = 0x0000000080000080
[23]: register SPRN_PMC1 = 0x0000000080000004
[24]: counter = 9
[25]: register SPRN_MMCR0 = 0x0000000080000080
[26]: register SPRN_PMC1 = 0x0000000080000004
[27]: counter = 10
[28]: register SPRN_MMCR0 = 0x0000000080000080
[29]: register SPRN_PMC1 = 0x0000000080000004
Quoted 1 line
Quoted 1 line
[30]: register
SPRN_PMC1=0x000000004000051e
PMC1 count (0x280000546) above upper limit 0x2800003e8 (+0x15e) [FAIL] Test FAILED on line 52
failure: cycles
==========
--- .../selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c | 2 -- tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c | 2 -- .../selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c | 2 -- .../selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c | 2 -- tools/testing/selftests/powerpc/pmu/ebb/ebb.c | 2 -- .../selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c | 2 -- .../selftests/powerpc/pmu/ebb/lost_exception_test.c | 1 - .../testing/selftests/powerpc/pmu/ebb/multi_counter_test.c | 7 ------- .../selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c | 2 -- .../testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c | 2 -- .../selftests/powerpc/pmu/ebb/pmc56_overflow_test.c | 2 -- 11 files changed, 26 deletions(-)
tools/testing/selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c +0 -2
@@ -91,8 +91,6 @@ int back_to_back_ebbs(void)ebb_global_disable ();ebb_freeze_pmcs (); -count_pmc (1 , sample_period); -dump_ebb_state ();event_close (&event);
tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c +0 -2
@@ -42,8 +42,6 @@ int cycles(void)ebb_global_disable ();ebb_freeze_pmcs (); -count_pmc (1 , sample_period); -dump_ebb_state ();event_close (&event);
tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c +0 -2
@@ -99,8 +99,6 @@ int cycles_with_freeze(void)ebb_global_disable ();ebb_freeze_pmcs (); -count_pmc (1 , sample_period); -dump_ebb_state ();printf ("EBBs while frozen %d\n" , ebbs_while_frozen);
tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c +0 -2
@@ -71,8 +71,6 @@ int cycles_with_mmcr2(void)ebb_global_disable ();ebb_freeze_pmcs (); -count_pmc (1 , sample_period); -dump_ebb_state ();event_close (&event);
tools/testing/selftests/powerpc/pmu/ebb/ebb.c +0 -2
@@ -396,8 +396,6 @@ int ebb_child(union pipe read_pipe, union pipe write_pipe)ebb_global_disable ();ebb_freeze_pmcs (); -count_pmc (1 , sample_period); -dump_ebb_state ();event_close (&event);
tools/testing/selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c +0 -2
@@ -38,8 +38,6 @@ static int victim_child(union pipe read_pipe, union pipe write_pipe)ebb_global_disable ();ebb_freeze_pmcs (); -count_pmc (1 , sample_period); -dump_ebb_state ();FAIL_IF (ebb_state.stats.ebb_count ==0 );
tools/testing/selftests/powerpc/pmu/ebb/lost_exception_test.c +0 -1
@@ -75,7 +75,6 @@ static int test_body(void)ebb_freeze_pmcs ();ebb_global_disable (); -count_pmc (4 , sample_period);mtspr (SPRN_PMC4 ,0xdead );dump_summary_ebb_state ();
tools/testing/selftests/powerpc/pmu/ebb/multi_counter_test.c +0 -7
@@ -70,13 +70,6 @@ int multi_counter(void)ebb_global_disable ();ebb_freeze_pmcs (); -count_pmc (1 , sample_period); -count_pmc (2 , sample_period); -count_pmc (3 , sample_period); -count_pmc (4 , sample_period); -count_pmc (5 , sample_period); -count_pmc (6 , sample_period); -dump_ebb_state ();for (i =0 ; i <6 ; i++)
tools/testing/selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c +0 -2
@@ -61,8 +61,6 @@ static int cycles_child(void)ebb_global_disable ();ebb_freeze_pmcs (); -count_pmc (1 , sample_period); -dump_summary_ebb_state ();event_close (&event);
tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c +0 -2
@@ -82,8 +82,6 @@ static int test_body(void)ebb_global_disable ();ebb_freeze_pmcs (); -count_pmc (1 , sample_period); -dump_ebb_state ();if (mmcr0_mismatch)
tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c +0 -2
@@ -76,8 +76,6 @@ int pmc56_overflow(void)ebb_global_disable ();ebb_freeze_pmcs (); -count_pmc (2 , sample_period); -dump_ebb_state ();printf ("PMC5/6 overflow %d\n" , pmc56_overflowed);
Signature · 1 line
2.21.3
Quoted 24 lines · Desnes A. Nunes do Rosario
An extra count on ebb_state.stats.pmc_count[PMC_INDEX(pmc)] is being per- formed when
count_pmc()is used to reset PMCs on a few selftests. This extrapmc_countcan occasionally invalidate results, such as the ones fromcycles_testshown hereafter. Theebb_check_count()failed with an above the upper limit error due to the extra value on ebb_state.stats.pmc_count.Furthermore, this extra count is also indicated by extra PMC1
trace_logon the output of the cycle test (as well as onpmc56_overflow_test):==========
...
[21]: counter = 8
[22]: registerSPRN_MMCR0=0x0000000080000080
[23]: registerSPRN_PMC1=0x0000000080000004
[24]: counter = 9
[25]: registerSPRN_MMCR0=0x0000000080000080
[26]: registerSPRN_PMC1=0x0000000080000004
[27]: counter = 10
[28]: registerSPRN_MMCR0=0x0000000080000080
[29]: registerSPRN_PMC1=0x0000000080000004
Quoted 8 lines
Quoted 1 line
Quoted 1 line
[30]: register
SPRN_PMC1=0x000000004000051ePMC1 count (
0x280000546) above upper limit0x2800003e8(+0x15e) [FAIL] Test FAILED on line 52
failure: cycles
==========Signed-off-by Desnes A. Nunes do Rosario <[email protected]>---
I too have run into similar failure with cycles_test. I will add that the failure is inconsistent. I have run into this issue 1 out of 25 times. The failure always happen at first instance. Subsequent tries work correctly.
With this patch applied the test completes successfully 25 out of 25 times.
# ./cycles_test test: cycles ….. ….. [25]: register SPRN_MMCR0 = 0x0000000080000080 [26]: register SPRN_PMC1 = 0x0000000080000004 [27]: counter = 10 [28]: register SPRN_MMCR0 = 0x0000000080000080 [29]: register SPRN_PMC1 = 0x0000000080000004 [30]: register SPRN_PMC1 = 0x000000004000048f PMC1 count (0x2800004b7) above upper limit 0x2800003e8 (+0xcf) [FAIL] Test FAILED on line 52 failure: cycles
With the patch
# ./cycles_test test: cycles ….. ….. [25]: register SPRN_MMCR0 = 0x0000000080000080 [26]: register SPRN_PMC1 = 0x0000000080000004 [27]: counter = 10 [28]: register SPRN_MMCR0 = 0x0000000080000080 [29]: register SPRN_PMC1 = 0x0000000080000004 PMC1 count (0x280000028) is between 0x27ffffc18 and 0x2800003e8 delta +0x410/-0x3c0 success: cycles #
FWIW Tested-by : Sachin Sant <[email protected]>
Thanks
-Sachin
Quoted 29 lines · Sachin Sant
Quoted 29 lines · Desnes A. Nunes do Rosario
An extra count on ebb_state.stats.pmc_count[PMC_INDEX(pmc)] is being per- formed when
count_pmc()is used to reset PMCs on a few selftests. This extrapmc_countcan occasionally invalidate results, such as the ones fromcycles_testshown hereafter. Theebb_check_count()failed with an above the upper limit error due to the extra value on ebb_state.stats.pmc_count.Furthermore, this extra count is also indicated by extra PMC1
trace_logon the output of the cycle test (as well as onpmc56_overflow_test):==========
...
[21]: counter = 8
[22]: registerSPRN_MMCR0=0x0000000080000080
[23]: registerSPRN_PMC1=0x0000000080000004
[24]: counter = 9
[25]: registerSPRN_MMCR0=0x0000000080000080
[26]: registerSPRN_PMC1=0x0000000080000004
[27]: counter = 10
[28]: registerSPRN_MMCR0=0x0000000080000080
[29]: registerSPRN_PMC1=0x0000000080000004Quoted 1 line
Quoted 1 line
[30]: register
SPRN_PMC1=0x000000004000051ePMC1 count (
0x280000546) above upper limit0x2800003e8(+0x15e) [FAIL] Test FAILED on line 52
failure: cycles
==========
Quoted 5 lines
Quoted 2 lines
Signed-off-by Desnes A. Nunes do Rosario <[email protected]>---
I too have run into similar failure with
cycles_test. I will add that the failure is inconsistent. I have run into this issue 1 out of 25 times. The failure always happen at first instance. Subsequent tries work correctly.
Indeed; on my tests I was running 100 times to validate. Thanks for the review Sachin
Quoted 36 lines
With this patch applied the test completes successfully 25 out of 25 times.
# ./cycles_test test: cycles ….. ….. [25]: register SPRN_MMCR0 = 0x0000000080000080 [26]: register SPRN_PMC1 = 0x0000000080000004 [27]: counter = 10 [28]: register SPRN_MMCR0 = 0x0000000080000080 [29]: register SPRN_PMC1 = 0x0000000080000004 [30]: register SPRN_PMC1 = 0x000000004000048f PMC1 count (0x2800004b7) above upper limit 0x2800003e8 (+0xcf) [FAIL] Test FAILED on line 52 failure: cyclesWith the patch
# ./cycles_test test: cycles ….. ….. [25]: register SPRN_MMCR0 = 0x0000000080000080 [26]: register SPRN_PMC1 = 0x0000000080000004 [27]: counter = 10 [28]: register SPRN_MMCR0 = 0x0000000080000080 [29]: register SPRN_PMC1 = 0x0000000080000004 PMC1 count (0x280000028) is between 0x27ffffc18 and 0x2800003e8 delta +0x410/-0x3c0 success: cycles #FWIW Tested-by : Sachin Sant <[email protected]>
Thanks
-Sachin
Signature · 4 lines
Desnes A. Nunes do Rosario -------------------------------- Advisory Software Engineer - IBM Virtual Onsite Engineer - Red Hat
Michael Ellerman
AppliedQuoted 10 lines · Desnes A. Nunes do Rosario
An extra count on ebb_state.stats.pmc_count[PMC_INDEX(pmc)] is being per- formed when
count_pmc()is used to reset PMCs on a few selftests. This extrapmc_countcan occasionally invalidate results, such as the ones fromcycles_testshown hereafter. Theebb_check_count()failed with an above the upper limit error due to the extra value on ebb_state.stats.pmc_count.Furthermore, this extra count is also indicated by extra PMC1
trace_logon the output of the cycle test (as well as onpmc56_overflow_test):[...]
Applied to powerpc/next.
[1/1] selftests/powerpc: Purge extra count_pmc() calls of ebb selftests
https://git.kernel.org/powerpc/c/3337bf41e0dd70b4064cdf60acdfcdc2d050066c
cheers