Re: [ndctl PATCH v3 0/2] daxctl, util/sysfs: fix builtin-driver false failure on enable
Alison Schofield <[email protected]> Tue, 21 Jul 2026 17:22:43 -0700
| Newsgroups | dev.linux.lists.nvdimm,org.kernel.vger.linux-cxl |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Jun 18, 2026 at 05:06:51PM +0800, Chen Pei wrote:
> 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/[email protected]/
> [2]: https://lore.kernel.org/nvdimm/[email protected]/
> [3]: https://lore.kernel.org/nvdimm/[email protected]/
>
> 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
Thanks!
Applied to pending for NDCTL v86
https://github.com/pmem/ndctl/commits/pending/