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 C415AA09F6; Thu, 17 Dec 2020 12:16:57 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A2F62CA0A; Thu, 17 Dec 2020 12:16:55 +0100 (CET) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by dpdk.org (Postfix) with ESMTP id 1B8FCCA02 for ; Thu, 17 Dec 2020 12:16:54 +0100 (CET) Received: by mail-wr1-f53.google.com with SMTP id y17so26160835wrr.10 for ; Thu, 17 Dec 2020 03:16:54 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=Yjjkr1YnxL2KB4IBI4F2fu9HbkzAPcn+qP3R2xAE/XI=; b=CMIroDp2fQYmDfwkezRBTOZ/Yyci6+wBc4cA1Et0nJg3xEmjhi45Z+I0KjuESgD6C6 MDHM6/oCkkmntHIpZM9BMIW+4danF6m/jwqjrtSMiQ/2TjeZTDDck9Qs2KI6ZI1mWc4T v0Bvc68VzNo/wBRUub2ics6cVdYPk7Usr9KUb+q6XU5ceXA6/5b2uRAWqiEfkAGqUUbc y/cK7YwkfdB7v6xqOF8FrMwYzqxV/9nJHfBF0aahUIVodRi2iNLdanGL5xPP1p5hjter xB+KGGYQOZAOXnW9zfWajaN0subBaUYeSjso9D5KIqkjm/fhjszSifdYnkTFDk8U7LwS Zj0A== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Yjjkr1YnxL2KB4IBI4F2fu9HbkzAPcn+qP3R2xAE/XI=; b=NimiPdaeNax2JHRwajm/CFrKrmZ5zYWdJ/vVgQJakwQPuy48+QDlzfzOJT9PmidmBK siUqi7NoXH3+wYXQjDQ6pJx0vkgyNC0zGvX+0vv2ychF824LBIVOO8IMf9hCpzXw7CLq ps3vPdBTzNN7L8pTsiQxFASTvndcg1k7eG0T+vNBsKUi1nZHN9F6dWbVu4acpa06sv3M bSC/apYAIamNUlzg3/IRKsqiekETUmQFWKIwbkfnSjI2JAqIyBkZoFP82CTjZa3om8uZ Pzz00LJC0OQqmrroW14AvArC2OUXMyEAqnyBiQ71ctqI9kYprVKGOY0EHmERCi219IAP tRaQ== X-Gm-Message-State: AOAM530zBvxiyOIHoDaV/198cQN+QKJKNKJUVNckx0Y6OCpSq7K9oo2j BFNfSezeoF3S9fnHdE4c9GuLXQ== X-Google-Smtp-Source: ABdhPJwa1kygpNmkvPwAG/sIKefPb/2kXwl7LJZNYk7myFth+/lF8oyRKIOmMY8TGiUVJWcli1TYLA== X-Received: by 2002:a5d:62c8:: with SMTP id o8mr44007959wrv.51.1608203812660; Thu, 17 Dec 2020 03:16:52 -0800 (PST) Received: from localhost.localdomain ([182.191.83.208]) by smtp.gmail.com with ESMTPSA id h16sm8148818wrq.29.2020.12.17.03.16.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 03:16:52 -0800 (PST) From: Sarosh Arif To: sthemmin@microsoft.com Cc: dev@dpdk.org, Sarosh Arif Date: Thu, 17 Dec 2020 16:16:16 +0500 Message-Id: <20201217111616.24057-1-sarosh.arif@emumba.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201130124533.23341-1-sarosh.arif@emumba.com> References: <20201130124533.23341-1-sarosh.arif@emumba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [v2 PATCH] usertools: show an error message if unable to reserve requested hugepages 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" Sometimes the system is unable to reserve the requested hugepages because enough space is not available in the RAM. In that case, currently the script displays no error message hence the user can be under the delusion that the hugepages he requested are all successfully reserved. This patch displays an error message if the pages reserved are different from the requested pages and shows the actual pages reserved. Signed-off-by: Sarosh Arif --- v2: use a global variable SHOW_HUGEPAGES to remove linter warnings --- usertools/dpdk-hugepages.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/usertools/dpdk-hugepages.py b/usertools/dpdk-hugepages.py index 1be100ca3..83332c096 100755 --- a/usertools/dpdk-hugepages.py +++ b/usertools/dpdk-hugepages.py @@ -16,6 +16,8 @@ # systemd mount point for huge pages HUGE_MOUNT = "/dev/hugepages" +# show hugepages flag +SHOW_HUGEPAGES = False def fmt_memsize(kb): '''Format memory size in kB into conventional format''' @@ -62,6 +64,10 @@ def set_hugepages(path, pages): filename = os.path.basename(path) size = filename[10:] sys.exit('{} is not a valid system huge page size'.format(size)) + if get_hugepages(path) != pages: + print("Unable to reserve required pages. The pages reserved are:") + global SHOW_HUGEPAGES + SHOW_HUGEPAGES = True def show_numa_pages(): @@ -233,6 +239,9 @@ def main(): metavar='SIZE', help='setup huge pages by doing clear, unmount, reserve and mount') args = parser.parse_args() + + global SHOW_HUGEPAGES + SHOW_HUGEPAGES = args.show if args.setup: args.clear = True @@ -260,7 +269,7 @@ def main(): int(reserve_kb / pagesize_kb), pagesize_kb, node=args.node) if args.mount: mount_huge(pagesize_kb, HUGE_MOUNT) - if args.show: + if SHOW_HUGEPAGES: show_pages() print() show_mount() -- 2.25.1