Revert "powerpc/64s/idle: POWER9 ESL=0 stop avoid save/restore overhead"
authorMichael Ellerman <mpe@ellerman.id.au>
Thu, 5 Apr 2018 06:03:39 +0000 (16:03 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 5 Apr 2018 06:06:25 +0000 (16:06 +1000)
commita67cc594dffd29cfe33fbee40932c9d04197ab2f
treee07dce8a5f9ac9e762fcf0e2f7488fa377c534e3
parent07c3d9eaa4be3a000e2b9386cf678ee78f7f7abb
Revert "powerpc/64s/idle: POWER9 ESL=0 stop avoid save/restore overhead"

As described in that commit:

  When stop is executed with EC=ESL=0, it appears to execute like a
  normal instruction (resuming from NIP when woken by interrupt). So
  all the save/restore handling can be avoided completely.

This is true, except in the case of an NMI interrupt (sreset or
machine check) interrupting the instruction. In that case, the NMI
gets an "interrupt occurred while the processor was in power-saving
mode" indication. The power-save wakeup code uses that bit to decide
whether to restore some registers (e.g., LR). Because these are no
longer saved, this causes random register corruption.

It may be possible to restore this optimisation by detecting the case
of no register loss on the wakeup side, and avoid restoring in that
case, but that's not a minor fix because the wakeup code itself uses
some registers that would be live (e.g., LR).

Fixes: b9ee31e100e7 ("powerpc/64s/idle: POWER9 ESL=0 stop avoid save/restore overhead")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/idle_book3s.S