xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] xen arm/arm64: minor improvement in smp_send_call_function_mask()
@ 2014-08-25 10:18 Anup Patel
  2014-08-26 21:02 ` Ian Campbell
  0 siblings, 1 reply; 2+ messages in thread
From: Anup Patel @ 2014-08-25 10:18 UTC (permalink / raw)
  To: xen-devel
  Cc: Ian.Campbell, Anup Patel, stefano.stabellini, julien.grall,
	patches, stefano.stabellini, Pranavkumar Sawargaonkar

Currently, smp_send_call_function_mask() function implemented
by xen arm/arm64 will use IPI to call function on current CPU.

This means that current smp_send_call_function_mask() will do
the following on current CPU:
Trigger SGI for current CPU => Xen takes interrupt on current CPU
=> IPI interrupt handler will call smp_call_function_interrupt()

This patch improves the above by straight away calling
smp_call_function_interrupt() for current CPU. This is very
similar to smp_send_call_function_mask() implemented by Xen x86.

Changes since v1:
 - Drop the check protecting send_SGI_mask() call

Signed-off-by: Anup Patel <anup.patel@linaro.org>
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Acked-by: Julien Grall <julien.grall@linaro.org>
---
 xen/arch/arm/smp.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/smp.c b/xen/arch/arm/smp.c
index 30203b8..917d490 100644
--- a/xen/arch/arm/smp.c
+++ b/xen/arch/arm/smp.c
@@ -19,7 +19,18 @@ void smp_send_event_check_mask(const cpumask_t *mask)
 
 void smp_send_call_function_mask(const cpumask_t *mask)
 {
-    send_SGI_mask(mask, GIC_SGI_CALL_FUNCTION);
+    cpumask_t target_mask;
+
+    cpumask_andnot(&target_mask, mask, cpumask_of(smp_processor_id()));
+
+    send_SGI_mask(&target_mask, GIC_SGI_CALL_FUNCTION);
+
+    if ( cpumask_test_cpu(smp_processor_id(), mask) )
+    {
+        local_irq_disable();
+        smp_call_function_interrupt();
+        local_irq_enable();
+    }
 }
 
 /*
-- 
1.7.9.5

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

* Re: [PATCH v2] xen arm/arm64: minor improvement in smp_send_call_function_mask()
  2014-08-25 10:18 [PATCH v2] xen arm/arm64: minor improvement in smp_send_call_function_mask() Anup Patel
@ 2014-08-26 21:02 ` Ian Campbell
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Campbell @ 2014-08-26 21:02 UTC (permalink / raw)
  To: Anup Patel
  Cc: stefano.stabellini, julien.grall, patches, xen-devel,
	stefano.stabellini, Pranavkumar Sawargaonkar

On Mon, 2014-08-25 at 15:48 +0530, Anup Patel wrote:
> Currently, smp_send_call_function_mask() function implemented
> by xen arm/arm64 will use IPI to call function on current CPU.
> 
> This means that current smp_send_call_function_mask() will do
> the following on current CPU:
> Trigger SGI for current CPU => Xen takes interrupt on current CPU
> => IPI interrupt handler will call smp_call_function_interrupt()
> 
> This patch improves the above by straight away calling
> smp_call_function_interrupt() for current CPU. This is very
> similar to smp_send_call_function_mask() implemented by Xen x86.
> 
> Changes since v1:
>  - Drop the check protecting send_SGI_mask() call

Please put this sort of thing after the --- break so it doesn't end up
in the final commit log.
> 
> Signed-off-by: Anup Patel <anup.patel@linaro.org>
> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
> Acked-by: Julien Grall <julien.grall@linaro.org>

Acked + applied. thanks.

> ---
>  xen/arch/arm/smp.c |   13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/arch/arm/smp.c b/xen/arch/arm/smp.c
> index 30203b8..917d490 100644
> --- a/xen/arch/arm/smp.c
> +++ b/xen/arch/arm/smp.c
> @@ -19,7 +19,18 @@ void smp_send_event_check_mask(const cpumask_t *mask)
>  
>  void smp_send_call_function_mask(const cpumask_t *mask)
>  {
> -    send_SGI_mask(mask, GIC_SGI_CALL_FUNCTION);
> +    cpumask_t target_mask;
> +
> +    cpumask_andnot(&target_mask, mask, cpumask_of(smp_processor_id()));
> +
> +    send_SGI_mask(&target_mask, GIC_SGI_CALL_FUNCTION);
> +
> +    if ( cpumask_test_cpu(smp_processor_id(), mask) )
> +    {
> +        local_irq_disable();
> +        smp_call_function_interrupt();
> +        local_irq_enable();
> +    }
>  }
>  
>  /*

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

end of thread, other threads:[~2014-08-26 21:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-25 10:18 [PATCH v2] xen arm/arm64: minor improvement in smp_send_call_function_mask() Anup Patel
2014-08-26 21:02 ` Ian Campbell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).