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 57EE8A0566; Mon, 8 Mar 2021 23:25:40 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3C44822A3A1; Mon, 8 Mar 2021 23:25:40 +0100 (CET) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by mails.dpdk.org (Postfix) with ESMTP id 4B9F722A369 for ; Mon, 8 Mar 2021 23:25:39 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id EC2EB5C0117; Mon, 8 Mar 2021 17:25:38 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 08 Mar 2021 17:25:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:subject:date:message-id:mime-version :content-transfer-encoding; s=fm3; bh=f+n3mZ/gQ3ZhliXNxq2tyvJTjR HfgrACaY+/ugv5AqQ=; b=yH0efaUjv2Fg9e9kjt0jqyPngl8BQLU4UhFBNhPHBA lhNU///5xOa1pb1Ukxo3r+xS59aqDkPbCNh92tINxsEbRTWMmXAkTHmWBaXF7ma+ 9gMn+McwBypWiRvcDQiHWMnrVupS1Qy52w7vfmMhSpZjKMm7wXD1d9llaW4bbijJ rYiYlSqtRgSfVkD3wl6tcXaiTsP6AHX0LVUHgHQWOS8g2Ao5C0q5EI+q3ocyHhJn hrjlW+g+TkpQXdAztszrX3Kyv9gEuIFQbLW3XC7c6y2JUM+RO/vLbbL7l8pcgqoY bW77fUg83OXQecNZ2onf87bOwziGfVFTzDGkgQxwL1HQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=f+n3mZ/gQ3ZhliXNx q2tyvJTjRHfgrACaY+/ugv5AqQ=; b=n+C47GvChW6PL1Nv+1KK0bwv9qNnHBAzu 8izYic3CK/onxv0ZT/3nCihxwJr7/TlZQnWUdtRMVCJwqUd/iIOfyoLy5Ik72Z9H hS/HqXevyqcWfQdQYmrG4759d+IZpdyho9iAk34vHeL0j83vgiFd27t1GNgB47C4 BTQu62X2Z1QWEWKtMwAcJ2tYZ2MpINxKxFI6WlpcLIiCErw3dxVftweEHEhFkCw7 WfcfMq90G99TDw7HsNTuOZnqcYfmN60HbAKlIb4wxX6C03F6x7J4gVJg766dDwX9 1vmM0b0st1clZD+9K0Jd0VsrEtzXMQd3onLH8TVKPjLJfi17ZaE8Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledruddugedgledvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgggfestdekredtre dttdenucfhrhhomhepvfhhohhmrghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhho nhhjrghlohhnrdhnvghtqeenucggtffrrghtthgvrhhnpedvledvudehvdduudevuedvve ehgeduleegiefgjeehudehtddtgeduffejiefhgfenucfkphepjeejrddufeegrddvtdef rddukeegnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomh epthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 6340E1080064 for ; Mon, 8 Mar 2021 17:25:38 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Date: Mon, 8 Mar 2021 23:25:20 +0100 Message-Id: <20210308222521.822118-1-thomas@monjalon.net> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] usertools: show hugepages requested/set on failure 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" In case the number of requested hugepages cannot be set, a more detailed error message is printed. The new message does not mention "reserve" because setting can be reserving or clearing. The filename and numbers requested/set are printed to ease debugging. Signed-off-by: Thomas Monjalon --- usertools/dpdk-hugepages.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/usertools/dpdk-hugepages.py b/usertools/dpdk-hugepages.py index fb368b6933..5c409eb16c 100755 --- a/usertools/dpdk-hugepages.py +++ b/usertools/dpdk-hugepages.py @@ -57,19 +57,21 @@ def get_hugepages(path): return 0 -def set_hugepages(path, pages): +def set_hugepages(path, reqpages): '''Write the number of reserved huge pages''' filename = path + '/nr_hugepages' try: with open(filename, 'w') as nr_hugepages: - nr_hugepages.write('{}\n'.format(pages)) + nr_hugepages.write('{}\n'.format(reqpages)) except PermissionError: sys.exit('Permission denied: need to be root!') except FileNotFoundError: sys.exit("Invalid page size. Valid page sizes: {}".format( get_valid_page_sizes(path))) - if get_hugepages(path) != pages: - sys.exit('Unable to reserve required pages.') + gotpages = get_hugepages(path) + if gotpages != reqpages: + sys.exit('Unable to set pages ({} instead of {} in {}).'.format( + gotpages, reqpages, filename)) def show_numa_pages(): -- 2.30.1