[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 4/7] xen/arm: traps: Avoid using BUG_ON() in _show_registers()


  • To: Julien Grall <julien.grall@xxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Fri, 26 Jul 2019 12:33:50 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=epam.com;dmarc=pass action=none header.from=epam.com;dkim=pass header.d=epam.com;arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WDFk9sNvCKFny8OZ+KO/5vgBjXKK+ftwC6zR+ROp4uw=; b=gnfdX0yCO1av2Hgse7w+h3uYPf8DSeBp1PUyE63gXsGO+KweHKnVqS4N1m5UTDpc02HLG68dVD4fVpjGDcHaVAmQbpDDD0doVWvdWt3KBIsj1RgrjSOwPafF5hSExytASronyPL3nPq92kNNr3bqv0VDOeKPzQUV7BWrPn7VLOR5jgFzkfnUO/V78sQhqnsr+8+vWl/7akRt5IfpdeOtsZw4o93xYkKA6sD31RJh9YJi8/ZB3qp/QczG16iENoresp9POMmYPJeNRAajBw9/V8AXCC5RlUgc7mp5TFxtQ58ltNTiVEcqG5cpHX7B7Ez19rLmjEqUqUZjfdg2fzGi0A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LPpsn8u7xdP/duAPwhnUEIm/c8qTcEK3IJRudowtoc4duoTkwOxMKffdvXfrCaH64AgTNhBtbXVQgk2yyZ+Ze8S/3PU34leinGpK9NCrB72GRlamRsu6etXE2IKOIszVZZOUi4WCfRgswvB4hH/q2pbJFUBqhPglHh1Gl2S/36NtSiLwsESZDLLOin8gdRlLt/JSg1ZmIXpP4kB0yRO24lSn5yx6DlTlnHVmfZRsRVLQ/JAc0OOD++1s91L99Kow5lW4McWncV+P+d9ax529sg2JCLogyzJx7qpyxDyImkv2cavcJ93mMEvmLsxNtukXTyWnL5DoSPBI7odcdiMRpA==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Volodymyr_Babchuk@xxxxxxxx;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 26 Jul 2019 12:33:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVQZ6jkn14PosZBEuHDyOOLSG7sKbc2YEA
  • Thread-topic: [PATCH 4/7] xen/arm: traps: Avoid using BUG_ON() in _show_registers()

Julien Grall writes:

> At the moment, _show_registers() is using a BUG_ON() to assert only
> userspace will run 32-bit code in a 64-bit domain.
>
> Such extra precaution is not necessary and could be avoided by only
> checking the CPU mode to decide whether show_registers_64() or
> show_reigsters_32() should be called.
>
> This has also the nice advantage to avoid nested if in the code.
>
> Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>

> ---
>  xen/arch/arm/traps.c | 16 +++-------------
>  1 file changed, 3 insertions(+), 13 deletions(-)
>
> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
> index 54e66a86d0..132686ee0f 100644
> --- a/xen/arch/arm/traps.c
> +++ b/xen/arch/arm/traps.c
> @@ -914,21 +914,11 @@ static void _show_registers(const struct cpu_user_regs 
> *regs,
>  
>      if ( guest_mode )
>      {
> -        if ( is_32bit_domain(v->domain) )
> +        if ( psr_mode_is_32bit(regs) )
>              show_registers_32(regs, ctxt, guest_mode, v);
>  #ifdef CONFIG_ARM_64
> -        else if ( is_64bit_domain(v->domain) )
> -        {
> -            if ( psr_mode_is_32bit(regs) )
> -            {
> -                BUG_ON(!usr_mode(regs));
> -                show_registers_32(regs, ctxt, guest_mode, v);
> -            }
> -            else
> -            {
> -                show_registers_64(regs, ctxt, guest_mode, v);
> -            }
> -        }
> +        else
> +            show_registers_64(regs, ctxt, guest_mode, v);
>  #endif
>      }
>      else


-- 
Volodymyr Babchuk at EPAM
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.