Skip to content

libdaxctl: Fix multi-range memory block handling

Alison Schofield linux-cxl nvdimm 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 2 repliesIn review
  2. v14 patches 9 repliesSuperseded

Changes in v2 from the cover letter

- Patch 3: Reset errno before each readdir() (GregoryP)
- Link to v1: https://lore.kernel.org/nvdimm/[email protected]/

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4libdaxctl: handle mapping initialization failuresdaxctl/lib/libdaxctl.c+58 -120 replies
2/4libdaxctl: tie mapping cache lifetime to the devicedaxctl/lib/libdaxctl.c+6 -20 replies
3/4libdaxctl: match memory blocks against each dax device mappingdaxctl/lib/libdaxctl.c+15 -51 reply
4/4test/daxctl-create.sh: count memory blocks across dax mappingstest/daxctl-create.sh+58 -00 replies

Reviews trailers per patch

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

PatchGregory Price (Meta)
1/4R-b T-b
2/4R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [ndctl PATCH v2 0/4] libdaxctl: Fix multi-range memory block handling

Changes in v2:
- Patch 3: Reset errno before each readdir() (GregoryP)
- Link to v1: https://lore.kernel.org/nvdimm/[email protected]/

Review and testing of Gregory's dax kmem atomic whole-device hotplug series[1] exposed an existing libdaxctl bug when handling DAX devices with multiple physical address ranges.

libdaxctl identifies a device's memory blocks using a single contiguous address window, even when the device has separate ranges with gaps between them. This can exclude blocks belonging to the device and include blocks belonging to another device in the gaps. As a result, daxctl can report incorrect memory block counts and potentially online or offline another device's memory.

Patches 1-2 address mapping reliability issues discovered while fixing the memory block ownership checks.

Patch 3 corrects the memory block ownership checks.

Patch 4 adds regression coverage using a two-range DAX device.

[1] https://lore.kernel.org/linux-cxl/[email protected]/

Alison Schofield (4):
libdaxctl: handle mapping initialization failures
libdaxctl: tie mapping cache lifetime to the device
libdaxctl: match memory blocks against each dax device mapping test/daxctl-create.sh: count memory blocks across dax mappings

 daxctl/lib/libdaxctl.c | 98 ++++++++++++++++++++++++++++++++++--------
 test/daxctl-create.sh  | 58 +++++++++++++++++++++++++
 2 files changed, 137 insertions(+), 19 deletions(-)
Signature · 1 line
2.37.3