Linux CXL
 help / color / mirror / Atom feed
* [PATCH 0/6] daxctl: use dax kmem atomic whole-device hotplug
@ 2026-10-16 21:42 Gregory Price (Meta)
  2026-10-16 21:42 ` [PATCH 1/6] libdaxctl: add dax kmem atomic hotplug state accessors Gregory Price (Meta)
                   ` (6 more replies)
  0 siblings, 7 replies; 23+ messages in thread
From: Gregory Price (Meta) @ 2026-10-16 21:42 UTC (permalink / raw)
  To: nvdimm, linux-cxl; +Cc: alison.schofield

Kernels with the dax_kmem daxX.Y/state attribute [1] can unplug or
plug-and-online a whole device atomically. Use it in daxctl
online-memory and offline-memory so other agents (udev, auto-online)
can't race daxctl block by block, notably the offline-then-unbind race
on teardown.

Kernels without the attribute keep the per-block path.

Behavior change: offline-memory now always unplugs the device (state
'unplugged'), removing its memory blocks, even if they were all
offline already. Previously that was a no-op.

'daxctl list' (and 'ndctl/cxl list -X') gains 'hotplug_state',
reporting daxX.Y/state. The kernel only updates that when written, so
it goes stale if blocks are toggled individually.

If there is a mismatch between 'dax/state' and the blocks, then
'hotplug_state' reports 'inconsistent' (online state / zones disagree).
That is intentional: it flags agents fighting over the device.
It only appears when the attribute exists.

Compatibility notes:
- Where the unplug fails (e.g. no memory hotremove support),
  online-memory falls back to the per-block path and offline-memory
  of an already offline device remains a no-op.
- Older daxctl/ndctl/cxl binaries don't expect a device with no memory
  blocks.  Basically multiple daxctl versions on the same box can cause
  older versions to fail when in the unplugged state.  Not a huge issue.
- If re-adding fails after an unplug (e.g. region can't be reserved)
  the device is left unplugged.
- For multi-range devices the kernel succeeds if any range is added.
  daxctl can't tell that a range is missing.

[1] https://lore.kernel.org/all/20260712154505.3564379-1-gourry@gourry.net/

Gregory Price (6):
  libdaxctl: add dax kmem atomic hotplug state accessors
  daxctl: online whole-device memory atomically when available
  daxctl: offline whole-device memory via atomic unplug when available
  daxctl: report whole-device hotplug state in 'daxctl list'
  Documentation: describe atomic whole-device hotplug in daxctl man
    pages
  test/daxctl-devices.sh: cycle offline/online to cover unplug and
    replug

 Documentation/daxctl/daxctl-list.txt          |   5 +
 .../daxctl/daxctl-offline-memory.txt          |   5 +
 Documentation/daxctl/daxctl-online-memory.txt |   5 +
 .../daxctl/daxctl-reconfigure-device.txt      |   5 +-
 daxctl/device.c                               | 156 +++++++++++++++++-
 daxctl/json.c                                 |  53 +++++-
 daxctl/lib/libdaxctl-private.h                |   9 +
 daxctl/lib/libdaxctl.c                        |  71 +++++++-
 daxctl/lib/libdaxctl.sym                      |   6 +
 daxctl/libdaxctl.h                            |  18 ++
 test/daxctl-devices.sh                        |  53 ++++++
 11 files changed, 379 insertions(+), 7 deletions(-)

-- 
2.53.0-Meta


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2026-10-29 21:38 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-16 21:42 [PATCH 0/6] daxctl: use dax kmem atomic whole-device hotplug Gregory Price (Meta)
2026-10-16 21:42 ` [PATCH 1/6] libdaxctl: add dax kmem atomic hotplug state accessors Gregory Price (Meta)
2026-10-22  2:01   ` Alison Schofield
2026-10-16 21:42 ` [PATCH 2/6] daxctl: online whole-device memory atomically when available Gregory Price (Meta)
2026-10-22  2:12   ` Alison Schofield
2026-10-22 16:40     ` Gregory Price (Meta)
2026-10-16 21:42 ` [PATCH 3/6] daxctl: offline whole-device memory via atomic unplug " Gregory Price (Meta)
2026-10-22  2:20   ` Alison Schofield
2026-10-22 16:46     ` Gregory Price (Meta)
2026-10-22 22:00       ` Alison Schofield
2026-10-23  1:48         ` Gregory Price (Meta)
2026-10-23  1:56           ` Gregory Price (Meta)
2026-10-16 21:42 ` [PATCH 4/6] daxctl: report whole-device hotplug state in 'daxctl list' Gregory Price (Meta)
2026-10-22  2:21   ` Alison Schofield
2026-10-16 21:42 ` [PATCH 5/6] Documentation: describe atomic whole-device hotplug in daxctl man pages Gregory Price (Meta)
2026-10-22  2:23   ` Alison Schofield
2026-10-22 16:47     ` Gregory Price (Meta)
2026-10-16 21:42 ` [PATCH 6/6] test/daxctl-devices.sh: cycle offline/online to cover unplug and replug Gregory Price (Meta)
2026-10-22  2:34   ` Alison Schofield
2026-10-22 16:49     ` Gregory Price (Meta)
2026-10-29 21:38       ` Alison Schofield
2026-10-22  1:59 ` [PATCH 0/6] daxctl: use dax kmem atomic whole-device hotplug Alison Schofield
2026-10-22 16:30   ` Gregory Price (Meta)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox