Re: [PATCH 16/20] ARC: entry: Add more common chores to EXCEPTION_PROLOGUE

From: Pavel . Kozlov
Date: Fri Aug 18 2023 - 08:59:07 EST


Hi Vineet,

> Subject: [PATCH 16/20] ARC: entry: Add more common chores to
> EXCEPTION_PROLOGUE
>
> THe high level structure of most ARC exception handlers is
> 1. save regfile with EXCEPTION_PROLOGUE
> 2. setup r0: EFA (not part of pt_regs)
> 3. setup r1: pointer to pt_regs (SP)
> 4. drop down to pure kernel mode (from exception)
> 5. call the Linux "C" handler
>
> Remove the boiler plate code by moving #2, #3, #4 into #1.
>
> The exceptions to most exceptions are syscall Trap and Machine check
> which don't do some of above for various reasons, so call a newly
> introduced variant EXCEPTION_PROLOGUE_KEEP_AE (same as original
> EXCEPTION_PROLOGUE)

I'm observing the ARC700 (nSIM) system freeze after this patch.

...
f0000000.serial: ttyS0 at MMIO 0xf0000000 (irq = 24, base_baud = 3125000) is a 16550A
printk: console [ttyS0] enabled
printk: console [ttyS0] enabled
printk: bootconsole [uart8250] disabled
printk: bootconsole [uart8250] disabled
NET: Registered PF_PACKET protocol family
NET: Registered PF_KEY protocol family
clk: Disabling unused clocks
Freeing unused kernel image (initmem) memory: 2856K
This architecture does not have kernel memory protection.
Run /init as init process

> @@ -128,11 +123,6 @@ ENTRY(EV_PrivilegeV)
>
> EXCEPTION_PROLOGUE
>
> - lr r0, [efa]
> - mov r1, sp
> -
> - FAKE_RET_FROM_EXCPN
> -
> bl do_privilege_fault
> b ret_from_exception

The same update is also required for the call_do_page_fault wrapper for ARcompact.

Regards,
Pavel