[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260127133141.5f7aa3cd01f4eee4055f075f@linux-foundation.org>
Date: Tue, 27 Jan 2026 13:31:41 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Gregory Price <gourry@...rry.net>
Cc: linux-mm@...ck.org, linux-cxl@...r.kernel.org, nvdimm@...ts.linux.dev,
linux-kernel@...r.kernel.org, virtualization@...ts.linux.dev,
kernel-team@...a.com, dan.j.williams@...el.com, vishal.l.verma@...el.com,
dave.jiang@...el.com, david@...nel.org, mst@...hat.com,
jasowang@...hat.com, xuanzhuo@...ux.alibaba.com, eperezma@...hat.com,
osalvador@...e.de, Hannes Reinecke <hare@...e.de>
Subject: Re: [PATCH v2 4/5] dax/kmem: add sysfs interface for runtime
hotplug state control
On Wed, 14 Jan 2026 18:50:20 -0500 Gregory Price <gourry@...rry.net> wrote:
> The dax kmem driver currently onlines memory automatically during
> probe using the system's default online policy but provides no way
> to control or query the entire region state at runtime.
>
> There is no atomic to offline and remove memory blocks together.
>
> Add a new 'hotplug' sysfs attribute that allows userspace to control
> and query the entire memory region state.
>
> The interface supports the following states:
> - "unplug": memory is offline and blocks are not present
> - "online": memory is online as normal system RAM
> - "online_movable": memory is online in ZONE_MOVABLE
>
> Valid transitions:
> - unplugged -> online
> - unplugged -> online_movable
> - online -> unplugged
> - online_movable -> unplugged
>
> "offline" (memory blocks exist but are offline by default) is not
> supported because it's functionally equivalent to "unplugged" and
> entices races between offlining and unplugging.
>
> The initial state after probe uses mhp_get_default_online_type() to
> preserve backwards compatibility - existing systems with auto-online
> policies will continue to work as before.
>
> As with any hot-remove mechanism, the removal can fail and if rollback
> fails the system can be left in an inconsistent state.
>
> Unbind Note:
> We used to call remove_memory() during unbind, which would fire a
> BUG() if any of the memory blocks were online at that time. We lift
> this into a WARN in the cleanup routine and don't attempt hotremove
> if ->state is not DAX_KMEM_UNPLUGGED.
>
> The resources are still leaked but this prevents deadlock on unbind
> if a memory region happens to be impossible to hotremove.
>
> ...
>
> --- a/Documentation/ABI/testing/sysfs-bus-dax
> +++ b/Documentation/ABI/testing/sysfs-bus-dax
> @@ -151,3 +151,20 @@ Description:
> memmap_on_memory parameter for memory_hotplug. This is
> typically set on the kernel command line -
> memory_hotplug.memmap_on_memory set to 'true' or 'force'."
> +
> +What: /sys/bus/dax/devices/daxX.Y/hotplug
> +Date: January, 2026
> +KernelVersion: v6.21
> +Contact: nvdimm@...ts.linux.dev
> +Description:
> + (RW) Controls what hotplug state of the memory region.
s/what// ?
Maybe "Controls hotplug state of a dax memory region".
> + Applies to all memory blocks associated with the device.
> + Only applies to dax_kmem devices.
> +
> + States: [unplugged, online, online_movable]
> + Arguments:
> + "unplug": memory is offline and blocks are not present
> + "online": memory is online as normal system RAM
> + "online_movable": memory is online in ZONE_MOVABLE
> +
This is perhaps a little brief? Is there more we can tell users about
what this is and how it behaves and why they might want to use it?
Powered by blists - more mailing lists