linux/arch/powerpc
Sam Bobroff 0aab374709 powerpc/powernv: Restore non-volatile CRs after nap
Patches 7cba160ad "powernv/cpuidle: Redesign idle states management"
and 77b54e9f2 "powernv/powerpc: Add winkle support for offline cpus"
use non-volatile condition registers (cr2, cr3 and cr4) early in the system
reset interrupt handler (system_reset_pSeries()) before it has been determined
if state loss has occurred. If state loss has not occurred, control returns via
the power7_wakeup_noloss() path which does not restore those condition
registers, leaving them corrupted.

Fix this by restoring the condition registers in the power7_wakeup_noloss()
case.

This is apparent when running a KVM guest on hardware that does not
support winkle or sleep and the guest makes use of secondary threads. In
practice this means Power7 machines, though some early unreleased Power8
machines may also be susceptible.

The secondary CPUs are taken off line before the guest is started and
they call pnv_smp_cpu_kill_self(). This checks support for sleep
states (in this case there is no support) and power7_nap() is called.

When the CPU is woken, power7_nap() returns and because the CPU is
still off line, the main while loop executes again. The sleep states
support test is executed again, but because the tested values cannot
have changed, the compiler has optimized the test away and instead we
rely on the result of the first test, which has been left in cr3
and/or cr4. With the result overwritten, the wrong branch is taken and
power7_winkle() is called on a CPU that does not support it, leading
to it stalling.

Fixes: 7cba160ad7 ("powernv/cpuidle: Redesign idle states management")
Fixes: 77b54e9f21 ("powernv/powerpc: Add winkle support for offline cpus")
[mpe: Massage change log a bit more]
Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2015-05-01 16:55:11 +10:00
..
boot powerpc: Remove the celleb support 2015-04-07 17:15:13 +10:00
configs powerpc: Remove the celleb support 2015-04-07 17:15:13 +10:00
crypto
include Revert "powerpc/tm: Abort syscalls in active transactions" 2015-04-30 15:24:58 +10:00
kernel powerpc/powernv: Restore non-volatile CRs after nap 2015-05-01 16:55:11 +10:00
kvm powerpc/kvm: Fix SMP=n build error in book3s_xics.c 2015-04-29 08:06:32 +10:00
lib powerpc: Export __spin_yield 2015-04-21 15:21:28 +02:00
math-emu
mm powerpc/mm: Fix build error with CONFIG_PPC_TRANSACTIONAL_MEM disabled 2015-04-23 17:42:14 +10:00
net
oprofile powerpc/oprofile: reduce mmap_sem hold for exe_file 2015-04-17 09:04:11 -04:00
perf powerpc/mm/thp: Make page table walk safe against thp split/collapse 2015-04-17 11:23:39 +10:00
platforms powerpc/pseries: Correct cpu affinity for dlpar added cpus 2015-05-01 13:47:24 +10:00
sysdev powerpc: dart_iommu: Remove check for controller_ops == NULL case 2015-04-11 20:49:19 +10:00
xmon
Kconfig powerpc updates for 4.1 2015-04-16 13:53:32 -05:00
Kconfig.debug powerpc: Remove the celleb support 2015-04-07 17:15:13 +10:00
Makefile
relocs_check.sh