Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752418AbdHXMEo (ORCPT ); Thu, 24 Aug 2017 08:04:44 -0400 Received: from mail-by2nam03on0055.outbound.protection.outlook.com ([104.47.42.55]:57712 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751812AbdHXMEk (ORCPT ); Thu, 24 Aug 2017 08:04:40 -0400 From: Ganapatrao Kulkarni To: 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 Subject: [PATCH v6 1/4] perf utils: passing pmu as a parameter to function get_cpuid_str Date: Thu, 24 Aug 2017 17:33:46 +0530 Message-Id: <20170824120349.2323-2-ganapatrao.kulkarni@cavium.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170824120349.2323-1-ganapatrao.kulkarni@cavium.com> References: <20170824120349.2323-1-ganapatrao.kulkarni@cavium.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR01CA0095.INDPRD01.PROD.OUTLOOK.COM (10.174.208.11) To CO2PR07MB2567.namprd07.prod.outlook.com (10.166.201.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 20cc954c-66ad-4f4f-617e-08d4eae84b39 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:CO2PR07MB2567; X-Microsoft-Exchange-Diagnostics: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oikIZ2IG0B6LTEnUf5wTOVCcnF028JOS400bTB78TwsCrprynW43/sywKPKq10b66hbOKgrNFXNhxJNiJzOMlxfhacgsmnoW6MCWAXeP+dRjttyMChsiydxTbpRDteoVu2p5aGoPj3TFy4ZymUWzgT5kKl8Jm32z+8y9Rc8zQUX2A+j74Y4UpzQgmapKwU7zBy6YDWkDHf2Dh0AWgc6z4nI1o90ISWjfJDNjzOZ0sS29sBWYbU3/S9JrYTqWKWYi2OI8FIPNR+DKTQqW8q5mu2lQtiwmY6HkTkI8QoDiB+ZCYaMlwbLN2kZUEC89fBXF7cIb8Coe9ArFTxzY6XK5wz6owJjcz7+kSFIHhy;4:pS+lewLyXdfMz2Z+ZSGxv0Dqlqhsjvwc/qNo2qGWaOTqsGeavuCDwxKrk9CxDdYnYyPY7fS6X3wtBIVliu/sfuqQFqgyEGRx9UBSDrUYCvK2eHjylPQGlhRY5jW55Ralj2YoJe3ShSWHMrbpeHeQDkj3Rabg1yDqP0X+uGHji6me8PFlJrGekQJMnpvvsymcub3dw61JThyJz4V1j6wQARIpqWyCc3PWnTGjZBKROZhClfKmFFXngto8g9abMVIl X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(3002001)(6041248)(20161123562025)(20161123555025)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CO2PR07MB2567;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CO2PR07MB2567; X-Forefront-PRVS: 04097B7F7F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(7370300001)(4630300001)(6009001)(189002)(199003)(97736004)(25786009)(105586002)(42186005)(189998001)(110136004)(2950100002)(6512007)(106356001)(2906002)(68736007)(4326008)(33646002)(53936002)(5660300001)(6116002)(3846002)(6506006)(50986999)(47776003)(48376002)(7350300001)(5003940100001)(86362001)(7736002)(305945005)(50226002)(66066001)(6666003)(8676002)(72206003)(81166006)(1076002)(7416002)(81156014)(50466002)(36756003)(101416001)(6486002)(5009440100003)(76176999)(478600001);DIR:OUT;SFP:1101;SCL:1;SRVR:CO2PR07MB2567;H:mypc.cavium.com.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Ganapatrao.Kulkarni@cavium.com; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CO2PR07MB2567;23:2UaMyA3NNE4w9l8mqECdbeexu9Zd0gTlAAc42jFGs?= =?us-ascii?Q?KcPLSd6MZzPQyF9I6zSH4+KXBv7ihMJklbwmE8jkKCyxYfX/qSGAOlVQwnA6?= =?us-ascii?Q?vznm/96SVhPCU55rowNvwVg0pIky+uX6Pb5J2nNDefAZje7FK62Xk8J0Sqh4?= =?us-ascii?Q?NvbnxGVNmRO8Q2gyCGuPi2BULbWabhSaJeOpWN/yhj7Jt40cAUPsAxTGEk8U?= =?us-ascii?Q?OS1lys3hhgUmpcCAW63lh1oSrcaoZnFbWVtMzfDEcfkJu/NL/cY5ql0YGdE3?= =?us-ascii?Q?iTe6ivW1bTrTb0dVVslqXnLxpNgPmHDkXc7QPtkgq5uSk8TboFPA5K2L+Gqp?= =?us-ascii?Q?gncRidnfRDX0SDY6VAzPNEAFqlkqp+g4/V47rwq2YgGjr5Pgy1qaSlPpOKD9?= =?us-ascii?Q?/HGAuzhNVQvZi8XkOmcqcpGts8FlYEHJRT7wSVqghrLaf+s599RIbh+aMzgF?= =?us-ascii?Q?vFsld3oEHvF+wttB+aNMLwr2fbvNDAj2eEX8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aoMiA2NbjKatOAEzQBMBNZfiqB7XgoVi4wHmN4EDfuE/aePXauko0+vgohSRp6Zr6qnqoKP+BoazL7QgVwMKsYpG2Q7kwPt/9EyalJd0ETm/krOyENwOObXtAEpLqEisnJ1MShwA==;5:Ktm5AL7uyl/p+DRfrH962VfdP+mxrFIoCQFt0v35aalWqyC9yGg6zMkV5Kn452V3UMAxbfJvEyqxeMrPToug8RMMi9UMDazPirCH4mvJlBBuy1frFwc+LYlmyUQ6aXqj8BHwlewKm9Iz/GqVmvRCzh32DJILQgMMxmEyaMb9iVI=;24:mtnWNMntfV4xEb8gdxj/qV528bXCtm8pu+1w0IeGi1S/UzaJ5h2d2znR5hrtBFQKew+s7SsuwqF5jQwW1NfdFz118teVh2JsNQDF5viWI0M=;7:1uiWDCX7J5YiNUhVBfVMH8MRibI6DRkkzKuCedWfK48khmFnuVuLQbR4hSv/7EE9Pj4t1yTVpjbXcpOEAExpXhul0Ieg0tTwulfL9uu+gftdINL1hXSHh32ZuL1PckxyhzQIxcuM3rZKL9+FHl4eWXyWdRBDVax/ltWgSNdM3Q/DmsIzmWc558Y8aAbCg/LuGntHL10+yBU1O84kDfqLhE57nPjh4rMHfYRpbCiaGuc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2017 12:04:33.9571 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2567 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3253 Lines: 105 cpuid string will not be same on all CPUs on heterogeneous platforms like ARM's big.LITTLE, adding provision(using pmu->cpus) to find cpuid string from associated CPUs of PMU CORE device. Signed-off-by: Ganapatrao Kulkarni --- tools/perf/arch/powerpc/util/header.c | 2 +- tools/perf/arch/x86/util/header.c | 2 +- tools/perf/util/header.h | 3 ++- tools/perf/util/pmu.c | 9 +++++---- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/perf/arch/powerpc/util/header.c b/tools/perf/arch/powerpc/util/header.c index 9aaa6f5..2953681 100644 --- a/tools/perf/arch/powerpc/util/header.c +++ b/tools/perf/arch/powerpc/util/header.c @@ -34,7 +34,7 @@ get_cpuid(char *buffer, size_t sz) } char * -get_cpuid_str(void) +get_cpuid_str(struct perf_pmu *pmu __maybe_unused) { char *bufp; diff --git a/tools/perf/arch/x86/util/header.c b/tools/perf/arch/x86/util/header.c index a74a48d..d52bc27 100644 --- a/tools/perf/arch/x86/util/header.c +++ b/tools/perf/arch/x86/util/header.c @@ -65,7 +65,7 @@ get_cpuid(char *buffer, size_t sz) } char * -get_cpuid_str(void) +get_cpuid_str(struct perf_pmu *pmu __maybe_unused) { char *buf = malloc(128); diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h index d30109b..05e5758 100644 --- a/tools/perf/util/header.h +++ b/tools/perf/util/header.h @@ -8,6 +8,7 @@ #include #include "event.h" #include "env.h" +#include "pmu.h" enum { HEADER_RESERVED = 0, /* always cleared */ @@ -151,5 +152,5 @@ int write_padded(int fd, const void *bf, size_t count, size_t count_aligned); */ int get_cpuid(char *buffer, size_t sz); -char *get_cpuid_str(void); +char *get_cpuid_str(struct perf_pmu *pmu __maybe_unused); #endif /* __PERF_HEADER_H */ diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index ac16a9d..aefdbd1 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -511,7 +511,7 @@ static struct cpu_map *pmu_cpumask(const char *name) * Each architecture should provide a more precise id string that * can be use to match the architecture's "mapfile". */ -char * __weak get_cpuid_str(void) +char * __weak get_cpuid_str(struct perf_pmu *pmu __maybe_unused) { return NULL; } @@ -521,7 +521,8 @@ char * __weak get_cpuid_str(void) * to the current running CPU. Then, add all PMU events from that table * as aliases. */ -static void pmu_add_cpu_aliases(struct list_head *head, const char *name) +static void pmu_add_cpu_aliases(struct list_head *head, const char *name, + struct perf_pmu *pmu) { int i; struct pmu_events_map *map; @@ -533,7 +534,7 @@ static void pmu_add_cpu_aliases(struct list_head *head, const char *name) if (cpuid) cpuid = strdup(cpuid); if (!cpuid) - cpuid = get_cpuid_str(); + cpuid = get_cpuid_str(pmu); if (!cpuid) return; @@ -610,12 +611,12 @@ static struct perf_pmu *pmu_lookup(const char *name) if (pmu_aliases(name, &aliases)) return NULL; - pmu_add_cpu_aliases(&aliases, name); pmu = zalloc(sizeof(*pmu)); if (!pmu) return NULL; pmu->cpus = pmu_cpumask(name); + pmu_add_cpu_aliases(&aliases, name, pmu); INIT_LIST_HEAD(&pmu->format); INIT_LIST_HEAD(&pmu->aliases); -- 2.9.4