DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yongxin Liu <yongxin.liu@windriver.com>
To: dev@dpdk.org, anatoly.burakov@intel.com, thomas@monjalon.net
Subject: [dpdk-dev] [PATCH v3] usertools/devbind: fix binding for built-in kernel drivers
Date: Thu, 19 Nov 2020 15:16:46 +0800	[thread overview]
Message-ID: <20201119071646.10052-1-yongxin.liu@windriver.com> (raw)
In-Reply-To: <20201118025854.13455-1-yongxin.liu@windriver.com>

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"), 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.

Thanks for Anatoly Burakov's advice.

Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com>
---

v3:
 - Add built-in module list in loaded_modules for checking
   instead of removing error check.

v2:
 - fix git commit description style in commit log
 - fix typo spelling

---
 usertools/dpdk-devbind.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py
index 99112b7ab..5b34ccd2a 100755
--- a/usertools/dpdk-devbind.py
+++ b/usertools/dpdk-devbind.py
@@ -181,7 +181,13 @@ def module_is_loaded(module):
 
     loaded_modules = sysfs_mods
 
-    return module in sysfs_mods
+    # add built-in modules as loaded
+    builtin_mods = subprocess.check_output(["cat /lib/modules/$(uname -r)/modules.builtin"], shell=True).splitlines()
+    for mod in builtin_mods:
+        mod_name = os.path.basename(mod.decode("utf8")).split(".ko", 1)
+        loaded_modules.append(mod_name[0])
+
+    return module in loaded_modules
 
 
 def check_modules():
-- 
2.14.4


  parent reply	other threads:[~2020-11-19  7:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18  2:58 [dpdk-dev] [PATCH v2] usertools/devbind: fix binding for built-in 1kernel drivers Yongxin Liu
2020-11-18 16:27 ` Burakov, Anatoly
2020-11-19  7:24   ` Liu, Yongxin
2020-11-19  7:16 ` Yongxin Liu [this message]
2020-11-19 12:18   ` [dpdk-dev] [PATCH v3] usertools/devbind: fix binding for built-in kernel drivers Burakov, Anatoly
2020-11-20  2:30     ` Liu, Yongxin
2020-11-20  2:22 ` [dpdk-dev] [PATCH v4] " Yongxin Liu
2020-11-20 10:49   ` Burakov, Anatoly
2020-11-20 11:38   ` Burakov, Anatoly
2020-11-23  3:05 ` [dpdk-dev] [PATCH v5] " Yongxin Liu
2020-12-03  8:25   ` Liu, Yongxin
2021-02-11 10:43     ` Burakov, Anatoly
2021-02-11 22:19       ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201119071646.10052-1-yongxin.liu@windriver.com \
    --to=yongxin.liu@windriver.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).