From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id BB2F6A09DF;
	Wed,  2 Dec 2020 21:58:05 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 0A2A4C996;
	Wed,  2 Dec 2020 21:58:04 +0100 (CET)
Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com
 [148.163.158.5]) by dpdk.org (Postfix) with ESMTP id C0F1FC956
 for <dev@dpdk.org>; Wed,  2 Dec 2020 21:58:01 +0100 (CET)
Received: from pps.filterd (m0098419.ppops.net [127.0.0.1])
 by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id
 0B2Kv4rt028752; Wed, 2 Dec 2020 15:58:00 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com;
 h=from : to : cc : subject
 : date : message-id : in-reply-to : references : mime-version :
 content-transfer-encoding; s=pp1;
 bh=04cL4bNaZL7rxBZwz7VN5tYxD3Ht8SqaR65FOCp3w0Y=;
 b=LOW/7xzdds7OzKmCl6DBQE/aVczk5RNCLKkBNyHnAdIwHUxctJgrEeTNdziRFkO98N64
 HkIp8tDt83DybEtwoDdP/TyTnKsDpBJj2EdeiC4tQ5cgeBFw2b5oOLVyLe7qHTvzWtX5
 pXllcrK08pmyAOjho6YC2Z+qt+ybm59OMF0R6m5MxounrEL83f1rcf4DfVBOTGRk7EK7
 kIfWrZ0Dm8R2JxagWCUuZsii2YSgEXXPR2Ix5W/6FuwQ48N7HcWRBLOI6KhheRYaSd5a
 nBqDWgxHz0RHbCfNnaOXTvVHQmOOsqwkwKovw5gGaB+m45fbxK3Bpl4+KY9DWMElOWnj 6g== 
Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com
 [169.55.91.170])
 by mx0b-001b2d01.pphosted.com with ESMTP id 356jdgr1d8-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
 Wed, 02 Dec 2020 15:57:59 -0500
Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1])
 by ppma02wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0B2KuoxI009317;
 Wed, 2 Dec 2020 20:57:59 GMT
Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com
 [9.57.198.29]) by ppma02wdc.us.ibm.com with ESMTP id 356cbejeqg-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
 Wed, 02 Dec 2020 20:57:59 +0000
Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com
 [9.57.199.106])
 by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id
 0B2Kvwfq65274276
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Wed, 2 Dec 2020 20:57:59 GMT
Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1])
 by IMSVA (Postfix) with ESMTP id DAE6E28059;
 Wed,  2 Dec 2020 20:57:58 +0000 (GMT)
Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1])
 by IMSVA (Postfix) with ESMTP id CDFCB28058;
 Wed,  2 Dec 2020 20:57:58 +0000 (GMT)
Received: from localhost.localdomain (unknown [9.114.224.51])
 by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP;
 Wed,  2 Dec 2020 20:57:58 +0000 (GMT)
From: David Christensen <drc@linux.vnet.ibm.com>
To: dev@dpdk.org, stephen@networkplumber.org
Cc: David Christensen <drc@linux.vnet.ibm.com>
Date: Wed,  2 Dec 2020 12:57:56 -0800
Message-Id: <20201202205756.39577-1-drc@linux.vnet.ibm.com>
X-Mailer: git-send-email 2.27.0
In-Reply-To: <20201202181959.13753-1-drc@linux.vnet.ibm.com>
References: <20201202181959.13753-1-drc@linux.vnet.ibm.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-TM-AS-GCONF: 00
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312, 18.0.737
 definitions=2020-12-02_12:2020-11-30,
 2020-12-02 signatures=0
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
 lowpriorityscore=0
 phishscore=0 priorityscore=1501 clxscore=1015 mlxlogscore=999
 impostorscore=0 suspectscore=2 spamscore=0 mlxscore=0 bulkscore=0
 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx
 scancount=1 engine=8.12.0-2009150000 definitions=main-2012020119
Subject: [dpdk-dev] [PATCH v2] usertools: show hugepages on POWER systems
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

The IBM PowerNV systems include NUMA nodes that don't have associated
CPUs or hugepage memory.  Here is an example on an IBM AC922 system:

$ lscpu
...
NUMA node0 CPU(s):   0-63
NUMA node8 CPU(s):   64-127
NUMA node252 CPU(s):
...

$ numastat -m
...
                          Node 0          Node 8        Node 252
                 --------------- --------------- ---------------
MemTotal               126763.19       130785.06            0.00
MemFree                119513.38       125294.44            0.00
MemUsed                  7249.81         5490.62            0.00
...
HugePages_Total             4.00         1734.00            0.00
HugePages_Free              0.00            4.00            0.00
HugePages_Surp              4.00         1730.00            0.00
...

Modify dpdk-hugepages.py to test for the ../hugepages directory before
attempting to parse the hugepage entries.

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
---
v2:
- reduce indentation and use continue to skip non-existent paths
---
 usertools/dpdk-hugepages.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/usertools/dpdk-hugepages.py b/usertools/dpdk-hugepages.py
index 1be100ca3..4b6401dc2 100755
--- a/usertools/dpdk-hugepages.py
+++ b/usertools/dpdk-hugepages.py
@@ -70,6 +70,8 @@ def show_numa_pages():
     for numa_path in glob.glob('/sys/devices/system/node/node*'):
         node = numa_path[29:]  # slice after /sys/devices/system/node/node
         path = numa_path + '/hugepages'
+        if not os.path.exists(path):
+            continue
         for hdir in os.listdir(path):
             pages = get_hugepages(path + '/' + hdir)
             if pages > 0:
-- 
2.27.0