linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/mm: fix early initialization failure for MMUs with no hash table
@ 2021-11-27  2:04 Vladimir Oltean
  2021-11-27 12:00 ` Christophe Leroy
  2021-11-27 15:48 ` Vladimir Oltean
  0 siblings, 2 replies; 3+ messages in thread
From: Vladimir Oltean @ 2021-11-27  2:04 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev; +Cc: stable, Paul Mackerras, linux-kernel

The blamed patch attempted to do a trivial conversion of
map_mem_in_cams() by adding an extra "bool init" argument, but by
mistake, changed the way in which two call sites pass the other boolean
argument, "bool dry_run".

As a result, early_init_this_mmu() now calls map_mem_in_cams() with
dry_run=true, and setup_initial_memory_limit() calls with dry_run=false,
both of which are unintended changes.

This makes the kernel boot process hang here:

[    0.045211] e500 family performance monitor hardware support registered
[    0.051891] rcu: Hierarchical SRCU implementation.
[    0.057791] smp: Bringing up secondary CPUs ...

Issue noticed on a Freescale T1040.

Fixes: 52bda69ae8b5 ("powerpc/fsl_booke: Tell map_mem_in_cams() if init is done")
Cc: stable@vger.kernel.org
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 arch/powerpc/mm/nohash/tlb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/mm/nohash/tlb.c b/arch/powerpc/mm/nohash/tlb.c
index 89353d4f5604..647bf454a0fa 100644
--- a/arch/powerpc/mm/nohash/tlb.c
+++ b/arch/powerpc/mm/nohash/tlb.c
@@ -645,7 +645,7 @@ static void early_init_this_mmu(void)
 
 		if (map)
 			linear_map_top = map_mem_in_cams(linear_map_top,
-							 num_cams, true, true);
+							 num_cams, false, true);
 	}
 #endif
 
@@ -766,7 +766,7 @@ void setup_initial_memory_limit(phys_addr_t first_memblock_base,
 		num_cams = (mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY) / 4;
 
 		linear_sz = map_mem_in_cams(first_memblock_size, num_cams,
-					    false, true);
+					    true, true);
 
 		ppc64_rma_size = min_t(u64, linear_sz, 0x40000000);
 	} else
-- 
2.25.1


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

* Re: [PATCH] powerpc/mm: fix early initialization failure for MMUs with no hash table
  2021-11-27  2:04 [PATCH] powerpc/mm: fix early initialization failure for MMUs with no hash table Vladimir Oltean
@ 2021-11-27 12:00 ` Christophe Leroy
  2021-11-27 15:48 ` Vladimir Oltean
  1 sibling, 0 replies; 3+ messages in thread
From: Christophe Leroy @ 2021-11-27 12:00 UTC (permalink / raw)
  To: Vladimir Oltean, Michael Ellerman, linuxppc-dev
  Cc: Paul Mackerras, linux-kernel, stable



Le 27/11/2021 à 03:04, Vladimir Oltean a écrit :
> The blamed patch attempted to do a trivial conversion of
> map_mem_in_cams() by adding an extra "bool init" argument, but by
> mistake, changed the way in which two call sites pass the other boolean
> argument, "bool dry_run".
> 
> As a result, early_init_this_mmu() now calls map_mem_in_cams() with
> dry_run=true, and setup_initial_memory_limit() calls with dry_run=false,
> both of which are unintended changes.
> 
> This makes the kernel boot process hang here:
> 
> [    0.045211] e500 family performance monitor hardware support registered
> [    0.051891] rcu: Hierarchical SRCU implementation.
> [    0.057791] smp: Bringing up secondary CPUs ...
> 
> Issue noticed on a Freescale T1040.
> 
> Fixes: 52bda69ae8b5 ("powerpc/fsl_booke: Tell map_mem_in_cams() if init is done")
> Cc: stable@vger.kernel.org
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Thanks for you patch.

However, it should already be fixed in 5.16-rc2 with the following 
commit : 
https://github.com/torvalds/linux/commit/5b54860943dc4681be5de2fc287408c7ce274dfc

Christophe

