All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] memblock: check memory total_size
@ 2021-09-28 10:50 Peng Fan (OSS)
  2021-09-28 16:37 ` Mike Rapoport
  0 siblings, 1 reply; 2+ messages in thread
From: Peng Fan (OSS) @ 2021-09-28 10:50 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 NXP i.MX ARM64 platform, there is 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 also needs to be
taked into consideration, 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>
---
 mm/memblock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index 184dcd2e5d99..ab67b82a9cce 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->cnt <= 1 && !memblock_memory->total_size) {
 		pr_warn("%s: No memory registered yet\n", __func__);
 		return;
 	}
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] memblock: check memory total_size
  2021-09-28 10:50 [PATCH] memblock: check memory total_size Peng Fan (OSS)
@ 2021-09-28 16:37 ` Mike Rapoport
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Rapoport @ 2021-09-28 16:37 UTC (permalink / raw)
  To: Peng Fan (OSS)
  Cc: akpm, david, geert+renesas, linux-mm, linux-kernel, Peng Fan

Hi,

On Tue, Sep 28, 2021 at 06:50:57PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> mem=[X][G|M] is broken on NXP i.MX ARM64 platform, there is 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 also needs to be
> taked into consideration, othersize bootargs 'mem=[X][G|B]' not work
> anymore.

I believe this is issue is not specific to i.MX but rather this could
happen on any arm64 platform. Can you please update the changelog?
 
> 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>
> ---
>  mm/memblock.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/memblock.c b/mm/memblock.c
> index 184dcd2e5d99..ab67b82a9cce 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->cnt <= 1 && !memblock_memory->total_size) {

The test for non-zero total size shold be sufficient here.

>  		pr_warn("%s: No memory registered yet\n", __func__);
>  		return;
>  	}
> -- 
> 2.30.0
> 

-- 
Sincerely yours,
Mike.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-28 16:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-28 10:50 [PATCH] memblock: check memory total_size Peng Fan (OSS)
2021-09-28 16:37 ` Mike Rapoport

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.