android_kernel_oneplus_msm8998/drivers/tty
Jibin Xu 1c4d760039 sysrq : fix Show Regs call trace on ARM
[ Upstream commit b00bebbc301c8e1f74f230dc82282e56b7e7a6db ]

When kernel configuration SMP,PREEMPT and DEBUG_PREEMPT are enabled,
echo 1 >/proc/sys/kernel/sysrq
echo p >/proc/sysrq-trigger
kernel will print call trace as below:

sysrq: SysRq : Show Regs
BUG: using __this_cpu_read() in preemptible [00000000] code: sh/435
caller is __this_cpu_preempt_check+0x18/0x20
Call trace:
[<ffffff8008088e80>] dump_backtrace+0x0/0x1d0
[<ffffff8008089074>] show_stack+0x24/0x30
[<ffffff8008447970>] dump_stack+0x90/0xb0
[<ffffff8008463950>] check_preemption_disabled+0x100/0x108
[<ffffff8008463998>] __this_cpu_preempt_check+0x18/0x20
[<ffffff80084c9194>] sysrq_handle_showregs+0x1c/0x40
[<ffffff80084c9c7c>] __handle_sysrq+0x12c/0x1a0
[<ffffff80084ca140>] write_sysrq_trigger+0x60/0x70
[<ffffff8008251e00>] proc_reg_write+0x90/0xd0
[<ffffff80081f1788>] __vfs_write+0x48/0x90
[<ffffff80081f241c>] vfs_write+0xa4/0x190
[<ffffff80081f3354>] SyS_write+0x54/0xb0
[<ffffff80080833f0>] el0_svc_naked+0x24/0x28

This can be seen on a common board like an r-pi3.
This happens because when echo p >/proc/sysrq-trigger,
get_irq_regs() is called outside of IRQ context,
if preemption is enabled in this situation,kernel will
print the call trace. Since many prior discussions on
the mailing lists have made it clear that get_irq_regs
either just returns NULL or stale data when used outside
of IRQ context,we simply avoid calling it outside of
IRQ context.

Signed-off-by: Jibin Xu <jibin.xu@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-09 18:42:40 +01:00
..
hvc TTY/Serial driver patches for 4.4-rc1 2015-11-04 21:35:12 -08:00
ipwireless
serial serial: 8250: Preserve DLD[7:4] for PORT_XR17V35X 2017-12-09 18:42:40 +01:00
vt vt: fix unchecked __put_user() in tioclinux ioctls 2017-07-21 07:44:57 +02:00
amiserial.c
bfin_jtag_comm.c
cyclades.c tty: Remove ASYNC_CLOSING checks in open()/hangup() methods 2015-10-17 21:11:29 -07:00
ehv_bytechan.c
goldfish.c Revert "tty: goldfish: Fix a parameter of a call to free_irq" 2017-10-21 17:09:06 +02:00
isicom.c
Kconfig
Makefile
metag_da.c
mips_ejtag_fdc.c ttyFDC: Fix build problems due to use of module_{init,exit} 2015-10-17 21:29:21 -07:00
moxa.c
moxa.h
mxser.c
mxser.h
n_gsm.c TTY: n_gsm, fix false positive WARN_ON 2016-06-01 12:15:52 -07:00
n_hdlc.c tty: n_hdlc: get rid of racy n_hdlc.tbuf 2017-03-15 09:57:10 +08:00
n_r3964.c tty: r3964: Replace/remove bogus tty lock use 2015-10-17 21:11:29 -07:00
n_tracerouter.c n_tracerouter: stop including <asm-generic/bug> 2015-10-15 00:21:10 +02:00
n_tracesink.c n_tracesink: stop including <asm-generic/bug> 2015-10-15 00:21:11 +02:00
n_tracesink.h
n_tty.c Fix OpenSSH pty regression on close 2016-06-01 12:15:52 -07:00
nozomi.c tty: nozomi: avoid a harmless gcc warning 2017-04-30 05:49:27 +02:00
pty.c tty: pty: Fix ldisc flush after userspace become aware of the data already 2017-05-20 14:27:02 +02:00
rocket.c tty: Remove tty_port::close_wait 2015-10-17 21:11:29 -07:00
rocket.h
rocket_int.h
synclink.c tty: synclink, fix indentation 2015-10-17 21:14:06 -07:00
synclink_gt.c tty: Remove ASYNC_CLOSING checks in open()/hangup() methods 2015-10-17 21:11:29 -07:00
synclinkmp.c tty: Remove ASYNC_CLOSING checks in open()/hangup() methods 2015-10-17 21:11:29 -07:00
sysrq.c sysrq : fix Show Regs call trace on ARM 2017-12-09 18:42:40 +01:00
tty_audit.c tty: audit: Fix audit source 2015-11-20 16:19:54 -08:00
tty_buffer.c tty: fix __tty_insert_flip_char regression 2017-09-27 11:00:13 +02:00
tty_io.c tty: Drop krefs for interrupted tty lock 2017-06-14 13:16:26 +02:00
tty_ioctl.c tty: Fix tty_send_xchar() lock order inversion 2015-11-20 16:19:54 -08:00
tty_ldisc.c tty: Prevent ldisc drivers from re-using stale tty fields 2016-11-21 10:06:40 +01:00
tty_ldsem.c
tty_mutex.c tty: Drop krefs for interrupted tty lock 2017-06-14 13:16:26 +02:00
tty_port.c tty: Abstract tty buffer work 2015-10-17 21:32:21 -07:00