android_kernel_samsung_msm8976/arch/powerpc
Thomas Huth 2ba90c0e06 powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers
commit 1c2cb594441d02815d304cccec9742ff5c707495 upstream.

The EPOW interrupt handler uses rtas_get_sensor(), which in turn
uses rtas_busy_delay() to wait for RTAS becoming ready in case it
is necessary. But rtas_busy_delay() is annotated with might_sleep()
and thus may not be used by interrupts handlers like the EPOW handler!
This leads to the following BUG when CONFIG_DEBUG_ATOMIC_SLEEP is
enabled:

 BUG: sleeping function called from invalid context at arch/powerpc/kernel/rtas.c:496
 in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/1
 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.2.0-rc2-thuth #6
 Call Trace:
 [c00000007ffe7b90] [c000000000807670] dump_stack+0xa0/0xdc (unreliable)
 [c00000007ffe7bc0] [c0000000000e1f14] ___might_sleep+0x134/0x180
 [c00000007ffe7c20] [c00000000002aec0] rtas_busy_delay+0x30/0xd0
 [c00000007ffe7c50] [c00000000002bde4] rtas_get_sensor+0x74/0xe0
 [c00000007ffe7ce0] [c000000000083264] ras_epow_interrupt+0x44/0x450
 [c00000007ffe7d90] [c000000000120260] handle_irq_event_percpu+0xa0/0x300
 [c00000007ffe7e70] [c000000000120524] handle_irq_event+0x64/0xc0
 [c00000007ffe7eb0] [c000000000124dbc] handle_fasteoi_irq+0xec/0x260
 [c00000007ffe7ef0] [c00000000011f4f0] generic_handle_irq+0x50/0x80
 [c00000007ffe7f20] [c000000000010f3c] __do_irq+0x8c/0x200
 [c00000007ffe7f90] [c0000000000236cc] call_do_irq+0x14/0x24
 [c00000007e6f39e0] [c000000000011144] do_IRQ+0x94/0x110
 [c00000007e6f3a30] [c000000000002594] hardware_interrupt_common+0x114/0x180

Fix this issue by introducing a new rtas_get_sensor_fast() function
that does not use rtas_busy_delay() - and thus can only be used for
sensors that do not cause a BUSY condition - known as "fast" sensors.

The EPOW sensor is defined to be "fast" in sPAPR - mpe.

Fixes: 587f83e8dd ("powerpc/pseries: Use rtas_get_sensor in RAS code")
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-01 12:07:30 +02:00
..
boot powerpc/mpc85xx: Add ranges to etsec2 nodes 2015-04-13 14:02:12 +02:00
configs USB: remove remaining instances of USB_SUSPEND 2013-05-15 13:44:44 -04:00
crypto crypto: add missing crypto module aliases 2015-01-29 17:40:57 -08:00
include powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers 2015-10-01 12:07:30 +02:00
kernel powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers 2015-10-01 12:07:30 +02:00
kvm KVM: PPC: e500: Fix bad address type in deliver_tlb_misss() 2014-02-06 11:08:17 -08:00
lib powerpc: fix typo 'CONFIG_PPC_CPU' 2014-07-06 18:54:15 -07:00
math-emu
mm vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
net bpf: do not use reciprocal divide 2014-02-06 11:08:16 -08:00
oprofile
perf powerpc/perf: Fix book3s kernel to userspace backtraces 2015-07-10 10:40:22 -07:00
platforms powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers 2015-10-01 12:07:30 +02:00
sysdev axonram: Fix bug in direct_access 2015-03-06 14:40:50 -08:00
xmon powerpc/xmon: Fix another endiannes issue in RTAS call from xmon 2015-02-05 22:35:36 -08:00
Kconfig locking/mutex: Disable optimistic spinning on some architectures 2014-07-28 08:00:07 -07:00
Kconfig.debug
Makefile powerpc: Fix 64 bit builds with binutils 2.24 2014-06-07 13:25:40 -07:00
relocs_check.pl