From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B7262A00C2; Wed, 17 Mar 2021 15:44:20 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 583284067E; Wed, 17 Mar 2021 15:44:20 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id BC26B4014D for ; Wed, 17 Mar 2021 15:44:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615992257; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wbrqo4MkzTifJnHgCnV1j2a9GZRgyFnL9LUxgJKLFfo=; b=Rre6ey2mQJFVzOuqw4fbwUw1/X86cB3SwQECwX9w6iMKtLrMfuAbpezG75Aj2VviOqqIHH X3ARfQuH8L7rFLNjYboFpaUmrwF5yKBf5RDlxYziWl83qdkor9GMMCKVTkgxSvXuAnPAyt jiwAf9MN7a4FF6+d51yBF+5Y6gqniMg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-121-iO2vN1w9MEiwoRGSvxWpyg-1; Wed, 17 Mar 2021 10:44:16 -0400 X-MC-Unique: iO2vN1w9MEiwoRGSvxWpyg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CABA61007474; Wed, 17 Mar 2021 14:44:14 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (ovpn-117-240.rdu2.redhat.com [10.10.117.240]) by smtp.corp.redhat.com (Postfix) with ESMTP id E1D9B60864; Wed, 17 Mar 2021 14:44:10 +0000 (UTC) From: Aaron Conole To: dev@dpdk.org Cc: David Marchand , Thomas Monjalon Date: Wed, 17 Mar 2021 10:44:09 -0400 Message-Id: <20210317144409.288346-1-aconole@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=aconole@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-dev] [PATCH] test: make hugepage check more robust under Linux X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The hugepage test really needs to check multiple things on Linux: 1. Are hugepages reserved in the system? 2. Is the hugepage mountpoint available so that we can allocate them? 3. Do we have permissions to write into the hugepage mountpoint? The existing hugepage check only verifies the first. On some setups, a non-root user won't have access to the mountpoint for hugepages to be allocated and that needs to be reflected in the test as well. Add such checks for Linux OS to give a more check when running test suites. Signed-off-by: Aaron Conole --- app/test/has-hugepage.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/test/has-hugepage.sh b/app/test/has-hugepage.sh index d600fad319..1c3cfb665a 100755 --- a/app/test/has-hugepage.sh +++ b/app/test/has-hugepage.sh @@ -3,7 +3,17 @@ # Copyright 2020 Mellanox Technologies, Ltd if [ "$(uname)" = "Linux" ] ; then - cat /proc/sys/vm/nr_hugepages || echo 0 + nr_hugepages=$(cat /proc/sys/vm/nr_hugepages) + # Need to check if we have permissions to access hugepages + perm="" + for mount in `mount | grep hugetlbfs | awk '{ print $3; }'`; do + test ! -w $mount/. || perm="$mount" + done + if [ "$perm" = "" -o "$nr_hugepages" = "0" ]; then + echo 0 + else + echo $nr_hugepages + fi elif [ "$(uname)" = "FreeBSD" ] ; then echo 1 # assume FreeBSD always has hugepages else -- 2.25.4