[PATCH v2 4/4] usertools/dpdk-devbind: print NUMA node

Robin Jarry rjarry at redhat.com
Mon Aug 19 13:34:47 CEST 2024


Anatoly Burakov, Aug 16, 2024 at 14:16:
> 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>

NB: Although it is better than dpdk-hugepages.py, this script could also 
benefit from a major cleanup as you did for cpu_layout.py.

>  usertools/dpdk-devbind.py | 27 +++++++++++++++++++--------
>  1 file changed, 19 insertions(+), 8 deletions(-)
>
> diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
> index b276e8efc8..c0611a501d 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
> @@ -579,18 +584,24 @@ def show_device_status(devices_type, device_name, if_field=False):
>  
>      # 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 is_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 is_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 is_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