[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aWV5D_9DoiynqViB@gourry-fedora-PF4VCD3F>
Date: Mon, 12 Jan 2026 17:43:27 -0500
From: Gregory Price <gourry@...rry.net>
To: "David Hildenbrand (Red Hat)" <david@...nel.org>
Cc: linux-cxl@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-team@...a.com, dave@...olabs.net,
jonathan.cameron@...wei.com, dave.jiang@...el.com,
alison.schofield@...el.com, vishal.l.verma@...el.com,
ira.weiny@...el.com, dan.j.williams@...el.com
Subject: Re: [PATCH 2/6] cxl: add sysram_region memory controller
On Mon, Jan 12, 2026 at 09:00:54PM +0100, David Hildenbrand (Red Hat) wrote:
> On 1/12/26 17:35, Gregory Price wrote:
> > Add a sysram memctrl that directly hotplugs memory without needing to
> > route through DAX. This simplifies the sysram usecase considerably.
> >
> > The sysram memctl adds new sysfs controls when registered:
> > region/memctrl/[hotplug, hotunplug, state]
> >
> > hotplug: controller attempts to hotplug the memory region
>
> Why disconnect the hotplug from the online state?
>
> echo online_movable > hotplug ?
>
> Then we can just have something like add_and_online_memory() in the core.
>
mostly i cobbled this together over the weekend to have it for
discussion at the community DAX meeting.
I think just having
[offline,online,online_movable] > hotplug
is probably the better option. There's not much use in a memory_region
control that lets you offline the memory but not remove the blocks.
I mean, I know of *a* use for that, and it's not something we want to
support :]
> > hotunplug: controller attempts to offline and hotunplug the memory region
> > state: [online,online_normal,offline]
> > online : controller onlines blocks in ZONE_MOVABLE
>
> I don't like this incosistency regarding the remainder of common hotplug
> toggles.
>
> We should use exactly the same values with exactly the same semantics. Yes,
> user-space tooling should be thaught to pass in online_movable :)
>
> > online_normal: controller onlines blocks in ZONE_NORMAL
> > offline : controller attempts to offline the memory blocks
>
> Why is that required? ideally we'd start with hotplug vs. hotunplug and
> leave manual onlining/offlining out of this interface for now.
>
That is fair, although i would like a build option to default the online
mode to ZONE_MOVABLE for auto-configured sysram regions w/ the SP bit
set, otherwise that will be forever locked to using the DAX model.
> > + } else if (sysfs_streq(buf, "offline")) {
> > + int offline_rc = 0;
> > +
> > + rc = walk_memory_blocks(range.start, range_len(&range),
> > + &offline_rc, offline_memory_block_cb);
> > + if (!rc)
> > + rc = offline_rc;
>
> Let's expose this functionality through some common-code helpers. I really
> don't want more code doing this non-obvious device_offline() etc dance.
>
> walk_memory_blocks() should become a core-mm helper. Maybe we can also
> cleanup drivers/acpi/acpi_memhotplug.c in that regard.
>
> Hopefully we can then also reuse these helpers in ppc code (see
> dlpar_add_lmb() and dlpar_remove_lmb() that do something similar, but grab
> the device hotplug lock themselves as they want to perform some additional
> operations).
>
I'll take a look.
Thanks!
~Gregory
Powered by blists - more mailing lists