From patchwork Tue Sep 4 12: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: 145923 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp3574962ljw; Tue, 4 Sep 2018 05:01:56 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdakyw3o40jnOz69HdzkSqbdryaguHqUvD6/AnAlMeLI4nVNCY+hY4v/ztEzc0H56APnBYa6 X-Received: by 2002:a37:5e03:: with SMTP id s3-v6mr28498711qkb.339.1536062516272; Tue, 04 Sep 2018 05:01:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536062516; cv=none; d=google.com; s=arc-20160816; b=rCqWvzlX9QNfOSVNdvsWevxJs/9CWiXWAna51N8vgW6uXJSsSGuDs+zqXtiYQhfO/9 5kYXA18nlYR60yaqbWI+jrlKpb/QjoIUc1+37yzTv+lFkFzNdfDk4d122fP6KFovBYpz 2t9apNeL4YTRhJuNzxU6SF5PXrRAaYm0fi+VSlDU27Q4slTo41GJe0JXhI3MNM1Pd28f KLbDqWHbUX5IIylUUxb8M0Gw4hkPIeI8Ssb/fO2enOPaQMq3bBk/O8CXXxjHqAcpJNRc JtnDllUBmLyGDXY2MSsU6Sz90lbuOCJmvh55P6aQpy6YmmuLUTHMDSgtLnq6u0Oc5X2W v3jw== 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=qEJhU2Rc0u75UVGAx7bdh1fGRm+0FAJOqkuZxsJ4o/0=; b=xFQVkmZhwaUpUAQ8E5AzCpScp23BUwLGDTce/6V5rD2zLLRVJjIMwT2T3++GZiF/Vb iyeGrRw1kxnQs5REZMcCpOMIFQ48v9AYYg1neEh/h2cBUI8zM/oiQWmExEgUVfJh8dCM PvnDTOQ46KAQGbDCqDXIk/f/HXMFxXZwvla5p0AcNiFAcuLw4XeA+kZss5wZtr6h9ZyJ 3xZ3ylGbMmCmdGpDyON7bOUIu8AtSUvGjA1AJif8tMW2ABlhfJEpQD5Ogsfr0/Uor4wx Kk7cI0wIdii/etyP98j/81+TeU8EKlKMx8FBnySugR1TrONlp7iJb5dhX7azVu7+bPmc qyjQ== 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 v46-v6si4637010qtv.299.2018.09.04.05.01.55; Tue, 04 Sep 2018 05:01:56 -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 5CDB6685BE; Tue, 4 Sep 2018 12:01: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 60B8F60CF7; Tue, 4 Sep 2018 12:01:51 +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 1868661A2B; Tue, 4 Sep 2018 12:01:39 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id 5D9FB685D0 for ; Tue, 4 Sep 2018 12:00:11 +0000 (UTC) Received: from mxback9o.mail.yandex.net (mxback9o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::23]) by forward106p.mail.yandex.net (Yandex) with ESMTP id D4DA82D8742D for ; Tue, 4 Sep 2018 15:00:09 +0300 (MSK) Received: from smtp4p.mail.yandex.net (smtp4p.mail.yandex.net [2a02:6b8:0:1402::15:6]) by mxback9o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id qyw9E0HJAk-09Y4EP4J; Tue, 04 Sep 2018 15:00:09 +0300 Received: by smtp4p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id D4gyALJ8d8-09Hm8fCk; Tue, 04 Sep 2018 15:00:09 +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 12:00:06 +0000 Message-Id: <1536062407-7301-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536062407-7301-1-git-send-email-odpbot@yandex.ru> References: <1536062407-7301-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 693 Subject: [lng-odp] [PATCH v2 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: e81a26cbc48048931817e90079842e469b3191c0 **/ 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 12:00:07 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: 145924 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp3575876ljw; Tue, 4 Sep 2018 05:02:32 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda5PCS6HTS1/JZTgRQzNlH+5QDCXAREEI/wlqpTrJEqovjl1WLd7pOuRdK1OLcJdTUYeykS X-Received: by 2002:a0c:f38f:: with SMTP id i15-v6mr29073295qvk.241.1536062552506; Tue, 04 Sep 2018 05:02:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536062552; cv=none; d=google.com; s=arc-20160816; b=zZEvhV90lgUBPfDapRkh9bJsuWshTxxgWMrjYUdqs93WDGGMtFEYyDna2dHJrpqZLb CTElfCbKeL2gvfpxot7CrOolna6Z9wSN7qT0AQjjcs5e7OcpDUdYMhlvpAZl4kmqD9c2 EjIgvwigFDhFiI4A+t8jsiSKzEjtQj61KnTCwsUdEsDLRMS8kjKs/Naf0oBPA82puvca R2RFPvS/t5qOptmmxweUUifIYAlPz4g1zfGi0SDl3OIX42t8RuATrMLXT+h+BfsR5q0W jV/gshMhJfaijNuclDgHMUFLPL79XXEGulynQurlS9n5dlkSBewAheytLNqVOMu/Bcmb GYlA== 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=G/K8/9FYVe8dffi9xp/C49tYOV1BKRFVATw9ZUbeygM=; b=jKxXGUVgtYZW5Plz6C7VHoSvukatwPcaKD+k4cXUUweZz2dw2YjPZwYHs00SPIf5Hy cwQc+kaXmqzL1J3hgauQpsm3PNmhq14L5jRZbLiFo3ZScO/J2iX57d8LynFbxfIY0anC Wn+UGTxKqp2/sRS+uvymFvjv/rnRCAwsSDsmWXIN6vv0yL1pCFJYvNNPauvQkQnoDVuA Cbf+SPXTwvYIFbFQtWcQIN2ZNNQQUtmex8GOGLjzL31VXEDS+FtlWcFFHVLGdaGiaVRt nzMyQWerkyDIFlgN2XsmBK49f3yjDG6w73/BQrKIM6UsT94WwLXbL8hfsrzhKLvSJLoR yNlA== 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 t66-v6si710276qki.261.2018.09.04.05.02.32; Tue, 04 Sep 2018 05:02:32 -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 2C67E685BE; Tue, 4 Sep 2018 12:02:32 +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 E6C5261A2B; Tue, 4 Sep 2018 12:01:52 +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 6DAC861A2B; Tue, 4 Sep 2018 12:01:39 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id 9D4D7685D5 for ; Tue, 4 Sep 2018 12:00:12 +0000 (UTC) Received: from mxback1j.mail.yandex.net (mxback1j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10a]) by forward100j.mail.yandex.net (Yandex) with ESMTP id D09495D84194 for ; Tue, 4 Sep 2018 15:00:10 +0300 (MSK) Received: from smtp4p.mail.yandex.net (smtp4p.mail.yandex.net [2a02:6b8:0:1402::15:6]) by mxback1j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id pIPcPobZia-0An4iVEe; Tue, 04 Sep 2018 15:00:10 +0300 Received: by smtp4p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id D4gyALJ8d8-09HCCjU1; Tue, 04 Sep 2018 15: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 12:00:07 +0000 Message-Id: <1536062407-7301-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536062407-7301-1-git-send-email-odpbot@yandex.ru> References: <1536062407-7301-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 693 Subject: [lng-odp] [PATCH v2 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: e81a26cbc48048931817e90079842e469b3191c0 **/ .../arch/x86/odp_sysinfo_parse.c | 30 +++++++++++++++---- 1 file changed, 25 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..5084e6b5f 100644 --- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c @@ -15,34 +15,54 @@ 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 && + 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++; } }