[PATCH v1 1/1] usertools/devbind: fix NUMA node display

Anatoly Burakov anatoly.burakov at intel.com
Fri Nov 29 10:52:24 CET 2024


On some systems (particularly ones with NUMA disabled in BIOS), 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 at intel.com>
---

Notes:
    This is an alternative fix to patch 34067 [1]
    
    The difference between this and the original patch is that we drop the
    check for sysfs node, because it does not give us any useful information,
    and instead rely just on lspci dictionary to let us know if it's safe to
    enable NUMA node display.
    
    [1] https://patches.dpdk.org/project/dpdk/patch/9af1231398c4ba116d3b89164690feace37293a9.1732810125.git.anatoly.burakov@intel.com/

 usertools/dpdk-devbind.py | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index 34f8f3ed3b..283707fc16 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -111,11 +111,6 @@
 args = []
 
 
-# check if this system has NUMA support
-def is_numa():
-    return os.path.exists('/sys/devices/system/node')
-
-
 # check if a specific kernel module is loaded
 def module_is_loaded(module):
     global loaded_modules
@@ -595,9 +590,12 @@ def show_device_status(devices_type, device_name, if_field=False):
     dpdk_drv = []
     no_drv = []
 
+    print_numa = True  # by default, assume we can print NUMA information
+
     # split our list of network devices into the three categories above
     for d in devices.keys():
         if device_type_match(devices[d], devices_type):
+            print_numa &= "NUMANode" in devices[d]
             if not has_driver(d):
                 no_drv.append(devices[d])
                 continue
@@ -616,8 +614,6 @@ def show_device_status(devices_type, device_name, if_field=False):
         print("".join('=' * len(msg)))
         return
 
-    print_numa = is_numa()
-
     # print each category separately, so we can clearly see what's used by DPDK
     if dpdk_drv:
         extra_param = "drv=%(Driver_str)s unused=%(Module_str)s"
-- 
2.43.5



More information about the dev mailing list