From patchwork Tue Sep 4 11:00:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 145908 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp3516005ljw; Tue, 4 Sep 2018 04:00:56 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda69KDiBwdw20Cr+NeGJkIrUlG0UHKqMVtIgK6uMgcG5oYdKhSYMfDq7pxo6Qbh8LodPsp1 X-Received: by 2002:a0c:f685:: with SMTP id p5-v6mr28294308qvn.22.1536058856000; Tue, 04 Sep 2018 04:00:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536058855; cv=none; d=google.com; s=arc-20160816; b=hrY4P8VD+MV0cwFCMGAQt9Y8Qauy1ZIkLu59QF3H5T8YkuMlVZrYtQkS+4YaTcw5bQ qVwrOpwYVareBAc40AClU3eGGoeBOEqJdmWGzp5jTm9t2ov1UUtIwjD0f2xvsqOBYls0 EDGil/jNRfZk/uOSNW8bHFjbeZHL40xgHSaQMSYTALEgi8K71zvhWbHqYsGzb4yXVRE2 +QYmAbXIspK0aTlqJzeSENdua7mKWMXFXEPaxBMyZWJ3xtt/mRPAF1wRIHzFt0qtBMcq Y7A3zjWMgWcT+8rsdLx/SVfFiH5bB2EVrn3qFI27yin8RmFlzF1DhLsCSD3uEAtcAl3U pZCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=JFgQ2oNmcuJ57XYsl864zEcYsVHjMmYi4dBaR6BlazY=; b=nUACFVdGayPN775cRD7ez49auvHaaUNFqRXOHT5BWS84ZMvvMJI9PUE9QlMD69Aa7Y u21I6kdDZI/gjo9hFY4XByz/x7Qa3qR5agpvRzCixWXRrXygka4BjmZzQInSe07A31Nh rlRFDvnpfmhFsBe+7nsBOcUoi+MNPchjTQ54bI901wndFT2y2W+Ci8DFZCAFhc6xb9VZ RPKgd4Qa01/zbtGEEyWEhwBXSu2L4SfMhbbT5ctl4cA2madC8/dbImfz+KV4uvnCTztT RZSfB+21E3MUsvCk8zZMOgyUDsjup9JJXqfJ+Dg8jRolDwRNrtOi0D5Gzu9gwqj6zQ// /8xw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id u11-v6si2504393qvn.144.2018.09.04.04.00.55; Tue, 04 Sep 2018 04:00:55 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id A9F78685E4; Tue, 4 Sep 2018 11:00:55 +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=-3.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW 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 6CFF560E8C; Tue, 4 Sep 2018 11:00:24 +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 D708D618B2; Tue, 4 Sep 2018 11:00:19 +0000 (UTC) Received: from forward103p.mail.yandex.net (forward103p.mail.yandex.net [77.88.28.106]) by lists.linaro.org (Postfix) with ESMTPS id E150660CFC for ; Tue, 4 Sep 2018 11:00:13 +0000 (UTC) Received: from mxback2j.mail.yandex.net (mxback2j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10b]) by forward103p.mail.yandex.net (Yandex) with ESMTP id E0A1A2184CF8 for ; Tue, 4 Sep 2018 14:00:11 +0300 (MSK) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback2j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id GHoWrN4PH0-0BnW0nk1; Tue, 04 Sep 2018 14:00:11 +0300 Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Qr6wIRRKfs-09ZCxFKk; Tue, 04 Sep 2018 14:00:10 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 4 Sep 2018 11:00:05 +0000 Message-Id: <1536058806-6930-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536058806-6930-1-git-send-email-odpbot@yandex.ru> References: <1536058806-6930-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 693 Subject: [lng-odp] [PATCH v1 1/2] linux-gen: sysinfo: return 0 if hugepages are not supported X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Per API return 0 from odp_sys_huge_page_size_all() if hugepages are not supported/detected. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 693 (lumag:fix-cpu_max_hz) ** https://github.com/Linaro/odp/pull/693 ** Patch: https://github.com/Linaro/odp/pull/693.patch ** Base sha: 0a5d67beda902557056d5b5146d8cbe86e5001b0 ** Merge commit sha: 1585363355b8a72a90dd174216db95a06e062bad **/ platform/linux-generic/odp_system_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index bca02ba14..2ac8b32bb 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -443,7 +443,7 @@ int odp_sys_huge_page_size_all(uint64_t size[], int num) dir = opendir("/sys/kernel/mm/hugepages"); if (!dir) { ODP_ERR("Failed to open huge page directory\n"); - return -1; + return 0; } while ((entry = readdir(dir)) != NULL) { From patchwork Tue Sep 4 11:00:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 145911 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp3517667ljw; Tue, 4 Sep 2018 04:02:07 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaYteQa+9D2gMdCeOVazuYophNQdipV6Z3UTaj+maSDZoyPAl7Kibk1ISpgP5Lhx3LkM1yx X-Received: by 2002:a37:c987:: with SMTP id m7-v6mr28487004qkl.324.1536058927337; Tue, 04 Sep 2018 04:02:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536058927; cv=none; d=google.com; s=arc-20160816; b=aljuSvJ+awA9e/2lTsxwAWYYkOkEWH++tBVNvbnPiBG1Llw1MtuSKemq5wWkOcC0QP UMF5ZtLMaB6HQkmYMqvBj8tHIvxu3kNtnnfkIJn7vbvcIYS3qxMb7ZR/l2Zwsecg3vTV USvmAiBhQ/Pll302njNQsq+8w4OVqOZQy92Al02lNJZYju5Oxlnoihxu6p6/YEuLMw29 lG0hZ8rmO9lDOvZsMM600umRiyoL/ftCy0gAY3adWRrO5spATgcaMgm+KTRC4qZ2IiiG v0DAdywyRC6E4PDvSb3YYIxIQdPj5z8NUifgmMBFnEOql+macQV9qRlBG0uQOMfuevfk EMyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=6sOSNbzAwCINGER1brNh8LHLPbhbQGQh8RqijWWfeyk=; b=oHMFegBbzVMIa4S+UN6mosjb2njmmCAxa1uezDgcvwfEkWNTHIzmockpQcSnui4RQE xO70neNuTx7pAY/zZhVQo7c9W/Oqlc0vmfAzEymx7zJ360xAO6fEVpweL+U7ePL/uHBQ lqCXe0ID6PHLupEtYL4BrcmVDsYKuLTYCDGbqpcpX5NIke8nJDTgvN+OdwgJaZY8LyWT hPpDc0SSxGiYkoP+Gb/S2TiexWm3ch5ap+dUnZkkzdl1tZGIVxMYayvXC+WSuc2TqTTC vsbzw1Feqd80mUgAqyfrTxfoZ5nlGsuyWoAvjrcTlRMkRjZjVwkgEwHR+iRCyxy0Txf/ 5ZTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id z30-v6si5565042qtd.127.2018.09.04.04.02.07; Tue, 04 Sep 2018 04:02:07 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id F2099685EC; Tue, 4 Sep 2018 11:02:06 +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=-3.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW 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 11B9D6180C; Tue, 4 Sep 2018 11:00:30 +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 A476061BFF; Tue, 4 Sep 2018 11:00:23 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id 47C6860E8C for ; Tue, 4 Sep 2018 11:00:18 +0000 (UTC) Received: from mxback1g.mail.yandex.net (mxback1g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:162]) by forward101o.mail.yandex.net (Yandex) with ESMTP id AEF6213460DA for ; Tue, 4 Sep 2018 14:00:14 +0300 (MSK) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback1g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Qvxv7iDpoG-0EfevHfh; Tue, 04 Sep 2018 14:00:14 +0300 Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Qr6wIRRKfs-0CZmA9An; Tue, 04 Sep 2018 14:00:12 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 4 Sep 2018 11:00:06 +0000 Message-Id: <1536058806-6930-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536058806-6930-1-git-send-email-odpbot@yandex.ru> References: <1536058806-6930-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 693 Subject: [lng-odp] [PATCH v1 2/2] linux-gen: x86: as a last resort parse max cpu freq from bogomips value X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 693 (lumag:fix-cpu_max_hz) ** https://github.com/Linaro/odp/pull/693 ** Patch: https://github.com/Linaro/odp/pull/693.patch ** Base sha: 0a5d67beda902557056d5b5146d8cbe86e5001b0 ** Merge commit sha: 1585363355b8a72a90dd174216db95a06e062bad **/ .../arch/x86/odp_sysinfo_parse.c | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c index 504aa3efa..7ae5474c2 100644 --- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c @@ -15,34 +15,52 @@ int cpuinfo_parser(FILE *file, system_info_t *sysinfo) char str[1024]; char *pos, *pos_end; double ghz = 0.0; + double mhz = 0.0; uint64_t hz; int id = 0; + bool freq_set = false; strcpy(sysinfo->cpu_arch_str, "x86"); while (fgets(str, sizeof(str), file) != NULL && id < CONFIG_NUM_CPU) { pos = strstr(str, "model name"); if (pos) { + freq_set = false; + /* Copy model name between : and @ characters */ pos = strchr(str, ':'); pos_end = strchr(str, '@'); - if (pos == NULL || pos_end == NULL) + if (pos == NULL) continue; - *(pos_end - 1) = '\0'; + if (pos_end != NULL) + *(pos_end - 1) = '\0'; + strncpy(sysinfo->model_str[id], pos + 2, MODEL_STR_SIZE - 1); if (sysinfo->cpu_hz_max[id]) { + freq_set = true; id++; continue; } /* max frequency needs to be set */ - if (sscanf(pos_end, "@ %lfGHz", &ghz) == 1) { + if (pos_end != NULL && sscanf(pos_end, "@ %lfGHz", &ghz) == 1) { hz = (uint64_t)(ghz * 1000000000.0); - sysinfo->cpu_hz_max[id] = hz; + sysinfo->cpu_hz_max[id++] = hz; + freq_set = true; + } + } else if (!freq_set && (pos = strstr(str, "bogomips")) != NULL) { + pos = strchr(str, ':'); + if (pos == NULL) + continue; + + if (sscanf(pos + 2, "%lf", &mhz) == 1) { + /* On typical x86 BogoMIPS is freq * 2 */ + hz = (uint64_t)(mhz * 1000000.0 / 2); + sysinfo->cpu_hz_max[id++] = hz; + freq_set = true; } - id++; } }