From patchwork Thu Jul 9 10:46:01 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: 50933 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9EB63228E5 for ; Thu, 9 Jul 2015 10:47:02 +0000 (UTC) Received: by lbbei7 with SMTP id ei7sf1490360lbb.3 for ; Thu, 09 Jul 2015 03:47:01 -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: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=Ra4nT8O1D92BlOieN8uSiw0F8y47fJdIgJL2ZWp7j/c=; b=nCSuqoXIfcCvt9Tv2+y0OO0EILjMudkswrGUMbLtqRzCOhLE/xuRNxmrkEZ2eQma+W BsUGvm3D1eApK8IAuKhx06CvVJUrtMQEFH11Q7goOiJ7lkrl5b288URjUuclD3BD42yS LQ68tZSDHAoIC+qtHG19GQKWJA+8af/M2pU3lvLWM4qG4CYhjZWLMqdDhcBxViUYHUpt SIRi4Aj607N+PoK+ePPDUw0/x22aKObimFqrS6TgsxWaFiCdroSc2Qe+4Q5Wxhxb8p6d nqqrBwRA8IOeUm+Ywjq/WT4VfTv8ODglE33EA9U610N3AkuTsRDIBsBPZZlYsZbSc5Xt IUcg== X-Gm-Message-State: ALoCoQm80qdCuZeFsFf2euoSQ4Tu6+PBOzIcevNWWwgvOBGRZhjjgjjn+uk727wNzInA3+fZSdxJ X-Received: by 10.112.171.41 with SMTP id ar9mr7508762lbc.24.1436438821609; Thu, 09 Jul 2015 03:47:01 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.105 with SMTP id i9ls312965laa.96.gmail; Thu, 09 Jul 2015 03:47:01 -0700 (PDT) X-Received: by 10.152.121.99 with SMTP id lj3mr13726568lab.37.1436438821485; Thu, 09 Jul 2015 03:47:01 -0700 (PDT) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id ew10si4364640lac.11.2015.07.09.03.47.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Jul 2015 03:47:01 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by labgy5 with SMTP id gy5so91344163lab.2 for ; Thu, 09 Jul 2015 03:47:01 -0700 (PDT) X-Received: by 10.152.37.228 with SMTP id b4mr13948100lak.117.1436438821334; Thu, 09 Jul 2015 03:47:01 -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.108.230 with SMTP id hn6csp576440lbb; Thu, 9 Jul 2015 03:47:00 -0700 (PDT) X-Received: by 10.55.15.129 with SMTP id 1mr23223214qkp.29.1436438820224; Thu, 09 Jul 2015 03:47:00 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id b33si5595524qkh.70.2015.07.09.03.46.58; Thu, 09 Jul 2015 03:47:00 -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 4398361FBB; Thu, 9 Jul 2015 10:46:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal 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 ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 324E461FC3; Thu, 9 Jul 2015 10:46:28 +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 0C03661FBF; Thu, 9 Jul 2015 10:46:24 +0000 (UTC) Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0118.outbound.protection.outlook.com [65.55.169.118]) by lists.linaro.org (Postfix) with ESMTPS id 8C2A461FA9 for ; Thu, 9 Jul 2015 10:46:17 +0000 (UTC) Received: from CO2PR03CA0022.namprd03.prod.outlook.com (10.141.194.149) by BN1PR03MB284.namprd03.prod.outlook.com (10.255.200.26) with Microsoft SMTP Server (TLS) id 15.1.207.12; Thu, 9 Jul 2015 10:46:15 +0000 Received: from BN1BFFO11FD037.protection.gbl (2a01:111:f400:7c10::1:135) by CO2PR03CA0022.outlook.office365.com (2a01:111:e400:1414::21) with Microsoft SMTP Server (TLS) id 15.1.195.15 via Frontend Transport; Thu, 9 Jul 2015 10:46:15 +0000 Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11FD037.mail.protection.outlook.com (10.58.144.100) with Microsoft SMTP Server (TLS) id 15.1.201.10 via Frontend Transport; Thu, 9 Jul 2015 10:46:15 +0000 Received: from hongbo.ap.freescale.net (hongbo.ap.freescale.net [10.193.20.67]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t69AkBfc022771; Thu, 9 Jul 2015 03:46:13 -0700 From: To: Date: Thu, 9 Jul 2015 18:46:01 +0800 Message-ID: <1436438768-4258-2-git-send-email-hongbo.zhang@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436438768-4258-1-git-send-email-hongbo.zhang@freescale.com> References: <1436438768-4258-1-git-send-email-hongbo.zhang@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD037; 1:N9RXHczbyD2OERcHnopFVOtmsx6Ge6tN2cczHzYF6VKRr4mDCXoTFp9SH/2bti/Ewe2L0yGJcuOORTlJxEW16LKGYMzCaJFCGOpYlsoCXx6BEX8Hindfm1tPTspSTruQVq4WXuGh+pQOXmTkP+N1usH813yUwjriqwzOGAvTaWZSwesIwmpAe0Ms6LGsd8iSXYsfrQkwxrbBOLOvw5XzaFzmUcUw4rSctLO/e8u9PUU62LyQLZkJAX5eXD3nhm5sLQDPCI1qfZLIcoMFH7U1FpyBqETlUOnVAg6vm/nnaMtCmXX5vEQTRsaysAPxyxIM X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(979002)(6009001)(2980300002)(339900001)(189002)(199003)(62966003)(77156002)(76176999)(50986999)(47776003)(46102003)(77096005)(2950100001)(48376002)(50466002)(104016003)(85426001)(92566002)(189998001)(87936001)(33646002)(86152002)(86362001)(105606002)(5001860100001)(5001830100001)(4001540100001)(110136002)(5001960100002)(36756003)(50226001)(5003940100001)(106466001)(2351001)(229853001)(6806004)(19580395003)(19580405001)(41533002)(217873001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN1PR03MB284; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BN1PR03MB284; 2:5GQ9TbIBPYLgV+FQ4v4hYWP6ZGvXy9VuF8OQbycbVwZ79WwC8PZm42iGUgtN2Glw; 3:1S8CtzOhQX5hxSpJNF9wmwvehpRvzVIc76+GaPS83qqdXjSe5xNNvYqZztDQuHbQB9rVpvySQ+/ML8QIi9kYCDC7vd4i5mfxgGVztDrm04uffI/+27rATuSWCHmWbZ3BYEPgZll6k1xZk8ofNTAXwgGFDrvIXaHBIF+RjXvWZV2u3CH0HnmsxFvEQh9xJXH26J5R6RYPH0wVZUtcTzV6yfiwOkGfAKgKwnL2J9MbndY=; 25:DnxCYPE/03+5zSOR4ClhNL22NpiK2SE6XRx+oHlueBWGnarHGfptawoAotPqZWhx6wQCvYwPrK2Xa4n7zNAIPWf7F35PTJkjacxJTtef5Oe+KizwQuLYermkEdrWmHRT1SFAO6fNxiUIRrxk1KcMcG0n93tPmYS31Xwc3tncg+cAA1TaPfvq7JbbJokB0E1mQ10UX5Q3rW3N8R04k0i0+bFFsvQBAOg/FeJskDzeaSz88oOzyPu8+Isw8a6TxYRfEIWZ7HLrD9NtSRIDI8Cl4w==; 20:qfALqHE+kycZEbmmITCKb6kfxlyOsT2IOYsLbQdoSE3V3h6TieWnxEZFmRXz93wD3XhZeuZG3bI3zswunRBwT7XA1uOL3nG+Nx1VynU9TBZ6qSrO5iyi6awMNYzf83ZW2Ngyqs0Y5KxwlizcVDLRmOZPP36WD9OSaycd5xQ3vGTyygGeXugS7xl6hl3yfEqoROrtLQoXsMFcWehpKp7cwMCJgCF2RvnPHTb16Ei/oJLg4ttcoqFmeiwDMTI6pjJw0AsIkGJTuBHUyQYMPCq0ESIaFdTAIKoqfQO1810KxrxEKCj30kwxCDb2iLtdw4MWpti2M8o5/GD/9dwmVeZ+omVg4yplJkEz0vN5Jlydr3I= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN1PR03MB284; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BN1PR03MB284; BCL:0; PCL:0; RULEID:; SRVR:BN1PR03MB284; X-Microsoft-Exchange-Diagnostics: 1; BN1PR03MB284; 4:GYp+uK1uUvR9yuo/iC/AU2O9sOwoLG6AkmWX0m2JtBeEbyAiJLuHQIHIWI+4VqxQ/+PNQdUIsZf9KjOZB5rUiOSaNuJKzCc8eLYEAbVjxQ1XoKa+Aq+D5RJvBwTgDykd0Wb36PAAI/HxFQhnCAfVL0BPEupUEBQ/ZBbzIBfRiUNmz14FBWHwxutlFGJ2pwY2JaMLrtqbz1IetYd9zaHYn+PuoTN4CMuuypboPEIf+NEFaJEFjHnf5d5HRFFnI7lsmscy1yjrS50GlP1RArrvbMy7AhxZtUaZB/CvMYVSwJk= X-Forefront-PRVS: 0632519F33 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1PR03MB284; 23:2zUzu6R1ZCQ45swDNLVPyh8oCq5fawY+KHXlUu6bMo?= =?us-ascii?Q?O+7ZPg9OI6mzXx+kZK10ZHfpoOUYSbMNqoW66Z0ZotnNBR6FM7IG/WejZJO6?= =?us-ascii?Q?Jsuj34PYizhJTllceL3WrUzyiT0tZbOzDJtcZgCoFrk9KRWRqKNJ3NJRBdJQ?= =?us-ascii?Q?1Zfhx2VJTH/QV7WZfWBN23Mb0/oIomispzDxbFIGxW0aqu1tgLFvcNBkGpmI?= =?us-ascii?Q?Ddog0bRUsD3mOWHJyZOCf31mFKTCqKBfm6NFxCTR/EWbmX0cwoEBhxM0uBYL?= =?us-ascii?Q?OUcrHwcXZlj3lNuI/cIc3dHMu31QUVENt+C213E2lGpDbar6wkzUn9gagnsb?= =?us-ascii?Q?uP+hDLu4SrmO8N3oBeQKTaNYkupw63czoCXuEIPe2JUdM71iRJysDqMquMxF?= =?us-ascii?Q?RrB4i1yaLIkerVILzCeH5Lo/7difv9luWJNDkjHbJ//TR0Erh74rLOGBzfsm?= =?us-ascii?Q?vmbYsPoZ8XsYpp6BhOPTNmgLnaZ7PS+Q205dOU25CXoydjFJT2TM3Sp2yPvn?= =?us-ascii?Q?KiTJOpMkPzodj8S5zqoxSLBj3lG+IE5zvWt0nPC/yYi1sRMX/WBxEJZ1QPux?= =?us-ascii?Q?RZztPHfFZzRWgrcE4VZqgXPi9bx2cWgxlPLfelzJiiWbzpfF9J2Rtah1rOkH?= =?us-ascii?Q?RdSgmWaNwXTz4AIp3gMctM4smtcWrDC/R0NnHVFuN4aHN7MHH4zXI+GA2T8q?= =?us-ascii?Q?7otbbB1+gC8iqDYsgU3QTa2qmjPBj9qjyYN5WBlj9nzcZ1ruXhfE/kHRN3dd?= =?us-ascii?Q?bJGEQtaxI2+j+k9RFyfuND/NgVI3Wa4nJTwLmUx+3xBRPmpWDns3xjm2Gdvs?= =?us-ascii?Q?lAuluyD64pVgVWYbVuLJjmun7nl4RJrZdtnYHOjXzLFB87Yy24++l506buOZ?= =?us-ascii?Q?pu1SNwApwucqYcsev2cXASrGI+byZaN6WgdTUQNPceMKScjasO5cs8++2EQl?= =?us-ascii?Q?71WD/VSTPByFgGlQwmsdkjdG+iOfmkX8bpHHXqFBEozCV4n3zAKCT233Xftm?= =?us-ascii?Q?ef2pap7LacWGeDenU3RyWX7eO5Y4KuQA4V5KhX8WpVWkGp71qioD4LTfo0Ph?= =?us-ascii?Q?QS2g7wJm+qFCSefhQF4rY9yq37f/Cvb25YcSqAgpI2OD0PdppdS8+xjHrpga?= =?us-ascii?Q?j3yQTDiyzO87UJ9VjZn4vqBVqgDpDftJAL48TahefeHUllgmCWsg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN1PR03MB284; 5:eHezj/ln688ikTZVShI/IfnvbvwJQUaablXrfEODHx4PpcjG5OuYv0fxdIVEg5bYz0eqwwUnFlzu7ThoDKx7fqvQdH12n7BxbkASmCO90jTysg0AigcHaU0pYG5a9WFJaUx0wPk++ttlKu6K+uPHcg==; 24:ZXcS4NxXSWgQCqxZjNQSc02OzTpiBD9CZO5QKVDrujNYYfb5EcW9VCC+0Dz2zFG0OTzSO08kaZmg8Et+6JM/XFn5i2HFhv2HRoFig2+3HII=; 20:BSj+9SpHLhUYzQZCO23t7zfF4LNUWD14pPLUxbukoN7lwgNvwCU4jKcfCPFFaF/MTH3bta2H9lXarb+8hXUiWA== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2015 10:46:15.0606 (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.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR03MB284 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH v3 1/8] 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.215.49 as permitted sender) smtp.mail=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 | 29 +++++++++++++-------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index 8c5d339..bcf7e63 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -22,13 +22,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..3add081 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -36,7 +36,6 @@ typedef struct { #define HUGE_PAGE_DIR "/sys/kernel/mm/hugepages" - /* * Report the number of CPUs in the affinity mask of the main thread */ @@ -139,10 +138,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 +187,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 +227,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 +332,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 +390,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)