linux/arch/mips
Yang Shi 7768fdc079 mips: rt: Replace pagefault_* to raw version
In k{un}map_coherent, pagefault_disable and pagefault_enable are called
respectively, but k{un}map_coherent needs preempt disabled according to
commit f8829caee3 ("[MIPS] Fix aliasing bug
in copy_to_user_page / copy_from_user_page") to avoid dcache alias on COW.

k{un}map_coherent are just called when cpu_has_dc_aliases == 1 with VIPT cache.
However, actually, the most modern MIPS processors have PIPT dcache without
dcache alias issue. In such case, k{un}map_atomic will be called with preempt
enabled.

To fix this, we replace pagefault_* to raw version in k{un}map_coherent, which
disables preempt, otherwise the following kernel panic may be caught:

CPU 0 Unable to handle kernel paging request at virtual address fffffffffffd5000, epc == ffffffff80122c00, ra == ffffffff8011fbcc
Oops[#1]:
CPU: 0 PID: 409 Comm: runltp Not tainted 3.14.17-rt5 #1
task: 980000000fa936f0 ti: 980000000eed0000 task.ti: 980000000eed0000
$ 0 : 0000000000000000 000000001400a4e1 fffffffffffd5000 0000000000000001
$ 4 : 980000000cded000 fffffffffffd5000 980000000cdedf00 ffffffffffff00fe
$ 8 : 0000000000000000 ffffffffffffff00 000000000000000d 0000000000000004
$12 : 980000000eed3fe0 000000000000a400 ffffffffa00ae278 0000000000000000
$16 : 980000000cded000 000000726eb855c8 98000000012ccfe8 ffffffff8095e0c0
$20 : ffffffff80ad0000 ffffffff8095e0c0 98000000012d0bd8 980000000fb92000
$24 : 0000000000000000 ffffffff80177fb0
$28 : 980000000eed0000 980000000eed3b60 980000000fb92060 ffffffff8011fbcc
Hi : 000000000002cb02
Lo : 000000000000ee56
epc : ffffffff80122c00 copy_page+0x38/0x548
    Not tainted
ra : ffffffff8011fbcc copy_user_highpage+0x16c/0x180
Status: 1400a4e3 KX SX UX KERNEL EXL IE
Cause : 10800408
BadVA : fffffffffffd5000
PrId : 00010000 (MIPS64R2-generic)
Modules linked in: i2c_piix4 i2c_core uhci_hcd
Process runltp (pid: 409, threadinfo=980000000eed0000, task=980000000fa936f0, tls=000000fff7756700)
Stack : 98000000012ccfe8 980000000eeb7ba8 980000000ecc7508 000000000666da5b
000000726eb855c8 ffffffff802156e0 000000726ea4a000 98000000010007e0
980000000fb92060 0000000000000000 0000000000000000 6db6db6db6db6db7
0000000000000080 000000726eb855c8 980000000fb92000 980000000eeeec28
980000000ecc7508 980000000fb92060 0000000000000001 00000000000000a9
ffffffff80995e60 ffffffff80218910 000000001400a4e0 ffffffff804efd24
980000000ee25b90 ffffffff8079cec4 ffffffff8079d49c ffffffff80979658
000000000666da5b 980000000eeb7ba8 000000726eb855c8 00000000000000a9
980000000fb92000 980000000fa936f0 980000000eed3eb0 0000000000000001
980000000fb92088 0000000000030002 980000000ecc7508 ffffffff8011ecd0
...
Call Trace:
[<ffffffff80122c00>] copy_page+0x38/0x548
[<ffffffff8011fbcc>] copy_user_highpage+0x16c/0x180
[<ffffffff802156e0>] do_wp_page+0x658/0xcd8
[<ffffffff80218910>] handle_mm_fault+0x7d8/0x1070
[<ffffffff8011ecd0>] __do_page_fault+0x1a0/0x508
[<ffffffff80104d84>] resume_userspace_check+0x0/0x10

Or there may be random segmentation fault happened.

Cc: stable-rt@vger.kernel.org
Signed-off-by: Yang Shi <yang.shi@windriver.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2020-10-14 00:59:24 +03:00
..
alchemy MIPS: Alchemy: Fix unchecked kstrtoul return value 2014-03-06 20:52:28 +01:00
ar7 Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2014-01-30 17:20:32 -08:00
ath79 mips: delete non-required instances of include <linux/init.h> 2014-01-24 22:39:56 +01:00
bcm47xx MIPS: BCM47XX: Check all (32) GPIOs when looking for a pin 2014-03-19 09:28:10 +01:00
bcm63xx mips: delete non-required instances of include <linux/init.h> 2014-01-24 22:39:56 +01:00
boot MIPS: ZBOOT: add missing <linux/string.h> include 2014-10-05 14:52:16 -07:00
cavium-octeon MIPS: OCTEON: fix kernel crash when offlining a CPU 2015-02-11 14:54:46 +08:00
cobalt MIPS: Cobalt: Move to 8250/16550 serial early printk driver 2013-10-29 21:24:38 +01:00
configs MIPS: Kill CONFIG_MTD_PARTITIONS 2014-01-24 22:39:45 +01:00
dec DEC: Whitespace cleanup 2013-10-29 21:24:44 +01:00
emma MIPS: Remove panic_timeout settings 2013-11-26 12:12:27 +01:00
fw mips: delete non-required instances of include <linux/init.h> 2014-01-24 22:39:56 +01:00
include nosave: consolidate __nosave_{begin,end} in <asm/sections.h> 2015-05-06 21:59:21 +02:00
jazz Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-03-02 07:44:16 -08:00
jz4740 mips: delete non-required instances of include <linux/init.h> 2014-01-24 22:39:56 +01:00
kernel mips-enable-interrupts-in-signal.patch 2020-10-14 00:59:08 +03:00
kvm KVM: MIPS: Fix trace event to save PC directly 2015-03-18 13:31:28 +01:00
lantiq mips: dts: Fix missing device_type="memory" property in memory nodes 2014-06-07 10:28:07 -07:00
lasat mips: delete non-required instances of include <linux/init.h> 2014-01-24 22:39:56 +01:00
lib mips: delete non-required instances of include <linux/init.h> 2014-01-24 22:39:56 +01:00
loongson MIPS: Loongson: Make platform serial setup always built-in. 2014-12-06 15:55:33 -08:00
loongson1 MIPS: Idle: Consolidate all declarations in <asm/idle.h>. 2013-05-22 01:34:27 +02:00
math-emu MIPS: math-emu: Fix prefx detection and COP1X function field definition 2014-03-11 23:10:55 +01:00
mm mips: rt: Replace pagefault_* to raw version 2020-10-14 00:59:24 +03:00
mti-malta MIPS: APRP: Choose the correct VPE loader by fixing the linking 2014-03-06 21:20:23 +01:00
mti-sead3 mips: delete non-required instances of include <linux/init.h> 2014-01-24 22:39:56 +01:00
netlogic Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2014-01-30 17:20:32 -08:00
oprofile MIPS: oprofile: Fix backtrace on 64-bit kernel 2014-12-06 15:55:32 -08:00
pci MIPS: Octeon: Fix fall through on bar type OCTEON_DMA_BAR_TYPE_SMALL 2014-03-15 00:46:23 +01:00
pmcs-msp71xx MIPS: introduce MIPS_L1_CACHE_SHIFT_<N> 2014-01-24 22:39:55 +01:00
pnx833x MIPS: PNX833x: PNX8335_PCI_ETHERNET_INT depends on CONFIG_SOC_PNX8335 2013-08-05 13:34:22 +02:00
power nosave: consolidate __nosave_{begin,end} in <asm/sections.h> 2015-05-06 21:59:21 +02:00
ralink mips: dts: Fix missing device_type="memory" property in memory nodes 2014-06-07 10:28:07 -07:00
rb532 MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
sgi-ip22 MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
sgi-ip27 mips: delete non-required instances of include <linux/init.h> 2014-01-24 22:39:56 +01:00
sgi-ip32 MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
sibyte MIPS: Remove panic_timeout settings 2013-11-26 12:12:27 +01:00
sni MIPS: Cleanup CP0 PRId and CP1 FPIR register access masks 2013-09-18 20:25:19 +02:00
txx9 MIPS: TXx9: Fix build error if CONFIG_TOSHIBA_JMR3927 is not selected 2013-09-03 15:30:50 +02:00
vr41xx MIPS: Idle: Consolidate all declarations in <asm/idle.h>. 2013-05-22 01:34:27 +02:00
Kbuild KVM/MIPS32: Infrastructure/build files. 2013-05-08 03:55:34 +02:00
Kbuild.platforms MIPS: PowerTV: Remove support code. 2013-10-29 21:25:17 +01:00
Kconfig mips-disable-highmem-on-rt.patch 2020-10-14 00:59:20 +03:00
Kconfig.debug MIPS: Add 8250/16550 serial early printk driver 2013-10-29 21:24:36 +01:00
Makefile Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2014-01-30 17:20:32 -08:00