From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 60A96A04DB; Mon, 30 Nov 2020 13:49:04 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1ABD64F9A; Mon, 30 Nov 2020 13:49:03 +0100 (CET) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by dpdk.org (Postfix) with ESMTP id 1343237AF for ; Mon, 30 Nov 2020 13:49:01 +0100 (CET) Received: by mail-wr1-f47.google.com with SMTP id k14so16064497wrn.1 for ; Mon, 30 Nov 2020 04:49:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emumba-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gGd8enapjsmsZORvBSevQQOLj7sWK5c2CpilHFIaboE=; b=pUcf/JdWipY2becyYZlpOcTzrFbwNY/eVQDSHoH8pr/fpSOPOE9S+n+56PMRWQ0JyH SZqOblCVv5uYzJMbXvsWoSgtCZn9v5bMXjODDRMC7tsmNdGDawBCd86UYdnnNKfhFEws Jv85B4hD0b4ndDsSOJKWcPHoj2ds+2aMNBFdlita/5TZiHdTBUNwV4SJ5hBnN44hBeMC 3cyvhLogShtcMtdXMSTrL2MMSfV1Yq9HmMPoBhTb2e/HGWUEMgZjWdoGQenMqil6TnFo 9x/A+iLJU2rcmj6sFYEMj7sQBcLFKXiP4JUvnIM2ocaozw+DH6Qmsi72H5XWPzKDoRjx N7KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gGd8enapjsmsZORvBSevQQOLj7sWK5c2CpilHFIaboE=; b=nEKtrd4gVqBCv06p2+y4/t9QAwhg5p26s9mmsG7TTS3HcKfnC9TjayNZc35v1GCgl1 0pTgc/gex7Oza6uNuRedDybNRBECTJhYdGte9M8DTlkUSihkkejjmHRcS8+WFkW8ZP3r u2YNekW8lCzMdqoUNCZ60IjHIy3sdRv67tnjk+6XFAF4RqwIz27deyWZcoCY0xKwmQ5e 2MFv9k/saWgM6j45bfjtU+aE5Z1is/JAUr6wYIdonIEtTK2W9w9JYwVIvuHsK9vMataR HUkq9HaoXHchdqAsgBUHRDORVEDTKXiNN5ygQdxmtbNdU8Os1Fc4bDMjGyk2BpyxbbWO C3vg== X-Gm-Message-State: AOAM530apvqDnqNBQWCjftJo4TexznMgpOxD1lbLUqriOL+88nqJ55jY MxX10Ejw00ynrHJFuwitl6KZoQ== X-Google-Smtp-Source: ABdhPJxDSYltSqpXRvEUWewlwD/Q3dH/fU6CUHG/YJp2HxAB1HNaMpvVAdDzzOHT2fpDSpuwuoedpw== X-Received: by 2002:adf:e801:: with SMTP id o1mr28245565wrm.3.1606740539772; Mon, 30 Nov 2020 04:48:59 -0800 (PST) Received: from localhost.localdomain ([182.191.83.208]) by smtp.gmail.com with ESMTPSA id b4sm7599849wrr.30.2020.11.30.04.48.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2020 04:48:59 -0800 (PST) From: Sarosh Arif To: sthemmin@microsoft.com Cc: dev@dpdk.org, Sarosh Arif Date: Mon, 30 Nov 2020 17:47:19 +0500 Message-Id: <20201130124719.23434-1-sarosh.arif@emumba.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] usertools: show valid hugepage sizes if user requests an invalid hugepage size X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" If user requests a hugepage size which is not supported by the system, currently user gets an error message saying that the requested size is not a valid system huge page size. In addition to this if we display the valid hugepage sizes it will be convenient for the user to request the right size next time. Signed-off-by: Sarosh Arif --- usertools/dpdk-hugepages.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/usertools/dpdk-hugepages.py b/usertools/dpdk-hugepages.py index 1be100ca3..f503ad377 100755 --- a/usertools/dpdk-hugepages.py +++ b/usertools/dpdk-hugepages.py @@ -49,6 +49,14 @@ def get_hugepages(path): return int(nr_hugepages.read()) return 0 +def show_valid_page_sizes(path): + valid_page_sizes = "" + hugepage_dir_path = os.path.split(path)[0] + hugepage_dirs = os.listdir(hugepage_dir_path) + for each_dir in hugepage_dirs: + hugepage_size = each_dir.split("-")[1] + valid_page_sizes = valid_page_sizes + " " + hugepage_size + print("valid page sizes: {}".format(valid_page_sizes)) def set_hugepages(path, pages): '''Write the number of reserved huge pages''' @@ -61,8 +69,9 @@ def set_hugepages(path, pages): except FileNotFoundError: filename = os.path.basename(path) size = filename[10:] - sys.exit('{} is not a valid system huge page size'.format(size)) - + print('{} is not a valid system huge page size'.format(size)) + show_valid_page_sizes(path) + sys.exit() def show_numa_pages(): '''Show huge page reservations on Numa system''' -- 2.25.1