[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d19e60d7-8abb-4e46-8935-bc989b1d5d68@redhat.com>
Date: Tue, 11 Feb 2025 14:27:39 +0100
From: David Hildenbrand <david@...hat.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Tony Luck <tony.luck@...el.com>
Cc: Robert Moore <robert.moore@...el.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>, Len Brown
<lenb@...nel.org>, linux-acpi@...r.kernel.org, acpica-devel@...ts.linux.dev,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
Oscar Salvador <osalvador@...e.de>, Danilo Krummrich <dakr@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] ACPI/MRRM: Add "node" symlink to
/sys/devices/system/memory/rangeX
On 11.02.25 07:51, Greg Kroah-Hartman wrote:
> On Mon, Feb 10, 2025 at 01:12:22PM -0800, Tony Luck wrote:
>> Users will likely want to know which node owns each memory range
>> and which CPUs are local to the range.
>>
>> Add a symlink to the node directory to provide both pieces of information.
>>
>> Signed-off-by: Tony Luck <tony.luck@...el.com>
>> ---
>> drivers/acpi/acpi_mrrm.c | 29 +++++++++++++++++++++++++++++
>> 1 file changed, 29 insertions(+)
>>
>> diff --git a/drivers/acpi/acpi_mrrm.c b/drivers/acpi/acpi_mrrm.c
>> index 51ed9064e025..28b484943bbd 100644
>> --- a/drivers/acpi/acpi_mrrm.c
>> +++ b/drivers/acpi/acpi_mrrm.c
>> @@ -119,6 +119,31 @@ static struct attribute *memory_range_attrs[] = {
>>
>> ATTRIBUTE_GROUPS(memory_range);
>>
>> +static __init int add_node_link(struct mrrm_mem_range_entry *entry)
>> +{
>> + struct node *node = NULL;
>> + int ret = 0;
>> + int nid;
>> +
>> + for_each_online_node(nid) {
>> + for (int z = 0; z < MAX_NR_ZONES; z++) {
>> + struct zone *zone = NODE_DATA(nid)->node_zones + z;
>> +
>> + if (!populated_zone(zone))
>> + continue;
>> + if (zone_intersects(zone, PHYS_PFN(entry->base), PHYS_PFN(entry->length))) {
>> + node = node_devices[zone->node];
>> + goto found;
>> + }
>> + }
>> + }
>> +found:
>> + if (node)
>> + ret = sysfs_create_link(&entry->dev.kobj, &node->dev.kobj, "node");
>
> What is going to remove this symlink if the memory goes away? Or do
> these never get removed?
>
> symlinks in sysfs created like this always worry me. What is going to
> use it?
On top of that, we seem to be building a separate hierarchy here.
/sys/devices/system/memory/ operates in memory block granularity.
/sys/devices/system/node/nodeX/ links to memory blocks that belong to it.
Why is the memory-block granularity insufficient, and why do we have to
squeeze in another range API here?
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists