From: Yongxin Liu Date: Mon, 23 Nov 2020 03:05:33 +0000 (+0800) Subject: usertools: fix binding built-in kernel driver X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7a016af4aa6bd2f8425b4fb2d59e5dd19f12bceb;p=dpdk.git usertools: fix binding built-in kernel driver A driver can be loaded as a dynamic module or a built-in module. In commit 681a67288655 ("usertools: check if module is loaded before binding"), the script only checks modules in /sys/module/. However, for built-in kernel driver, it only shows up in /sys/module/, if it has a version or at least one parameter. So add check for modules in /lib/modules/$(uname -r)/modules.builtin. Fixes: 681a67288655 ("usertools: check if module is loaded before binding") Cc: stable@dpdk.org Signed-off-by: Yongxin Liu Reviewed-by: Anatoly Burakov --- diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py index c2ede3d4df..98bd1b7e4d 100755 --- a/usertools/dpdk-devbind.py +++ b/usertools/dpdk-devbind.py @@ -7,6 +7,7 @@ import sys import os import subprocess import argparse +import platform from glob import glob from os.path import exists, basename @@ -107,7 +108,17 @@ def module_is_loaded(module): loaded_modules = sysfs_mods - return module in sysfs_mods + # add built-in modules as loaded + release = platform.uname().release + filename = os.path.join("/lib/modules/", release, "modules.builtin") + if os.path.exists(filename): + try: + with open(filename) as f: + loaded_modules += [os.path.splitext(os.path.basename(mod))[0] for mod in f] + except IOError: + print("Warning: cannot read list of built-in kernel modules") + + return module in loaded_modules def check_modules():