All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/APIC: reduce self-IPI related code
@ 2014-09-09 15:49 Jan Beulich
  2014-09-09 15:58 ` Andrew Cooper
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2014-09-09 15:49 UTC (permalink / raw)
  To: xen-devel; +Cc: Keir Fraser

[-- Attachment #1: Type: text/plain, Size: 3257 bytes --]

send_IPI_self_{phys,flat}() were identical and send_IPI_self_x2apic()
was misplaced and pointlessly (implictly) had a non-x2APIC code path.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -92,6 +92,11 @@ static unsigned int cpu_mask_to_apicid_x
     return dest;
 }
 
+static void send_IPI_self_x2apic(uint8_t vector)
+{
+    apic_wrmsr(APIC_SELF_IPI, vector);
+}
+
 static void send_IPI_mask_x2apic_phys(const cpumask_t *cpumask, int vector)
 {
     unsigned int cpu;
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -124,21 +124,11 @@ static void __default_send_IPI_shortcut(
     apic_write_around(APIC_ICR, cfg);
 }
 
-void send_IPI_self_flat(int vector)
+void send_IPI_self_legacy(uint8_t vector)
 {
     __default_send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
 }
 
-void send_IPI_self_phys(int vector)
-{
-    __default_send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
-}
-
-void send_IPI_self_x2apic(int vector)
-{
-    apic_write(APIC_SELF_IPI, vector);    
-}
-
 void send_IPI_mask_flat(const cpumask_t *cpumask, int vector)
 {
     unsigned long mask = cpumask_bits(cpumask)[0];
--- a/xen/include/asm-x86/genapic.h
+++ b/xen/include/asm-x86/genapic.h
@@ -37,7 +37,7 @@ struct genapic { 
 	const cpumask_t *(*vector_allocation_cpumask)(int cpu);
 	unsigned int (*cpu_mask_to_apicid)(const cpumask_t *cpumask);
 	void (*send_IPI_mask)(const cpumask_t *mask, int vector);
-    void (*send_IPI_self)(int vector);
+    void (*send_IPI_self)(uint8_t vector);
 };
 
 #define APICFUNC(x) .x = x
@@ -52,12 +52,12 @@ extern const struct genapic *genapic;
 extern const struct genapic apic_default;
 
 const cpumask_t *target_cpus_all(void);
+void send_IPI_self_legacy(uint8_t vector);
 
 void init_apic_ldr_flat(void);
 void clustered_apic_check_flat(void);
 unsigned int cpu_mask_to_apicid_flat(const cpumask_t *cpumask);
 void send_IPI_mask_flat(const cpumask_t *mask, int vector);
-void send_IPI_self_flat(int vector);
 const cpumask_t *vector_allocation_cpumask_flat(int cpu);
 #define GENAPIC_FLAT \
 	.int_delivery_mode = dest_LowestPrio, \
@@ -68,13 +68,12 @@ const cpumask_t *vector_allocation_cpuma
 	.vector_allocation_cpumask = vector_allocation_cpumask_flat, \
 	.cpu_mask_to_apicid = cpu_mask_to_apicid_flat, \
 	.send_IPI_mask = send_IPI_mask_flat, \
-	.send_IPI_self = send_IPI_self_flat
+	.send_IPI_self = send_IPI_self_legacy
 
 void init_apic_ldr_phys(void);
 void clustered_apic_check_phys(void);
 unsigned int cpu_mask_to_apicid_phys(const cpumask_t *cpumask);
 void send_IPI_mask_phys(const cpumask_t *mask, int vector);
-void send_IPI_self_phys(int vector);
 const cpumask_t *vector_allocation_cpumask_phys(int cpu);
 #define GENAPIC_PHYS \
 	.int_delivery_mode = dest_Fixed, \
@@ -85,8 +84,6 @@ const cpumask_t *vector_allocation_cpuma
 	.vector_allocation_cpumask = vector_allocation_cpumask_phys, \
 	.cpu_mask_to_apicid = cpu_mask_to_apicid_phys, \
 	.send_IPI_mask = send_IPI_mask_phys, \
-	.send_IPI_self = send_IPI_self_phys
-
-void send_IPI_self_x2apic(int vector);
+	.send_IPI_self = send_IPI_self_legacy
 
 #endif




[-- Attachment #2: x86-self-IPI.patch --]
[-- Type: text/plain, Size: 3293 bytes --]

x86/APIC: reduce self-IPI related code

send_IPI_self_{phys,flat}() were identical and send_IPI_self_x2apic()
was misplaced and pointlessly (implictly) had a non-x2APIC code path.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -92,6 +92,11 @@ static unsigned int cpu_mask_to_apicid_x
     return dest;
 }
 
+static void send_IPI_self_x2apic(uint8_t vector)
+{
+    apic_wrmsr(APIC_SELF_IPI, vector);
+}
+
 static void send_IPI_mask_x2apic_phys(const cpumask_t *cpumask, int vector)
 {
     unsigned int cpu;
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -124,21 +124,11 @@ static void __default_send_IPI_shortcut(
     apic_write_around(APIC_ICR, cfg);
 }
 
-void send_IPI_self_flat(int vector)
+void send_IPI_self_legacy(uint8_t vector)
 {
     __default_send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
 }
 
-void send_IPI_self_phys(int vector)
-{
-    __default_send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
-}
-
-void send_IPI_self_x2apic(int vector)
-{
-    apic_write(APIC_SELF_IPI, vector);    
-}
-
 void send_IPI_mask_flat(const cpumask_t *cpumask, int vector)
 {
     unsigned long mask = cpumask_bits(cpumask)[0];
--- a/xen/include/asm-x86/genapic.h
+++ b/xen/include/asm-x86/genapic.h
@@ -37,7 +37,7 @@ struct genapic { 
 	const cpumask_t *(*vector_allocation_cpumask)(int cpu);
 	unsigned int (*cpu_mask_to_apicid)(const cpumask_t *cpumask);
 	void (*send_IPI_mask)(const cpumask_t *mask, int vector);
-    void (*send_IPI_self)(int vector);
+    void (*send_IPI_self)(uint8_t vector);
 };
 
 #define APICFUNC(x) .x = x
@@ -52,12 +52,12 @@ extern const struct genapic *genapic;
 extern const struct genapic apic_default;
 
 const cpumask_t *target_cpus_all(void);
+void send_IPI_self_legacy(uint8_t vector);
 
 void init_apic_ldr_flat(void);
 void clustered_apic_check_flat(void);
 unsigned int cpu_mask_to_apicid_flat(const cpumask_t *cpumask);
 void send_IPI_mask_flat(const cpumask_t *mask, int vector);
-void send_IPI_self_flat(int vector);
 const cpumask_t *vector_allocation_cpumask_flat(int cpu);
 #define GENAPIC_FLAT \
 	.int_delivery_mode = dest_LowestPrio, \
@@ -68,13 +68,12 @@ const cpumask_t *vector_allocation_cpuma
 	.vector_allocation_cpumask = vector_allocation_cpumask_flat, \
 	.cpu_mask_to_apicid = cpu_mask_to_apicid_flat, \
 	.send_IPI_mask = send_IPI_mask_flat, \
-	.send_IPI_self = send_IPI_self_flat
+	.send_IPI_self = send_IPI_self_legacy
 
 void init_apic_ldr_phys(void);
 void clustered_apic_check_phys(void);
 unsigned int cpu_mask_to_apicid_phys(const cpumask_t *cpumask);
 void send_IPI_mask_phys(const cpumask_t *mask, int vector);
-void send_IPI_self_phys(int vector);
 const cpumask_t *vector_allocation_cpumask_phys(int cpu);
 #define GENAPIC_PHYS \
 	.int_delivery_mode = dest_Fixed, \
@@ -85,8 +84,6 @@ const cpumask_t *vector_allocation_cpuma
 	.vector_allocation_cpumask = vector_allocation_cpumask_phys, \
 	.cpu_mask_to_apicid = cpu_mask_to_apicid_phys, \
 	.send_IPI_mask = send_IPI_mask_phys, \
-	.send_IPI_self = send_IPI_self_phys
-
-void send_IPI_self_x2apic(int vector);
+	.send_IPI_self = send_IPI_self_legacy
 
 #endif

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

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

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

* Re: [PATCH] x86/APIC: reduce self-IPI related code
  2014-09-09 15:49 [PATCH] x86/APIC: reduce self-IPI related code Jan Beulich
@ 2014-09-09 15:58 ` Andrew Cooper
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2014-09-09 15:58 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Keir Fraser


