linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/64e: Fix oops due to deferral of paca allocation
@ 2018-03-31 11:51 Michael Ellerman
  2018-03-31 14:04 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Ellerman @ 2018-03-31 11:51 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: npiggin

On 64-bit Book3E systems, in setup_tlb_core_data() we reference other
CPUs pacas. But in commit 59f577743d71 ("powerpc/64: Defer paca
allocation until memory topology is discovered") the allocation of
non-boot-CPU pacas was deferred until later in boot.

This leads to an oops:

  CPU maps initialized for 1 thread per core
  Unable to handle kernel paging request for data at address 0x8888888888888918
  Faulting instruction address: 0xc000000000e2f0d0
  Oops: Kernel access of bad area, sig: 11 [#1]
  NIP .setup_tlb_core_data+0xdc/0x160
  Call Trace:
    .setup_tlb_core_data+0x5c/0x160 (unreliable)
    .setup_arch+0x80/0x348
    .start_kernel+0x7c/0x598
    start_here_common+0x1c/0x40

Luckily setup_tlb_core_data() is called immediately prior to
smp_setup_pacas(). So simply switching their order is sufficient to
fix the oops and seems unlikely to have any other unwanted side
effects.

Fixes: 59f577743d71 ("powerpc/64: Defer paca allocation until memory topology is discovered")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/setup-common.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 56f7a2b793e0..0af5c11b9e78 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -915,9 +915,6 @@ void __init setup_arch(char **cmdline_p)
 	/* Parse memory topology */
 	mem_topology_setup();
 
-	/* On BookE, setup per-core TLB data structures. */
-	setup_tlb_core_data();
-
 	/*
 	 * Release secondary cpus out of their spinloops at 0x60 now that
 	 * we can map physical -> logical CPU ids.
@@ -927,6 +924,10 @@ void __init setup_arch(char **cmdline_p)
 	 */
 #ifdef CONFIG_SMP
 	smp_setup_pacas();
+
+	/* On BookE, setup per-core TLB data structures. */
+	setup_tlb_core_data();
+
 	smp_release_cpus();
 #endif
 
-- 
2.14.1

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

* Re: powerpc/64e: Fix oops due to deferral of paca allocation
  2018-03-31 11:51 [PATCH] powerpc/64e: Fix oops due to deferral of paca allocation Michael Ellerman
@ 2018-03-31 14:04 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2018-03-31 14:04 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev; +Cc: npiggin

On Sat, 2018-03-31 at 11:51:38 UTC, Michael Ellerman wrote:
> On 64-bit Book3E systems, in setup_tlb_core_data() we reference other
> CPUs pacas. But in commit 59f577743d71 ("powerpc/64: Defer paca
> allocation until memory topology is discovered") the allocation of
> non-boot-CPU pacas was deferred until later in boot.
> 
> This leads to an oops:
> 
>   CPU maps initialized for 1 thread per core
>   Unable to handle kernel paging request for data at address 0x8888888888888918
>   Faulting instruction address: 0xc000000000e2f0d0
>   Oops: Kernel access of bad area, sig: 11 [#1]
>   NIP .setup_tlb_core_data+0xdc/0x160
>   Call Trace:
>     .setup_tlb_core_data+0x5c/0x160 (unreliable)
>     .setup_arch+0x80/0x348
>     .start_kernel+0x7c/0x598
>     start_here_common+0x1c/0x40
> 
> Luckily setup_tlb_core_data() is called immediately prior to
> smp_setup_pacas(). So simply switching their order is sufficient to
> fix the oops and seems unlikely to have any other unwanted side
> effects.
> 
> Fixes: 59f577743d71 ("powerpc/64: Defer paca allocation until memory topology is discovered")
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Applied to powerpc next.

https://git.kernel.org/powerpc/c/1d0afc0d5a7c281f8ced3bd39f61f3

cheers

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

end of thread, other threads:[~2018-03-31 14:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-31 11:51 [PATCH] powerpc/64e: Fix oops due to deferral of paca allocation Michael Ellerman
2018-03-31 14:04 ` Michael Ellerman

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).