[PATCH v4 4/4] usertools/dpdk-devbind: print NUMA node
Anatoly Burakov
anatoly.burakov at intel.com
Wed Aug 21 11:22:39 CEST 2024
Currently, devbind does not print out any NUMA information, which makes
figuring out which NUMA node device belongs to not trivial. Add printouts
for NUMA information if NUMA support is enabled on the system.
Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
Acked-by: Robin Jarry <rjarry at redhat.com>
---
Notes:
v1 -> v2:
- Added commit to print out NUMA information in devbind
usertools/dpdk-devbind.py | 29 +++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)
diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index b276e8efc8..078e8c387b 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -110,6 +110,11 @@
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
@@ -577,20 +582,28 @@ 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"
+ if print_numa:
+ extra_param = "numa_node=%(NUMANode)s " + extra_param
display_devices("%s devices using DPDK-compatible driver" % device_name,
- dpdk_drv, "drv=%(Driver_str)s unused=%(Module_str)s")
+ dpdk_drv, extra_param)
if kernel_drv:
- if_text = ""
+ extra_param = "drv=%(Driver_str)s unused=%(Module_str)s"
if if_field:
- if_text = "if=%(Interface)s "
- display_devices("%s devices using kernel driver" % device_name, kernel_drv,
- if_text + "drv=%(Driver_str)s "
- "unused=%(Module_str)s %(Active)s")
+ extra_param = "if=%(Interface)s " + extra_param
+ if print_numa:
+ extra_param = "numa_node=%(NUMANode)s " + extra_param
+ display_devices("%s devices using kernel driver" % device_name,
+ kernel_drv, extra_param)
if no_drv:
- display_devices("Other %s devices" % device_name, no_drv,
- "unused=%(Module_str)s")
+ extra_param = "unused=%(Module_str)s"
+ if print_numa:
+ extra_param = "numa_node=%(NUMANode)s " + extra_param
+ display_devices("Other %s devices" % device_name, no_drv, extra_param)
def show_status():
--
2.43.5
More information about the dev
mailing list