linux/arch/powerpc/platforms
Paul Mackerras 53c656c413 powerpc/powernv: Handle irq_happened flag correctly in off-line loop
This fixes a bug where it is possible for an off-line CPU to fail to go
into a low-power state (nap/sleep/winkle), and to become unresponsive to
requests from the KVM subsystem to wake up and run a VCPU. What can
happen is that a maskable interrupt of some kind (external, decrementer,
hypervisor doorbell, or HMI) after we have called local_irq_disable() at
the beginning of pnv_smp_cpu_kill_self() and before interrupts are
hard-disabled inside power7_nap/sleep/winkle(). In this situation, the
pending event is marked in the irq_happened flag in the PACA. This
pending event prevents power7_nap/sleep/winkle from going to the
requested low-power state; instead they return immediately. We don't
deal with any of these pending event flags in the off-line loop in
pnv_smp_cpu_kill_self() because power7_nap et al. return 0 in this case,
so we will have srr1 == 0, and none of the processing to clear
interrupts or doorbells will be done.

Usually, the most obvious symptom of this is that a KVM guest will fail
with a console message saying "KVM: couldn't grab cpu N".

This fixes the problem by making sure we handle the irq_happened flags
properly. First, we hard-disable before the off-line loop. Once we have
hard-disabled, the irq_happened flags can't change underneath us. We
unconditionally clear the DEC and HMI flags: there is no processing of
timer interrupts while off-line, and the necessary HMI processing is all
done in lower-level code. We leave the EE and DBELL flags alone for the
first iteration of the loop, so that we won't fail to respond to a
split-core request that came in just before hard-disabling. Within the
loop, we handle external interrupts if the EE bit is set in irq_happened
as well as if the low-power state was interrupted by an external
interrupt. (We don't need to do the msgclr for a pending doorbell in
irq_happened, because doorbells are edge-triggered and don't remain
pending in hardware.) Then we clear both the EE and DBELL flags, and
once clear, they cannot be set again (until this CPU comes online again,
that is).

This also fixes the debug check to not be done when we just ran a KVM
guest or when the sleep didn't happen because of a pending event in
irq_happened.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2015-10-21 20:52:49 +11:00
..
8xx genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
40x powerpc: make of_device_ids const 2014-09-25 23:14:46 +10:00
44x powerpc/44x/Akebono: Remove select of IBM_EMAC_RGMII_WOL 2014-12-29 15:45:44 +11:00
52xx genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
82xx genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
83xx powerpc: don't use module_init in non-modular 83xx suspend code 2015-06-16 14:12:29 -04:00
85xx genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
86xx genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
512x genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
amigaone lib/scatterlist: make ARCH_HAS_SG_CHAIN an actual Kconfig 2014-08-08 15:57:26 -07:00
cell genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
chrp genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
embedded6xx genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
maple powerpc/maple: Move controller ops from ppc_md to controller_ops 2015-04-11 20:49:17 +10:00
pasemi powerpc/MSI: Fix race condition in tearing down MSI interrupts 2015-09-10 17:27:08 +10:00
powermac genirq/irqdomain: Allow irq domain aliasing 2015-07-30 00:14:36 +02:00
powernv powerpc/powernv: Handle irq_happened flag correctly in off-line loop 2015-10-21 20:52:49 +11:00
ps3 powerpc/ps3: Remove unused os_area_db_id_video_mode 2015-09-30 10:33:02 +10:00
pseries Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-09-18 08:11:42 -07:00
Kconfig powerpc: Remove the celleb support 2015-04-07 17:15:13 +10:00
Kconfig.cputype powerpc: Little endian should depend on PPC_BOOK3S_64 2015-05-18 16:48:11 +10:00
Makefile powerpc: Remove platforms/wsp and associated pieces 2014-06-11 16:35:38 +10:00
fsl_uli1575.c of/irq: Refactor interrupt-map parsing 2013-10-24 11:43:04 +01:00