Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751605AbdHPHLY (ORCPT ); Wed, 16 Aug 2017 03:11:24 -0400 Received: from mail-bn3nam01on0075.outbound.protection.outlook.com ([104.47.33.75]:17823 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751530AbdHPHLU (ORCPT ); Wed, 16 Aug 2017 03:11:20 -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, Robert.Richter@cavium.com, gpkulkarni@gmail.com Subject: [PATCH v5 1/4] perf utils: passing pmu as a parameter to function get_cpuid_str Date: Wed, 16 Aug 2017 12:40:45 +0530 Message-Id: <20170816071048.26087-2-ganapatrao.kulkarni@cavium.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170816071048.26087-1-ganapatrao.kulkarni@cavium.com> References: <20170816071048.26087-1-ganapatrao.kulkarni@cavium.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR01CA0112.INDPRD01.PROD.OUTLOOK.COM (10.174.208.28) To CO2PR07MB2567.namprd07.prod.outlook.com (10.166.201.18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c503e039-c431-4212-c4be-08d4e475fd96 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: 1;CO2PR07MB2567;3:PL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VclGhWavO8ZFzCQeeP91Lu+suIt8d3CXheGFKTVwgN1lHINjrUCT7eQstWjLX08vHJjKrQDTf90v+aMpj5Cag+yBk7xzczNhpcvwRTxzB5QyWPy7gZ8yHYkMTS/XTopHD+smMQiAA8zuaV8pV40rb0z9I0UMoiMzzkamsfQaTXUqpxkk9mGTF8QhSn55mnrJKRBlVG4ITdAM+XM+QW6+bjb6pGnbjHVVHa8GfxXP5yA7Wif0YS1bfBy2uRQTXdSZtAtNQpqel42M25+SfAHy3jgeFVkFN/2KOPTs0TmiaYK/jslTkGqFwuBiX8u8fCI3yj1o58+CZIDKZziXOCvoI12kV;4:uJSphte2ewVjWkRGKV+ttamcWj2q8h0CKNZyIcYjju9OVrZkcCxC0RAQUjoqwCgKY/S3w/Q88ULWxSYDPEEMsKe0T7+whtIIUeaAGZtWMz0ol0erzQ5FQcW2KbSCyIXo+xsmary/A89R5RUXo8OnLqA+/zhzZg0Vj2OkE2p3A+oNdpiM/j98djbv814PIT7/RNqR4tL9rb7Dd55WBmOl3idjw+vr0alFHoP7T6L8mM8tiU+w/QsReP5R91gARKFV 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)(93006095)(93001095)(100000703101)(100105400095)(3002001)(10201501046)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(20161123564025)(20161123558100)(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: 0401647B7F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(7370300001)(6009001)(199003)(189002)(86362001)(36756003)(50986999)(76176999)(5003940100001)(7350300001)(106356001)(105586002)(69596002)(33646002)(97736004)(53416004)(47776003)(72206003)(478600001)(42186005)(25786009)(66066001)(101416001)(6512007)(189998001)(110136004)(4326008)(53936002)(5009440100003)(50466002)(6486002)(50226002)(2906002)(1076002)(6506006)(48376002)(68736007)(6116002)(6666003)(3846002)(81166006)(2950100002)(81156014)(7416002)(5660300001)(8676002)(305945005)(7736002);DIR:OUT;SFP:1101;SCL:1;SRVR:CO2PR07MB2567;H:mypc.caveonetworks.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX: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:wz4Jf8OMxAJbP6BqCD/TEzelrVfAHOIMmXShN42/C?= =?us-ascii?Q?lnXmtn7YDZRvRUZxECYLCRRU5ON9vDnnmwYvzRpp+eY5IjUFTHTT+WM95j7l?= =?us-ascii?Q?fJ/5mpPJdd5HZybIT2s6ddx+1O5vHg2V4EMdAm303ehk2CTdfeqPX1yfhSfl?= =?us-ascii?Q?UnAYvL59YTUMwZy+aybSPIo+8V1NQK7Z9hZtgNVlHbsbFOfm3ILSA5rMnRJp?= =?us-ascii?Q?4pS3zGYAamT3o4H+MHqXlM3Xa6S41sb8pXiYMgBNQcFRFTLdpsL76VS03L78?= =?us-ascii?Q?teopNdnvxbCCDapGRTOCS3c3nkmn1i6WQjNGXgDow+Aj4d/mvSYF5F0XeFw/?= =?us-ascii?Q?IZJBhTVhP+uEFn6goLunnF48BC+QLybQpI9WVFH8Pq1SRL+vwC9X6BnfqUez?= =?us-ascii?Q?hrEVlT94WDXcDx+GPr3IIz9+Qfn1o+hA2UMMHzgx7zE2WxSnvySjZY3+82NO?= =?us-ascii?Q?CiJmKvSUEaHwaiOLfdCKJi2edENn77fzO/MiPW1+lGuzJ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PlLRsKKUalzILT09PB7ID6+DOpfw4HDwUmnVIAeKV7W85baY9P2fBtxIg2rCi+iMHMyV5zBoa7TBqClN2GnmGljksTkuByR/bJ96/JvhX6Mq7iBQs+UirvmZtNB18gI3G2QuLUr1T3aVmfasl4e1mGE4M1o/fMVHf8tcgDbpQE5+6WwPPe8GpBmgHwQ==;5:TJtkS+noPJp8ibShpi7M8tPiDpwpRH+gxDDgxSaEZYlbFyGbqBS3GnhS/odLLDVC+LqulNfvX2SjWmLADTiU7R8eSVydsijvCez2wjFIwD3GANSDEjWsf7cnqYzbQ+qQyvgzVx/0DVPfFyvNiiF8tg==;24:0lO8yZx/FhZzD+nyzQHZ2KxzbaJjJeCbjZIB8qorWMFEH7kp7vTkDKNc0Z6dkpkBL9hKAKUvqZhCAe2/33IQRSunUcoQH4ig/oChIrg0ENY=;7:TTgHtb2W5HZVRFzNVgeJv/9BvngJEIPPRm3OBtj6W3yyZbWmb9hW5uNGW9s4sn60xiTvzBafyKiohX4CbDkCLOEp/HIpgqZYDHO2Wz+gQqivqhvCHzGA2UxGpYXQdnYsJ0/57A1G+kZwC9wvNF9Tfn+1b5sUZx14ksFLsOCeDp6emBmFfVmUaRIm0UEod9DkH7TGO/jCdEC5UBus8dAd64DxkOLoLxT09wRW0g1nq+w= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2017 07:11:14.3502 (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