x86/genapic: patch indirect calls to direct ones
authorJan Beulich <jbeulich@suse.com>
Fri, 17 May 2019 12:39:08 +0000 (14:39 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 17 May 2019 12:39:08 +0000 (14:39 +0200)
For (I hope) obvious reasons only the ones used at runtime get
converted.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/smp.c
xen/include/asm-x86/mach-generic/mach_apic.h

index b15d4f05df162ab33648e13cd92795f297e3afa5..e0292b9577b1a8f66f75f62078ace42dca32a841 100644 (file)
 
 void send_IPI_mask(const cpumask_t *mask, int vector)
 {
-    genapic.send_IPI_mask(mask, vector);
+    alternative_vcall(genapic.send_IPI_mask, mask, vector);
 }
 
 void send_IPI_self(int vector)
 {
-    genapic.send_IPI_self(vector);
+    alternative_vcall(genapic.send_IPI_self, vector);
 }
 
 /*
index 0984554d3684e21de4025471085adc95c5a636ca..75f1e766b00173d0543f04782a20597dc25576c3 100644 (file)
 #define TARGET_CPUS ((const typeof(cpu_online_map) *)&cpu_online_map)
 #define init_apic_ldr (genapic.init_apic_ldr)
 #define clustered_apic_check (genapic.clustered_apic_check)
-#define cpu_mask_to_apicid (genapic.cpu_mask_to_apicid)
-#define vector_allocation_cpumask(cpu) (genapic.vector_allocation_cpumask(cpu))
+#define cpu_mask_to_apicid(mask) ({ \
+       /* \
+        * There are a number of places where the address of a local variable \
+        * gets passed here. The use of ?: in alternative_call<N>() triggers an \
+        * "address of ... is always true" warning in such a case with at least \
+        * gcc 7 and 8. Hence the seemingly pointless local variable here. \
+        */ \
+       const cpumask_t *m_ = (mask); \
+       alternative_call(genapic.cpu_mask_to_apicid, m_); \
+})
+#define vector_allocation_cpumask(cpu) \
+       alternative_call(genapic.vector_allocation_cpumask, cpu)
 
 static inline void enable_apic_mode(void)
 {