From patchwork Thu Sep 17 13:09:58 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: 53800 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 patches.linaro.org (Postfix) with ESMTPS id EBDF722E57 for ; Thu, 17 Sep 2015 13:25:24 +0000 (UTC) Received: by lbbmp1 with SMTP id mp1sf6281208lbb.2 for ; Thu, 17 Sep 2015 06:25:23 -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=mrWmIqPV7C9pfBNtmZxRbeGQM/lBXiIsgAhQu0x+PaLDLY6Ae7zdWTbrCg16wURYId qpvkBsG2eEdx+kcQ9ie4xYF52nUDn2q3c6E9GKCfi7A8fjcsxqtWswVJMDzw0Ad7SR52 KJY/ZsML2Revw5nDaTZ2rlToSF1gb2YWkYeO2h7BCpIY5UY5JeLuWiKaLyojrKR44dSL FJL/uukQreE+G2JCFN2q47S3k4Z5CyI119C+vVdhZbsVuz4Zv4F/aGCAG47f3ukd8tii fV9DeF8BXgwDS07AeM2TnxGiyA/by1viE5ppTCT71SzpgSc978rrm9SMy1Oc5C5BMVEb YjEg== X-Gm-Message-State: ALoCoQnI6Zd7fXJ5F2fJAtn1lNX7U7BjZ+Q1JBtb9EVZlxXstB2G9uap8CUYJfFxxuCAGCm6grWh X-Received: by 10.180.89.104 with SMTP id bn8mr3110363wib.4.1442496323878; Thu, 17 Sep 2015 06:25:23 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.231 with SMTP id v7ls78816lav.37.gmail; Thu, 17 Sep 2015 06:25:23 -0700 (PDT) X-Received: by 10.153.11.165 with SMTP id ej5mr36551483lad.10.1442496323721; Thu, 17 Sep 2015 06:25:23 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id vn6si2144630lbb.74.2015.09.17.06.25.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Sep 2015 06:25:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by lanb10 with SMTP id b10so11037232lan.3 for ; Thu, 17 Sep 2015 06:25:23 -0700 (PDT) X-Received: by 10.152.5.170 with SMTP id t10mr21544355lat.112.1442496323309; Thu, 17 Sep 2015 06:25:23 -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 w3csp3070318lbq; Thu, 17 Sep 2015 06:25:20 -0700 (PDT) X-Received: by 10.140.29.201 with SMTP id b67mr6679874qgb.36.1442496313389; Thu, 17 Sep 2015 06:25:13 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id z6si2561643qkz.79.2015.09.17.06.25.12; Thu, 17 Sep 2015 06:25:13 -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 CEA1D62C19; Thu, 17 Sep 2015 13:25:12 +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 CB10E62D59; Thu, 17 Sep 2015 13:24:40 +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 1EF8D62D4F; Thu, 17 Sep 2015 13:24:36 +0000 (UTC) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bn0109.outbound.protection.outlook.com [157.56.110.109]) by lists.linaro.org (Postfix) with ESMTPS id 26C5C62C06 for ; Thu, 17 Sep 2015 13:24:25 +0000 (UTC) Received: from DM2PR03CA0031.namprd03.prod.outlook.com (10.141.96.30) by DM2PR03MB495.namprd03.prod.outlook.com (10.141.85.149) with Microsoft SMTP Server (TLS) id 15.1.268.17; Thu, 17 Sep 2015 13:24:24 +0000 Received: from BL2FFO11FD005.protection.gbl (2a01:111:f400:7c09::190) by DM2PR03CA0031.outlook.office365.com (2a01:111:e400:2428::30) with Microsoft SMTP Server (TLS) id 15.1.274.16 via Frontend Transport; Thu, 17 Sep 2015 13:24:23 +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 BL2FFO11FD005.mail.protection.outlook.com (10.173.161.1) with Microsoft SMTP Server (TLS) id 15.1.274.4 via Frontend Transport; Thu, 17 Sep 2015 13:24:22 +0000 Received: from hongbo.ap.freescale.net (hongbo.ap.freescale.net [10.193.20.3]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t8HDOGbe005200; Thu, 17 Sep 2015 06:24:19 -0700 From: To: Date: Thu, 17 Sep 2015 21:09:58 +0800 Message-ID: <1442495411-12362-2-git-send-email-hongbo.zhang@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442495411-12362-1-git-send-email-hongbo.zhang@freescale.com> References: <1442495411-12362-1-git-send-email-hongbo.zhang@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD005; 1:9Za9oJ45tmANNAirbg2YTGqsDme2uTC2fa0G/5gOZNX84Pkev9FCDQ1V3pjeLEoqgMZnl6gQy/zxOtfJjKJ1m59tVPGZ+BCEJ/MpZzssFOhwAFl58cZaGmojTjJOcqTcIddhdcJsK8UMbKZ0ln0/MIzfUHdVb64kODc+9RWqJ07z2Lrn6gt8Z9yxUc8S75jchOwdIw11QthCCNoQrgKHh7MfJPVozodBVqLhODjzJS0BQkMsWJO64YbxnuneUQ0noJepMvjRV3IMmJPlqkEYY8eI2m4790mPSfe/cht/7N2MIT5Bh2HUBg9ve31kU38hkrc80XPGDhSlC7fbRGu+4uxu/GXt/3HidM4WW455pvKLZTqBx2gGmpqvcGyB+UpF2LBx063TMh7ZQCUJnDb4Yw== X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(6806004)(2351001)(19580405001)(19580395003)(229853001)(5003940100001)(5007970100001)(85426001)(189998001)(5001960100002)(110136002)(69596002)(106466001)(76176999)(50986999)(104016003)(5001830100001)(62966003)(5001860100001)(33646002)(87936001)(50226001)(77156002)(46102003)(64706001)(92566002)(47776003)(81156007)(97736004)(4001540100001)(36756003)(68736005)(86152002)(2950100001)(48376002)(77096005)(105606002)(50466002)(86362001)(41533002)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM2PR03MB495; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB495; 2:Oa4u1omzuJvsXsnBL2qZD9H5KZmqnJzCggRbn5m2HHbWO+hRgxFarkyADYldMGlDkaefLuebrwPFmSUoQDx+2rQtQluA2HFi5nfo6dkhQ4YJsmVOYjq+E5VB24eRk9Z0b1az43IvCwyYfm5LrqQdv1I7D8w1jpnEPZOnzRlUekE=; 3:wsNWEQI83/6IPRSjmR77OvAN+JaHbgkEJG3hgYugCJEhVyen++0X+XkFxPKitInFPfLRxEeiWMDgc6BghoBaNGTohy5u9YoP5NMdnkA0Tn4eLtWe2Ghk+AQwpgmq093wTczMzeOSS/WjpMzy22+BXMlbgvdTsltWC/2HHgXMrnNsU2qetkqteRsie0cZkgeFfmKoDMJrMapG8IruTmw005kiC4XRFF+E0xiUBFaNcao=; 25:YlT3qNttAETL5CMBBtzk+xNh0k1Pue8TieLvIo++UEaUReTLM5R9DGoXm4cltvrM2LDWg3ndphNkuTMRxhmvpzrHm9Y4cv0L6yfGdaXV8z/dCaiEiMWJznmG7+qbTVfxwJwXfU1QcWBd7VbIRlGeTeRLpun8boO+yLv83Iv7eoLZeR7hCcYrUF8PFLBCM2RkeiCSS3xm2kjegtGKts4fkCXDzoP255vv6ne6YnU3ggSq6c8KCEuNHFZ9GZaDNOpl0fttUtcptvkChZifkQ68Kw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR03MB495; X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB495; 20:Oniq1DKpEsdYmRi62p8LSbgeXjtYM9DY1F63xxmnUMpADla/o+J+5+wQiicdR6WEGORleenNy//oy8Cx+fzJMrMTGD1x4q/mzLpoqFxyr2iULyFVYfdHcoTh3fKWWWeqTJlb2vJw9xlaAj0EKtlDSE2mMmIepiD8VF9ogmTIbbye5Oce3To0RmW/KZkipgO7c7Tj/L2QKRvSH8ith9LDDgjqybkgaWxpJJGQj+v19ohTRrGH6cpgRD6Dc/iNLfTFxs1NoFXwPEk+BtVEL5x8Zhv8MA9Ko0OTrLCSSGSde4u9YmKiNO/5Bvh7LC7UIJOpjxSAd7hJy9qcDXhiwgoHDNtrb75QK/KOwps8G1JO4WE=; 4:UxDoG/shC1WUJwJ/jVl6hNoWOCR+jYj+q81Ev7D50Ug02G8DrOjweBYE/hqN+E3gJwHELk8EEcojx6E+tSXA5Fg/YPU5cLAv0efI3qwYq6+vtVKxLoTGX/lsfK6ExSq6vRnwldRKSsLJlDJnkTqrjMddvFotcOBEB3RIyOjjjC4ug2OjewnT1DuNTmJF5w5lHEsc5nUCd6eR5N/KY/aNhxfjH4pNZAPoJWgGxM7/3gOyH5SlM83kKwTOW/HiKUesE8yQGSaunirhBOFjEsvqfCEqtqpHBqQsqVtR+0FSN2SRBZWqCJ9G7xDB9KBErhJzWkcPvLaHlIE7WothCK2rFg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(8121501046)(520078)(3002001); SRVR:DM2PR03MB495; BCL:0; PCL:0; RULEID:; SRVR:DM2PR03MB495; X-Forefront-PRVS: 07025866F6 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR03MB495; 23:oeCd6aHBmnIXoEkFPcNeYDFehTmnqdMJBATeneO4RL?= =?us-ascii?Q?gSEJZEPptL413di0PT37wycwlx6n4GBZVUf6qjcWGlCtjMILcaNWk0V6NLGo?= =?us-ascii?Q?2V+cbh8ecZhCNjsy2BrPrCDGngtAvHUtKmszA/BqvZTUNMEq/IWW6MJQbshI?= =?us-ascii?Q?qZlLcZ0MrYYvUmGh2KFjeh3H6peKRo2092ifBnAjppYt8paSMdqowWzTH7Ig?= =?us-ascii?Q?JJohfeJhujYzJovBGhu0kVv3f3NhiqsCEsDlw9b0CU8y9XM8tdHq7KvW/pSQ?= =?us-ascii?Q?CFAq1LqTuAM8adgMJWNCC/ejhoC4ThcP/QA2bhZKe/rrTj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yaHTYN/Mp9+tHEK32waRcgTL9BAHLyJ8PJW5Pd2KY51JHDeHy+q9Xyb?= =?us-ascii?Q?AhIAZYN8uQ0a9kN+HThhM07LpOUIpthZch/hgW?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB495; 5:q/zATKsZq+RnAEL36dXApL8/9XJuYTSTHzMb5i3QiiUWtSi3a7RYuPBw7Y/766Gp5luLw7VOa9izxGxco8iupcBVMNOJPikzq4xOscjxMbmWjr07CeKmWMl0+Sc/lVyV8dQnbq9Gt3IYY8AnFV0Opg==; 24:Tgd3mMmTx73Be37kH5+fuDcnDsZF+Rukh0RCIbgGW+KzKZVzByG4y0Ce4Fte7oWFZzq3rCcNvomttUZoZSBWdd66A/Q94c19TbNGKci57hA=; 20:HuZ855mS1lKHwL1PHB0gfo5yBl/EdLC5LjbY3l+zQ+c/1oOLm1cLStYWhWL044HkAweuJPZ1Lqe6JAJg+SXw0Q== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2015 13:24:22.9176 (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: DM2PR03MB495 X-Topics: patch Cc: petri.savolainen@nokia.com, stuart.haslam@arm.com Subject: [lng-odp] [API NEXT PATCH v6 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.215.44 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)