From patchwork Sat Dec 23 16:00:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 122686 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3566347qgn; Sat, 23 Dec 2017 08:00:24 -0800 (PST) X-Google-Smtp-Source: ACJfBotFzj7TyPz1TB01u4j5dg48uoWt0qX09CKt7yyArHYPY14kURZsngDdNKugaKhOvu3MJb8N X-Received: by 10.200.36.22 with SMTP id c22mr24829845qtc.207.1514044824293; Sat, 23 Dec 2017 08:00:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514044824; cv=none; d=google.com; s=arc-20160816; b=zMqodQ7Cv5FpW4juLGqmnzUBL9GPB5YuYtWkiMecKkZZiLpvaVVp8X+u4DhpSniLrj 1FArn+oXZvDY+EWBkAFnAwZlLTTLgQruD8JFAZD78fSi+OliV3ahQ4Xi66sXXh6ioEFb 6zt2qHiNuTloP6hAo12ZlBtV3pzoH3bVNkqZVwg2e3t21bJ0Cmb/Thb9lp4e4R23P4IO evlZlbEXa3I2U05oa8NeWdERQBbeoE66zyJnZq0Y6Ylkcy/d4ah3FhHPCnyZq9YSvdIu 8ksYOJOatmiPKE1V9MgnqzFAyf7iEnEqFnNYVLciTK/GEMAtlOZv3EHAIL/xx69wZx7g NQWg== 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=uT2LESxqwJuBW1ECaRj7x0uIHDzu8qJnkHwyBySHfro=; b=kKTHQ1yKH2CenJsGKnG5HSeetmKXhIrIjhBhuVE/7mfeDdhVqSHBZeCqbH7UyC0PPN 5RT4nKNbT6JyQgzs9jevmsqnbRkhtiQ5pKvQmhNp6cstWK7//9sc76DB0krWjp9T8DkC tjxwm8RigJTgNm5ScgJ8co4h82iW1HQgtoPpWtOz61OBDh8p3oJhWFDw7F/vDKsr9m2R rp0wQxKq6knRR55VDMxYXYOT3YZM05xQiyVHBlqdi5hdsChYRYjJ0qEbSp0G39KhL3YT Uev1QovEurQSPAJa7iLKpDggNte+8uH8laSn3Cw7WMydLJmxkrsOXC1tHuJqGu4bQt0N N9jA== 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 b9si1477753qkj.414.2017.12.23.08.00.22; Sat, 23 Dec 2017 08:00:24 -0800 (PST) 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 74EF361529; Sat, 23 Dec 2017 16:00:22 +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=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 1DADA6088C; Sat, 23 Dec 2017 16:00:15 +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 5C22860975; Sat, 23 Dec 2017 16:00:13 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id 259416088C for ; Sat, 23 Dec 2017 16:00:12 +0000 (UTC) Received: from mxback3j.mail.yandex.net (mxback3j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10c]) by forward106o.mail.yandex.net (Yandex) with ESMTP id 84653783EFC for ; Sat, 23 Dec 2017 19:00:10 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback3j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id hcWHBhMVzt-0A883GNk; Sat, 23 Dec 2017 19:00:10 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id E8ZQbWAaks-09IG0OlX; Sat, 23 Dec 2017 19: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: Sat, 23 Dec 2017 19:00:08 +0300 Message-Id: <1514044808-4009-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514044808-4009-1-git-send-email-odpbot@yandex.ru> References: <1514044808-4009-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 366 Subject: [lng-odp] [PATCH v1 1/1] bug_3478 linux-gen: _ishm: proper alignment for current page size 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: Ilias Apalodimas fixes https://bugs.linaro.org/show_bug.cgi?id=3478 on systems compiled without hugetlb odp_init_global() failed on systems with hugetlb alignment was superfluous Signed-off-by: Ilias Apalodimas --- /** Email created from pull request 366 (apalos:bug_3478_2) ** https://github.com/Linaro/odp/pull/366 ** Patch: https://github.com/Linaro/odp/pull/366.patch ** Base sha: 260ca880b76151b66919cf0f3c149c2ba9ede24e ** Merge commit sha: f0393505ec2694de4673892f137aeaa657d4c389 **/ platform/linux-generic/_ishm.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/platform/linux-generic/_ishm.c b/platform/linux-generic/_ishm.c index 82465bc54..bce4e402c 100644 --- a/platform/linux-generic/_ishm.c +++ b/platform/linux-generic/_ishm.c @@ -864,8 +864,8 @@ int _odp_ishm_reserve(const char *name, uint64_t size, int fd, * the same address every where, otherwise alignment may be * be wrong for some process */ hp_align = align; - if (hp_align <= odp_sys_huge_page_size()) - hp_align = odp_sys_huge_page_size(); + if (hp_align <= page_hp_size) + hp_align = page_hp_size; else flags |= _ODP_ISHM_SINGLE_VA; @@ -1441,6 +1441,8 @@ int _odp_ishm_init_global(void) void *spce_addr; int i; uid_t uid; + char *hp_dir = odp_global_data.hugepage_info.default_huge_page_dir; + uint64_t align; odp_global_data.main_pid = getpid(); odp_global_data.shm_dir = getenv("ODP_SHM_DIR"); @@ -1466,13 +1468,13 @@ int _odp_ishm_init_global(void) return -1; } - if (!odp_global_data.hugepage_info.default_huge_page_dir) + if (!hp_dir) { ODP_DBG("NOTE: No support for huge pages\n"); - else { - ODP_DBG("Huge pages mount point is: %s\n", - odp_global_data.hugepage_info.default_huge_page_dir); - _odp_ishm_cleanup_files( - odp_global_data.hugepage_info.default_huge_page_dir); + align = odp_sys_page_size(); + } else { + ODP_DBG("Huge pages mount point is: %s\n", hp_dir); + _odp_ishm_cleanup_files(hp_dir); + align = odp_sys_huge_page_size(); } _odp_ishm_cleanup_files(odp_global_data.shm_dir); @@ -1504,8 +1506,7 @@ int _odp_ishm_init_global(void) *reserve the address space for _ODP_ISHM_SINGLE_VA reserved blocks, * only address space! */ - spce_addr = _odp_ishmphy_book_va(ODP_CONFIG_ISHM_VA_PREALLOC_SZ, - odp_sys_huge_page_size()); + spce_addr = _odp_ishmphy_book_va(ODP_CONFIG_ISHM_VA_PREALLOC_SZ, align); if (!spce_addr) { ODP_ERR("unable to reserve virtual space\n."); goto init_glob_err3;