Re: [Xen-devel] [PATCH v4 06/12] x86/genapic: patch indirect calls to direct ones

2018-10-03 Thread Andrew Cooper
On 02/10/18 11:14, Jan Beulich wrote:
> For (I hope) obvious reasons only the ones used at runtime get
> converted.
>
> Signed-off-by: Jan Beulich 
> Reviewed-by: Wei Liu 

Acked-by: Andrew Cooper 

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

[Xen-devel] [PATCH v4 06/12] x86/genapic: patch indirect calls to direct ones

2018-10-02 Thread Jan Beulich
For (I hope) obvious reasons only the ones used at runtime get
converted.

Signed-off-by: Jan Beulich 
Reviewed-by: Wei Liu 
---
v2: Drop open-coded numbers from macro invocations.

--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -29,12 +29,12 @@
 
 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);
 }
 
 /*
--- a/xen/include/asm-x86/mach-generic/mach_apic.h
+++ b/xen/include/asm-x86/mach-generic/mach_apic.h
@@ -15,8 +15,18 @@
 #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() 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)
 {





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