Re: PPC32: Boot regression on Nintendo Wii, after create_branch rework in 5.8
From: Jordan Niethe <hidden>
Date: 2021-04-28 01:34:10
Subsystem:
linux for powerpc (32-bit and 64-bit), the rest · Maintainers:
Madhavan Srinivasan, Linus Torvalds
On Mon, Apr 26, 2021 at 1:40 AM Jonathan Neuschäfer [off-list ref] wrote:
Hi,
I recently booted my Wii again, and I noticed a regression at boot time.
Output stops after the "Finalizing device tree... flat tree at 0xXXXXXX"
message. I bisected it to this commit in the 5.8 development cycle:
commit 7c95d8893fb55869882c9f68f4c94840dc43f18f
Author: Jordan Niethe [off-list ref]
Date: Wed May 6 13:40:25 2020 +1000
powerpc: Change calling convention for create_branch() et. al.
create_branch(), create_cond_branch() and translate_branch() return the
instruction that they create, or return 0 to signal an error. Separate
these concerns in preparation for an instruction type that is not just
an unsigned int. Fill the created instruction to a pointer passed as
the first parameter to the function and use a non-zero return value to
signify an error.
Signed-off-by: Jordan Niethe [off-list ref]
Signed-off-by: Michael Ellerman [off-list ref]
Reviewed-by: Alistair Popple [off-list ref]
Link: https://lore.kernel.org/r/20200506034050.24806-6-jniethe5@gmail.com (local)
arch/powerpc/include/asm/code-patching.h | 12 +--
arch/powerpc/kernel/optprobes.c | 24 +++---
arch/powerpc/kernel/setup_32.c | 4 +-
arch/powerpc/kernel/trace/ftrace.c | 24 +++---
arch/powerpc/lib/code-patching.c | 134 ++++++++++++++++++-------------
arch/powerpc/lib/feature-fixups.c | 5 +-
6 files changed, 119 insertions(+), 84 deletions(-)
Do you have any hints on how to debug and/or fix this issue?Thanks for bisecting and reporting.
The "Finalizing device tree... flat tree at 0xXXXXXX" message comes
from the bootwrapper so if that is the last output it must be crashing
pretty early.
Commit 7c95d8893fb5 ("powerpc: Change calling convention for
create_branch() et. al.") made a change to machine_init() in
setup_32.c which seems like it might be a likely culprit for causing
early crashing.
The branch that is created and patched is just for optimization, so to
see if that is in fact the problem it might be worth trying to boot
with a patch like below
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c@@ -87,9 +87,6 @@ notrace void __init machine_init(u64 dt_ptr) patch_instruction_site(&patch__memcpy_nocache, ppc_inst(PPC_INST_NOP)); - create_cond_branch(&insn, addr, branch_target(addr), 0x820000); - patch_instruction(addr, insn); /* replace b by bne cr0 */ - /* Do some early initialization based on the flat device tree */ early_init_devtree(__va(dt_ptr));
Best regards, Jonathan Neuschäfer