Skip to content

daxctl, util/sysfs: fix builtin-driver false failure on enable

Chen Pei linux-cxl nvdimm 3 versions – Applied

Status from this message: Applied to pending for NDCTL v86

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 2 repliesApplied
  2. v22 patches 1 replySuperseded
  3. v12 patches 11 repliesSuperseded

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/2daxctl: fix kmod reference leak on probe-insert failuredaxctl/lib/libdaxctl.c+1 -00 replies
2/2daxctl, util/sysfs: skip module probe-insert when driver is builtin or livedaxctl/lib/libdaxctl.c util/sysfs.c util/sysfs.h+79 -31 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchDave JiangAlison SchofieldJonathan Cameron
1/2R-b R-b
2/2R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v3 thread

Cover letter [ndctl PATCH v3 0/2] daxctl, util/sysfs: fix builtin-driver false failure on enable

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

 daxctl/lib/libdaxctl.c | 23 ++++++++++++++++++++--
 util/sysfs.c           | 44 +++++++++++++++++++++++++++++++++++++++++-
 util/sysfs.h           | 16 +++++++++++++++
 3 files changed, 80 insertions(+), 3 deletions(-)
Signature · 1 line
2.43.0