> ---
>   arch/powerpc/mm/nohash/tlb.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/mm/nohash/tlb.c b/arch/powerpc/mm/nohash/tlb.c
> index 89353d4f5604..647bf454a0fa 100644
> --- a/arch/powerpc/mm/nohash/tlb.c
> +++ b/arch/powerpc/mm/nohash/tlb.c
> @@ -645,7 +645,7 @@ static void early_init_this_mmu(void)
>   
>   		if (map)
>   			linear_map_top = map_mem_in_cams(linear_map_top,
> -							 num_cams, true, true);
> +							 num_cams, false, true);
>   	}
>   #endif
>   
> @@ -766,7 +766,7 @@ void setup_initial_memory_limit(phys_addr_t first_memblock_base,
>   		num_cams = (mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY) / 4;
>   
>   		linear_sz = map_mem_in_cams(first_memblock_size, num_cams,
> -					    false, true);
> +					    true, true);
>   
>   		ppc64_rma_size = min_t(u64, linear_sz, 0x40000000);
>   	} else
> 

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

* Re: [PATCH] powerpc/mm: fix early initialization failure for MMUs with no hash table
  2021-11-27  2:04 [PATCH] powerpc/mm: fix early initialization failure for MMUs with no hash table Vladimir Oltean
  2021-11-27 12:00 ` Christophe Leroy
@ 2021-11-27 15:48 ` Vladimir Oltean
  1 sibling, 0 replies; 3+ messages in thread
From: Vladimir Oltean @ 2021-11-27 15:48 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev; +Cc: stable, Paul Mackerras, linux-kernel

On Sat, Nov 27, 2021 at 04:04:48AM +0200, Vladimir Oltean wrote:
> The blamed patch attempted to do a trivial conversion of
> map_mem_in_cams() by adding an extra "bool init" argument, but by
> mistake, changed the way in which two call sites pass the other boolean
> argument, "bool dry_run".
> 
> As a result, early_init_this_mmu() now calls map_mem_in_cams() with
> dry_run=true, and setup_initial_memory_limit() calls with dry_run=false,
> both of which are unintended changes.
> 
> This makes the kernel boot process hang here:
> 
> [    0.045211] e500 family performance monitor hardware support registered
> [    0.051891] rcu: Hierarchical SRCU implementation.
> [    0.057791] smp: Bringing up secondary CPUs ...
> 
> Issue noticed on a Freescale T1040.
> 
> Fixes: 52bda69ae8b5 ("powerpc/fsl_booke: Tell map_mem_in_cams() if init is done")
> Cc: stable@vger.kernel.org
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
>  arch/powerpc/mm/nohash/tlb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/mm/nohash/tlb.c b/arch/powerpc/mm/nohash/tlb.c
> index 89353d4f5604..647bf454a0fa 100644
> --- a/arch/powerpc/mm/nohash/tlb.c
> +++ b/arch/powerpc/mm/nohash/tlb.c
> @@ -645,7 +645,7 @@ static void early_init_this_mmu(void)
>  
>  		if (map)
>  			linear_map_top = map_mem_in_cams(linear_map_top,
> -							 num_cams, true, true);
> +							 num_cams, false, true);
>  	}
>  #endif
>  
> @@ -766,7 +766,7 @@ void setup_initial_memory_limit(phys_addr_t first_memblock_base,
>  		num_cams = (mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY) / 4;
>  
>  		linear_sz = map_mem_in_cams(first_memblock_size, num_cams,
> -					    false, true);
> +					    true, true);
>  
>  		ppc64_rma_size = min_t(u64, linear_sz, 0x40000000);
>  	} else
> -- 
> 2.25.1
>

This is a duplicate of commit 5b54860943dc ("powerpc/book3e: Fix TLBCAM preset at boot"),
looks like I'm late to the party. That commit unbricks my board, so
please drop this patch.

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

end of thread, other threads:[~2021-11-27 19:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-27  2:04 [PATCH] powerpc/mm: fix early initialization failure for MMUs with no hash table Vladimir Oltean
2021-11-27 12:00 ` Christophe Leroy
2021-11-27 15:48 ` Vladimir Oltean

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).