linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Anju T Sudhakar <anju@linux.vnet.ibm.com>
To: mpe@ellerman.id.au
Cc: maddy@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org,
	hemant@linux.vnet.ibm.com
Subject: [PATCH] Fix for supporting nest events on muti socket system
Date: Mon, 14 Aug 2017 17:12:23 +0530	[thread overview]
Message-ID: <1502710943-22738-1-git-send-email-anju@linux.vnet.ibm.com> (raw)

In a multi node system with discontinuous node id, nest event values
are not showing up properly.That is,

snip from lscpu output:

..
NUMA node0 CPU(s): 0-15
NUMA node8 CPU(s): 16-31
..

Nest event values on such systems are broken:

$./perf stat -e 'nest_powerbus0_imc/PM_PB_CYC/' -C 0-14 -I 1000 sleep 1000
#           time             counts unit events
     1.000294577    30,17,24,42,880 nest_powerbus0_imc/PM_PB_CYC/
     2.000528938    29,92,08,53,760 nest_powerbus0_imc/PM_PB_CYC/
     3.000713925    29,92,08,00,000 nest_powerbus0_imc/PM_PB_CYC/
     4.000901944    29,95,08,63,360 nest_powerbus0_imc/PM_PB_CYC/
     5.001089119    29,92,07,92,320 nest_powerbus0_imc/PM_PB_CYC/
     6.001276106    29,92,08,11,520 nest_powerbus0_imc/PM_PB_CYC/

$./perf stat -e 'nest_powerbus0_imc/PM_PB_CYC/' -C 16-28 -I 1000 sleep 1000
#           time             counts unit events
     1.000049902    <not supported> nest_powerbus0_imc/PM_PB_CYC/
     2.000147269    <not supported> nest_powerbus0_imc/PM_PB_CYC/
     3.000219730    <not supported> nest_powerbus0_imc/PM_PB_CYC/
     4.000288098    <not supported> nest_powerbus0_imc/PM_PB_CYC/
     5.000358716    <not supported> nest_powerbus0_imc/PM_PB_CYC/
     6.000435615    <not supported> nest_powerbus0_imc/PM_PB_CYC/
     7.000508481    <not supported> nest_powerbus0_imc/PM_PB_CYC/

This is because, when fetching for the reference count, node id is used
as the array index which is not how this is done when initializing the
structure. Patch to fix the same by using the right index to get the
nest_imc_refc.

$./perf stat -e 'nest_powerbus0_imc/PM_PB_CYC/' -C 16-28 -I 1000 sleep 1000
#           time             counts unit events
     1.000241961    26,12,35,28,704 nest_powerbus0_imc/PM_PB_CYC/
     2.000451678    25,95,72,48,512 nest_powerbus0_imc/PM_PB_CYC/
     3.000634963    25,93,13,96,608 nest_powerbus0_imc/PM_PB_CYC/
     4.000821186    25,95,74,38,208 nest_powerbus0_imc/PM_PB_CYC/
     5.001005221    25,93,13,30,048 nest_powerbus0_imc/PM_PB_CYC/ 

Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
---
 arch/powerpc/perf/imc-pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c
index 46cd912..bbcce29 100644
--- a/arch/powerpc/perf/imc-pmu.c
+++ b/arch/powerpc/perf/imc-pmu.c
@@ -1064,7 +1064,7 @@ static int init_nest_pmu_ref(void)
 	 */
 	for_each_possible_cpu(cpu) {
 		nid = cpu_to_node(cpu);
-		for_each_online_node(i) {
+		for (i = 0; i < num_possible_nodes(); i++) {
 			if (nest_imc_refc[i].id == nid) {
 				per_cpu(local_nest_imc_refc, cpu) = &nest_imc_refc[i];
 				break;
-- 
2.7.4

             reply	other threads:[~2017-08-14 11:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-14 11:42 Anju T Sudhakar [this message]
2017-08-16 12:29 ` Fix for supporting nest events on muti socket system Michael Ellerman

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=1502710943-22738-1-git-send-email-anju@linux.vnet.ibm.com \
    --to=anju@linux.vnet.ibm.com \
    --cc=hemant@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.vnet.ibm.com \
    --cc=mpe@ellerman.id.au \
    /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).