Thread (7 messages) 7 messages, 3 authors, 2024-11-29

Re: [PATCH] arch_numa: Restore nid checks before registering a memblock with a node

From: Marc Zyngier <maz@kernel.org>
Date: 2024-11-28 16:52:19
Also in: lkml, stable

Hi Mike,

On Thu, 28 Nov 2024 07:03:33 +0000,
Mike Rapoport [off-list ref] wrote:
Hi Marc,
quoted
diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c
index e187016764265..5457248eb0811 100644
--- a/drivers/base/arch_numa.c
+++ b/drivers/base/arch_numa.c
@@ -207,7 +207,21 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
 static int __init numa_register_nodes(void)
 {
 	int nid;
-
+	struct memblock_region *mblk;
+
+	/* Check that valid nid is set to memblks */
+	for_each_mem_region(mblk) {
+		int mblk_nid = memblock_get_region_node(mblk);
+		phys_addr_t start = mblk->base;
+		phys_addr_t end = mblk->base + mblk->size - 1;
+
+		if (mblk_nid == NUMA_NO_NODE || mblk_nid >= MAX_NUMNODES) {
+			pr_warn("Warning: invalid memblk node %d [mem %pap-%pap]\n",
+				mblk_nid, &start, &end);
+			return -EINVAL;
+		}
We have memblock_validate_numa_coverage() that checks that amount of memory
with unset node id is less than a threshold. The loop here can be replaced
with something like

	if (!memblock_validate_numa_coverage(0))
		return -EINVAL;
Unfortunately, that doesn't seem to result in something that works
(relevant extract only):

[    0.000000] NUMA: no nodes coverage for 9MB of 65516MB RAM
[    0.000000] NUMA: Faking a node at [mem 0x0000000000500000-0x0000000fff0fffff]
[    0.000000] NUMA: no nodes coverage for 0MB of 65516MB RAM
[    0.000000] Unable to handle kernel paging request at virtual address 0000000000001d40

Any idea?

	M.

-- 
Without deviation from the norm, progress is not possible.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help