summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2021-09-02 12:26:31 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2021-09-02 12:26:31 -0700
commit612b23f27793ea1cf41621ca6dc552eb4699f41c (patch)
tree5fe0c187a717d051e03c1861cd996a82bf37b915 /mm
parent4a3bb4200a5958d76cc26ebe4db4257efa56812b (diff)
parente888fa7bb882a1f305526d8f49d7016a7bc5f5ca (diff)
Merge tag 'memblock-v5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock
Pull memblock updates from Mike Rapoport: "Robustness and debug improvements: - add check for memory add/cap ordering - add missing debug code to memblock_add_node()" * tag 'memblock-v5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock: memblock: Check memory add/cap ordering memblock: Add missing debug code to memblock_add_node()
Diffstat (limited to 'mm')
-rw-r--r--mm/memblock.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index de7b553baa50..e2ca8ddc8ebe 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -665,6 +665,11 @@ repeat:
int __init_memblock memblock_add_node(phys_addr_t base, phys_addr_t size,
int nid)
{
+ phys_addr_t end = base + size - 1;
+
+ memblock_dbg("%s: [%pa-%pa] nid=%d %pS\n", __func__,
+ &base, &end, nid, (void *)_RET_IP_);
+
return memblock_add_range(&memblock.memory, base, size, nid, 0);
}
@@ -1680,6 +1685,11 @@ void __init memblock_cap_memory_range(phys_addr_t base, phys_addr_t size)
if (!size)
return;
+ if (memblock.memory.cnt <= 1) {
+ pr_warn("%s: No memory registered yet\n", __func__);
+ return;
+ }
+
ret = memblock_isolate_range(&memblock.memory, base, size,
&start_rgn, &end_rgn);
if (ret)