linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Desnes A. Nunes do Rosario" <desnesn@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: desnesn@linux.ibm.com, shuah@kernel.org, gromero@linux.ibm.com
Subject: [PATCH 3/3] selftests/powerpc: ensure PMC reads are set and ordered on count_pmc
Date: Wed,  8 Apr 2020 19:35:43 -0300	[thread overview]
Message-ID: <20200408223543.21168-4-desnesn@linux.ibm.com> (raw)
In-Reply-To: <20200408223543.21168-1-desnesn@linux.ibm.com>

Function count_pmc() needs a memory barrier to ensure that PMC reads are
fully consistent. The lack of it can occasionally fail pmc56_overflow test,
since depending on the workload on the system, PMC5 & 6 can have past val-
ues from the time the counters are frozen and turned back on. These past
values will be accounted as overflows and make the test fail.

=========
test: pmc56_overflow
...
ebb_state:
...
>>pmc[5] count = 0xfd4cbc8c
>>pmc[6] count = 0xddd8b3b6
HW state:
MMCR0 0x0000000084000000 FC PMAE
MMCR2 0x0000000000000000
EBBHR 0x0000000010003f68
BESCR 0x8000000000000000 GE
...
PMC5  0x0000000000000000
PMC6  0x0000000000000000
SIAR  0x0000000010003398
...
  [3]: register SPRN_PMC2  = 0x0000000080000003
  [4]: register SPRN_PMC5  = 0x0000000000000000
  [5]: register SPRN_PMC6  = 0x0000000000000000
  [6]: register SPRN_PMC2  = 0x0000000080000003
>>[7]: register SPRN_PMC5  = 0x000000008f21266d
>>[8]: register SPRN_PMC6  = 0x000000000da80f8d
  [9]: register SPRN_PMC2  = 0x0000000080000003
>>[10]: register SPRN_PMC5  = 0x000000006e2b961f
>>[11]: register SPRN_PMC6  = 0x00000000d030a429
  [12]: register SPRN_PMC2  = 0x0000000080000003
  [13]: register SPRN_PMC5  = 0x0000000000000000
  [14]: register SPRN_PMC6  = 0x0000000000000000
...
PMC5/6 overflow 2
[FAIL] Test FAILED on line 87
failure: pmc56_overflow
=========

Signed-off-by: Desnes A. Nunes do Rosario <desnesn@linux.ibm.com>
---
 tools/testing/selftests/powerpc/pmu/ebb/ebb.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/powerpc/pmu/ebb/ebb.c b/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
index bf6f25dfcf7b..6199f3cea0f9 100644
--- a/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
+++ b/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
@@ -258,6 +258,10 @@ int count_pmc(int pmc, uint32_t sample_period)
 	start_value = pmc_sample_period(sample_period);
 
 	val = read_pmc(pmc);
+
+	/* Ensure pmc value is consistent between freezes */
+	mb();
+
 	if (val < start_value)
 		ebb_state.stats.negative++;
 	else
-- 
2.21.1


  parent reply	other threads:[~2020-04-08 22:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-08 22:35 [PATCH, RESEND, 0/3] selftests/powerpc: A few fixes on powerpc selftests Desnes A. Nunes do Rosario
2020-04-08 22:35 ` [PATCH, RESEND, 1/3] selftests/powerpc: Use write_pmc instead of count_pmc to reset PMCs on ebb tests Desnes A. Nunes do Rosario
2020-04-23  5:45   ` Rashmica Gupta
2020-04-08 22:35 ` [PATCH, RESEND, 2/3] selftests/powerpc: enable performance alerts when freezing counters on cycles_with_freeze_test selftest Desnes A. Nunes do Rosario
2020-04-23  5:47   ` Rashmica Gupta
2020-04-08 22:35 ` Desnes A. Nunes do Rosario [this message]
2020-04-23  5:54   ` [PATCH 3/3] selftests/powerpc: ensure PMC reads are set and ordered on count_pmc Rashmica Gupta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200408223543.21168-4-desnesn@linux.ibm.com \
    --to=desnesn@linux.ibm.com \
    --cc=gromero@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).