Skip to content
  • Ganesh Goudar's avatar
    powerpc/pseries: Avoid using addr_to_pfn in real mode · 4ff753fe
    Ganesh Goudar authored
    When an UE or memory error exception is encountered the MCE handler
    tries to find the pfn using addr_to_pfn() which takes effective
    address as an argument, later pfn is used to poison the page where
    memory error occurred, recent rework in this area made addr_to_pfn
    to run in real mode, which can be fatal as it may try to access
    memory outside RMO region.
    
    Have two helper functions to separate things to be done in real mode
    and virtual mode without changing any functionality. This also fixes
    the following error as the use of addr_to_pfn is now moved to virtual
    mode.
    
    Without this change following kernel crash is seen on hitting UE.
    
    [  485.128036] Oops: Kernel access of bad area, sig: 11 [#1]
    [  485.128040] LE SMP NR_CPUS=2048 NUMA pSeries
    [  485.128047] Modules linked in:
    [  485.128067] CPU: 15 PID: 6536 Comm: insmod Kdump: loaded Tainted: G OE 5.7.0 #22
    [  485.128074] NIP:  c00000000009b24c LR: c0000000000398d8 CTR: c000000000cd57c0
    [  485.128078] REGS: c000000003f1f970 TRAP: 0300   Tainted: G OE (5.7.0)
    [  485.128082] MSR:  8000000000001003 <SF,ME,RI,LE>  CR: 28008284  XER: 00000001
    [  485.128088] CFAR: c00000000009b190 DAR: c0000001fab00000 DSISR: 40000000 IRQMASK: 1
    [  485.128088] GPR00: 0000000000000001 c000000003f1fbf0 c000000001634300 0000b0fa01000000
    [  485.128088] GPR04: d000000002220000 0000000000000000 00000000fab00000 0000000000000022
    [  485.128088] GPR08: c0000001fab00000 0000000000000000 c0000001fab00000 c000000003f1fc14
    [  485.128088] GPR12: 0000000000000008 c000000003ff5880 d000000002100008 0000000000000000
    [  485.128088] GPR16: 000000000000ff20 000000000000fff1 000000000000fff2 d0000000021a1100
    [  485.128088] GPR20: d000000002200000 c00000015c893c50 c000000000d49b28 c00000015c893c50
    [  485.128088] GPR24: d0000000021a0d08 c0000000014e5da8 d0000000021a0818 000000000000000a
    [  485.128088] GPR28: 0000000000000008 000000000000000a c0000000017e2970 000000000000000a
    [  485.128125] NIP [c00000000009b24c] __find_linux_pte+0x11c/0x310
    [  485.128130] LR [c0000000000398d8] addr_to_pfn+0x138/0x170
    [  485.128133] Call Trace:
    [  485.128135] Instruction dump:
    [  485.128138] 3929ffff 7d4a3378 7c883c36 7d2907b4 794a1564 7d294038 794af082 3900ffff
    [  485.128144] 79291f24 790af00e 78e70020 7d095214 <7c69502a> 2fa30000 419e011c 70690040
    [  485.128152] ---[ end trace d34b27e29ae0e340 ]---
    
    Fixes: 9ca766f9
    
     ("powerpc/64s/pseries: machine check convert to use common event code")
    Signed-off-by: default avatarGanesh Goudar <ganeshgr@linux.ibm.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20200724063946.21378-1-ganeshgr@linux.ibm.com
    4ff753fe