diff mbox

Fix for supporting nest events on muti socket system

Message ID 1502710943-22738-1-git-send-email-anju@linux.vnet.ibm.com (mailing list archive)
State Accepted
Commit 7efbae90892b7858f1d4873d34ffffbeb460ed8b
Headers show

Commit Message

Anju T Sudhakar Aug. 14, 2017, 11:42 a.m. UTC
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(-)

Comments

Michael Ellerman Aug. 16, 2017, 12:29 p.m. UTC | #1
On Mon, 2017-08-14 at 11:42:23 UTC, Anju T wrote:
> 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>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/7efbae90892b7858f1d4873d34ffff

cheers
diff mbox

Patch

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;