From: Andrew Morton <akpm@linux-foundation.org>
To: Gregory Price <gourry@gourry.net>
Cc: linux-mm@kvack.org, linux-cxl@vger.kernel.org,
nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org,
virtualization@lists.linux.dev, kernel-team@meta.com,
dan.j.williams@intel.com, vishal.l.verma@intel.com,
dave.jiang@intel.com, david@kernel.org, mst@redhat.com,
jasowang@redhat.com, xuanzhuo@linux.alibaba.com,
eperezma@redhat.com, osalvador@suse.de,
Hannes Reinecke <hare@suse.de>
Subject: Re: [PATCH v2 4/5] dax/kmem: add sysfs interface for runtime hotplug state control
Date: Tue, 27 Jan 2026 13:31:41 -0800 [thread overview]
Message-ID: <20260127133141.5f7aa3cd01f4eee4055f075f@linux-foundation.org> (raw)
In-Reply-To: <20260114235022.3437787-5-gourry@gourry.net>
On Wed, 14 Jan 2026 18:50:20 -0500 Gregory Price <gourry@gourry.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@lists.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?
next prev parent reply other threads:[~2026-01-27 21:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-14 23:50 [PATCH v2 0/5] add " Gregory Price
2026-01-14 23:50 ` [PATCH v2 1/5] mm/memory_hotplug: pass online_type to online_memory_block() via arg Gregory Price
2026-01-14 23:50 ` [PATCH v2 2/5] mm/memory_hotplug: add 'online_type' argument to add_memory_driver_managed Gregory Price
2026-01-14 23:50 ` [PATCH v2 3/5] dax/kmem: extract hotplug/hotremove helper functions Gregory Price
2026-01-14 23:50 ` [PATCH v2 4/5] dax/kmem: add sysfs interface for runtime hotplug state control Gregory Price
2026-01-27 21:31 ` Andrew Morton [this message]
2026-01-14 23:50 ` [PATCH v2 5/5] dax/kmem: add memory notifier to block external state changes Gregory Price
2026-01-15 2:42 ` [PATCH] dax/kmem: add build config for protected dax memory blocks Gregory Price
2026-01-27 21:34 ` Andrew Morton
2026-01-27 21:42 ` Gregory Price
2026-01-15 17:26 ` [PATCH v2 0/5] add runtime hotplug state control David Hildenbrand (Red Hat)
2026-01-15 17:42 ` Gregory Price
2026-01-15 17:46 ` David Hildenbrand (Red Hat)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260127133141.5f7aa3cd01f4eee4055f075f@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=david@kernel.org \
--cc=eperezma@redhat.com \
--cc=gourry@gourry.net \
--cc=hare@suse.de \
--cc=jasowang@redhat.com \
--cc=kernel-team@meta.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mst@redhat.com \
--cc=nvdimm@lists.linux.dev \
--cc=osalvador@suse.de \
--cc=virtualization@lists.linux.dev \
--cc=vishal.l.verma@intel.com \
--cc=xuanzhuo@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox