Skip to content

Commit ddfc146

Browse files
committed
Merge tag 'fixes-2024-12-06' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock
Pull memblock fixes from Mike Rapoport: "Restore check for node validity in arch_numa. The rework of NUMA initialization in arch_numa dropped a check that refused to accept configurations with invalid node IDs. Restore that check to ensure that when firmware passes invalid nodes, such configuration is rejected and kernel gracefully falls back to dummy NUMA" * tag 'fixes-2024-12-06' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock: arch_numa: Restore nid checks before registering a memblock with a node memblock: allow zero threshold in validate_numa_converage()
2 parents c7cde62 + 180bbad commit ddfc146

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

drivers/base/arch_numa.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ static int __init numa_register_nodes(void)
208208
{
209209
int nid;
210210

211+
/* Check the validity of the memblock/node mapping */
212+
if (!memblock_validate_numa_coverage(0))
213+
return -EINVAL;
214+
211215
/* Finally register nodes. */
212216
for_each_node_mask(nid, numa_nodes_parsed) {
213217
unsigned long start_pfn, end_pfn;

mm/memblock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ int __init_memblock memblock_add(phys_addr_t base, phys_addr_t size)
735735
/**
736736
* memblock_validate_numa_coverage - check if amount of memory with
737737
* no node ID assigned is less than a threshold
738-
* @threshold_bytes: maximal number of pages that can have unassigned node
738+
* @threshold_bytes: maximal memory size that can have unassigned node
739739
* ID (in bytes).
740740
*
741741
* A buggy firmware may report memory that does not belong to any node.
@@ -755,7 +755,7 @@ bool __init_memblock memblock_validate_numa_coverage(unsigned long threshold_byt
755755
nr_pages += end_pfn - start_pfn;
756756
}
757757

758-
if ((nr_pages << PAGE_SHIFT) >= threshold_bytes) {
758+
if ((nr_pages << PAGE_SHIFT) > threshold_bytes) {
759759
mem_size_mb = memblock_phys_mem_size() >> 20;
760760
pr_err("NUMA: no nodes coverage for %luMB of %luMB RAM\n",
761761
(nr_pages << PAGE_SHIFT) >> 20, mem_size_mb);

0 commit comments

Comments
 (0)