selftests/powerpc: Purge extra count_pmc() calls of ebb selftests
authorDesnes A. Nunes do Rosario <desnesn@linux.ibm.com>
Fri, 26 Jun 2020 16:47:37 +0000 (13:47 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Sep 2020 09:21:17 +0000 (11:21 +0200)
[ Upstream commit 3337bf41e0dd70b4064cdf60acdfcdc2d050066c ]

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
>> [30]: register SPRN_PMC1  = 0x000000004000051e
PMC1 count (0x280000546) above upper limit 0x2800003e8 (+0x15e)
[FAIL] Test FAILED on line 52
failure: cycles
==========

Signed-off-by: Desnes A. Nunes do Rosario <desnesn@linux.ibm.com>
Tested-by: Sachin Sant <sachinp@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200626164737.21943-1-desnesn@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c
tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c
tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c
tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c
tools/testing/selftests/powerpc/pmu/ebb/ebb.c
tools/testing/selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c
tools/testing/selftests/powerpc/pmu/ebb/lost_exception_test.c
tools/testing/selftests/powerpc/pmu/ebb/multi_counter_test.c
tools/testing/selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c
tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c
tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c

index 94110b1dcd3d812d97dcc4313f5acadd67cd613c..031baa43646fb8fb8979ad0354013c9ca27152b9 100644 (file)
@@ -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);
index 7c57a8d79535d6178c27fe0d92ea3b7a778240f2..361e0be9df9ae087592e590a29aab763a44ed663 100644 (file)
@@ -42,8 +42,6 @@ int cycles(void)
        ebb_global_disable();
        ebb_freeze_pmcs();
 
-       count_pmc(1, sample_period);
-
        dump_ebb_state();
 
        event_close(&event);
index ecf5ee3283a3ea135676cb9b20b106ab310b2fc2..fe7d0dc2a1a26bf890d415093594ddebbb407dea 100644 (file)
@@ -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);
index c0faba520b35c7113d19a80efcca05b07ddf9f88..b9b30f974b5eaceb13f17409f5803e9185ea96b9 100644 (file)
@@ -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);
index 46681fec549b809e2973a23ed10c5014f28365de..2694ae161a84ae5d624c16d0d00abf98361a8d41 100644 (file)
@@ -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);
index a991d2ea8d0a1e6908278a984dd227ac1001f8a4..174e4f4dae6c06d960c202489d07dbaf1cdf6b6f 100644 (file)
@@ -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);
index eb8acb78bc6c11b3f4f54eedcf0660b9ddc005b1..531083accfcadcd1da7b220994402bcb5584ae32 100644 (file)
@@ -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();
index 6ff8c8ff27d66cf9aeb4579f95a8598f1e4e8296..035c02273cd49a076ffe5012ad7bc4c11d3f258c 100644 (file)
@@ -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++)
index 037cb6154f36070a711ecbdc3985eade494d1761..3e9d4ac965c8513d860bbec2525844eaad23276f 100644 (file)
@@ -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);
index c5fa64790c22ee55c3a9a44ebf09e1745e58264b..d90891fe96a327be9b18c68e06129b4d45eafba9 100644 (file)
@@ -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)
index 30e1ac62e8cb4249350c89aa64163e3d4ee3bedd..8ca92b9ee5b01c6faa2e17002d853a131b6d897d 100644 (file)
@@ -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);