Skip to content

Commit

Permalink
usertools/devbind: print device NUMA node
Browse files Browse the repository at this point in the history
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@intel.com>
Acked-by: Robin Jarry <rjarry@redhat.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
  • Loading branch information
anatolyburakov authored and david-marchand committed Nov 26, 2024
1 parent f63ca24 commit a7d69ce
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions usertools/dpdk-devbind.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,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
Expand Down Expand Up @@ -611,20 +616,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():
Expand Down

0 comments on commit a7d69ce

Please sign in to comment.