[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <988ca415-ea91-4509-8552-5b8829d9e8f0@amd.com>
Date: Tue, 13 Jan 2026 16:35:02 -0600
From: "Cheatham, Benjamin" <benjamin.cheatham@....com>
To: Gregory Price <gourry@...rry.net>
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>, David Hildenbrand <david@...nel.org>, "Hannes
Reinecke" <hare@...e.de>
Subject: Re: [PATCH 6/6] cxl/sysram: disallow onlining in ZONE_NORMAL if state
is movable only
On 1/12/2026 5:14 PM, Gregory Price wrote:
> On Mon, Jan 12, 2026 at 03:11:05PM -0600, Cheatham, Benjamin wrote:
>> On 1/12/2026 10:35 AM, Gregory Price wrote:
>>> If state is set to online (default to ZONE_MOVABLE), the user intends
>>> for this memory to either refuse non-movable allocations, and/or intends
>>> to preserve the hot-unpluggability of this memory. However, any admin
>>> can write `offline` and `online` to the memory block controller and
>>> bring that memory online in ZONE_NORMAL.
>>
>> Is it the expectation that the user will never want to change the zone from
>> MOVABLE to NORMAL? I can't think of a reason someone would want to off the top
>> of my head, but I also can't think of a reason to restrict it either.
>>
>
> It's more to restrict this pattern
>
> echo online_movable > region0/hotplug
> -> creates: node1/memory123/
>
> echo offline > node1/memory123/state
> echo online > node1/memory123/state
>
> The result of this would be valid_zones=[normal movable], which would
> break hot-unplug.
Ahh ok I think I get it now. I wasn't thinking about bypassing the memctrl/ interface
and using the memory block sysfs directly. Thanks for the explanation!
Thanks,
Ben
>
>>> If an actor attempts to online the block into ZONE_NORMAL, it will fail,
>>> but if it attempts to online into either NORMAL or MOVABLE, only MOVABLE
>>> will be allowed and it will succeed.
>>
>> I'm not sure you need this paragraph. I think it's a logical conclusion of the above
>> that if someone attempts to online the memory as NORMAL or MOVABLE it'll only be onlined
>> as MOVABLE.
>
> in the above situation the following occurs:
>
> echo online > region0/hotplug
> echo offline > node1/memory123/state
> echo online > node1/memory123/state
> cat node1/memory123/valid_zones
> normal movable
> echo offline > node1/memory123/state
> echo 1 > node1/memory123/online
> cat node1/memory123/valid_zones
> normal
>
>
> echo online_movable > region0/hotplug
> echo offline > node1/memory123/state
> echo online > node1/memory123/state
> cat node1/memory123/valid_zones
> movable
> echo offline > node1/memory123/state
> echo 1 > node1/memory123/online
> fail with EXXXX (i forget what code)
>
> It's a little confusing.
>
>>> + switch (data->last_online_type) {
>>> + case MMOP_ONLINE_MOVABLE:
>>> + return sysfs_emit(buf, "online\n");
>>> + case MMOP_ONLINE_KERNEL:
>>> + return sysfs_emit(buf, "online_normal\n");
>>> + case MMOP_OFFLINE:
>>> + default:
>>
>> You're missing the MMOP_ONLINE case. In that case the memory would be reported as "offline", which
>> I doubt is the intention.
>>
>
> Blah, i originally had all of them and just reduced to
> MMOP_ONLINE_MOVABLE and MMOP_ONLINE (i don't see a good use for
> MMOP_ONLINE_KERNEL), but i'll fix this up.
>
> Thanks!
> Gregory
Powered by blists - more mailing lists