powerpc/64s: Idle POWER8 avoid full state loss recovery where possible
authorNicholas Piggin <npiggin@gmail.com>
Wed, 19 Apr 2017 13:05:50 +0000 (23:05 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 23 Apr 2017 10:32:12 +0000 (20:32 +1000)
commit0d7720a24234cefa8b318b1a3cf0b302a51faec9
tree8876c07f27927d3290451a9b9795d63423ce8099
parente420249d44d02e9fc110087ed8feddc38b13528c
powerpc/64s: Idle POWER8 avoid full state loss recovery where possible

If not all threads were in winkle, full state loss recovery is not
necessary and can be avoided. A previous patch removed this optimisation
due to some complexity with the implementation. Re-implement it by
counting the number of threads in winkle with the per-core idle state.
Only restore full state loss if all threads were in winkle.

This has a small window of false positives right before threads execute
winkle and just after they wake up, when the winkle count does not
reflect the true number of threads in winkle. This is not a significant
problem in comparison with even the minimum winkle duration. For
correctness, a false positive is not a problem (only false negatives
would be).

Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/cpuidle.h
arch/powerpc/kernel/idle_book3s.S