[PATCH 10/17] arm64: entry: consolidate EL1 return paths

Anshuman Khandual anshuman.khandual at arm.com
Thu Jan 9 19:39:03 PST 2020



On 01/09/2020 12:26 AM, Mark Rutland wrote:
> Each of the EL1 exception handler stubs has an identical copy of the
> kernel_exit code. While each handler needs its own kernel_entry
> sequence, there's no need to duplicate this for each handler, and we can
> consolidate them for better I-cache usage.
> 
> This patch makes the EL1 handlers all use a common kernel_exit stub
> called ret_to_kernel, matching the ret_to_user stub used by EL0
> handlers.
> 
> As with the handlers, ret_to_kenerl is aligned for better I-cache and

Small nit, s/ret_to_kenerl/ret_to_kernel

> brapnch predictor utilization, and for consistency the same alignment is

Small nit, s/brapnch/branch

> applied to ret_to_user.
> 
> Signed-off-by: Mark Rutland <mark.rutland at arm.com>
> Cc: Catalin Marinas <catalin.marinas at arm.com>
> Cc: James Morse <james.morse at arm.com>
> Cc: Will Deacon <will at kernel.org>

Reviewed-by: Anshuman Khandual <anshuman.khandual at arm.com>

> ---
>  arch/arm64/kernel/entry.S | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
> index 35a8c56b0582..e76326feb1da 100644
> --- a/arch/arm64/kernel/entry.S
> +++ b/arch/arm64/kernel/entry.S
> @@ -519,7 +519,7 @@ el1_sync:
>  	kernel_entry 1
>  	mov	x0, sp
>  	bl	el1_sync_handler
> -	kernel_exit 1
> +	b	ret_to_kernel
>  ENDPROC(el1_sync)
>  
>  	.align	6
> @@ -527,7 +527,7 @@ el1_irq:
>  	kernel_entry 1
>  	mov	x0, sp
>  	bl	el1_irq_handler
> -	kernel_exit 1
> +	b	ret_to_kernel
>  ENDPROC(el1_irq)
>  
>  	.align	6
> @@ -535,10 +535,18 @@ el1_error:
>  	kernel_entry 1
>  	mov	x0, sp
>  	bl	el1_error_handler
> -	kernel_exit 1
> +	b	ret_to_kernel
>  ENDPROC(el1_error)
>  
>  /*
> + * Common EL1 exception return path
> + */
> +	.align 6
> +ret_to_kernel:
> +	kernel_exit 1
> +ENDPROC(ret_to_kernel)
> +
> +/*
>   * EL0 mode handlers.
>   */
>  	.align	6
> @@ -606,6 +614,7 @@ work_pending:
>  /*
>   * "slow" syscall return path.
>   */
> +	.align 6
>  ret_to_user:
>  	disable_daif
>  	gic_prio_kentry_setup tmp=x3
> 



More information about the linux-arm-kernel mailing list