All of lore.kernel.org
 help / color / mirror / Atom feed
From: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
To: Julien Grall <julien.grall@arm.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	"andrii.anisov@gmail.com" <andrii.anisov@gmail.com>
Subject: Re: [Xen-devel] [PATCH RFC for-4.13 10/10] xen/arm64: entry: Ensure the guest state is synced when receiving a vSError
Date: Fri, 27 Sep 2019 15:30:05 +0000	[thread overview]
Message-ID: <87k19t92pv.fsf@epam.com> (raw)
In-Reply-To: <20190926183808.11630-11-julien.grall@arm.com>


Hi Julien,

Julien Grall writes:

> At the moment, when a SError is received while checking for a pending
> one, we will skip the handling the initial exception.
>
> This includes call to exit_from_guest{, _noirq} that is used to
Did you mean enter_hypervisor_from_guest{, _noirq} there? Otherwise, I'm
confused a lot.

> synchronize part of the guest state with the internal representation.
> However, we still call leave_hypervisor_tail() which is used for preempting
> the guest and synchronizing back part of the guest state.
>
> exit_from_guest{, _noirq} works in pair with leave_hypervisor_tail(), so
> skipping if former may result to a loss of some part of  guest state.
> An example is the new vGIC which will save the state of the LRS on exit
> from the guest and rewrite all of them on entry to the guest.
>
> For now, calling leave_hypervisor_tail() is not necessary when injecting
> a vSError to the guest. But as the path is spread accross multiple file,
> it is hard to enforce that for the future (someone we may want to crash the
> domain). Therefore it is best to call exit_from_guest{, _noirq} in the
> vSError path as well.
>
> Note that the return value of check_pending_vserror is now set in x19
> instead of x0. This is because we want to keep the value across call to
> C-function and x0, unlike x19, will not be saved by the callee.
>
> Signed-off-by: Julien Grall <julien.grall@arm.com>
>
> ---
>
> I am not aware of any issues other than with the new vGIC. But I
> haven't looked hard enough so I think it would be worth to try to fix it
> for Xen 4.13.
> ---
>  xen/arch/arm/arm64/entry.S | 21 ++++++++++++++-------
>  1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/xen/arch/arm/arm64/entry.S b/xen/arch/arm/arm64/entry.S
> index 91cf6ee6f4..f5350247e1 100644
> --- a/xen/arch/arm/arm64/entry.S
> +++ b/xen/arch/arm/arm64/entry.S
> @@ -168,11 +168,13 @@
>          /*
>           * The vSError will be checked while SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT
>           * is not set. If a vSError took place, the initial exception will be
> -         * skipped. Exit ASAP
> +         * skipped.
> +         *
> +         * However, we still need to call exit_from_guest{,_noirq} as the
> +         * return path to the guest may rely on state saved by them.
>           */
>          alternative_if SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT
>          bl      check_pending_vserror
> -        cbnz    x0, 1f
>          alternative_else_nop_endif
>  
>          mov     x0, sp
> @@ -180,6 +182,11 @@
>          msr     daifclr, \iflags
>          mov     x0, sp
>          bl      enter_hypervisor_from_guest
> +
> +        alternative_if SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT
> +        cbnz    x19, 1f
> +        alternative_else_nop_endif
> +
>          mov     x0, sp
>          bl      do_trap_\trap
>  1:
> @@ -383,9 +390,9 @@ return_from_trap:
>  /*
>   * This function is used to check pending virtual SError in the gap of
>   * EL1 -> EL2 world switch.
> - * The x0 register will be used to indicate the results of detection.
> - * x0 -- Non-zero indicates a pending virtual SError took place.
> - * x0 -- Zero indicates no pending virtual SError took place.
> + * The register x19 will be used to indicate the results of detection.
> + * x19 -- Non-zero indicates a pending virtual SError took place.
> + * x19 -- Zero indicates no pending virtual SError took place.
>   */
>  check_pending_vserror:
>          /*
> @@ -432,9 +439,9 @@ abort_guest_exit_end:
>  
>          /*
>           * Not equal, the pending SError exception took place, set
> -         * x0 to non-zero.
> +         * x19 to non-zero.
>           */
> -        cset    x0, ne
> +        cset    x19, ne
>  
>          ret


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

  reply	other threads:[~2019-09-27 15:30 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-26 18:37 [Xen-devel] [PATCH RFC for-4.13 00/10] xen/arm: XSA-201 and XSA-263 fixes Julien Grall
2019-09-26 18:37 ` [Xen-devel] [PATCH RFC for-4.13 01/10] xen/arm64: entry: Introduce a macro to generate guest vector and use it Julien Grall
2019-09-27 11:34   ` Volodymyr Babchuk
2019-10-01 19:53     ` Stefano Stabellini
2019-09-26 18:38 ` [Xen-devel] [PATCH RFC for-4.13 02/10] xen/arm64: head: Check if an SError is pending when receiving a vSError Julien Grall
2019-09-27 11:35   ` Volodymyr Babchuk
2019-10-01 19:58     ` Stefano Stabellini
2019-09-26 18:38 ` [Xen-devel] [PATCH RFC for-4.13 03/10] xen/arm: traps: Rework entry/exit from the guest path Julien Grall
2019-09-27 11:45   ` Volodymyr Babchuk
2019-09-27 12:16     ` Julien Grall
2019-09-27 12:27       ` Volodymyr Babchuk
2019-09-27 12:44         ` Julien Grall
2019-09-27 12:49           ` Volodymyr Babchuk
2019-10-01 20:12   ` Stefano Stabellini
2019-10-01 21:06     ` Julien Grall
2019-10-02  0:16       ` Stefano Stabellini
2019-10-02  9:12         ` Julien Grall
2019-10-02 12:41         ` Stefano Stabellini
2019-10-02 12:47           ` Julien Grall
2019-10-02 22:26             ` Stefano Stabellini
2019-10-03 10:24               ` Julien Grall
2019-10-03 17:48                 ` Stefano Stabellini
2019-10-03 17:53                   ` Julien Grall
2019-09-26 18:38 ` [Xen-devel] [PATCH RFC for-4.13 04/10] xen/arm: Ensure the SSBD workaround is re-enabled right after exiting a guest Julien Grall
2019-09-27 11:56   ` Volodymyr Babchuk
2019-09-27 12:22     ` Julien Grall
2019-09-27 12:39       ` Volodymyr Babchuk
2019-09-27 13:16         ` Julien Grall
2019-09-27 13:33           ` Volodymyr Babchuk
2019-09-27 14:11             ` Julien Grall
2019-09-27 14:21               ` Volodymyr Babchuk
2019-09-27 16:24                 ` Julien Grall
2019-09-27 17:58                   ` Volodymyr Babchuk
2019-09-27 20:31                     ` Julien Grall
2019-09-30 12:14   ` Volodymyr Babchuk
2019-09-30 12:15     ` Julien Grall
2019-09-26 18:38 ` [Xen-devel] [PATCH RFC for-4.13 05/10] xen/arm: alternative: Remove unused parameter for alternative_if_not_cap Julien Grall
2019-09-27 11:50   ` Volodymyr Babchuk
2019-10-01 20:55     ` Stefano Stabellini
2019-09-26 18:38 ` [Xen-devel] [PATCH RFC for-4.13 06/10] xen/arm: Move ARCH_PATCH_INSN_SIZE out of the header livepatch.h Julien Grall
2019-09-27 11:51   ` Volodymyr Babchuk
2019-09-27 11:59   ` Ross Lagerwall
2019-10-01 20:57   ` Stefano Stabellini
2019-09-26 18:38 ` [Xen-devel] [PATCH RFC for-4.13 07/10] xen/arm: Allow insn.h to be called from assembly Julien Grall
2019-09-27 11:52   ` Volodymyr Babchuk
2019-10-01 21:00   ` Stefano Stabellini
2019-10-21 16:43     ` Julien Grall
2019-10-21 17:23       ` Stefano Stabellini
2019-09-26 18:38 ` [Xen-devel] [PATCH RFC for-4.13 08/10] xen/arm: alternative: add auto-nop infrastructure Julien Grall
2019-09-27 15:34   ` Volodymyr Babchuk
2019-10-01 22:08     ` Stefano Stabellini
2019-09-26 18:38 ` [Xen-devel] [PATCH RFC for-4.13 09/10] xen/arm: asm: Replace use of ALTERNATIVE with alternative_if Julien Grall
2019-09-27 12:11   ` Volodymyr Babchuk
2019-09-27 12:34     ` Julien Grall
2019-09-27 12:46       ` Volodymyr Babchuk
2019-10-01 22:19   ` Stefano Stabellini
2019-10-01 22:44     ` Julien Grall
2019-10-01 22:52       ` Stefano Stabellini
2019-09-26 18:38 ` [Xen-devel] [PATCH RFC for-4.13 10/10] xen/arm64: entry: Ensure the guest state is synced when receiving a vSError Julien Grall
2019-09-27 15:30   ` Volodymyr Babchuk [this message]
2019-10-02  0:50   ` Stefano Stabellini
2019-09-27  4:17 ` [Xen-devel] [PATCH RFC for-4.13 00/10] xen/arm: XSA-201 and XSA-263 fixes Jürgen Groß

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k19t92pv.fsf@epam.com \
    --to=volodymyr_babchuk@epam.com \
    --cc=andrii.anisov@gmail.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.