]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
ARC: Re-enable MMU upon Machine Check exception
authorJose Abreu <Jose.Abreu@synopsys.com>
Fri, 1 Sep 2017 16:00:23 +0000 (17:00 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Sep 2017 12:43:19 +0000 (14:43 +0200)
commit 1ee55a8f7f6b7ca4c0c59e0b4b4e3584a085c2d3 upstream.

I recently came upon a scenario where I would get a double fault
machine check exception tiriggered by a kernel module.
However the ensuing crash stacktrace (ksym lookup) was not working
correctly.

Turns out that machine check auto-disables MMU while modules are allocated
in kernel vaddr spapce.

This patch re-enables the MMU before start printing the stacktrace
making stacktracing of modules work upon a fatal exception.

Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Reviewed-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
[vgupta: moved code into low level handler to avoid in 2 places]
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arc/kernel/entry.S
arch/arc/mm/tlb.c

index 1eea99beecc3b016c0f9d13129da65c26d333c30..85d9ea4a0acccc937a1cf51b29fc0480afa4010d 100644 (file)
@@ -92,6 +92,12 @@ ENTRY(EV_MachineCheck)
        lr  r0, [efa]
        mov r1, sp
 
+       ; hardware auto-disables MMU, re-enable it to allow kernel vaddr
+       ; access for say stack unwinding of modules for crash dumps
+       lr      r3, [ARC_REG_PID]
+       or      r3, r3, MMU_ENABLE
+       sr      r3, [ARC_REG_PID]
+
        lsr     r3, r2, 8
        bmsk    r3, r3, 7
        brne    r3, ECR_C_MCHK_DUP_TLB, 1f
index b181f3ee38aab54565d8de8c1e5136375c6358cc..ac81502055f8507cc840eec449726e6b3e625d0c 100644 (file)
@@ -908,9 +908,6 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address,
 
        local_irq_save(flags);
 
-       /* re-enable the MMU */
-       write_aux_reg(ARC_REG_PID, MMU_ENABLE | read_aux_reg(ARC_REG_PID));
-
        /* loop thru all sets of TLB */
        for (set = 0; set < mmu->sets; set++) {