From patchwork Mon Aug 14 11:42:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anju T Sudhakar X-Patchwork-Id: 801174 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xWDph2sZ3z9t24 for ; Mon, 14 Aug 2017 22:06:04 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xWDph1dJxzDrG2 for ; Mon, 14 Aug 2017 22:06:04 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xWDHh09fZzDr0Y for ; Mon, 14 Aug 2017 21:42:39 +1000 (AEST) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v7EBeYiB143729 for ; Mon, 14 Aug 2017 07:42:36 -0400 Received: from e23smtp06.au.ibm.com (e23smtp06.au.ibm.com [202.81.31.148]) by mx0a-001b2d01.pphosted.com with ESMTP id 2cb4kfs3k7-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 14 Aug 2017 07:42:35 -0400 Received: from localhost by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 14 Aug 2017 21:42:33 +1000 Received: from d23relay08.au.ibm.com (202.81.31.227) by e23smtp06.au.ibm.com (202.81.31.212) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 14 Aug 2017 21:42:32 +1000 Received: from d23av06.au.ibm.com (d23av06.au.ibm.com [9.190.235.151]) by d23relay08.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v7EBgWx837748804 for ; Mon, 14 Aug 2017 21:42:32 +1000 Received: from d23av06.au.ibm.com (localhost [127.0.0.1]) by d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v7EBgVp1029637 for ; Mon, 14 Aug 2017 21:42:31 +1000 Received: from xenial-xerus.in.ibm.com ([9.77.196.18]) by d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v7EBgSA4029575; Mon, 14 Aug 2017 21:42:29 +1000 From: Anju T Sudhakar To: mpe@ellerman.id.au Subject: [PATCH] Fix for supporting nest events on muti socket system Date: Mon, 14 Aug 2017 17:12:23 +0530 X-Mailer: git-send-email 2.7.4 X-TM-AS-MML: disable x-cbid: 17081411-0040-0000-0000-0000034E0B92 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17081411-0041-0000-0000-00000CCB9E74 Message-Id: <1502710943-22738-1-git-send-email-anju@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-08-14_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1708140189 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hemant@linux.vnet.ibm.com, maddy@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 nest_powerbus0_imc/PM_PB_CYC/ 2.000147269 nest_powerbus0_imc/PM_PB_CYC/ 3.000219730 nest_powerbus0_imc/PM_PB_CYC/ 4.000288098 nest_powerbus0_imc/PM_PB_CYC/ 5.000358716 nest_powerbus0_imc/PM_PB_CYC/ 6.000435615 nest_powerbus0_imc/PM_PB_CYC/ 7.000508481 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 --- 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;