On Mon, 13 Mar 2017, Wei Chen wrote:
> We have provided an option to administrator to determine how to
> handle the SErrors. In order to skip the check of pending SError,
> in conventional way, we have to read the option every time before
> we try to check the pending SError. This will add overhead to check
> the option at every trap.
> 
> The ARM64 supports the alternative patching feature. We can use an
> ALTERNATIVE to avoid checking option at every trap. We added a new
> cpufeature named "SKIP_CHECK_PENDING_VSERROR". This feature will be
> enabled when the option is not diverse.
> 
> Signed-off-by: Wei Chen <wei.c...@arm.com>

Reviewed-by: Stefano Stabellini <sstabell...@kernel.org>


> ---
>  xen/arch/arm/arm64/entry.S | 41 +++++++++++++++++++++++++----------------
>  1 file changed, 25 insertions(+), 16 deletions(-)
> 
> diff --git a/xen/arch/arm/arm64/entry.S b/xen/arch/arm/arm64/entry.S
> index 02802c0..4baa3cb 100644
> --- a/xen/arch/arm/arm64/entry.S
> +++ b/xen/arch/arm/arm64/entry.S
> @@ -1,5 +1,6 @@
>  #include <asm/asm_defns.h>
>  #include <asm/regs.h>
> +#include <asm/alternative.h>
>  #include <public/xen.h>
>  
>  /*
> @@ -229,12 +230,14 @@ hyp_irq:
>  
>  guest_sync:
>          entry   hyp=0, compat=0
> -        bl      check_pending_vserror
>          /*
> -         * If x0 is Non-zero, a vSError took place, the initial exception
> -         * doesn't have any significance to be handled. Exit ASAP
> +         * The vSError will be checked while SKIP_CHECK_PENDING_VSERROR is
> +         * not set. If a vSError took place, the initial exception will be
> +         * skipped. Exit ASAP
>           */
> -        cbnz    x0, 1f
> +        ALTERNATIVE("bl check_pending_vserror; cbnz x0, 1f",
> +                    "nop; nop",
> +                    SKIP_CHECK_PENDING_VSERROR)
>          msr     daifclr, #2
>          mov     x0, sp
>          bl      do_trap_hypervisor
> @@ -243,12 +246,14 @@ guest_sync:
>  
>  guest_irq:
>          entry   hyp=0, compat=0
> -        bl      check_pending_vserror
>          /*
> -         * If x0 is Non-zero, a vSError took place, the initial exception
> -         * doesn't have any significance to be handled. Exit ASAP
> +         * The vSError will be checked while SKIP_CHECK_PENDING_VSERROR is
> +         * not set. If a vSError took place, the initial exception will be
> +         * skipped. Exit ASAP
>           */
> -        cbnz    x0, 1f
> +        ALTERNATIVE("bl check_pending_vserror; cbnz x0, 1f",
> +                    "nop; nop",
> +                    SKIP_CHECK_PENDING_VSERROR)
>          mov     x0, sp
>          bl      do_trap_irq
>  1:
> @@ -267,12 +272,14 @@ guest_error:
>  
>  guest_sync_compat:
>          entry   hyp=0, compat=1
> -        bl      check_pending_vserror
>          /*
> -         * If x0 is Non-zero, a vSError took place, the initial exception
> -         * doesn't have any significance to be handled. Exit ASAP
> +         * The vSError will be checked while SKIP_CHECK_PENDING_VSERROR is
> +         * not set. If a vSError took place, the initial exception will be
> +         * skipped. Exit ASAP
>           */
> -        cbnz    x0, 1f
> +        ALTERNATIVE("bl check_pending_vserror; cbnz x0, 1f",
> +                    "nop; nop",
> +                    SKIP_CHECK_PENDING_VSERROR)
>          msr     daifclr, #2
>          mov     x0, sp
>          bl      do_trap_hypervisor
> @@ -281,12 +288,14 @@ guest_sync_compat:
>  
>  guest_irq_compat:
>          entry   hyp=0, compat=1
> -        bl      check_pending_vserror
>          /*
> -         * If x0 is Non-zero, a vSError took place, the initial exception
> -         * doesn't have any significance to be handled. Exit ASAP
> +         * The vSError will be checked while SKIP_CHECK_PENDING_VSERROR is
> +         * not set. If a vSError took place, the initial exception will be
> +         * skipped. Exit ASAP
>           */
> -        cbnz    x0, 1f
> +        ALTERNATIVE("bl check_pending_vserror; cbnz x0, 1f",
> +                    "nop; nop",
> +                    SKIP_CHECK_PENDING_VSERROR)
>          mov     x0, sp
>          bl      do_trap_irq
>  1:
> -- 
> 2.7.4
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to