From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] x86/APIC: reduce self-IPI related code Date: Tue, 9 Sep 2014 16:58:51 +0100 Message-ID: <540F23BB.3010003@citrix.com> References: <540F3DA50200007800032CE3@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8567210663823510690==" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XRNxg-0002MU-HC for xen-devel@lists.xenproject.org; Tue, 09 Sep 2014 16:08:08 +0000 In-Reply-To: <540F3DA50200007800032CE3@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich , xen-devel Cc: Keir Fraser List-Id: xen-devel@lists.xenproject.org --===============8567210663823510690== Content-Type: multipart/alternative; boundary="------------080600020008060707050807" --------------080600020008060707050807 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit 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 Reviewed-by: Andrew Cooper > > --- 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 --------------080600020008060707050807 Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit
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

--------------080600020008060707050807-- --===============8567210663823510690== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============8567210663823510690==--