All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH for-4.13] xen/arm: livepatch: Prevent CPUs to fetch stale instructions after livepatching
@ 2019-09-18 13:52 Julien Grall
  2019-09-18 15:06 ` Ross Lagerwall
  2019-09-18 16:21 ` Volodymyr Babchuk
  0 siblings, 2 replies; 3+ messages in thread
From: Julien Grall @ 2019-09-18 13:52 UTC (permalink / raw)
  To: xen-devel
  Cc: Ross Lagerwall, Julien Grall, Stefano Stabellini,
	Volodymyr Babchuk, Konrad Rzeszutek Wilk

During livepatch, a single CPU will take care of applying the patch and
all the others will wait for the action to complete. They will then once
execute arch_livepatch_post_action() to flush the pipeline.

Per B2.2.5 "Concurrent modification and execution of instructions" in
DDI 0487E.a, flushing the instruction cache is not enough to ensure new
instructions are seen. All the PEs should also do an isb() to
synchronize the fetched instruction stream.

Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/arch/arm/livepatch.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/livepatch.c b/xen/arch/arm/livepatch.c
index 279d52cc6c..00c5e2bc45 100644
--- a/xen/arch/arm/livepatch.c
+++ b/xen/arch/arm/livepatch.c
@@ -88,7 +88,8 @@ void arch_livepatch_revert(const struct livepatch_func *func)
 
 void arch_livepatch_post_action(void)
 {
-    /* arch_livepatch_revive has nuked the instruction cache. */
+    /* Discard any stale instructions that may have been fetched. */
+    isb();
 }
 
 void arch_livepatch_mask(void)
-- 
2.11.0


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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Xen-devel] [PATCH for-4.13] xen/arm: livepatch: Prevent CPUs to fetch stale instructions after livepatching
  2019-09-18 13:52 [Xen-devel] [PATCH for-4.13] xen/arm: livepatch: Prevent CPUs to fetch stale instructions after livepatching Julien Grall
@ 2019-09-18 15:06 ` Ross Lagerwall
  2019-09-18 16:21 ` Volodymyr Babchuk
  1 sibling, 0 replies; 3+ messages in thread
From: Ross Lagerwall @ 2019-09-18 15:06 UTC (permalink / raw)
  To: Julien Grall, xen-devel
  Cc: Stefano Stabellini, Volodymyr Babchuk, Konrad Rzeszutek Wilk

On 9/18/19 2:52 PM, Julien Grall wrote:
> During livepatch, a single CPU will take care of applying the patch and
> all the others will wait for the action to complete. They will then once
> execute arch_livepatch_post_action() to flush the pipeline.
> 
> Per B2.2.5 "Concurrent modification and execution of instructions" in
> DDI 0487E.a, flushing the instruction cache is not enough to ensure new
> instructions are seen. All the PEs should also do an isb() to
> synchronize the fetched instruction stream.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> ---
>   xen/arch/arm/livepatch.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/arch/arm/livepatch.c b/xen/arch/arm/livepatch.c
> index 279d52cc6c..00c5e2bc45 100644
> --- a/xen/arch/arm/livepatch.c
> +++ b/xen/arch/arm/livepatch.c
> @@ -88,7 +88,8 @@ void arch_livepatch_revert(const struct livepatch_func *func)
>   
>   void arch_livepatch_post_action(void)
>   {
> -    /* arch_livepatch_revive has nuked the instruction cache. */
> +    /* Discard any stale instructions that may have been fetched. */
> +    isb();
>   }
>   
>   void arch_livepatch_mask(void)
> 
Acked-by: Ross Lagerwall <ross.lagerwall@citrix.com>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Xen-devel] [PATCH for-4.13] xen/arm: livepatch: Prevent CPUs to fetch stale instructions after livepatching
  2019-09-18 13:52 [Xen-devel] [PATCH for-4.13] xen/arm: livepatch: Prevent CPUs to fetch stale instructions after livepatching Julien Grall
  2019-09-18 15:06 ` Ross Lagerwall
@ 2019-09-18 16:21 ` Volodymyr Babchuk
  1 sibling, 0 replies; 3+ messages in thread
From: Volodymyr Babchuk @ 2019-09-18 16:21 UTC (permalink / raw)
  To: Julien Grall
  Cc: xen-devel@lists.xenproject.org, Ross Lagerwall, Volodymyr Babchuk,
	Stefano Stabellini, Konrad Rzeszutek Wilk


Hi Julien,

Julien Grall writes:

> During livepatch, a single CPU will take care of applying the patch and
> all the others will wait for the action to complete. They will then once
> execute arch_livepatch_post_action() to flush the pipeline.
>
> Per B2.2.5 "Concurrent modification and execution of instructions" in
> DDI 0487E.a, flushing the instruction cache is not enough to ensure new
> instructions are seen. All the PEs should also do an isb() to
> synchronize the fetched instruction stream.
>
> Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>

> ---
>  xen/arch/arm/livepatch.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/arm/livepatch.c b/xen/arch/arm/livepatch.c
> index 279d52cc6c..00c5e2bc45 100644
> --- a/xen/arch/arm/livepatch.c
> +++ b/xen/arch/arm/livepatch.c
> @@ -88,7 +88,8 @@ void arch_livepatch_revert(const struct livepatch_func *func)
>  
>  void arch_livepatch_post_action(void)
>  {
> -    /* arch_livepatch_revive has nuked the instruction cache. */
> +    /* Discard any stale instructions that may have been fetched. */
> +    isb();
>  }
>  
>  void arch_livepatch_mask(void)


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-18 16:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-18 13:52 [Xen-devel] [PATCH for-4.13] xen/arm: livepatch: Prevent CPUs to fetch stale instructions after livepatching Julien Grall
2019-09-18 15:06 ` Ross Lagerwall
2019-09-18 16:21 ` Volodymyr Babchuk

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.