[-- Attachment #1.1: Type: text/plain, Size: 3583 bytes --]

On 09/09/14 16:49, Jan Beulich wrote:
> send_IPI_self_{phys,flat}() were identical and send_IPI_self_x2apic()
> was misplaced and pointlessly (implictly) had a non-x2APIC code path.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

>
> --- a/xen/arch/x86/genapic/x2apic.c
> +++ b/xen/arch/x86/genapic/x2apic.c
> @@ -92,6 +92,11 @@ static unsigned int cpu_mask_to_apicid_x
>      return dest;
>  }
>  
> +static void send_IPI_self_x2apic(uint8_t vector)
> +{
> +    apic_wrmsr(APIC_SELF_IPI, vector);
> +}
> +
>  static void send_IPI_mask_x2apic_phys(const cpumask_t *cpumask, int vector)
>  {
>      unsigned int cpu;
> --- a/xen/arch/x86/smp.c
> +++ b/xen/arch/x86/smp.c
> @@ -124,21 +124,11 @@ static void __default_send_IPI_shortcut(
>      apic_write_around(APIC_ICR, cfg);
>  }
>  
> -void send_IPI_self_flat(int vector)
> +void send_IPI_self_legacy(uint8_t vector)
>  {
>      __default_send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
>  }
>  
> -void send_IPI_self_phys(int vector)
> -{
> -    __default_send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
> -}
> -
> -void send_IPI_self_x2apic(int vector)
> -{
> -    apic_write(APIC_SELF_IPI, vector);    
> -}
> -
>  void send_IPI_mask_flat(const cpumask_t *cpumask, int vector)
>  {
>      unsigned long mask = cpumask_bits(cpumask)[0];
> --- a/xen/include/asm-x86/genapic.h
> +++ b/xen/include/asm-x86/genapic.h
> @@ -37,7 +37,7 @@ struct genapic { 
>  	const cpumask_t *(*vector_allocation_cpumask)(int cpu);
>  	unsigned int (*cpu_mask_to_apicid)(const cpumask_t *cpumask);
>  	void (*send_IPI_mask)(const cpumask_t *mask, int vector);
> -    void (*send_IPI_self)(int vector);
> +    void (*send_IPI_self)(uint8_t vector);
>  };
>  
>  #define APICFUNC(x) .x = x
> @@ -52,12 +52,12 @@ extern const struct genapic *genapic;
>  extern const struct genapic apic_default;
>  
>  const cpumask_t *target_cpus_all(void);
> +void send_IPI_self_legacy(uint8_t vector);
>  
>  void init_apic_ldr_flat(void);
>  void clustered_apic_check_flat(void);
>  unsigned int cpu_mask_to_apicid_flat(const cpumask_t *cpumask);
>  void send_IPI_mask_flat(const cpumask_t *mask, int vector);
> -void send_IPI_self_flat(int vector);
>  const cpumask_t *vector_allocation_cpumask_flat(int cpu);
>  #define GENAPIC_FLAT \
>  	.int_delivery_mode = dest_LowestPrio, \
> @@ -68,13 +68,12 @@ const cpumask_t *vector_allocation_cpuma
>  	.vector_allocation_cpumask = vector_allocation_cpumask_flat, \
>  	.cpu_mask_to_apicid = cpu_mask_to_apicid_flat, \
>  	.send_IPI_mask = send_IPI_mask_flat, \
> -	.send_IPI_self = send_IPI_self_flat
> +	.send_IPI_self = send_IPI_self_legacy
>  
>  void init_apic_ldr_phys(void);
>  void clustered_apic_check_phys(void);
>  unsigned int cpu_mask_to_apicid_phys(const cpumask_t *cpumask);
>  void send_IPI_mask_phys(const cpumask_t *mask, int vector);
> -void send_IPI_self_phys(int vector);
>  const cpumask_t *vector_allocation_cpumask_phys(int cpu);
>  #define GENAPIC_PHYS \
>  	.int_delivery_mode = dest_Fixed, \
> @@ -85,8 +84,6 @@ const cpumask_t *vector_allocation_cpuma
>  	.vector_allocation_cpumask = vector_allocation_cpumask_phys, \
>  	.cpu_mask_to_apicid = cpu_mask_to_apicid_phys, \
>  	.send_IPI_mask = send_IPI_mask_phys, \
> -	.send_IPI_self = send_IPI_self_phys
> -
> -void send_IPI_self_x2apic(int vector);
> +	.send_IPI_self = send_IPI_self_legacy
>  
>  #endif
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel


[-- Attachment #1.2: Type: text/html, Size: 4319 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

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

end of thread, other threads:[~2014-09-09 16:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-09 15:49 [PATCH] x86/APIC: reduce self-IPI related code Jan Beulich
2014-09-09 15:58 ` Andrew Cooper

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.