[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] x86: don't build platform hypercall helpers multiple times



commit c92e34bfae67b8ed7b47565a2a76e6797d4afe75
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Oct 21 10:52:28 2015 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Oct 21 10:52:28 2015 +0200

    x86: don't build platform hypercall helpers multiple times
    
    ... to eliminate the resulting duplicate symbols. This includes
    dropping an odd per-CPU variable left from 32-bit days: Now that we
    only care about 64-bit builds, converting the uint64_t needing
    passing to a void pointer is no problem anymore.
    
    Since the COMPAT handling section needs to be re-organized for this
    anyway, also adjust a few other shortcomings (like declarations not
    being visible at the point of the respective definition, risking both
    to get out of sync).
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/platform_hypercall.c |   50 ++++++++++++++++--------------------
 xen/arch/x86/sysctl.c             |    1 +
 xen/include/asm-x86/smp.h         |    6 ++++
 3 files changed, 29 insertions(+), 28 deletions(-)

diff --git a/xen/arch/x86/platform_hypercall.c 
b/xen/arch/x86/platform_hypercall.c
index 7626261..39fa808 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -34,6 +34,20 @@
 #include "cpu/mtrr/mtrr.h"
 #include <xsm/xsm.h>
 
+/* Declarations for items shared with the compat mode handler. */
+extern spinlock_t xenpf_lock;
+
+#define RESOURCE_ACCESS_MAX_ENTRIES 3
+struct resource_access {
+    unsigned int nr_done;
+    unsigned int nr_entries;
+    xenpf_resource_entry_t *entries;
+};
+
+long cpu_frequency_change_helper(void *);
+void check_resource_access(struct resource_access *);
+void resource_access(void *);
+
 #ifndef COMPAT
 typedef long ret_t;
 DEFINE_SPINLOCK(xenpf_lock);
@@ -43,32 +57,12 @@ DEFINE_SPINLOCK(xenpf_lock);
 # define copy_to_compat copy_to_guest
 # undef guest_from_compat_handle
 # define guest_from_compat_handle(x,y) ((x)=(y))
-#else
-extern spinlock_t xenpf_lock;
-#endif
 
-static DEFINE_PER_CPU(uint64_t, freq);
-
-static long cpu_frequency_change_helper(void *data)
+long cpu_frequency_change_helper(void *data)
 {
-    return cpu_frequency_change(this_cpu(freq));
+    return cpu_frequency_change((uint64_t)data);
 }
 
-/* from sysctl.c */
-long cpu_up_helper(void *data);
-long cpu_down_helper(void *data);
-
-/* from core_parking.c */
-long core_parking_helper(void *data);
-uint32_t get_cur_idle_nums(void);
-
-#define RESOURCE_ACCESS_MAX_ENTRIES 3
-struct xen_resource_access {
-    unsigned int nr_done;
-    unsigned int nr_entries;
-    xenpf_resource_entry_t *entries;
-};
-
 static bool_t allow_access_msr(unsigned int msr)
 {
     switch ( msr )
@@ -83,7 +77,7 @@ static bool_t allow_access_msr(unsigned int msr)
     return 0;
 }
 
-static void check_resource_access(struct xen_resource_access *ra)
+void check_resource_access(struct resource_access *ra)
 {
     unsigned int i;
 
@@ -122,9 +116,9 @@ static void check_resource_access(struct 
xen_resource_access *ra)
     ra->nr_done = i;
 }
 
-static void resource_access(void *info)
+void resource_access(void *info)
 {
-    struct xen_resource_access *ra = info;
+    struct resource_access *ra = info;
     unsigned int i;
     u64 tsc = 0;
 
@@ -185,6 +179,7 @@ static void resource_access(void *info)
 
     ra->nr_done = i;
 }
+#endif
 
 ret_t do_platform_op(XEN_GUEST_HANDLE_PARAM(xen_platform_op_t) u_xenpf_op)
 {
@@ -457,10 +452,9 @@ ret_t 
do_platform_op(XEN_GUEST_HANDLE_PARAM(xen_platform_op_t) u_xenpf_op)
         ret = -EINVAL;
         if ( op->u.change_freq.flags || !cpu_online(op->u.change_freq.cpu) )
             break;
-        per_cpu(freq, op->u.change_freq.cpu) = op->u.change_freq.freq;
         ret = continue_hypercall_on_cpu(op->u.change_freq.cpu,
                                         cpu_frequency_change_helper,
-                                        NULL);
+                                        (void *)op->u.change_freq.freq);
         break;
 
     case XENPF_getidletime:
@@ -734,7 +728,7 @@ ret_t 
do_platform_op(XEN_GUEST_HANDLE_PARAM(xen_platform_op_t) u_xenpf_op)
 
     case XENPF_resource_op:
     {
-        struct xen_resource_access ra;
+        struct resource_access ra;
         unsigned int cpu;
         XEN_GUEST_HANDLE(xenpf_resource_entry_t) guest_entries;
 
diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index e54ddac..34ee240 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -24,6 +24,7 @@
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/support.h>
 #include <asm/processor.h>
+#include <asm/smp.h>
 #include <asm/numa.h>
 #include <xen/nodemask.h>
 #include <xen/cpu.h>
diff --git a/xen/include/asm-x86/smp.h b/xen/include/asm-x86/smp.h
index ea07888..fb0f42a 100644
--- a/xen/include/asm-x86/smp.h
+++ b/xen/include/asm-x86/smp.h
@@ -58,6 +58,12 @@ int hard_smp_processor_id(void);
 
 void __stop_this_cpu(void);
 
+long cpu_up_helper(void *data);
+long cpu_down_helper(void *data);
+
+long core_parking_helper(void *data);
+uint32_t get_cur_idle_nums(void);
+
 /*
  * The value may be greater than the actual socket number in the system and
  * is required not to change from the initial startup.
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.