DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org, Robin Jarry <rjarry@redhat.com>,
	Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH v1 1/1] usertools/devbind: fix NUMA node display
Date: Thu, 28 Nov 2024 16:08:55 +0000	[thread overview]
Message-ID: <9af1231398c4ba116d3b89164690feace37293a9.1732810125.git.anatoly.burakov@intel.com> (raw)

On some systems, even though NUMA nodes may be present in sysfs, the lspci
command will not have NUMANode keys in them, which will cause an exception.
Fix to check if NUMANode keys are available in lspci output before enabling
NUMA node output.

Fixes: a7d69cef8f20 ("usertools/devbind: print device NUMA node")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 usertools/dpdk-devbind.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index 34f8f3ed3b..8a4aac371c 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -113,7 +113,16 @@
 
 # check if this system has NUMA support
 def is_numa():
-    return os.path.exists('/sys/devices/system/node')
+    if not os.path.exists("/sys/devices/system/node"):
+        return False
+    # occasionally, system may report NUMA support but lspci will not, so we
+    # want to go through all devices and see if any of them do not have NUMANode
+    # property - this will mean it is not safe to try to access it
+    for device_dict in devices.values():
+        if "NUMANode" not in device_dict:
+            return False
+    # all checks passed
+    return True
 
 
 # check if a specific kernel module is loaded
-- 
2.43.5


             reply	other threads:[~2024-11-28 16:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-28 16:08 Anatoly Burakov [this message]
2024-11-28 17:20 ` Stephen Hemminger

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=9af1231398c4ba116d3b89164690feace37293a9.1732810125.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=rjarry@redhat.com \
    --cc=stephen@networkplumber.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).