alistair23-linux/drivers/tty
Jibin Xu b00bebbc30 sysrq : fix Show Regs call trace on ARM
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>
2017-10-04 10:52:00 +02:00
..
hvc powerpc updates for 4.14 2017-09-07 10:15:40 -07:00
ipwireless
serdev
serial serial: 8250_dw: Improve clock rate setting 2017-10-04 10:17:27 +02:00
vt vt: Use bsearch library function in is_double_width 2017-09-18 18:31:48 +02:00
amiserial.c
bfin_jtag_comm.c
cyclades.c
ehv_bytechan.c
goldfish.c tty: goldfish: Implement support for kernel 'earlycon' parameter 2017-08-31 18:58:45 +02:00
isicom.c
Kconfig Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next 2017-09-10 09:57:23 -07:00
Makefile
metag_da.c
mips_ejtag_fdc.c
moxa.c
moxa.h
mxser.c mxser: remove unused parameters 2017-10-04 10:15:47 +02:00
mxser.h
n_gsm.c drivers: tty: n_gsm: use setup_timer() helper. 2017-10-03 20:28:36 +02:00
n_hdlc.c
n_null.c
n_r3964.c
n_tracerouter.c
n_tracesink.c
n_tracesink.h
n_tty.c
nozomi.c
pty.c TTY/Serial updates for 4.14-rc1 2017-09-05 10:30:48 -07:00
rocket.c
rocket.h
rocket_int.h
synclink.c tty: synclink: Reuse an existing error handling path 2017-09-18 18:31:48 +02:00
synclink_gt.c
synclinkmp.c
sysrq.c sysrq : fix Show Regs call trace on ARM 2017-10-04 10:52:00 +02:00
tty_audit.c
tty_baudrate.c
tty_buffer.c
tty_io.c Staging/IIO driver updates for 4.14-rc1 2017-09-05 10:36:26 -07:00
tty_ioctl.c
tty_jobctrl.c
tty_ldisc.c
tty_ldsem.c
tty_mutex.c
tty_port.c ttyport: trivial fix for some typo in comments 2017-09-18 18:31:48 +02:00
vcc.c drivers: tty: vcc: use setup_timer() helper. 2017-10-03 20:28:36 +02:00