From patchwork Mon Nov 30 12:45:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarosh Arif X-Patchwork-Id: 84637 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6D110A04DB; Mon, 30 Nov 2020 13:46:52 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4A0024C99; Mon, 30 Nov 2020 13:46:49 +0100 (CET) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by dpdk.org (Postfix) with ESMTP id 47CD74C93 for ; Mon, 30 Nov 2020 13:46:47 +0100 (CET) Received: by mail-wr1-f68.google.com with SMTP id l1so16015169wrb.9 for ; Mon, 30 Nov 2020 04:46:47 -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=NhdPtsik4KQAvqCKgJUm3q3tjpEJnWENiS71XQiXmH0=; b=QTG1vncKoPWuMUNYvwW9FuzGl81h9RCHpXq+P5+/8HcdVW+ELtlPfZDr+LrkLKHZ1N VR/eDTkg/OgLoKAUtaxLjGUrss1UpPxdkWBKRObSyBLYY6aDRikzUaNupDxtNvV8jeyg znE3H2zq5II4bWNb5iAJeqYm3hC24mkG4dyBdHOuvRPCuCT011NYtKlcutIxodqN/FEC Ba/rhVKp9j2PmpbN/5vtygGbrq90fqNw2+8CSTcANLSPYzIjnjhIGS8s/EoWnxOB3NXr HsN+AkNLHaZQ1Kb5iTkl+d4yaLdqFqzyaD9ZHwoD7AAiNJV3y9vyrbLNLyT/nq1cETO7 1iuA== 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=NhdPtsik4KQAvqCKgJUm3q3tjpEJnWENiS71XQiXmH0=; b=pWuD6k34oa447RgXQvndREP6zutsSK0jm/Ih5e7rR6WO0lurftJ1SvxqJwGgZfE68a gtPIxH2j6Hr8VtxCOSAcmA44SI98K333UhrtUH4Anc9kJWcv+cABykeTfc7BSaJMkqUg vJmhVdtGTdtEQUKZPPNMSJOJ5ZAXNIXq4wxQ2+BTjHKhWHjJeVIlTE3/uo+BEH/cwO5J jZrh7o/sPFl9qtkeMTRKr02iQCWqgE/h7Jpmf46QJA9mARVlGwueEcgXsrOhcB0lcry5 uI690MTikBPqv0KjIRFm2wFA+cLRhWnTynZipePeticPv+G/e/xrQfjjKnBeum5QXE8Z g1fw== X-Gm-Message-State: AOAM533hsdpQCcdDjSPeUmcJglK0VS1aRqqmcue2+75tDStzaREJz9mz BWUQ6tpRm7urGqaJNnOVYsCtyg== X-Google-Smtp-Source: ABdhPJya2ADSVSxm8Hr34tuU5Boj0M3P0ZOFYQFKqji3k0nm6jmV2nOJius+iZmdl+D5vVhbg8cZzQ== X-Received: by 2002:a5d:620a:: with SMTP id y10mr27801902wru.236.1606740404566; Mon, 30 Nov 2020 04:46:44 -0800 (PST) Received: from localhost.localdomain ([182.191.83.208]) by smtp.gmail.com with ESMTPSA id x25sm4873636wmc.3.2020.11.30.04.46.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2020 04:46:43 -0800 (PST) From: Sarosh Arif To: sthemmin@microsoft.com Cc: dev@dpdk.org, Sarosh Arif Date: Mon, 30 Nov 2020 17:45:33 +0500 Message-Id: <20201130124533.23341-1-sarosh.arif@emumba.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [dpdk-dev] [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 --- usertools/dpdk-hugepages.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/usertools/dpdk-hugepages.py b/usertools/dpdk-hugepages.py index 1be100ca3..3f6e62c8f 100755 --- a/usertools/dpdk-hugepages.py +++ b/usertools/dpdk-hugepages.py @@ -62,7 +62,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:") + show_pages() + args.show = False def show_numa_pages(): '''Show huge page reservations on Numa system''' @@ -232,6 +235,8 @@ def main(): '--setup', metavar='SIZE', help='setup huge pages by doing clear, unmount, reserve and mount') + + global args args = parser.parse_args() if args.setup: