Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752235AbdLECMT (ORCPT ); Mon, 4 Dec 2017 21:12:19 -0500 Received: from mga14.intel.com ([192.55.52.115]:9631 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751380AbdLECMP (ORCPT ); Mon, 4 Dec 2017 21:12:15 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,362,1508828400"; d="scan'208";a="9097913" Subject: Re: [PATCH v9 3/5] perf utils: use pmu->is_uncore to detect PMU UNCORE devices To: Ganapatrao Kulkarni , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Will.Deacon@arm.com, catalin.marinas@arm.com, mark.rutland@arm.com, acme@kernel.org, alexander.shishkin@linux.intel.com, peterz@infradead.org, mingo@redhat.com, jnair@caviumnetworks.com, zhangshaokun@hisilicon.com, Jonathan.Cameron@huawei.com, Robert.Richter@cavium.com, gklkml16@gmail.com, "Jin, Yao" References: <20171016183222.25750-1-ganapatrao.kulkarni@cavium.com> <20171016183222.25750-4-ganapatrao.kulkarni@cavium.com> From: "Jin, Yao" Message-ID: <6fdad34d-1612-0447-e58e-5c748f92668d@linux.intel.com> Date: Tue, 5 Dec 2017 10:12:11 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171016183222.25750-4-ganapatrao.kulkarni@cavium.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3367 Lines: 100 Hi Kulkarni, Arnaldo, This patch has been merged in perf/core branch today. But I see a regression issue when I run the 'perf stat'. With bisect checking, I locate to this patch. commit ad8737a08973f5dca632bdd63cf2abc99670e540 Author: Ganapatrao Kulkarni Date: Tue Oct 17 00:02:20 2017 +0530 perf pmu: Use pmu->is_uncore to detect UNCORE devices For example (on Intel skylake desktop), 1. The correct output should be (without this patch): root@skl:/tmp# perf stat --per-thread -p 1754 -M CPI,IPC ^C Performance counter stats for process id '1754': vmstat-1754 1,882,798 inst_retired.any # 0.8 CPI vmstat-1754 1,589,720 cycles vmstat-1754 1,882,798 inst_retired.any # 1.2 IPC vmstat-1754 1,589,720 cpu_clk_unhalted.thread 2.647443167 seconds time elapsed 2. With this patch, the output will be: root@skl:/tmp# perf stat --per-thread -p 1754 -M CPI,IPC ^C Performance counter stats for process id '1754': vmstat-1754 1,945,589 inst_retired.any vmstat-1754 inst_retired.any vmstat-1754 1,609,892 cycles vmstat-1754 1,945,589 inst_retired.any vmstat-1754 inst_retired.any vmstat-1754 1,609,892 cpu_clk_unhalted.thread vmstat-1754 cpu_clk_unhalted.thread 3.051274166 seconds time elapsed Could you please help to take a look? Thanks Jin Yao On 10/17/2017 2:32 AM, Ganapatrao Kulkarni wrote: > PMU CORE devices are identified using sysfs filename cpu, however > on some platforms(like arm/arm64), PMU CORE sysfs name is not cpu. > Hence cpu cannot be used to differentiate PMU CORE/UNCORE devices. > > commit: > 66ec1191 ("perf pmu: Unbreak perf record for arm/arm64 with events with explicit PMU") > > has introduced pmu->is_uncore, which is set to PMU UNCORE devices only. > Adding changes to use pmu->is_uncore to identify UNCORE devices. > > Acked-by: Will Deacon > Tested-by: Shaokun Zhang > Signed-off-by: Ganapatrao Kulkarni > --- > tools/perf/util/pmu.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c > index 8b17db5..9110718 100644 > --- a/tools/perf/util/pmu.c > +++ b/tools/perf/util/pmu.c > @@ -603,7 +603,6 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu) > */ > i = 0; > while (1) { > - const char *pname; > > pe = &map->table[i++]; > if (!pe->name) { > @@ -612,9 +611,13 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu) > break; > } > > - pname = pe->pmu ? pe->pmu : "cpu"; > - if (strncmp(pname, name, strlen(pname))) > - continue; > + if (pmu->is_uncore) { > + /* check for uncore devices */ > + if (pe->pmu == NULL) > + continue; > + if (strncmp(pe->pmu, name, strlen(pe->pmu))) > + continue; > + } > > /* need type casts to override 'const' */ > __perf_pmu__new_alias(head, NULL, (char *)pe->name, >