Excerpts from Christophe Leroy's message of March 16, 2021 5:16 pm: > > > Le 12/03/2021 à 02:20, Nicholas Piggin a écrit : >> There is no need for this to be in asm, use the new intrrupt entry wrapper. >> >> Signed-off-by: Nicholas Piggin <npig...@gmail.com> >> --- >> Hopefully this works on a real G5 now, but I couldn't reproduce the >> problem with QEMU. >> >> Thanks, >> Nick >> >> arch/powerpc/include/asm/interrupt.h | 19 +++++++++++ >> arch/powerpc/include/asm/processor.h | 1 + >> arch/powerpc/include/asm/thread_info.h | 6 ++++ >> arch/powerpc/kernel/exceptions-64s.S | 45 -------------------------- >> arch/powerpc/kernel/idle_book3s.S | 4 +++ >> 5 files changed, 30 insertions(+), 45 deletions(-) >> >> diff --git a/arch/powerpc/include/asm/interrupt.h >> b/arch/powerpc/include/asm/interrupt.h >> index aedfba29e43a..ef015d3b5e39 100644 >> --- a/arch/powerpc/include/asm/interrupt.h >> +++ b/arch/powerpc/include/asm/interrupt.h >> @@ -9,6 +9,17 @@ >> #include <asm/kprobes.h> >> #include <asm/runlatch.h> >> >> +static inline void nap_adjust_return(struct pt_regs *regs) >> +{ >> +#ifdef CONFIG_PPC_970_NAP >> + if (unlikely(test_thread_local_flags(_TLF_NAPPING))) { >> + /* Can avoid a test-and-clear because NMIs do not call this */ >> + clear_thread_local_flags(_TLF_NAPPING); >> + regs->nip = (unsigned long)power4_idle_nap_return; > > Why don't you do regs->nip = regs->link like PPC32 instead of going via an > intermediate symbol that > does nothing else than branching to LR ?
It is supposed to keep the return branch predictor balanced. I don't know if these CPUs have one, if it gets lost during nap, or if nap latency is so high it really doesn't matter. But I think it is good practice to make a habit of keeping things balanced. Thanks, Nick