From patchwork Tue Oct 13 11:13:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hongbo.zhang@freescale.com X-Patchwork-Id: 54832 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by patches.linaro.org (Postfix) with ESMTPS id A3CAF20490 for ; Tue, 13 Oct 2015 11:31:43 +0000 (UTC) Received: by wicid10 with SMTP id id10sf8790431wic.2 for ; Tue, 13 Oct 2015 04:31:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:in-reply-to:references:mime-version:spamdiagnosticoutput :spamdiagnosticmetadata:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :content-type:content-transfer-encoding:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=XYrkyLJGY8UoIupXQOkvBVkPZnoc1DenJ2opuRpENJ4=; b=F9TsBJsku69jv8BPjEjWnmH0PAlBH4k/EJW/qTZmtY0yDqTcn/8ISIVSA1t3Zc39oq 68juiMLQT6q0sVphgJwiHCgjA13g285jV0NO+/UQQVPzY3p+k/jmzodpxy+nW6zGiAlk AVLSirm6hJQqX1HRhCvnoGx+2iXn2IqREcp5zyPL+GaO05C0ATePI7dG8nP6aOlywBRD Dky7aw2x97xcqL7UXearrdZ2/MVh/JgkIfupdA8kf9+qPSVHhnvXtulQzTD6lXVdykxY TNOJDwm5FK4PiS2C3kA5WU2Augj/Gze8TnX+K77UxBvZAF8ZYZ7Qkmwvnvy8fiUzjKsL fwZw== X-Gm-Message-State: ALoCoQmTRKNAQlrRWlVwcZQdADcdRa8bcV+u03ySho2UF2I2xj14EflTQQup8BBTZEg2OOwQ63A6 X-Received: by 10.112.147.7 with SMTP id tg7mr6929136lbb.16.1444735902969; Tue, 13 Oct 2015 04:31:42 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.89.207 with SMTP id n198ls570245lfb.54.gmail; Tue, 13 Oct 2015 04:31:42 -0700 (PDT) X-Received: by 10.112.161.138 with SMTP id xs10mr14367079lbb.47.1444735902785; Tue, 13 Oct 2015 04:31:42 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id d75si1894415lfd.7.2015.10.13.04.31.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Oct 2015 04:31:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbcao8 with SMTP id ao8so16087728lbc.3 for ; Tue, 13 Oct 2015 04:31:42 -0700 (PDT) X-Received: by 10.112.168.228 with SMTP id zz4mr15047523lbb.73.1444735902560; Tue, 13 Oct 2015 04:31:42 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2073064lbq; Tue, 13 Oct 2015 04:31:41 -0700 (PDT) X-Received: by 10.55.25.22 with SMTP id k22mr39257337qkh.65.1444735901225; Tue, 13 Oct 2015 04:31:41 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 84si2352339qhx.86.2015.10.13.04.31.40; Tue, 13 Oct 2015 04:31:41 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 2E57761A23; Tue, 13 Oct 2015 11:31:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 3141661A1D; Tue, 13 Oct 2015 11:31:36 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id CB72761A1D; Tue, 13 Oct 2015 11:31:33 +0000 (UTC) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0141.outbound.protection.outlook.com [157.56.110.141]) by lists.linaro.org (Postfix) with ESMTPS id 19BD0619F5 for ; Tue, 13 Oct 2015 11:31:33 +0000 (UTC) Received: from CH1PR03CA008.namprd03.prod.outlook.com (10.255.156.153) by BL2PR03MB484.namprd03.prod.outlook.com (10.141.92.152) with Microsoft SMTP Server (TLS) id 15.1.293.16; Tue, 13 Oct 2015 11:31:31 +0000 Received: from BL2FFO11FD022.protection.gbl (10.255.156.132) by CH1PR03CA008.outlook.office365.com (10.255.156.153) with Microsoft SMTP Server (TLS) id 15.1.293.16 via Frontend Transport; Tue, 13 Oct 2015 11:31:31 +0000 Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD022.mail.protection.outlook.com (10.173.161.101) with Microsoft SMTP Server (TLS) id 15.1.293.9 via Frontend Transport; Tue, 13 Oct 2015 11:31:31 +0000 Received: from hongbo.ap.freescale.net (hongbo.ap.freescale.net [10.193.20.96]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id t9DBVOFj009638; Tue, 13 Oct 2015 04:31:28 -0700 From: To: Date: Tue, 13 Oct 2015 19:13:05 +0800 Message-ID: <1444734798-29063-2-git-send-email-hongbo.zhang@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444734798-29063-1-git-send-email-hongbo.zhang@freescale.com> References: <1444734798-29063-1-git-send-email-hongbo.zhang@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD022; 1:8M8pQA0xvSy9EHQ0sAU0jLIeYShzap3O7qazQanr0b7Np1Oessmph+RTYeHmZzyqrpFYuJYIMrfyb6mmVxEXeLlNYq+kiGjTNOyhocgyy2CY2XQBcnW33y4+BjgnURBUMNWKNx7l9/86GuEYKCtwgsTeNVQ6iwFBqNNW408/W7DCq2JKQE3NrLCLgzeq0hOBDzQrnOOxrVS3q+K7UOahL036HQ/B0VyMDhgpH6kZut2ZYB5pryqgpWWyY+YDPaS1gS86A/k3F9Vqp4JbBeTq4e5/c4pfwRFOdw3k5EcmMNge9nWR4abARbQtzSEM4t8UrGF6/k9swEdH2exwt92zHnochQBrJbJqHaPelmKHkf6bwkE3OR53HN7AhiKvFeK2EYTyUWq6b8BGsn9jhdyxWA== X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(36756003)(5008740100001)(86362001)(50986999)(11100500001)(50226001)(104016004)(76176999)(2950100001)(5007970100001)(92566002)(6806005)(47776003)(64706001)(2351001)(229853001)(87936001)(81156007)(77096005)(106466001)(5001960100002)(5003940100001)(105606002)(110136002)(50466002)(97736004)(46102003)(85426001)(33646002)(48376002)(19580395003)(189998001)(86152002)(19580405001)(41533002)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:BL2PR03MB484; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB484; 2:Kbwox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121C57y+FTLuEJ52meNxoQkGyz6cWiH/zJ5Dl4LFri7Og4T7SG625/40matjKdHTeBAhLB8MwNWGHOU7XT2V1w=; 4:NNdLJSOxXYhTbq6115GJnf/eJwBLs3tR3l5VVOnDRpfVCGDys0ibF3fcIsdizehiB+CY4ta729hlEcTH2kMXL6Q2FEpo3YFk8QKEUtaj/Ag1DpOzxuPqPoWJN6XUy/yS7qRQt5nCeEF+n/GD4kwNx4Cl+vN9wq1oyKVI3d7ZB0YazzIWh81lGbQSHpIEOvjhdalfyREPxFp3NqXHZ4lLQ5pFtYcdjOQRVsMXQbYPJE6bE6qmezmTsRO+uODaGm6KmZWo3rNk6skt+tiHFhiduBGnzy8cxpv/KnhOtcG4K5Xrjl00HCWuxkXJf0q0VjB4BT0zAb05Y5GldGeLuYWsRw3VeZAOE8KjsxQwTvMZqdc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001); SRVR:BL2PR03MB484; BCL:0; PCL:0; RULEID:; SRVR:BL2PR03MB484; X-Forefront-PRVS: 07283408BE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL2PR03MB484; 23:CpIt8qoM/kdfve0XyEXVo9U/csw5MzrKcTGWgtUFyp?= =?us-ascii?Q?yKc1cFOJ2l5bNG3GknjLq/49viPoKNUdx261pLhJ5yzVqTBbsSYRKNycPh+w?= =?us-ascii?Q?0Sw/n1JP21LtZbJPhetW5C1y7GiWOMKLbK5qlyDnEkxO8+BA3CSn00Y3SCcP?= =?us-ascii?Q?2e714AcJI1cNQOY9FnNTr8DPfnMPSvyNH6u8upSju0ufy56EjoQsD0MSIO/h?= =?us-ascii?Q?yybNJzTd4WCa91cHjAfvSzjJ3m9lcQHa59gBghRuOdBUM/yD7+FwOfIGfgwr?= =?us-ascii?Q?y34ao0nqE4swXK92CB6h7LIb6BLLcIMYwOaQkBPshQ0Yqwr4teDhfO6O8iAV?= =?us-ascii?Q?FiiN2wHX05biOo1XtfQhuahpEOWqwv926oDcBJ6G87L2CQoyONjy5ojnVC3X?= =?us-ascii?Q?Iq+fz1OG1Qn4BpbxKIza2cREPIc1Op2Ll/dki7kihF1zPTlJ0iHIsCUob+IX?= =?us-ascii?Q?SCC3YF0oQnSAAX38nssdxfktPwJSrAPhI2gSltFBrYosMctceFhHoLyEG6Ys?= =?us-ascii?Q?BDKAf6Lh2CKDL1+vqvLIFuV0PRJCh+0sLJa7uDFRYc2DQmNLPKxTkg3w0kpI?= =?us-ascii?Q?kjD0J3N/Tr1He8QE2uvSlOjDaIhbqfHi0q6cz816kOeB9wmMm4erRzn1hPMT?= =?us-ascii?Q?cp5SclnrZYNCWjYweFusIGMMBkxt+ridWLFcXNQVHKAZAESznZldYQZcoUZj?= =?us-ascii?Q?xgygygetiUUYwsrRXtIahtx//O6s/pAgi1lTDHAt/sY7m9Uv2DKMc5TUuEg5?= =?us-ascii?Q?1ry7nA+T5ojGKnG94LcmswzYs4/9T99tVD5VizCo5HMhCFIyeqlziZDUii0U?= =?us-ascii?Q?YP++tqq4LW9uoW9zTRxr5lcGFJEoJpYtZXOYJWxS3S3cAxtIhiTR4CYIOhw2?= =?us-ascii?Q?goFYjAV0VKl3U0Y4bFUITEhxVQp8Ghy+HV7D3ubxYYvpTrJd9EXGSig108vH?= =?us-ascii?Q?pFN5z+qRi4E42PpP3RahIrDkgWzLtfblEGuwpvYGj92NLWM3ogYttdQ/fccC?= =?us-ascii?Q?oJx/sb2iMnhyYrzWeF7bXKpSGgVLqAd/eQzB9HD0r3+nGjjXwzadUGHnmWux?= =?us-ascii?Q?w7JPfzMu3dGs6g4JNmBzKpWP9fRnsVAWWM3Xt43dum5rSBYxEJj34EaZUOhP?= =?us-ascii?Q?gZl9w2EFQHY/40G8bs++RS4Q6QifHT?= X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB484; 5:vL4mRG5JM9+JyHj28Rhodq5uOGet3r69jFxKAuu9gNob2oZIsAneDRwVkHzMxUIZh7kv1w3DWTb29GLKCDyF/u3qgfcsxP9iAKowDQZtCau29NMSZbH8UyzD7T9NdBgnpx24qEQSY5tqc6+ucvQHkg==; 24:tcSV64cZ9BGQLutHMYsfJDvJEJ/V2+7U06U6tbzhC6wU3yi9Xad6SJHuqkICM+NWjBFNKZfmIlZ9EoHmrazI6445LR76e6I08vhqpbD5IpE=; 20:uUUoHA4NnW1STLx3VKZ2InWxbkM65RpkicwkO9Qegc0S2PvBckQIlvRzzLgyXrHxYOW8MCKirGGwVtEYL/IAQQ== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2015 11:31:31.0703 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR03MB484 X-Topics: patch Cc: petri.savolainen@nokia.com, stuart.haslam@arm.com Subject: [lng-odp] [API NEXT PATCH v7 01/14] linux-generic: sysinfo: make the model_str per-CPU data X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Hongbo Zhang For AMP system such as ARM big.LITTLE, cores are heterogeneous, and the model_str for each core may be different too, so this patch changes the model_str to data array model_str[] to contain data for each different core, while for the common SMP system, we can simply use the model_str[0] to contain data for all cores because they are all same, but if like, we can fill each item in the data array too. The new API to get each model_str for AMP system will be added later. Signed-off-by: Hongbo Zhang --- platform/linux-generic/include/odp_internal.h | 4 +++- platform/linux-generic/odp_system_info.c | 28 +++++++++++++-------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index 6f0050f..eac642c 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -23,13 +23,15 @@ extern "C" { extern __thread int __odp_errno; +#define MAX_CPU_NUMBER 128 + typedef struct { uint64_t cpu_hz; uint64_t huge_page_size; uint64_t page_size; int cache_line_size; int cpu_count; - char model_str[128]; + char model_str[MAX_CPU_NUMBER][128]; } odp_system_info_t; struct odp_global_data_s { diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index 31df29e..cf6d5a7 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -139,10 +139,10 @@ static int cpuinfo_x86(FILE *file, odp_system_info_t *sysinfo) if (pos) { int len; pos = strchr(str, ':'); - strncpy(sysinfo->model_str, pos+2, - sizeof(sysinfo->model_str)); - len = strlen(sysinfo->model_str); - sysinfo->model_str[len - 1] = 0; + strncpy(sysinfo->model_str[0], pos + 2, + sizeof(sysinfo->model_str[0])); + len = strlen(sysinfo->model_str[0]); + sysinfo->model_str[0][len - 1] = 0; model = 1; count--; } @@ -188,10 +188,10 @@ static int cpuinfo_octeon(FILE *file, odp_system_info_t *sysinfo) if (pos) { int len; pos = strchr(str, ':'); - strncpy(sysinfo->model_str, pos+2, - sizeof(sysinfo->model_str)); - len = strlen(sysinfo->model_str); - sysinfo->model_str[len - 1] = 0; + strncpy(sysinfo->model_str[0], pos + 2, + sizeof(sysinfo->model_str[0])); + len = strlen(sysinfo->model_str[0]); + sysinfo->model_str[0][len - 1] = 0; model = 1; count--; } @@ -228,10 +228,10 @@ static int cpuinfo_powerpc(FILE *file, odp_system_info_t *sysinfo) if (pos) { int len; pos = strchr(str, ':'); - strncpy(sysinfo->model_str, pos+2, - sizeof(sysinfo->model_str)); - len = strlen(sysinfo->model_str); - sysinfo->model_str[len - 1] = 0; + strncpy(sysinfo->model_str[0], pos + 2, + sizeof(sysinfo->model_str[0])); + len = strlen(sysinfo->model_str[0]); + sysinfo->model_str[0][len - 1] = 0; model = 1; count--; } @@ -333,7 +333,7 @@ static int systemcpu(odp_system_info_t *sysinfo) sysinfo->cpu_hz = 1400000000; sysinfo->cache_line_size = 64; - strncpy(sysinfo->model_str, "UNKNOWN", sizeof(sysinfo->model_str)); + strncpy(sysinfo->model_str[0], "UNKNOWN", sizeof(sysinfo->model_str)); return 0; } @@ -391,7 +391,7 @@ uint64_t odp_sys_page_size(void) const char *odp_sys_cpu_model_str(void) { - return odp_global_data.system_info.model_str; + return odp_global_data.system_info.model_str[0]; } int odp_sys_cache_line_size(void)