linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] memblock: check memory total_size
@ 2021-09-30  2:44 Peng Fan (OSS)
  0 siblings, 0 replies; only message in thread
From: Peng Fan (OSS) @ 2021-09-30  2:44 UTC (permalink / raw)
  To: rppt, akpm, david, geert+renesas; +Cc: linux-mm, linux-kernel, Peng Fan

From: Peng Fan <peng.fan@nxp.com>

mem=[X][G|M] is broken on ARM64 platform, there are cases that
even type.cnt is 1, but total_size is not 0 because regions are merged
into 1. So only check 'cnt' is not enough, total_size should be used,
othersize bootargs 'mem=[X][G|B]' not work anymore.

Fixes: e888fa7bb882 ("memblock: Check memory add/cap ordering")
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: David Hildenbrand <david@redhat.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---

V2:
 Update commit log
 Only check total_size, no need check cnt

 mm/memblock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index 184dcd2e5d99..103b052c016e 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1687,7 +1687,7 @@ void __init memblock_cap_memory_range(phys_addr_t base, phys_addr_t size)
 	if (!size)
 		return;
 
-	if (memblock.memory.cnt <= 1) {
+	if (!memblock_memory->total_size) {
 		pr_warn("%s: No memory registered yet\n", __func__);
 		return;
 	}
-- 
2.30.0



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-30  2:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-30  2:44 [PATCH V2] memblock: check memory total_size Peng Fan (OSS)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox