{"id":833365,"url":"http://patchwork.ozlabs.org/api/1.2/patches/833365/?format=json","web_url":"http://patchwork.ozlabs.org/project/ubuntu-kernel/patch/20171102140501.87671-8-gwalbon@linux.vnet.ibm.com/","project":{"id":15,"url":"http://patchwork.ozlabs.org/api/1.2/projects/15/?format=json","name":"Ubuntu Kernel","link_name":"ubuntu-kernel","list_id":"kernel-team.lists.ubuntu.com","list_email":"kernel-team@lists.ubuntu.com","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20171102140501.87671-8-gwalbon@linux.vnet.ibm.com>","list_archive_url":null,"date":"2017-11-02T14:04:56","name":"[Artful,07/12] powerpc/perf/imc: Fix nest events on muti socket system","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"d9d47978b98938375e44e6018c48c69b6cd7abe5","submitter":{"id":71662,"url":"http://patchwork.ozlabs.org/api/1.2/people/71662/?format=json","name":"Gustavo Walbon","email":"gwalbon@linux.vnet.ibm.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/ubuntu-kernel/patch/20171102140501.87671-8-gwalbon@linux.vnet.ibm.com/mbox/","series":[{"id":11509,"url":"http://patchwork.ozlabs.org/api/1.2/series/11509/?format=json","web_url":"http://patchwork.ozlabs.org/project/ubuntu-kernel/list/?series=11509","date":"2017-11-02T14:04:50","name":"Backport for Power9 Nest PMU Instrumentation","version":1,"mbox":"http://patchwork.ozlabs.org/series/11509/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/833365/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/833365/checks/","tags":{},"related":[],"headers":{"Return-Path":"<kernel-team-bounces@lists.ubuntu.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com\n\t(client-ip=91.189.94.19; helo=huckleberry.canonical.com;\n\tenvelope-from=kernel-team-bounces@lists.ubuntu.com;\n\treceiver=<UNKNOWN>)","Received":["from huckleberry.canonical.com (huckleberry.canonical.com\n\t[91.189.94.19])\n\tby ozlabs.org (Postfix) with ESMTP id 3ySRgX2pf0z9sNw;\n\tFri,  3 Nov 2017 01:05:28 +1100 (AEDT)","from localhost ([127.0.0.1] helo=huckleberry.canonical.com)\n\tby huckleberry.canonical.com with esmtp (Exim 4.86_2)\n\t(envelope-from <kernel-team-bounces@lists.ubuntu.com>)\n\tid 1eAG7Y-0002HV-Mx; Thu, 02 Nov 2017 14:05:24 +0000","from mx0b-001b2d01.pphosted.com ([148.163.158.5]\n\thelo=mx0a-001b2d01.pphosted.com)\n\tby huckleberry.canonical.com with esmtps\n\t(TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2)\n\t(envelope-from <gwalbon@linux.vnet.ibm.com>) id 1eAG7W-0002Cx-4f\n\tfor kernel-team@lists.ubuntu.com; Thu, 02 Nov 2017 14:05:22 +0000","from pps.filterd (m0098419.ppops.net [127.0.0.1])\n\tby mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tvA2E4XDe003893\n\tfor <kernel-team@lists.ubuntu.com>; Thu, 2 Nov 2017 10:05:21 -0400","from e12.ny.us.ibm.com (e12.ny.us.ibm.com [129.33.205.202])\n\tby mx0b-001b2d01.pphosted.com with ESMTP id 2e01bc5uh5-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <kernel-team@lists.ubuntu.com>; Thu, 02 Nov 2017 10:05:20 -0400","from localhost\n\tby e12.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <kernel-team@lists.ubuntu.com> from <gwalbon@linux.vnet.ibm.com>; \n\tThu, 2 Nov 2017 10:05:19 -0400","from b01cxnp23034.gho.pok.ibm.com (9.57.198.29)\n\tby e12.ny.us.ibm.com (146.89.104.199) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tThu, 2 Nov 2017 10:05:18 -0400","from b01ledav005.gho.pok.ibm.com (b01ledav005.gho.pok.ibm.com\n\t[9.57.199.110])\n\tby b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP\n\tid vA2E5Gil34341028; Thu, 2 Nov 2017 14:05:17 GMT","from b01ledav005.gho.pok.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 5CD7FAE03B;\n\tThu,  2 Nov 2017 10:06:04 -0400 (EDT)","from localhost (unknown [9.85.138.60])\n\tby b01ledav005.gho.pok.ibm.com (Postfix) with ESMTP id BE52DAE034;\n\tThu,  2 Nov 2017 10:06:03 -0400 (EDT)"],"From":"Gustavo Walbon <gwalbon@linux.vnet.ibm.com>","To":"kernel-team@lists.ubuntu.com","Subject":"[Artful][PATCH 07/12] powerpc/perf/imc: Fix nest events on muti\n\tsocket system","Date":"Thu,  2 Nov 2017 12:04:56 -0200","X-Mailer":"git-send-email 2.13.3","In-Reply-To":"<20171102140501.87671-1-gwalbon@linux.vnet.ibm.com>","References":"<20171102140501.87671-1-gwalbon@linux.vnet.ibm.com>","X-TM-AS-GCONF":"00","x-cbid":"17110214-0048-0000-0000-000001FF6933","X-IBM-SpamModules-Scores":"","X-IBM-SpamModules-Versions":"BY=3.00007997; HX=3.00000241; KW=3.00000007;\n\tPH=3.00000004; SC=3.00000239; SDB=6.00940090; UDB=6.00474019;\n\tIPR=6.00720346; \n\tBA=6.00005666; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009;\n\tZB=6.00000000; \n\tZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017836;\n\tXFM=3.00000015; UTC=2017-11-02 14:05:19","X-IBM-AV-DETECTION":"SAVI=unused REMOTE=unused XFE=unused","x-cbparentid":"17110214-0049-0000-0000-0000430E79F0","Message-Id":"<20171102140501.87671-8-gwalbon@linux.vnet.ibm.com>","X-Proofpoint-Virus-Version":"vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-11-02_05:, , signatures=0","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n\tpriorityscore=1501\n\tmalwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0\n\tclxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0\n\tclassifier=spam adjust=0 reason=mlx scancount=1\n\tengine=8.0.1-1707230000\n\tdefinitions=main-1711020178","X-BeenThere":"kernel-team@lists.ubuntu.com","X-Mailman-Version":"2.1.20","Precedence":"list","List-Id":"Kernel team discussions <kernel-team.lists.ubuntu.com>","List-Unsubscribe":"<https://lists.ubuntu.com/mailman/options/kernel-team>,\n\t<mailto:kernel-team-request@lists.ubuntu.com?subject=unsubscribe>","List-Archive":"<https://lists.ubuntu.com/archives/kernel-team>","List-Post":"<mailto:kernel-team@lists.ubuntu.com>","List-Help":"<mailto:kernel-team-request@lists.ubuntu.com?subject=help>","List-Subscribe":"<https://lists.ubuntu.com/mailman/listinfo/kernel-team>,\n\t<mailto:kernel-team-request@lists.ubuntu.com?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"kernel-team-bounces@lists.ubuntu.com","Sender":"\"kernel-team\" <kernel-team-bounces@lists.ubuntu.com>"},"content":"From: Anju T <anju@linux.vnet.ibm.com>\n\nBugLink: https://bugs.launchpad.net/bugs/1481347\n\nIn a multi node system with discontiguous node ids, nest event values\nare not showing up properly. eg. lscpu output:\n\n  NUMA node0 CPU(s): 0-15\n  NUMA node8 CPU(s): 16-31\n\nNest event values on such systems can be counted on CPUs <= 15:\n\n  $./perf stat -e 'nest_powerbus0_imc/PM_PB_CYC/' -C 0-14 -I 1000 sleep 1000\n  #           time             counts unit events\n       1.000294577    30,17,24,42,880 nest_powerbus0_imc/PM_PB_CYC/\n\nBut not on CPUs >= 16:\n\n  $./perf stat -e 'nest_powerbus0_imc/PM_PB_CYC/' -C 16-28 -I 1000 sleep 1000\n  #           time             counts unit events\n       1.000049902    <not supported> nest_powerbus0_imc/PM_PB_CYC/\n\nThis is because, when fetching the reference count, the node id (which\nmay be sparse) is used as the array index, not the node number (which\nis 0 based and contiguous).\n\nFix it by using the node number as the array index.\n\n  $./perf stat -e 'nest_powerbus0_imc/PM_PB_CYC/' -C 16-28 -I 1000 sleep 1000\n  #           time             counts unit events\n       1.000241961    26,12,35,28,704 nest_powerbus0_imc/PM_PB_CYC/\n\nSigned-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>\n[mpe: Change log tweaks for clarity and brevity]\nSigned-off-by: Michael Ellerman <mpe@ellerman.id.au>\n(cherry-picked from 7efbae90892b7858f1d4873d34ffffbeb460ed8b)\nSigned-off-by: Gustavo Walbon <gwalbon@linux.vnet.ibm.com>\n---\n arch/powerpc/perf/imc-pmu.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c\nindex 52017f6eafd9..a8f95f96d54b 100644\n--- a/arch/powerpc/perf/imc-pmu.c\n+++ b/arch/powerpc/perf/imc-pmu.c\n@@ -1064,7 +1064,7 @@ static int init_nest_pmu_ref(void)\n \t */\n \tfor_each_possible_cpu(cpu) {\n \t\tnid = cpu_to_node(cpu);\n-\t\tfor_each_online_node(i) {\n+\t\tfor (i = 0; i < num_possible_nodes(); i++) {\n \t\t\tif (nest_imc_refc[i].id == nid) {\n \t\t\t\tper_cpu(local_nest_imc_refc, cpu) = &nest_imc_refc[i];\n \t\t\t\tbreak;\n","prefixes":["Artful","07/12"]}