On Fri, 2019-04-12 at 14:30:52 UTC, Nicholas Piggin wrote: > Reimplement Book3S idle code in C, moving POWER7/8/9 implementation > speific HV idle code to the powernv platform code. > > Book3S assembly stubs are kept in common code and used only to save > the stack frame and non-volatile GPRs before executing architected > idle instructions, and restoring the stack and reloading GPRs then > returning to C after waking from idle. > > The complex logic dealing with threads and subcores, locking, SPRs, > HMIs, timebase resync, etc., is all done in C which makes it more > maintainable. > > This is not a strict translation to C code, there are some > significant differences: > > - Idle wakeup no longer uses the ->cpu_restore call to reinit SPRs, > but saves and restores them itself. > > - The optimisation where EC=ESL=0 idle modes did not have to save GPRs > or change MSR is restored, because it's now simple to do. ESL=1 > sleeps that do not lose GPRs can use this optimization too. > > - KVM secondary entry and cede is now more of a call/return style > rather than branchy. nap_state_lost is not required because KVM > always returns via NVGPR restoring path. > > - KVM secondary wakeup from offline sequence is moved entirely into > the offline wakeup, which avoids a hwsync in the normal idle wakeup > path. > > Performance measured with context switch ping-pong on different > threads or cores, is possibly improved a small amount, 1-3% depending > on stop state and core vs thread test for shallow states. Deep states > it's in the noise compared with other latencies. > > Reviewed-by: Gautham R. Shenoy <ego@xxxxxxxxxxxxxxxxxx> > Signed-off-by: Nicholas Piggin <npiggin@xxxxxxxxx> Applied to powerpc topic/ppc-kvm, thanks. https://git.kernel.org/powerpc/c/10d91611f426d4bafd2a83d966c36da8 cheers