From: Chen Pei <cp0613@linux.alibaba.com>
To: alison.schofield@intel.com, dave.jiang@intel.com,
jic23@kernel.org, nvdimm@lists.linux.dev
Cc: guoren@kernel.org, linux-cxl@vger.kernel.org
Subject: [ndctl PATCH v3 0/2] daxctl, util/sysfs: fix builtin-driver false failure on enable
Date: Thu, 18 Jun 2026 17:06:51 +0800 [thread overview]
Message-ID: <20260618090653.8983-1-cp0613@linux.alibaba.com> (raw)
When a DAX / ndctl driver is builtin (not a loadable module),
daxctl_insert_kmod_for_mode() and __util_bind() still call
kmod_module_probe_insert_module() unconditionally. libkmod only
short-circuits builtin modules when it can find the modules.builtin
index; otherwise it falls through to init_module() and returns -ENOENT,
surfacing as a spurious "insert failure".
Pre-check kmod_module_get_initstate() and skip probe-insert when the
module is already BUILTIN or LIVE, matching the pattern used by ndctl's
own test/core.c.
Changes since v2 [3]:
- Patch 2/2: Add a Reviewed-by tag.
Changes since v1 [1]:
- Patch 1/2: unchanged; collected Reviewed-by from Dave and Alison.
- Patch 2/2: factored the state check into a new helper
util_kmod_skip_probe_insert() in util/sysfs.{c,h} so both
daxctl_insert_kmod_for_mode() and __util_bind() share it. The
helper also returns the observed libkmod state via an out
parameter so the caller does not re-read /sys/module/<name>/
initstate to distinguish LIVE from BUILTIN.
- Patch 2/2: additionally treat KMOD_MODULE_COMING as builtin when
/sys/module/<name>/ exists but the initstate file does not. This
is the pattern libkmod's sysfs fallback emits for builtin drivers
when the modules.builtin index is missing (e.g. a kernel installed
without running modules_install). This was the case Jonathan hit
on a builtin DAX VM setup; rather than rely on a libkmod fix, ndctl
handles the corner case directly. Suggested by Alison [2].
[1]: https://lore.kernel.org/nvdimm/20260514063234.86439-1-cp0613@linux.alibaba.com/
[2]: https://lore.kernel.org/nvdimm/agtf5uwBJOaCDR6l@aschofie-mobl2.lan/
[3]: https://lore.kernel.org/nvdimm/20260526132251.254476-1-cp0613@linux.alibaba.com/
Chen Pei (2):
daxctl: fix kmod reference leak on probe-insert failure
daxctl, util/sysfs: skip module probe-insert when driver is builtin or
live
daxctl/lib/libdaxctl.c | 23 ++++++++++++++++++++--
util/sysfs.c | 44 +++++++++++++++++++++++++++++++++++++++++-
util/sysfs.h | 16 +++++++++++++++
3 files changed, 80 insertions(+), 3 deletions(-)
--
2.43.0
next reply other threads:[~2026-06-18 9:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-18 9:06 Chen Pei [this message]
2026-06-18 9:06 ` [ndctl PATCH v3 1/2] daxctl: fix kmod reference leak on probe-insert failure Chen Pei
2026-06-18 9:06 ` [ndctl PATCH v3 2/2] daxctl, util/sysfs: skip module probe-insert when driver is builtin or live Chen Pei
2026-07-09 23:03 ` Jonathan Cameron
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=20260618090653.8983-1-cp0613@linux.alibaba.com \
--to=cp0613@linux.alibaba.com \
--cc=alison.schofield@intel.com \
--cc=dave.jiang@intel.com \
--cc=guoren@kernel.org \
--cc=jic23@kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
/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