On 2026-10-21 19:12 -0700, Alison Schofield wrote:
> On Fri, Oct 16, 2026 at 05:42:44PM -0400, Gregory Price (Meta) wrote:
> > From: Gregory Price <[email protected]>
> > + if (param.no_movable)
> > + target = DAXCTL_KMEM_ONLINE;
> > + else
> > + target = DAXCTL_KMEM_ONLINE_MOVABLE;
> > +
>
> Hi Greg,
>
> A couple of things here...
>
> The atomic --no-movable path uses DAXCTL_KMEM_ONLINE, leaving zone selection
> to the kernel. With memory_hotplug.online_policy=auto-movable, IIUC this could
> place memory in ZONE_MOVABLE despite --no-movable.
>
> The per-block path checks the resulting zone and fails if it isn't
> ZONE_NORMAL,
> but the atomic path skips that check.
>
> Should this use DAXCTL_KMEM_ONLINE_KERNEL instead, or retain
> DAXCTL_KMEM_ONLINE
> and add the same zone check?
>
I think you are right, let me go test.
>
> > + if (state == DAXCTL_KMEM_OFFLINE) {
> > + /*
> > + * Onlining requires 'unplugged'. Don't unplug memory another
> > + * agent onlined meanwhile (a small window remains).
> > + */
>
> With this, a "reconfigure-device -m system-ram" may add the memory twice.
> First kmem adds it offline at probe and then daxctl unplugs it and adds it
> back online. If that re-add fails, the device is left unplugged rather than
> offline.
>
This was the intended behavior because otherwise a concurrent
block/state change would end up making the blocks unrecoverable.
> I get that falling back to per-block onlining would reopen the race this
> series is addressing. Could the kernel interface support transitioning
> directly from offline to an online state instead? It seems that would avoid
> both the extra hotplug work and the left-unplugged failure case.
>
This is an unfortunate wart for backward compatibility sake. It would
have been preferable to create the dax device without auto-hotplugging
the kmem region (hotplug but offline), but that would break userspace.
I can take another look whether i can get offline->online to work
internally, but this may still require the hotplug work you're concerned
about.
--
~Gregory