DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] usertools: show hugepages requested/set on failure
Date: Mon,  8 Mar 2021 23:25:20 +0100	[thread overview]
Message-ID: <20210308222521.822118-1-thomas@monjalon.net> (raw)

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 <thomas@monjalon.net>
---
 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


             reply	other threads:[~2021-03-08 22:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08 22:25 Thomas Monjalon [this message]
2021-03-25 17:08 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210308222521.822118-1-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).